Skip to content

Instantly share code, notes, and snippets.

Avatar

Cole Mickens colemickens

View GitHub Profile
View gist:790aa973b2249a383f38a297a91ac294
function instantiate() {
machine="${1}"; shift
# do it
true
#drv="$(nix eval --pure-eval ".#nixosConfigurations.${machine}.config.system.build.toplevel")" # TODO: why????
set -e
drv="$(set -eu; nix --experimental-features 'nix-command flakes' --pure-eval \
eval \
--raw ".#machines.${machine}")"
drv="$(set -euo pipefail; nix --experimental-features 'nix-command flakes' --pure-eval \
View gist:5b6daaf334ca51b383b8f0b86812eec8
+ ssh colemickens@aarch64.nixos.community \
'nix-shell -I nixpkgs=https://github.com/nixos/nixpkgs/archive/nixos-20.03.tar.gz -p cachix \
--command "echo /nix/store/w71nsc8cf7jrg1wpm5psqxr1d4frnx2m-nixos-system-raspberry-20.09.20200731.e197520 | env CACHIX_SIGNING_KEY=eREDACTED== cachix push colemickens" >/dev/stderr'
compressing and pushing /nix/store/71fg94rcf2fqfxwq221c7mdn3yf09wjb-system-path (4.31 MiB)
compressing and pushing /nix/store/apalrjqm9i9iscgl9kqpgsmj87myngsg-etc (33.73 KiB)
compressing and pushing /nix/store/b3ajfqw3s0a1ybdcyhczw2pj92a5shhr-user-units (9.10 KiB)
compressing and pushing /nix/store/f6x4sk20gncmbvjhh7r2mv93mrw1lz8z-unit-firewall.service (1.78 KiB)
compressing and pushing /nix/store/gzd3cd0raprqik1mk8x6zpwmildy9rdd-unit-polkit.service (1.23 KiB)
compressing and pushing /nix/store/ihjqi107r7m6p35kmpp7s85lhyds5f05-system-units (97.42 KiB)
compressing and pushing /nix/store/kd47ikfwq0zx4ljw66gm4jxyi9ibbghw-firewall-reload (1.95 KiB)
View gist:97cdbb57fc6b5c82a81bb3f014a81422
Jul 31 05:43:56 raspberry pixiecore[17884]: [DHCP] Got valid request to boot dc:a6:32:47:73:14 (IA32)
Jul 31 05:43:56 raspberry pixiecore[17884]: [DHCP] Offering to boot dc:a6:32:47:73:14
Jul 31 05:43:56 raspberry pixiecore[17884]: [TFTP] unable to extract mac from request:invalid MAC address "e43b854b"
Jul 31 05:43:56 raspberry pixiecore[17884]: [TFTP] unable to extract mac from request:invalid MAC address "e43b854b"
Jul 31 05:43:56 raspberry pixiecore[17884]: [TFTP] unable to extract mac from request:not found
Jul 31 05:43:56 raspberry pixiecore[17884]: [TFTP] unable to extract mac from request:not found
Jul 31 05:43:56 raspberry pixiecore[17884]: [TFTP] unable to extract mac from request:not found
Jul 31 05:43:56 raspberry pixiecore[17884]: [TFTP] unable to extract mac from request:not found
Jul 31 05:43:56 raspberry pixiecore[17884]: [TFTP] unable to extract mac from request:not found
Jul 31 05:43:56 raspberry pixiecore[17884]: [TFTP] unable to extract mac from request:not found
View gist:462726cb271cbee0bb95a866e71f60ef
querying info about missing paths...
starting pool of 7 threads
checking substituter 'https://cache.nixos.org' for path '/nix/store/fw6m497sbl2n7cpqs8lppvah856qjswk-nixos-system-raspberry-20.09.20200726.dirty'
querying info about '/nix/store/fw6m497sbl2n7cpqs8lppvah856qjswk-nixos-system-raspberry-20.09.20200726.dirty' on 'https://cache.nixos.org'...
downloading 'https://cache.nixos.org/fw6m497sbl2n7cpqs8lppvah856qjswk.narinfo'...
download thread waiting for 10000 ms
starting download of https://cache.nixos.org/fw6m497sbl2n7cpqs8lppvah856qjswk.narinfo
curl: Couldn't find host cache.nixos.org in the .netrc file; using defaults
download thread waiting for 100 ms
download thread waiting for 100 ms
View gist:b56368072132e446331918352ecc8bdf
# sadly, this is considerably faster than
# using nix and its usual remote building functionality
function remote() {
cache="colemickens"
cachixkey="$(set -e; gopass show "websites/cachix.org/apikey/${cache}")"
machine="${1}"; shift
remote="${1}"; shift
View gist:fcb5aa916280ee5df772e68808ba47e8

This is really painful.

sudo nix --experimental-features 'nix-command flakes' --pure-eval build --profile /nix/var/nix/profiles/system -j 0 --builders-use-substitutes --builders 'ssh://myuser@20.191.64.192 x86_64-linux - - - big-parallel kvm' .#nixosConfigurations.xeep.config.system.build.toplevel

warning: Git tree '/home/cole/code/nixcfg' is dirty                                            
error: --- Error -------------------------------------------------------------------- nix      
unable to start any build; either increase '--max-jobs' or enable remote builds   
@colemickens
colemickens / attribute-import.nix
Created Jul 27, 2020 — forked from BenSchZA/attribute-import.nix
Import attributes from Nix derivation
View attribute-import.nix
let
default = import ./default.nix {};
pkgs = default.pkgs;
python = default.python;
pythonPackages = default.pythonPackages;
in with default; {
# now pkgs, python, pythonPackages are just available.
...
}
View gist:b56f05cd8982ccd614c2a6f273b11c59
> sudo nix --experimental-features 'nix-command flakes' --pure-eval build --profile /nix/var/nix/profiles/system github:colemickens/nixcfg/main#nixosConfigurations.xeep.config.system.build.toplevel
trace: ___________________ SYS=x86_64-linux HOSTNAME=xeep
~/code/nixcfg main ------------------------------------------------------------------ 7s direnv impure nix 16:57:50
> ls -al ./result
lrwxrwxrwx 1 root root 84 Jul 22 16:57 ./result -> /nix/store/b8lg5yam4d5slnhqhxb9xy8yqgf4632i-nixos-system-xeep-20.09.20200719.5717d9d
~/code/nixcfg main ---------------------------------------------------------------------- direnv impure nix 16:58:12
View gist:1b4da8010116549cf2a40465572db38f
#!/nix/store/4la2w29x16vnm4fwcz7qfs0m45dgb8hl-bash-4.4-p23/bin/bash -e
function usage {
echo "USAGE: $0 INITRD_FILE" >&2
echo "Appends this configuration's secrets to INITRD_FILE" >&2
}
if [ $# -ne 1 ]; then
usage
exit 1
fi
View gist:50f6d7f60c83e5402ad60cdd7e24b8a0
mke2fs 1.45.5 (07-Jan-2020)
Found a gpt partition table in nixos.raw
Discarding device blocks: 4096/318208 done
Creating filesystem with 318208 4k blocks and 79680 inodes
Filesystem UUID: 5c323265-ed2d-4079-bf3a-66aa682e9b97
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: 0/10 done
Writing inode tables: 0/10 done
You can’t perform that action at this time.