Personal Nix flake
nixos home-manager nix
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(tests): Implement nixtest, initial snapshot tests

For now just tries to ensure filesystems and profiles aren't suddenly
changed

+327 -1
+18
flake.lock
··· 1051 1051 "type": "github" 1052 1052 } 1053 1053 }, 1054 + "nixtest": { 1055 + "locked": { 1056 + "dir": "lib", 1057 + "lastModified": 1769441055, 1058 + "narHash": "sha256-SrHLnM3UMzpj5/o52yf3lFOVpsIGEU5nAFUkdeJO1bM=", 1059 + "owner": "TECHNOFAB", 1060 + "repo": "nixtest", 1061 + "rev": "9f9fcb85349003edb554574d0e3f623811866f50", 1062 + "type": "gitlab" 1063 + }, 1064 + "original": { 1065 + "dir": "lib", 1066 + "owner": "TECHNOFAB", 1067 + "repo": "nixtest", 1068 + "type": "gitlab" 1069 + } 1070 + }, 1054 1071 "nixvim": { 1055 1072 "inputs": { 1056 1073 "flake-parts": "flake-parts_4", ··· 1259 1276 "unstable" 1260 1277 ], 1261 1278 "nixpkgs-hare": "nixpkgs-hare", 1279 + "nixtest": "nixtest", 1262 1280 "nixvim": "nixvim", 1263 1281 "nur": "nur", 1264 1282 "spicetify-nix": "spicetify-nix",
+2
flake.nix
··· 21 21 (importApply' ./nix/packages) 22 22 (importApply' ./nix/legacyPackages) 23 23 (importApply' ./nix/shells) 24 + (importApply' ./nix/tests) 24 25 ]; 25 26 perSystem = { 26 27 pkgs, ··· 105 106 inputs.nixpkgs.follows = "nixpkgs"; 106 107 }; 107 108 nix-std.url = "github:chessai/nix-std"; 109 + nixtest.url = "gitlab:TECHNOFAB/nixtest?dir=lib"; 108 110 nixneovimplugins = { 109 111 url = "github:jooooscha/nixpkgs-vim-extra-plugins"; 110 112 inputs.nixpkgs.follows = "nixpkgs";
+8
just/tests.just
··· 1 + # Runs tests 2 + run *args: 3 + nix run .#nixtests:run -- \ 4 + --snapshot-dir {{justfile_directory()}}/nix/tests/_snapshots \ 5 + {{args}} 6 + 7 + # Updates test snapshots 8 + updatesnaps: (run '--update-snapshots')
+5 -1
justfile
··· 1 1 _default: 2 - just --list 2 + just --list --list-submodules --unsorted 3 3 4 4 mod home './just/home.just' 5 5 mod secrets './just/secrets.just' 6 6 mod secureboot './just/secureboot.just' 7 7 mod system './just/system.just' 8 8 mod theme './just/theme.just' 9 + mod tests './just/tests.just' 9 10 mod u2f './just/u2f.just' 11 + 12 + # Run tests 13 + test: tests::run
+59
nix/tests/_snapshots/filesystems-desktop.snap.json
··· 1 + { 2 + "/": { 3 + "device": "/dev/disk/by-partlabel/disk-vdb-root", 4 + "fsType": "btrfs", 5 + "options": [ 6 + "x-initrd.mount", 7 + "compress=zstd", 8 + "subvol=@" 9 + ] 10 + }, 11 + "/.swapvol": { 12 + "device": "/dev/disk/by-partlabel/disk-vdb-root", 13 + "fsType": "btrfs", 14 + "options": [ 15 + "defaults", 16 + "subvol=@swap" 17 + ] 18 + }, 19 + "/boot": { 20 + "device": "/dev/disk/by-partlabel/disk-vdb-ESP", 21 + "fsType": "vfat", 22 + "options": [ 23 + "defaults" 24 + ] 25 + }, 26 + "/home": { 27 + "device": "/dev/disk/by-partlabel/disk-vdb-root", 28 + "fsType": "btrfs", 29 + "options": [ 30 + "compress=zstd", 31 + "subvol=@home" 32 + ] 33 + }, 34 + "/nix": { 35 + "device": "/dev/disk/by-partlabel/disk-vdb-root", 36 + "fsType": "btrfs", 37 + "options": [ 38 + "x-initrd.mount", 39 + "compress=zstd", 40 + "noatime", 41 + "subvol=@nix" 42 + ] 43 + }, 44 + "/run/media/lpchaim/storage": { 45 + "device": "/dev/disk/by-id/ata-ADATA_SU630_2J0220042661-part1", 46 + "fsType": "btrfs", 47 + "options": [ 48 + "defaults", 49 + "auto", 50 + "exec", 51 + "nofail", 52 + "nosuid", 53 + "nodev", 54 + "noatime", 55 + "compress=zstd", 56 + "x-gvfs-show" 57 + ] 58 + } 59 + }
+44
nix/tests/_snapshots/filesystems-laptop.snap.json
··· 1 + { 2 + "/": { 3 + "device": "/dev/disk/by-partlabel/disk-vdb-root", 4 + "fsType": "btrfs", 5 + "options": [ 6 + "x-initrd.mount", 7 + "compress=zstd", 8 + "subvol=@" 9 + ] 10 + }, 11 + "/.swapvol": { 12 + "device": "/dev/disk/by-partlabel/disk-vdb-root", 13 + "fsType": "btrfs", 14 + "options": [ 15 + "defaults", 16 + "subvol=@swap" 17 + ] 18 + }, 19 + "/boot": { 20 + "device": "/dev/disk/by-partlabel/disk-vdb-ESP", 21 + "fsType": "vfat", 22 + "options": [ 23 + "defaults" 24 + ] 25 + }, 26 + "/home": { 27 + "device": "/dev/disk/by-partlabel/disk-vdb-root", 28 + "fsType": "btrfs", 29 + "options": [ 30 + "compress=zstd", 31 + "subvol=@home" 32 + ] 33 + }, 34 + "/nix": { 35 + "device": "/dev/disk/by-partlabel/disk-vdb-root", 36 + "fsType": "btrfs", 37 + "options": [ 38 + "x-initrd.mount", 39 + "compress=zstd", 40 + "noatime", 41 + "subvol=@nix" 42 + ] 43 + } 44 + }
+39
nix/tests/_snapshots/filesystems-raspberrypi.snap.json
··· 1 + { 2 + "/": { 3 + "device": "/dev/disk/by-uuid/322a6d8e-f946-4d60-98a3-dd1af1373c79", 4 + "fsType": "btrfs", 5 + "options": [ 6 + "x-initrd.mount", 7 + "subvol=@", 8 + "compress=zstd", 9 + "noatime" 10 + ] 11 + }, 12 + "/boot": { 13 + "device": "/dev/disk/by-uuid/12CE-A600", 14 + "fsType": "vfat", 15 + "options": [ 16 + "fmask=0022", 17 + "dmask=0022" 18 + ] 19 + }, 20 + "/home": { 21 + "device": "/dev/disk/by-uuid/322a6d8e-f946-4d60-98a3-dd1af1373c79", 22 + "fsType": "btrfs", 23 + "options": [ 24 + "subvol=@home", 25 + "compress=zstd", 26 + "noatime" 27 + ] 28 + }, 29 + "/nix": { 30 + "device": "/dev/disk/by-uuid/322a6d8e-f946-4d60-98a3-dd1af1373c79", 31 + "fsType": "btrfs", 32 + "options": [ 33 + "x-initrd.mount", 34 + "subvol=@nix", 35 + "compress=zstd", 36 + "noatime" 37 + ] 38 + } 39 + }
+55
nix/tests/_snapshots/filesystems-steamdeck.snap.json
··· 1 + { 2 + "/": { 3 + "device": "/dev/disk/by-partlabel/disk-vdb-root", 4 + "fsType": "btrfs", 5 + "options": [ 6 + "x-initrd.mount", 7 + "compress=zstd", 8 + "subvol=@" 9 + ] 10 + }, 11 + "/.swapvol": { 12 + "device": "/dev/disk/by-partlabel/disk-vdb-root", 13 + "fsType": "btrfs", 14 + "options": [ 15 + "defaults", 16 + "subvol=@swap" 17 + ] 18 + }, 19 + "/boot": { 20 + "device": "/dev/disk/by-partlabel/disk-vdb-ESP", 21 + "fsType": "vfat", 22 + "options": [ 23 + "defaults" 24 + ] 25 + }, 26 + "/home": { 27 + "device": "/dev/disk/by-partlabel/disk-vdb-root", 28 + "fsType": "btrfs", 29 + "options": [ 30 + "compress=zstd", 31 + "subvol=@home" 32 + ] 33 + }, 34 + "/nix": { 35 + "device": "/dev/disk/by-partlabel/disk-vdb-root", 36 + "fsType": "btrfs", 37 + "options": [ 38 + "x-initrd.mount", 39 + "compress=zstd", 40 + "noatime", 41 + "subvol=@nix" 42 + ] 43 + }, 44 + "/run/media/lpchaim/sdcard": { 45 + "device": "/dev/disk/by-id/mmc-EF8S5_0x3b3163d0-part1", 46 + "fsType": "auto", 47 + "options": [ 48 + "defaults", 49 + "subvol=@", 50 + "compress=zstd", 51 + "noatime", 52 + "nofail" 53 + ] 54 + } 55 + }
+15
nix/tests/_snapshots/profiles-desktop.snap.json
··· 1 + { 2 + "home": [ 3 + "de.hyprland", 4 + "graphical", 5 + "hardware.gpu.nvidia" 6 + ], 7 + "nixos": [ 8 + "de.hyprland", 9 + "formfactor.desktop", 10 + "graphical", 11 + "greeter.gdm", 12 + "hardware.gpu.nvidia", 13 + "hardware.rgb" 14 + ] 15 + }
+14
nix/tests/_snapshots/profiles-laptop.snap.json
··· 1 + { 2 + "home": [ 3 + "de.hyprland", 4 + "graphical", 5 + "hardware.cpu.intel" 6 + ], 7 + "nixos": [ 8 + "de.hyprland", 9 + "formfactor.laptop", 10 + "graphical", 11 + "greeter.gdm", 12 + "hardware.cpu.intel" 13 + ] 14 + }
+10
nix/tests/_snapshots/profiles-raspberrypi.snap.json
··· 1 + { 2 + "home": [ 3 + "headless", 4 + "server" 5 + ], 6 + "nixos": [ 7 + "headless", 8 + "server" 9 + ] 10 + }
+11
nix/tests/_snapshots/profiles-steamdeck.snap.json
··· 1 + { 2 + "home": [ 3 + "de.gnome", 4 + "graphical" 5 + ], 6 + "nixos": [ 7 + "de.gnome", 8 + "graphical", 9 + "greeter.gdm" 10 + ] 11 + }
+47
nix/tests/default.nix
··· 1 + { 2 + inputs, 3 + lib, 4 + self, 5 + ... 6 + }: { 7 + imports = [ 8 + inputs.nixtest.flakeModule 9 + ]; 10 + 11 + perSystem = { 12 + nixtest = { 13 + skip = ""; 14 + suites = { 15 + "Filesystems" = { 16 + pos = __curPos; 17 + tests = 18 + self.nixosConfigurations 19 + |> lib.mapAttrsToList (name: os: { 20 + name = "filesystems-${name}"; 21 + type = "snapshot"; 22 + actual = 23 + os.config.fileSystems 24 + |> lib.filterAttrs (_: cfg: cfg.enable) 25 + |> lib.mapAttrs (_: cfg: {inherit (cfg) device fsType options;}); 26 + }); 27 + }; 28 + "Profiles" = { 29 + pos = __curPos; 30 + tests = 31 + self.nixosConfigurations 32 + |> lib.mapAttrsToList (name: os: { 33 + name = "profiles-${name}"; 34 + type = "snapshot"; 35 + actual = let 36 + filterEnabled = lib.filterAttrsRecursive (_: node: node == true || (builtins.isAttrs node && node != {})); 37 + attrsToString = lib.mapAttrsToListRecursive (path: _: lib.concatStringsSep "." path); 38 + in { 39 + nixos = os.config.my.profiles |> filterEnabled |> attrsToString; 40 + home = os.config.home-manager.users.lpchaim.my.profiles |> filterEnabled |> attrsToString; 41 + }; 42 + }); 43 + }; 44 + }; 45 + }; 46 + }; 47 + }