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