Modular, context-aware and aspect-oriented dendritic Nix configurations.
Discussions: https://oeiuwq.zulipchat.com/join/nqp26cd4kngon6mo3ncgnuap/
den.oeiuwq.com
configurations
den
dendritic
nix
aspect
oriented
1# Adds some checks for CI
2{ self, lib, ... }:
3{
4 perSystem =
5 { pkgs, ... }:
6 let
7 checkFile =
8 name: file:
9 pkgs.runCommandLocal name { } ''
10 ls -la ${file} | tee $out
11 '';
12
13 checkCond =
14 name: cond:
15 let
16 code = if cond then "touch $out" else ''echo "Cond-Failed: ${name}"'';
17 in
18 pkgs.runCommandLocal name { } code;
19
20 rockhopper = self.nixosConfigurations.rockhopper;
21 honeycrisp = self.darwinConfigurations.honeycrisp;
22 adelie = self.wslConfigurations.adelie;
23 cam = self.homeConfigurations.cam;
24 bob = self.homeConfigurations.bob;
25 luke = self.homeConfigurations.luke;
26
27 alice-at-rockhopper = rockhopper.config.home-manager.users.alice;
28 alice-at-honeycrisp = honeycrisp.config.home-manager.users.alice;
29
30 checks.x86_64-linux = {
31 vm = checkFile "vm-builds" "${rockhopper.config.system.build.vm}/bin/run-rockhopper-vm";
32
33 hosts-rockhopper = checkFile "nixos-builds" rockhopper.config.system.build.toplevel;
34 homes-cam = checkFile "home-builds" cam.activation-script;
35
36 rockhopper-hostname = checkCond "den.default.host.includes sets hostName" (
37 rockhopper.config.networking.hostName == "rockhopper"
38 );
39 honeycrisp-hostname = checkCond "den.default.host.includes sets hostName" (
40 honeycrisp.config.networking.hostName == "honeycrisp"
41 );
42 alice-primary-on-macos = checkCond "den._.primary-user sets macos primary" (
43 honeycrisp.config.system.primaryUser == "alice"
44 );
45 alice-exists-on-rockhopper = checkCond "den.default.user.includes defines user on host" (
46 rockhopper.config.users.users.alice.isNormalUser
47 );
48 alice-not-exists-on-adelie = checkCond "den.default.user.includes defines user on host" (
49 !adelie.config.users.users ? alice
50 );
51 will-exists-on-adelie = checkCond "den.default.user.includes defines user on host" (
52 adelie.config.users.users.will.isNormalUser
53 );
54 will-is-wsl-default = checkCond "wsl.defaultUser defined" (adelie.config.wsl.defaultUser == "will");
55
56 import-tree = checkCond "auto-imported from rockhopper/_nixos" (rockhopper.config.auto-imported);
57
58 user-contributes-to-host = checkCond "alice.nixos sets on rockhopper host" (
59 rockhopper.config.users.users.alice.description == "Alice Q. User"
60 );
61
62 host-contributes-to-user = checkCond "rockhopper contributes to all its users" (
63 alice-at-rockhopper.programs.direnv.enable
64 );
65
66 alice-hm-fish-enabled-by-default = checkCond "home-managed fish for alice" (
67 alice-at-rockhopper.programs.fish.enable
68 );
69 alice-hm-helix-enabled-by-user = checkCond "home-managed helix for alice" (
70 alice-at-rockhopper.programs.helix.enable
71 );
72
73 alice-hm-git-enabled-on = checkCond "home-managed git for alice at rockhopper" (
74 alice-at-rockhopper.programs.git.enable
75 );
76 alice-hm-git-enabled-off = checkCond "home-managed git for alice at honeycrisp" (
77 !alice-at-honeycrisp.programs.git.enable
78 );
79
80 alice-os-tmux-enabled-on = checkCond "os tmux for hosts having alice" (
81 rockhopper.config.programs.tmux.enable
82 );
83 alice-os-tmux-enabled-off = checkCond "os tmux for hosts having alice" (
84 !honeycrisp.config.programs.tmux.enable
85 );
86
87 will-always-love-you = checkCond "red-snapper fish is default shell" (
88 "fish" == lib.getName adelie.config.users.users.will.shell
89 );
90
91 luke-hm-depends-on-osConfig = checkCond "standalone hm can depend on osConfig" (
92 luke.config.programs.bat.enable
93 );
94
95 };
96
97 checks.aarch64-darwin = {
98 hosts-honeyscrisp = checkFile "darwin-builds" honeycrisp.config.system.build.toplevel;
99 homes-bob = checkFile "darwin-home-builds" bob.activation-script;
100 };
101 in
102 {
103 checks = checks.${pkgs.system} or { };
104 };
105}