tangled
alpha
login
or
join now
tjh.dev
/
nixpkgs
0
fork
atom
Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
0
fork
atom
overview
issues
pulls
pipelines
nixos/tests: add non-default-filesystems test
T0astBread
3 years ago
4c77ffb3
87cd533a
+55
2 changed files
expand all
collapse all
unified
split
nixos
tests
all-tests.nix
non-default-filesystems.nix
+1
nixos/tests/all-tests.nix
···
382
382
nixpkgs = pkgs.callPackage ../modules/misc/nixpkgs/test.nix { inherit evalMinimalConfig; };
383
383
node-red = handleTest ./node-red.nix {};
384
384
nomad = handleTest ./nomad.nix {};
385
385
+
non-default-filesystems = handleTest ./non-default-filesystems.nix {};
385
386
noto-fonts = handleTest ./noto-fonts.nix {};
386
387
novacomd = handleTestOn ["x86_64-linux"] ./novacomd.nix {};
387
388
nsd = handleTest ./nsd.nix {};
+54
nixos/tests/non-default-filesystems.nix
···
1
1
+
import ./make-test-python.nix ({ lib, pkgs, ... }:
2
2
+
{
3
3
+
name = "non-default-filesystems";
4
4
+
5
5
+
nodes.machine =
6
6
+
{ config, pkgs, lib, ... }:
7
7
+
let
8
8
+
disk = config.virtualisation.bootDevice;
9
9
+
in
10
10
+
{
11
11
+
virtualisation.useDefaultFilesystems = false;
12
12
+
13
13
+
boot.initrd.availableKernelModules = [ "btrfs" ];
14
14
+
boot.supportedFilesystems = [ "btrfs" ];
15
15
+
16
16
+
boot.initrd.postDeviceCommands = ''
17
17
+
FSTYPE=$(blkid -o value -s TYPE ${disk} || true)
18
18
+
if test -z "$FSTYPE"; then
19
19
+
modprobe btrfs
20
20
+
${pkgs.btrfs-progs}/bin/mkfs.btrfs ${disk}
21
21
+
22
22
+
mkdir /nixos
23
23
+
mount -t btrfs ${disk} /nixos
24
24
+
25
25
+
${pkgs.btrfs-progs}/bin/btrfs subvolume create /nixos/root
26
26
+
${pkgs.btrfs-progs}/bin/btrfs subvolume create /nixos/home
27
27
+
28
28
+
umount /nixos
29
29
+
fi
30
30
+
'';
31
31
+
32
32
+
virtualisation.fileSystems = {
33
33
+
"/" = {
34
34
+
device = disk;
35
35
+
fsType = "btrfs";
36
36
+
options = [ "subvol=/root" ];
37
37
+
};
38
38
+
39
39
+
"/home" = {
40
40
+
device = disk;
41
41
+
fsType = "btrfs";
42
42
+
options = [ "subvol=/home" ];
43
43
+
};
44
44
+
};
45
45
+
};
46
46
+
47
47
+
testScript = ''
48
48
+
machine.wait_for_unit("multi-user.target")
49
49
+
50
50
+
with subtest("BTRFS filesystems are mounted correctly"):
51
51
+
machine.succeed("grep -E '/dev/vda / btrfs rw,relatime,space_cache=v2,subvolid=[0-9]+,subvol=/root 0 0' /proc/mounts")
52
52
+
machine.succeed("grep -E '/dev/vda /home btrfs rw,relatime,space_cache=v2,subvolid=[0-9]+,subvol=/home 0 0' /proc/mounts")
53
53
+
'';
54
54
+
})