diff options
-rw-r--r-- | nixos/modules/system/boot/systemd/repart.nix | 90 | ||||
-rw-r--r-- | nixos/tests/systemd-repart.nix | 62 | ||||
-rw-r--r-- | pkgs/applications/audio/easyeffects/default.nix | 4 | ||||
-rw-r--r-- | pkgs/development/libraries/openexr/3.nix | 3 | ||||
-rw-r--r-- | pkgs/os-specific/linux/zfs/stable.nix | 4 | ||||
-rw-r--r-- | pkgs/tools/misc/moar/default.nix | 4 |
6 files changed, 125 insertions, 42 deletions
diff --git a/nixos/modules/system/boot/systemd/repart.nix b/nixos/modules/system/boot/systemd/repart.nix index 251c7e2361231..e81b3e4ff2a1b 100644 --- a/nixos/modules/system/boot/systemd/repart.nix +++ b/nixos/modules/system/boot/systemd/repart.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, ... }: +{ config, pkgs, lib, utils, ... }: let cfg = config.systemd.repart; @@ -26,14 +26,29 @@ let in { options = { - boot.initrd.systemd.repart.enable = lib.mkEnableOption (lib.mdDoc "systemd-repart") // { - description = lib.mdDoc '' - Grow and add partitions to a partition table at boot time in the initrd. - systemd-repart only works with GPT partition tables. - - To run systemd-repart after the initrd, see - `options.systemd.repart.enable`. - ''; + boot.initrd.systemd.repart = { + enable = lib.mkEnableOption (lib.mdDoc "systemd-repart") // { + description = lib.mdDoc '' + Grow and add partitions to a partition table at boot time in the initrd. + systemd-repart only works with GPT partition tables. + + To run systemd-repart after the initrd, see + `options.systemd.repart.enable`. + ''; + }; + + device = lib.mkOption { + type = with lib.types; nullOr str; + description = lib.mdDoc '' + The device to operate on. + + If `device == null`, systemd-repart will operate on the device + backing the root partition. So in order to dynamically *create* the + root partition in the initrd you need to set a device. + ''; + default = null; + example = "/dev/vda"; + }; }; systemd.repart = { @@ -84,31 +99,42 @@ in contents."/etc/repart.d".source = definitionsDirectory; # Override defaults in upstream unit. - services.systemd-repart = { - # systemd-repart tries to create directories in /var/tmp by default to - # store large temporary files that benefit from persistence on disk. In - # the initrd, however, /var/tmp does not provide more persistence than - # /tmp, so we re-use it here. - environment."TMPDIR" = "/tmp"; - serviceConfig = { - ExecStart = [ - " " # required to unset the previous value. - # When running in the initrd, systemd-repart by default searches - # for definition files in /sysroot or /sysusr. We tell it to look - # in the initrd itself. - ''${config.boot.initrd.systemd.package}/bin/systemd-repart \ + services.systemd-repart = + let + deviceUnit = "${utils.escapeSystemdPath initrdCfg.device}.device"; + in + { + # systemd-repart tries to create directories in /var/tmp by default to + # store large temporary files that benefit from persistence on disk. In + # the initrd, however, /var/tmp does not provide more persistence than + # /tmp, so we re-use it here. + environment."TMPDIR" = "/tmp"; + serviceConfig = { + ExecStart = [ + " " # required to unset the previous value. + # When running in the initrd, systemd-repart by default searches + # for definition files in /sysroot or /sysusr. We tell it to look + # in the initrd itself. + ''${config.boot.initrd.systemd.package}/bin/systemd-repart \ --definitions=/etc/repart.d \ - --dry-run=no - '' - ]; + --dry-run=no ${lib.optionalString (initrdCfg.device != null) initrdCfg.device} + '' + ]; + }; + # systemd-repart needs to run after /sysroot (or /sysuser, but we + # don't have it) has been mounted because otherwise it cannot + # determine the device (i.e disk) to operate on. If you want to run + # systemd-repart without /sysroot (i.e. to create the root + # partition), you have to explicitly tell it which device to operate + # on. The service then needs to be ordered to run after this device + # is available. + requires = lib.mkIf (initrdCfg.device != null) [ deviceUnit ]; + after = + if initrdCfg.device == null then + [ "sysroot.mount" ] + else + [ deviceUnit ]; }; - # systemd-repart needs to run after /sysroot (or /sysuser, but we don't - # have it) has been mounted because otherwise it cannot determine the - # device (i.e disk) to operate on. If you want to run systemd-repart - # without /sysroot, you have to explicitly tell it which device to - # operate on. - after = [ "sysroot.mount" ]; - }; }; environment.etc = lib.mkIf cfg.enable { diff --git a/nixos/tests/systemd-repart.nix b/nixos/tests/systemd-repart.nix index 5d579ae3371d1..22ea8fbd22711 100644 --- a/nixos/tests/systemd-repart.nix +++ b/nixos/tests/systemd-repart.nix @@ -56,8 +56,8 @@ let # however, creates separate filesystem images without a partition table, so # we have to create a disk image manually. # - # This creates two partitions, an ESP mounted on /dev/vda1 and the root - # partition mounted on /dev/vda2 + # This creates two partitions, an ESP available as /dev/vda1 and the root + # partition available as /dev/vda2. system.build.diskImage = import ../lib/make-disk-image.nix { inherit config pkgs lib; # Use a raw format disk so that it can be resized before starting the @@ -131,4 +131,62 @@ in assert "Growing existing partition 1." in systemd_repart_logs ''; }; + + create-root = makeTest { + name = "systemd-repart-create-root"; + meta.maintainers = with maintainers; [ nikstur ]; + + nodes.machine = { config, lib, pkgs, ... }: { + virtualisation.useDefaultFilesystems = false; + virtualisation.fileSystems = { + "/" = { + device = "/dev/disk/by-partlabel/created-root"; + fsType = "ext4"; + }; + "/nix/store" = { + device = "/dev/vda2"; + fsType = "ext4"; + }; + }; + + # Create an image containing only the Nix store. This enables creating + # the root partition with systemd-repart and then successfully booting + # into a working system. + # + # This creates two partitions, an ESP available as /dev/vda1 and the Nix + # store available as /dev/vda2. + system.build.diskImage = import ../lib/make-disk-image.nix { + inherit config pkgs lib; + onlyNixStore = true; + format = "raw"; + bootSize = "32M"; + additionalSpace = "0M"; + partitionTableType = "efi"; + installBootLoader = false; + copyChannel = false; + }; + + boot.initrd.systemd.enable = true; + + boot.initrd.systemd.repart.enable = true; + boot.initrd.systemd.repart.device = "/dev/vda"; + systemd.repart.partitions = { + "10-root" = { + Type = "root"; + Label = "created-root"; + Format = "ext4"; + }; + }; + }; + + testScript = { nodes, ... }: '' + ${useDiskImage nodes.machine} + + machine.start() + machine.wait_for_unit("multi-user.target") + + systemd_repart_logs = machine.succeed("journalctl --boot --unit systemd-repart.service") + assert "Adding new partition 2 to partition table." in systemd_repart_logs + ''; + }; } diff --git a/pkgs/applications/audio/easyeffects/default.nix b/pkgs/applications/audio/easyeffects/default.nix index 02f2cf0e16993..b9dd321f2963c 100644 --- a/pkgs/applications/audio/easyeffects/default.nix +++ b/pkgs/applications/audio/easyeffects/default.nix @@ -27,7 +27,6 @@ , pkg-config , rnnoise , rubberband -, speex , speexdsp , tbb , wrapGAppsHook4 @@ -43,7 +42,7 @@ stdenv.mkDerivation rec { owner = "wwmm"; repo = "easyeffects"; rev = "v${version}"; - sha256 = "sha256-JaqwzCWVnvFzzGHnmzYwe3occ9iw7s9xCH54eVKEuOs="; + hash = "sha256-JaqwzCWVnvFzzGHnmzYwe3occ9iw7s9xCH54eVKEuOs="; }; nativeBuildInputs = [ @@ -74,7 +73,6 @@ stdenv.mkDerivation rec { pipewire rnnoise rubberband - speex speexdsp tbb zita-convolver diff --git a/pkgs/development/libraries/openexr/3.nix b/pkgs/development/libraries/openexr/3.nix index 5ab6ecf2f3d51..243d8830565d2 100644 --- a/pkgs/development/libraries/openexr/3.nix +++ b/pkgs/development/libraries/openexr/3.nix @@ -36,7 +36,8 @@ stdenv.mkDerivation rec { # error reading back channel B pixel 21,-76 got -nan expected -nan env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isi686 "-msse2 -mfpmath=sse"; - doCheck = true; + # https://github.com/AcademySoftwareFoundation/openexr/issues/1400 + doCheck = !stdenv.isAarch32; meta = with lib; { description = "A high dynamic-range (HDR) image file format"; diff --git a/pkgs/os-specific/linux/zfs/stable.nix b/pkgs/os-specific/linux/zfs/stable.nix index 48c58874cfefd..25fa96b9b6e52 100644 --- a/pkgs/os-specific/linux/zfs/stable.nix +++ b/pkgs/os-specific/linux/zfs/stable.nix @@ -16,8 +16,8 @@ callPackage ./generic.nix args { else kernel.kernelOlder "6.2"; latestCompatibleLinuxPackages = if stdenv'.isx86_64 - then linuxKernel.packages.linux_6_1 - else linuxKernel.packages.linux_6_2; + then linuxKernel.packages.linux_6_2 + else linuxKernel.packages.linux_6_1; # this package should point to the latest release. version = "2.1.11"; diff --git a/pkgs/tools/misc/moar/default.nix b/pkgs/tools/misc/moar/default.nix index d77390e73be6c..d4f88096c1b88 100644 --- a/pkgs/tools/misc/moar/default.nix +++ b/pkgs/tools/misc/moar/default.nix @@ -2,13 +2,13 @@ buildGoModule rec { pname = "moar"; - version = "1.15.0"; + version = "1.15.1"; src = fetchFromGitHub { owner = "walles"; repo = pname; rev = "v${version}"; - sha256 = "sha256-FhP77kp3OOlUTIu96NTRjzF+x5K3MGKIMeQP4mMhy/I="; + sha256 = "sha256-ZCzRSySsgg8uOlnKZ5e9Ydzwaya+5JJpG20hOFwds2w="; }; vendorHash = "sha256-aFCv6VxHD1bOLhCHXhy4ubik8Z9uvU6AeqcMqIZI2Oo="; |