blob: 3360af959569293ac6971de2c9a372fe0123f5fd [file] [log] [blame]
Skyler Grey4d6b6a42024-08-05 18:08:19 +00001{ inputs, lib, channels, ... }:
2
3# Clicks modules must fulfil a contract consisting of 2 items:
4# - They must evaluate when running with only the NixOS modules and other Clicks
5# modules
6# - They must not change config without being enabled
7#
8# We can pretty eloquently test for both of these by evaluating our modules with
9# just the nixpkgs modules, and then doing the same thing without our modules
10{
11 testEmptyEvalMayNotChangeOutput = let
12 neededForEval = [
13 {
14 system.stateVersion = "24.05";
15 }
16 {
17 fileSystems."/" = {
18 device = "none";
19 fsType = "tmpfs";
20 };
21 }
22 {
23 boot.loader.grub.device = "nodev";
24 }
25 {
26 nixpkgs.config = {
27 allowBroken = true;
28 allowUnfree = true;
29 };
30 }
31 ];
32 libPlusClicks = lib.attrsets.recursiveUpdate channels.unstable.lib {
33 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...
34 };
35 in {
36 expr = (inputs.unstable.lib.nixosSystem {
37 lib = libPlusClicks;
38 system = channels.unstable.system;
39 modules = (lib.attrsets.attrValues inputs.self.nixosModules) ++ neededForEval;
40 }).config.system.build.toplevel.outPath;
41 expected = (inputs.unstable.lib.nixosSystem {
42 lib = libPlusClicks;
43 system = channels.unstable.system;
44 modules = neededForEval;
45 }).config.system.build.toplevel.outPath;
46 };
47}