···11-import ./make-test.nix {
11+import ./make-test.nix ({ pkgs, ... }: {
22 name = "systemd";
3344 machine = { lib, ... }: {
···2020 systemd.user.extraConfig = "DefaultEnvironment=\"XXX_USER=bar\"";
2121 services.journald.extraConfig = "Storage=volatile";
2222 services.xserver.displayManager.auto.user = "alice";
2323+2424+ systemd.shutdown.test = pkgs.writeScript "test.shutdown" ''
2525+ #!${pkgs.stdenv.shell}
2626+ PATH=${lib.makeBinPath (with pkgs; [ utillinux coreutils ])}
2727+ mount -t 9p shared -o trans=virtio,version=9p2000.L /tmp/shared
2828+ touch /tmp/shared/shutdown-test
2929+ umount /tmp/shared
3030+ '';
23312432 systemd.services.testservice1 = {
2533 description = "Test Service 1";
···6977 # has a last mount time, because the file system wasn't checked.
7078 $machine->fail('dumpe2fs /dev/vdb | grep -q "^Last mount time: *n/a"');
7179 };
8080+8181+ # Regression test for https://github.com/NixOS/nixpkgs/issues/35268
8282+ subtest "file system with x-initrd.mount is not unmounted", sub {
8383+ $machine->shutdown;
8484+ $machine->waitForUnit('multi-user.target');
8585+ # If the file system was unmounted during the shutdown the file system
8686+ # has a last mount time, because the file system wasn't checked.
8787+ $machine->fail('dumpe2fs /dev/vdb | grep -q "^Last mount time: *n/a"');
8888+ };
8989+9090+ subtest "systemd-shutdown works", sub {
9191+ $machine->shutdown;
9292+ $machine->waitForUnit('multi-user.target');
9393+ $machine->succeed('test -e /tmp/shared/shutdown-test');
9494+ };
7295 '';
7373-}
9696+})
+18-7
pkgs/os-specific/linux/mdadm/default.nix
···11-{ stdenv, fetchurl, groff, system-sendmail }:
11+{ stdenv, utillinux, coreutils, fetchurl, groff, system-sendmail }:
2233stdenv.mkDerivation rec {
44 name = "mdadm-4.1";
···88 sha256 = "0jjgjgqijpdp7ijh8slzzjjw690kydb1jjadf0x5ilq85628hxmb";
99 };
10101111- # This is to avoid self-references, which causes the initrd to explode
1212- # in size and in turn prevents mdraid systems from booting.
1313- allowedReferences = [ stdenv.cc.libc.out system-sendmail ];
1414-1511 patches = [ ./no-self-references.patch ];
16121713 makeFlags = [
1818- "NIXOS=1" "INSTALL=install" "INSTALL_BINDIR=$(out)/sbin"
1414+ "NIXOS=1" "INSTALL=install" "BINDIR=$(out)/sbin"
1515+ "SYSTEMD_DIR=$(out)/lib/systemd/system"
1916 "MANDIR=$(out)/share/man" "RUN_DIR=/dev/.mdadm"
2017 "STRIP="
2118 ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
2219 "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
2320 ];
2121+2222+ installFlags = [ "install-systemd" ];
2323+2424+ enableParallelBuilding = true;
24252526 nativeBuildInputs = [ groff ];
26272727- preConfigure = ''
2828+ postPatch = ''
2829 sed -e 's@/lib/udev@''${out}/lib/udev@' \
2930 -e 's@ -Werror @ @' \
3031 -e 's@/usr/sbin/sendmail@${system-sendmail}@' -i Makefile
3232+ sed -i \
3333+ -e 's@/usr/bin/basename@${coreutils}/bin/basename@g' \
3434+ -e 's@BINDIR/blkid@${utillinux}/bin/blkid@g' \
3535+ *.rules
3636+ '';
3737+3838+ # This is to avoid self-references, which causes the initrd to explode
3939+ # in size and in turn prevents mdraid systems from booting.
4040+ postFixup = ''
4141+ grep -r $out $out/bin && false || true
3142 '';
32433344 meta = with stdenv.lib; {