| { inputs, lib, channels, ... }: |
| |
| # Clicks modules must fulfil a contract consisting of 2 items: |
| # - They must evaluate when running with only the NixOS modules and other Clicks |
| # modules |
| # - They must not change config without being enabled |
| # |
| # We can pretty eloquently test for both of these by evaluating our modules with |
| # just the nixpkgs modules, and then doing the same thing without our modules |
| { |
| testEmptyEvalMayNotChangeOutput = let |
| neededForEval = [ |
| { |
| system.stateVersion = "24.05"; |
| } |
| { |
| fileSystems."/" = { |
| device = "none"; |
| fsType = "tmpfs"; |
| }; |
| } |
| { |
| boot.loader.grub.device = "nodev"; |
| } |
| { |
| nixpkgs.config = { |
| allowBroken = true; |
| allowUnfree = true; |
| }; |
| } |
| ]; |
| libPlusClicks = lib.attrsets.recursiveUpdate channels.unstable.lib { |
| clicks = lib.clicks; # Our own lib is permitted as a requirement... but we're doing this song/dance to stop us, say, relying on snowfall lib/agenix lix/whatever... |
| }; |
| in { |
| expr = (inputs.unstable.lib.nixosSystem { |
| lib = libPlusClicks; |
| system = channels.unstable.system; |
| modules = (lib.attrsets.attrValues inputs.self.nixosModules) ++ neededForEval; |
| }).config.system.build.toplevel.outPath; |
| expected = (inputs.unstable.lib.nixosSystem { |
| lib = libPlusClicks; |
| system = channels.unstable.system; |
| modules = neededForEval; |
| }).config.system.build.toplevel.outPath; |
| }; |
| } |