.files/Justfile

35 lines
1.2 KiB
Makefile

# Note:
# add `--option substitute false` to the command so it builds properly offline
# rfkill block all helps too
os host action:
#!/usr/bin/env bash
set -euo pipefail
nixpkgs=$(nix-instantiate --eval -E "let sources = import ./npins; in sources.nixpkgs.outPath" | jq -r .)
nixos-rebuild {{ action }} \
-I nixpkgs=${nixpkgs} \
-I nixos-config=./nix/configurations/{{ host }}.nix \
--no-reexec \
--file ./default.nix \
--attr "nixosConfigurations.{{ host }}"
install host:
#!/usr/bin/env bash
set -euo pipefail
nixpkgs=$(nix-instantiate --eval -E "let sources = import ./npins; in sources.nixpkgs.outPath" | jq -r .)
nixos-install \
-I nixpkgs=${nixpkgs} \
-I nixos-config=./nix/configurations/{{ host }}.nix \
--file ./default.nix \
--attr "nixosConfigurations.{{ host }}"
# Retain four weeks of generations so I don't fuck up
clean-os:
nix-env --delete-generations 28d -p /nix/var/nix/profiles/system
clean-hm:
nix-env --delete-generations 28d -p ~/.local/state/nix/profiles/home-manager
update:
npins update