Merge pull request #262179 from ElvishJerricco/systemd-stage-1-specific-fs-packages

systemd-stage-1: Use specific fs packages

authored by nikstur and committed by GitHub 6958acea d8e7df7b

+28 -10
+1 -1
nixos/modules/system/boot/systemd/initrd.nix
··· 358 358 ++ lib.optional (cfg.enableTpm2 && !(pkgs.stdenv.hostPlatform.isRiscV64 || pkgs.stdenv.hostPlatform.isArmv7)) "tpm-crb"; 359 359 360 360 boot.initrd.systemd = { 361 - initrdBin = [pkgs.bash pkgs.coreutils cfg.package.kmod cfg.package] ++ config.system.fsPackages; 361 + initrdBin = [pkgs.bash pkgs.coreutils cfg.package.kmod cfg.package]; 362 362 extraBin = { 363 363 less = "${pkgs.less}/bin/less"; 364 364 mount = "${cfg.package.util-linux}/bin/mount";
+10 -7
nixos/modules/tasks/filesystems/btrfs.nix
··· 52 52 config = mkMerge [ 53 53 (mkIf enableBtrfs { 54 54 system.fsPackages = [ pkgs.btrfs-progs ]; 55 + }) 55 56 56 - boot.initrd.kernelModules = mkIf inInitrd [ "btrfs" ]; 57 - boot.initrd.availableKernelModules = mkIf inInitrd ( 57 + (mkIf inInitrd { 58 + boot.initrd.kernelModules = [ "btrfs" ]; 59 + boot.initrd.availableKernelModules = 58 60 [ "crc32c" ] 59 61 ++ optionals (config.boot.kernelPackages.kernel.kernelAtLeast "5.5") [ 60 62 # Needed for mounting filesystems with new checksums 61 63 "xxhash_generic" 62 64 "blake2b_generic" 63 65 "sha256_generic" # Should be baked into our kernel, just to be sure 64 - ] 65 - ); 66 + ]; 66 67 67 - boot.initrd.extraUtilsCommands = mkIf (inInitrd && !config.boot.initrd.systemd.enable) 68 + boot.initrd.extraUtilsCommands = mkIf (!config.boot.initrd.systemd.enable) 68 69 '' 69 70 copy_bin_and_libs ${pkgs.btrfs-progs}/bin/btrfs 70 71 ln -sv btrfs $out/bin/btrfsck 71 72 ln -sv btrfsck $out/bin/fsck.btrfs 72 73 ''; 73 74 74 - boot.initrd.extraUtilsCommandsTest = mkIf (inInitrd && !config.boot.initrd.systemd.enable) 75 + boot.initrd.extraUtilsCommandsTest = mkIf (!config.boot.initrd.systemd.enable) 75 76 '' 76 77 $out/bin/btrfs --version 77 78 ''; 78 79 79 - boot.initrd.postDeviceCommands = mkIf (inInitrd && !config.boot.initrd.systemd.enable) 80 + boot.initrd.postDeviceCommands = mkIf (!config.boot.initrd.systemd.enable) 80 81 '' 81 82 btrfs device scan 82 83 ''; 84 + 85 + boot.initrd.systemd.initrdBin = [ pkgs.btrfs-progs ]; 83 86 }) 84 87 85 88 (mkIf enableAutoScrub {
+2
nixos/modules/tasks/filesystems/cifs.nix
··· 21 21 copy_bin_and_libs ${pkgs.cifs-utils}/sbin/mount.cifs 22 22 ''; 23 23 24 + boot.initrd.systemd.extraBin."mount.cifs" = mkIf inInitrd "${pkgs.cifs-utils}/sbin/mount.cifs"; 25 + 24 26 }; 25 27 }
+2
nixos/modules/tasks/filesystems/ext.nix
··· 25 25 ln -sv e2fsck $out/bin/fsck.ext4 26 26 ''; 27 27 28 + boot.initrd.systemd.initrdBin = lib.mkIf inInitrd [ pkgs.e2fsprogs ]; 29 + 28 30 }; 29 31 }
+2
nixos/modules/tasks/filesystems/f2fs.nix
··· 16 16 boot.initrd.extraUtilsCommands = mkIf (inInitrd && !config.boot.initrd.systemd.enable) '' 17 17 copy_bin_and_libs ${pkgs.f2fs-tools}/sbin/fsck.f2fs 18 18 ''; 19 + 20 + boot.initrd.systemd.initrdBin = mkIf inInitrd [ pkgs.f2fs-tools ]; 19 21 }; 20 22 }
+2
nixos/modules/tasks/filesystems/jfs.nix
··· 15 15 boot.initrd.extraUtilsCommands = mkIf (inInitrd && !config.boot.initrd.systemd.enable) '' 16 16 copy_bin_and_libs ${pkgs.jfsutils}/sbin/fsck.jfs 17 17 ''; 18 + 19 + boot.initrd.systemd.initrdBin = mkIf inInitrd [ pkgs.jfsutils ]; 18 20 }; 19 21 }
+2
nixos/modules/tasks/filesystems/reiserfs.nix
··· 21 21 ln -s reiserfsck $out/bin/fsck.reiserfs 22 22 ''; 23 23 24 + boot.initrd.systemd.initrdBin = mkIf inInitrd [ pkgs.reiserfsprogs ]; 25 + 24 26 }; 25 27 }
+2
nixos/modules/tasks/filesystems/vfat.nix
··· 21 21 ln -sv dosfsck $out/bin/fsck.vfat 22 22 ''; 23 23 24 + boot.initrd.systemd.extraBin = mkIf inInitrd [ pkgs.dosfstools ]; 25 + 24 26 }; 25 27 }
+2
nixos/modules/tasks/filesystems/xfs.nix
··· 26 26 '' 27 27 sed -i -e 's,^#!.*,#!'$out/bin/sh, $out/bin/fsck.xfs 28 28 ''; 29 + 30 + boot.initrd.systemd.initrdBin = mkIf inInitrd [ pkgs.xfsprogs.bin ]; 29 31 }; 30 32 }
+2 -1
nixos/modules/tasks/filesystems/zfs.nix
··· 632 632 targets.zfs-import.wantedBy = [ "zfs.target" ]; 633 633 targets.zfs.wantedBy = [ "initrd.target" ]; 634 634 extraBin = { 635 - # zpool and zfs are already in thanks to fsPackages 635 + zpool = "${cfgZfs.package}/sbin/zpool"; 636 + zfs = "${cfgZfs.package}/sbin/zfs"; 636 637 awk = "${pkgs.gawk}/bin/awk"; 637 638 }; 638 639 };
+1 -1
pkgs/build-support/kernel/make-initrd-ng/src/main.rs
··· 195 195 .wrap_err_with(|| format!("failed to resolve symlink of {:?}", source))?; 196 196 197 197 // Create the link, then push its target to the queue 198 - if !target.exists() { 198 + if !target.exists() && !target.is_symlink() { 199 199 unix::fs::symlink(&link_target, &target).wrap_err_with(|| { 200 200 format!("failed to symlink {:?} to {:?}", link_target, target) 201 201 })?;