All my system configs and packages in one repo
1# Uses &&
2set unstable
3
4alias b := build
5alias c := check
6alias sw := switch
7alias t := test
8
9default:
10 @just --choose
11
12[linux]
13build *args: (_rebuild "build" args)
14 nix run nixpkgs#nvd -- diff /run/current-system/ result/
15
16[macos]
17build *args: (_rebuild "build" args)
18
19check:
20 nix flake check --option allow-import-from-derivation true
21
22switch *args: (_rebuild "switch" args)
23
24test *args: (_rebuild "test" args)
25
26# blatantly stolen from getchoo
27ci:
28 nix run \
29 --inputs-from . \
30 --override-input nixpkgs nixpkgs \
31 github:Mic92/nix-fast-build -- \
32 --no-nom \
33 --skip-cached \
34 --option accept-flake-config true \
35 --option allow-import-from-derivation true \
36 --flake '.#hydraJobs'
37
38#=== ABSTRACTION ==#
39
40rebuild := if os() == "macos" { "darwin-rebuild" } else { "nixos-rebuild" }
41common_build_flags := "--flake .#$HOSTNAME --keep-going -L"
42specialisation := env("NIXOS_SPECIALISATION", "")
43additional_build_flags := if os() == "linux" { specialisation && "-c " + specialisation } else { "" }
44
45_rebuild cmd *args:
46 #!/usr/bin/env bash
47 set -o pipefail # fail if the build fails instead of blindly returning 0 as nom succeeds
48 {{ rebuild }} {{ cmd }} {{ common_build_flags }} {{ if cmd != "build" { additional_build_flags } else { " " } }} {{ args }} |& nix run n#nix-output-monitor