Skip to content

Commit 9c02427

Browse files
committed
Run nix fmt
1 parent d6d6c38 commit 9c02427

File tree

10 files changed

+120
-116
lines changed

10 files changed

+120
-116
lines changed

lib/default.nix

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,21 @@ let
3939
loc: defs:
4040
let
4141
evaled = lib.evalModules {
42-
modules =
43-
[
44-
{
45-
freeformType = lib.types.lazyAttrsOf lib.types.raw;
46-
options.type = lib.mkOption {
47-
type = lib.types.str;
48-
};
49-
}
50-
]
51-
++ map (
52-
{ value, file }:
53-
{
54-
_file = file;
55-
config = value;
56-
}
57-
) defs;
42+
modules = [
43+
{
44+
freeformType = lib.types.lazyAttrsOf lib.types.raw;
45+
options.type = lib.mkOption {
46+
type = lib.types.str;
47+
};
48+
}
49+
]
50+
++ map (
51+
{ value, file }:
52+
{
53+
_file = file;
54+
config = value;
55+
}
56+
) defs;
5857
};
5958
inherit (evaled.config) type;
6059
in
@@ -1195,6 +1194,7 @@ let
11951194
};
11961195

11971196
binfmt = import ./binfmt.nix;
1198-
} // outputs;
1197+
}
1198+
// outputs;
11991199
in
12001200
diskoLib

lib/make-disk-image.nix

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,18 @@ let
2929

3030
vmTools = pkgs.vmTools.override (
3131
{
32-
rootModules =
33-
[
34-
"9p"
35-
"9pnet_virtio" # we can drop those in future if we stop supporting 24.11
32+
rootModules = [
33+
"9p"
34+
"9pnet_virtio" # we can drop those in future if we stop supporting 24.11
3635

37-
"virtiofs"
38-
"virtio_pci"
39-
"virtio_blk"
40-
"virtio_balloon"
41-
"virtio_rng"
42-
]
43-
++ (lib.optional configSupportsZfs "zfs")
44-
++ cfg.extraRootModules;
36+
"virtiofs"
37+
"virtio_pci"
38+
"virtio_blk"
39+
"virtio_balloon"
40+
"virtio_rng"
41+
]
42+
++ (lib.optional configSupportsZfs "zfs")
43+
++ cfg.extraRootModules;
4544
kernel = pkgs.aggregateModules (
4645
[
4746
cfg.kernelPackages.kernel

lib/tests.nix

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -237,21 +237,20 @@ let
237237
(
238238
{ config, ... }:
239239
{
240-
boot.supportedFilesystems =
241-
[
242-
"btrfs"
243-
"cifs"
244-
"f2fs"
245-
"jfs"
246-
"ntfs"
247-
"reiserfs"
248-
"vfat"
249-
"xfs"
250-
]
251-
++ lib.optional (
252-
config.networking.hostId != null
253-
&& lib.meta.availableOn pkgs.stdenv.hostPlatform config.boot.zfs.package
254-
) "zfs";
240+
boot.supportedFilesystems = [
241+
"btrfs"
242+
"cifs"
243+
"f2fs"
244+
"jfs"
245+
"ntfs"
246+
"reiserfs"
247+
"vfat"
248+
"xfs"
249+
]
250+
++ lib.optional (
251+
config.networking.hostId != null
252+
&& lib.meta.availableOn pkgs.stdenv.hostPlatform config.boot.zfs.package
253+
) "zfs";
255254
}
256255
)
257256

lib/types/luks.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ in
227227
{
228228
boot.initrd.luks.devices.${config.name} = {
229229
inherit (config) device;
230-
} // config.settings;
230+
}
231+
// config.settings;
231232
}
232233
])
233234
++ (lib.optional (config.content != null) config.content._config);

lib/types/lvm_vg.nix

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@
77
}:
88
let
99
# Load kernel modules to ensure device mapper types are available
10-
kernelModules =
11-
[
12-
# Prevent unbootable systems if LVM snapshots are present at boot time.
13-
"dm-snapshot"
14-
]
15-
++ lib.filter (x: x != "") (
16-
map (lv: lib.optionalString (lv.lvm_type != null && lv.lvm_type != "thinlv") "dm-${lv.lvm_type}") (
17-
lib.attrValues config.lvs
18-
)
19-
);
10+
kernelModules = [
11+
# Prevent unbootable systems if LVM snapshots are present at boot time.
12+
"dm-snapshot"
13+
]
14+
++ lib.filter (x: x != "") (
15+
map (lv: lib.optionalString (lv.lvm_type != null && lv.lvm_type != "thinlv") "dm-${lv.lvm_type}") (
16+
lib.attrValues config.lvs
17+
)
18+
);
2019
in
2120
{
2221
options = {
@@ -182,24 +181,24 @@ in
182181
_config = lib.mkOption {
183182
internal = true;
184183
readOnly = true;
185-
default =
186-
[ { boot.initrd.kernelModules = kernelModules; } ]
187-
++ map (lv: [
188-
(lib.optional (lv.content != null) lv.content._config)
189-
(lib.optional (lv.lvm_type != null) {
190-
boot.initrd.kernelModules =
191-
[
192-
(if lv.lvm_type == "mirror" then "dm-mirror" else "dm-raid")
193-
]
194-
++ lib.optional (lv.lvm_type == "raid0") "raid0"
195-
++ lib.optional (lv.lvm_type == "raid1") "raid1"
196-
# ++ lib.optional (lv.lvm_type == "raid10") "raid10"
197-
++ lib.optional (
198-
lv.lvm_type == "raid4" || lv.lvm_type == "raid5" || lv.lvm_type == "raid6"
199-
) "raid456";
184+
default = [
185+
{ boot.initrd.kernelModules = kernelModules; }
186+
]
187+
++ map (lv: [
188+
(lib.optional (lv.content != null) lv.content._config)
189+
(lib.optional (lv.lvm_type != null) {
190+
boot.initrd.kernelModules = [
191+
(if lv.lvm_type == "mirror" then "dm-mirror" else "dm-raid")
192+
]
193+
++ lib.optional (lv.lvm_type == "raid0") "raid0"
194+
++ lib.optional (lv.lvm_type == "raid1") "raid1"
195+
# ++ lib.optional (lv.lvm_type == "raid10") "raid10"
196+
++ lib.optional (
197+
lv.lvm_type == "raid4" || lv.lvm_type == "raid5" || lv.lvm_type == "raid6"
198+
) "raid456";
200199

201-
})
202-
]) (lib.attrValues config.lvs);
200+
})
201+
]) (lib.attrValues config.lvs);
203202
description = "NixOS configuration";
204203
};
205204
_pkgs = lib.mkOption {

lib/types/mdadm.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@
108108
boot.initrd.services.swraid.enable = true;
109109
}
110110
)
111-
] ++ lib.optional (config.content != null) config.content._config;
111+
]
112+
++ lib.optional (config.content != null) config.content._config;
112113
description = "NixOS configuration";
113114
};
114115
_pkgs = lib.mkOption {

lib/types/zfs_fs.nix

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,20 @@
124124
fi
125125
'';
126126
})
127-
// lib.optionalAttrs
128-
(config.options.mountpoint or "" != "none" && config.options.canmount or "" != "off")
129-
{
130-
fs.${config.mountpoint} = ''
131-
if ! findmnt ${config._name} "${rootMountPoint}${config.mountpoint}" >/dev/null 2>&1; then
132-
mount ${config._name} "${rootMountPoint}${config.mountpoint}" \
133-
-o X-mount.mkdir \
134-
${lib.concatMapStringsSep " " (opt: "-o ${opt}") config.mountOptions} \
135-
${lib.optionalString ((config.options.mountpoint or "") != "legacy") "-o zfsutil"} \
136-
-t zfs
137-
fi
138-
'';
139-
};
127+
//
128+
lib.optionalAttrs
129+
(config.options.mountpoint or "" != "none" && config.options.canmount or "" != "off")
130+
{
131+
fs.${config.mountpoint} = ''
132+
if ! findmnt ${config._name} "${rootMountPoint}${config.mountpoint}" >/dev/null 2>&1; then
133+
mount ${config._name} "${rootMountPoint}${config.mountpoint}" \
134+
-o X-mount.mkdir \
135+
${lib.concatMapStringsSep " " (opt: "-o ${opt}") config.mountOptions} \
136+
${lib.optionalString ((config.options.mountpoint or "") != "legacy") "-o zfsutil"} \
137+
-t zfs
138+
fi
139+
'';
140+
};
140141
};
141142

142143
_unmount = diskoLib.mkUnmountOption {
@@ -149,15 +150,16 @@
149150
fi
150151
'';
151152
})
152-
// lib.optionalAttrs
153-
(config.options.mountpoint or "" != "none" && config.options.canmount or "" != "off")
154-
{
155-
fs.${config.mountpoint} = ''
156-
if findmnt ${config._name} "${rootMountPoint}${config.mountpoint}" >/dev/null 2>&1; then
157-
umount "${rootMountPoint}${config.mountpoint}"
158-
fi
159-
'';
160-
};
153+
//
154+
lib.optionalAttrs
155+
(config.options.mountpoint or "" != "none" && config.options.canmount or "" != "off")
156+
{
157+
fs.${config.mountpoint} = ''
158+
if findmnt ${config._name} "${rootMountPoint}${config.mountpoint}" >/dev/null 2>&1; then
159+
umount "${rootMountPoint}${config.mountpoint}"
160+
fi
161+
'';
162+
};
161163
};
162164

163165
_config = lib.mkOption {
@@ -170,8 +172,7 @@
170172
device = "${config._name}";
171173
fsType = "zfs";
172174
options =
173-
config.mountOptions
174-
++ lib.optional ((config.options.mountpoint or "") != "legacy") "zfsutil";
175+
config.mountOptions ++ lib.optional ((config.options.mountpoint or "") != "legacy") "zfsutil";
175176
};
176177
};
177178
description = "NixOS configuration";

tests/bcachefs.nix

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,23 @@ let
1616
machine.wait_for_text("enter passphrase for /nix");
1717
machine.send_chars("secretsecret\n");
1818
'';
19-
extraInstallerConfig = { config, ... }: {
20-
boot = {
21-
kernelPackages = pkgs.linuxPackages_testing;
22-
extraModulePackages = [
23-
(config.boot.kernelPackages.callPackage pkgs.bcachefs-tools.kernelModule {})
19+
extraInstallerConfig =
20+
{ config, ... }:
21+
{
22+
boot = {
23+
kernelPackages = pkgs.linuxPackages_testing;
24+
extraModulePackages = [
25+
(config.boot.kernelPackages.callPackage pkgs.bcachefs-tools.kernelModule { })
26+
];
27+
# Can also use the following instead of the above,
28+
# which doesn't necessitate passing in `config`,
29+
# so `{ config, ... }: ` can be removed:
30+
# supportedFilesystems = [ "bcachefs" ];
31+
};
32+
environment.systemPackages = [
33+
pkgs.bcachefs-tools
2434
];
25-
# Can also use the following instead of the above,
26-
# which doesn't necessitate passing in `config`,
27-
# so `{ config, ... }: ` can be removed:
28-
# supportedFilesystems = [ "bcachefs" ];
2935
};
30-
environment.systemPackages = [
31-
pkgs.bcachefs-tools
32-
];
33-
};
3436
extraSystemConfig = {
3537
environment.systemPackages = [
3638
pkgs.jq

tests/disko-install/configuration.nix

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@
2525
];
2626
};
2727
services.openssh.enable = true;
28-
boot.kernelParams =
29-
[ "console=tty0" ]
30-
++ (lib.optional (pkgs.stdenv.hostPlatform.isAarch) "ttyAMA0,115200")
31-
++ (lib.optional (pkgs.stdenv.hostPlatform.isRiscV64) "ttySIF0,115200")
32-
++ [ "console=ttyS0,115200" ];
28+
boot.kernelParams = [
29+
"console=tty0"
30+
]
31+
++ (lib.optional (pkgs.stdenv.hostPlatform.isAarch) "ttyAMA0,115200")
32+
++ (lib.optional (pkgs.stdenv.hostPlatform.isRiscV64) "ttySIF0,115200")
33+
++ [ "console=ttyS0,115200" ];
3334

3435
# reduce closure size
3536
nixpkgs.flake.setFlakeRegistry = false;

tests/disko-install/default.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ let
1616

1717
self.nixosConfigurations.testmachine.config.system.build.toplevel
1818
self.nixosConfigurations.testmachine.config.system.build.diskoScript
19-
] ++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs);
19+
]
20+
++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs);
2021

2122
closureInfo = pkgs.closureInfo { rootPaths = dependencies; };
2223
in

0 commit comments

Comments
 (0)