File tree Expand file tree Collapse file tree 3 files changed +22
-12
lines changed Expand file tree Collapse file tree 3 files changed +22
-12
lines changed Original file line number Diff line number Diff line change 62
62
checks = eachSystem (
63
63
{ pkgs , ... } :
64
64
{
65
+ minimal-machine =
66
+ ( pkgs . nixos [
67
+ publicInputs . self . nixosModules . facter
68
+ (
69
+ { lib , config , ... } :
70
+ {
71
+ boot . loader . grub . devices = lib . mkForce [ "/dev/sda" ] ;
72
+ fileSystems . "/" . device = lib . mkDefault "/dev/sda" ;
73
+ users . users . root . initialPassword = "fnord23" ;
74
+ system . stateVersion = config . system . nixos . version ;
75
+ nixpkgs . pkgs = pkgs ;
76
+ }
77
+ )
78
+ ] ) . config . system . build . toplevel ;
65
79
lib-tests = pkgs . runCommandLocal "lib-tests" { nativeBuildInputs = [ pkgs . nix-unit ] ; } ''
66
80
export HOME="$(realpath .)"
67
81
export NIX_CONFIG='
Original file line number Diff line number Diff line change 1
1
{
2
2
lib ,
3
3
config ,
4
- options ,
5
4
...
6
5
} :
7
- let
8
- cfg = config . facter ;
9
- modulePath = lib . concatStringsSep "/" ( lib . take 4 ( lib . splitString [ "/" ] __curPos . file ) ) ;
10
- in
11
6
{
12
7
imports = [
13
8
./bluetooth.nix
23
18
options . facter = with lib ; {
24
19
report = mkOption {
25
20
type = types . raw ;
26
- default = builtins . fromJSON ( builtins . readFile config . facter . reportPath ) ;
21
+ default = if config . facter . reportPath == null then { } else builtins . fromJSON ( builtins . readFile config . facter . reportPath ) ;
27
22
description = "An import for the reportPath." ;
28
23
} ;
29
24
30
25
reportPath = mkOption {
31
- type = types . path ;
26
+ type = types . nullOr types . path ;
27
+ default = null ;
32
28
description = "Path to a report generated by nixos-facter." ;
33
29
} ;
34
30
Original file line number Diff line number Diff line change 25
25
defaultText = "hardware dependent" ;
26
26
} ;
27
27
oracle . enable = lib . mkEnableOption "Enable the Facter Virtualisation Oracle module" // {
28
- default = report . virtualisation == "oracle" ;
28
+ default = report . virtualisation or null == "oracle" ;
29
29
defaultText = "environment dependent" ;
30
30
} ;
31
31
parallels . enable = lib . mkEnableOption "Enable the Facter Virtualisation Parallels module" // {
32
- default = report . virtualisation == "parallels" ;
32
+ default = report . virtualisation or null == "parallels" ;
33
33
defaultText = "environment dependent" ;
34
34
} ;
35
35
qemu . enable = lib . mkEnableOption "Enable the Facter Virtualisation Qemu module" // {
36
- default = builtins . elem report . virtualisation [
36
+ default = builtins . elem ( report . virtualisation or null ) [
37
37
"qemu"
38
38
"kvm"
39
39
"bochs"
40
40
] ;
41
41
defaultText = "environment dependent" ;
42
42
} ;
43
43
hyperv . enable = lib . mkEnableOption "Enable the Facter Virtualisation Hyper-V module" // {
44
- default = report . virtualisation == "microsoft" ;
44
+ default = report . virtualisation or null == "microsoft" ;
45
45
defaultText = "environment dependent" ;
46
46
} ;
47
47
# no virtualisation detected
48
48
none . enable = lib . mkEnableOption "Enable the Facter Virtualisation None module" // {
49
- default = report . virtualisation == "none" ;
49
+ default = report . virtualisation or null == "none" ;
50
50
defaultText = "environment dependent" ;
51
51
} ;
52
52
} ;
You can’t perform that action at this time.
0 commit comments