nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at master 81 lines 1.8 kB view raw
1{ 2 lib, 3 pkgs, 4 config, 5 extendModules, 6 ... 7}: 8{ 9 10 options = { 11 12 system.build = { 13 noFacter = lib.mkOption { 14 type = lib.types.unspecified; 15 description = "A version of the system closure with facter disabled"; 16 }; 17 }; 18 19 hardware.facter.debug = { 20 nvd = lib.mkOption { 21 type = lib.types.package; 22 description = '' 23 A shell application which will produce an nvd diff of the system closure with and without facter enabled. 24 ''; 25 }; 26 nix-diff = lib.mkOption { 27 type = lib.types.package; 28 description = '' 29 A shell application which will produce a nix-diff of the system closure with and without facter enabled. 30 ''; 31 }; 32 }; 33 34 }; 35 36 config.system.build = { 37 noFacter = extendModules { 38 modules = [ 39 { 40 # we 'disable' facter by overriding the report and setting it to empty with one caveat: hostPlatform 41 config.hardware.facter.report = lib.mkForce { 42 system = config.nixpkgs.hostPlatform; 43 }; 44 } 45 ]; 46 }; 47 }; 48 49 config.hardware.facter.debug = { 50 51 nvd = pkgs.writeShellApplication { 52 name = "facter-nvd-diff"; 53 runtimeInputs = [ 54 config.nix.package 55 pkgs.nvd 56 ]; 57 text = '' 58 nvd diff \ 59 ${config.system.build.noFacter.config.system.build.toplevel} \ 60 ${config.system.build.toplevel} \ 61 "$@" 62 ''; 63 }; 64 65 nix-diff = pkgs.writeShellApplication { 66 name = "facter-nix-diff"; 67 runtimeInputs = [ 68 config.nix.package 69 pkgs.nix-diff 70 ]; 71 text = '' 72 nix-diff \ 73 ${config.system.build.noFacter.config.system.build.toplevel} \ 74 ${config.system.build.toplevel} \ 75 "$@" 76 ''; 77 }; 78 79 }; 80 81}