···1-import ./make-test.nix {
2 name = "systemd";
34 machine = { lib, ... }: {
···20 systemd.user.extraConfig = "DefaultEnvironment=\"XXX_USER=bar\"";
21 services.journald.extraConfig = "Storage=volatile";
22 services.xserver.displayManager.auto.user = "alice";
000000002324 systemd.services.testservice1 = {
25 description = "Test Service 1";
···69 # has a last mount time, because the file system wasn't checked.
70 $machine->fail('dumpe2fs /dev/vdb | grep -q "^Last mount time: *n/a"');
71 };
00000000000000072 '';
73-}
···1+import ./make-test.nix ({ pkgs, ... }: {
2 name = "systemd";
34 machine = { lib, ... }: {
···20 systemd.user.extraConfig = "DefaultEnvironment=\"XXX_USER=bar\"";
21 services.journald.extraConfig = "Storage=volatile";
22 services.xserver.displayManager.auto.user = "alice";
23+24+ systemd.shutdown.test = pkgs.writeScript "test.shutdown" ''
25+ #!${pkgs.stdenv.shell}
26+ PATH=${lib.makeBinPath (with pkgs; [ utillinux coreutils ])}
27+ mount -t 9p shared -o trans=virtio,version=9p2000.L /tmp/shared
28+ touch /tmp/shared/shutdown-test
29+ umount /tmp/shared
30+ '';
3132 systemd.services.testservice1 = {
33 description = "Test Service 1";
···77 # has a last mount time, because the file system wasn't checked.
78 $machine->fail('dumpe2fs /dev/vdb | grep -q "^Last mount time: *n/a"');
79 };
80+81+ # Regression test for https://github.com/NixOS/nixpkgs/issues/35268
82+ subtest "file system with x-initrd.mount is not unmounted", sub {
83+ $machine->shutdown;
84+ $machine->waitForUnit('multi-user.target');
85+ # If the file system was unmounted during the shutdown the file system
86+ # has a last mount time, because the file system wasn't checked.
87+ $machine->fail('dumpe2fs /dev/vdb | grep -q "^Last mount time: *n/a"');
88+ };
89+90+ subtest "systemd-shutdown works", sub {
91+ $machine->shutdown;
92+ $machine->waitForUnit('multi-user.target');
93+ $machine->succeed('test -e /tmp/shared/shutdown-test');
94+ };
95 '';
96+})
+18-7
pkgs/os-specific/linux/mdadm/default.nix
···1-{ stdenv, fetchurl, groff, system-sendmail }:
23stdenv.mkDerivation rec {
4 name = "mdadm-4.1";
···8 sha256 = "0jjgjgqijpdp7ijh8slzzjjw690kydb1jjadf0x5ilq85628hxmb";
9 };
1011- # This is to avoid self-references, which causes the initrd to explode
12- # in size and in turn prevents mdraid systems from booting.
13- allowedReferences = [ stdenv.cc.libc.out system-sendmail ];
14-15 patches = [ ./no-self-references.patch ];
1617 makeFlags = [
18- "NIXOS=1" "INSTALL=install" "INSTALL_BINDIR=$(out)/sbin"
019 "MANDIR=$(out)/share/man" "RUN_DIR=/dev/.mdadm"
20 "STRIP="
21 ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
22 "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
23 ];
00002425 nativeBuildInputs = [ groff ];
2627- preConfigure = ''
28 sed -e 's@/lib/udev@''${out}/lib/udev@' \
29 -e 's@ -Werror @ @' \
30 -e 's@/usr/sbin/sendmail@${system-sendmail}@' -i Makefile
000000000031 '';
3233 meta = with stdenv.lib; {
···1+{ stdenv, utillinux, coreutils, fetchurl, groff, system-sendmail }:
23stdenv.mkDerivation rec {
4 name = "mdadm-4.1";
···8 sha256 = "0jjgjgqijpdp7ijh8slzzjjw690kydb1jjadf0x5ilq85628hxmb";
9 };
10000011 patches = [ ./no-self-references.patch ];
1213 makeFlags = [
14+ "NIXOS=1" "INSTALL=install" "BINDIR=$(out)/sbin"
15+ "SYSTEMD_DIR=$(out)/lib/systemd/system"
16 "MANDIR=$(out)/share/man" "RUN_DIR=/dev/.mdadm"
17 "STRIP="
18 ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
19 "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
20 ];
21+22+ installFlags = [ "install-systemd" ];
23+24+ enableParallelBuilding = true;
2526 nativeBuildInputs = [ groff ];
2728+ postPatch = ''
29 sed -e 's@/lib/udev@''${out}/lib/udev@' \
30 -e 's@ -Werror @ @' \
31 -e 's@/usr/sbin/sendmail@${system-sendmail}@' -i Makefile
32+ sed -i \
33+ -e 's@/usr/bin/basename@${coreutils}/bin/basename@g' \
34+ -e 's@BINDIR/blkid@${utillinux}/bin/blkid@g' \
35+ *.rules
36+ '';
37+38+ # This is to avoid self-references, which causes the initrd to explode
39+ # in size and in turn prevents mdraid systems from booting.
40+ postFixup = ''
41+ grep -r $out $out/bin && false || true
42 '';
4344 meta = with stdenv.lib; {