!PSmBFWNKoXmlQBzUQf:helsinki-systems.de

Stage 1 systemd

81 Members
systemd in NixOs's stage 1, replacing the current bash tooling https://github.com/NixOS/nixpkgs/projects/5125 Servers

Load older messages


SenderMessageTime
15 Nov 2022
@k900:0upti.meK900 We can map over fileSystems and filter on requiredForBoot or whatever that flag is 22:28:35
@elvishjerricco:matrix.org@elvishjerricco:matrix.org
In reply to @andreas.schraegle:helsinki-systems.de
mapping over boot.initrd.kernelModules ++ boot.initrd.availableKernelModules sounds fragile, IMHO.
maybe introducing boot.initrd.fsPackages and setting it in the filesystem modules might work?
A boot.initrd.fsPackages option would be functionally identical to boot.initrd.systemd.initrdBin
22:28:47
@elvishjerricco:matrix.org@elvishjerricco:matrix.org Mapping over fileSystems is better than the kernel modules I think, K900 22:29:08
@k900:0upti.meK900I'm pretty sure the kernel modules get added based on that anyway22:29:24
@k900:0upti.meK900So it's just skipping an indirection22:29:28
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgyea22:29:29
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgAnyone know where the translation fsType -> kernel module happens?22:29:42
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgCould help inform how to do this22:29:47
@k900:0upti.meK900I found it once22:29:49
@k900:0upti.meK900But I don't remember where22:29:58
@k900:0upti.meK900...or how22:30:14
@elvishjerricco:matrix.org@elvishjerricco:matrix.org Probably something to do with boot.initrd.supportedFilesystems 22:32:26
@andreas.schraegle:helsinki-systems.de@andreas.schraegle:helsinki-systems.dethe pattern seems to be that they're all set here: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/system/boot/stage-1.nix#L748 and them the filesystem modules do use that, e.g. here: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/tasks/filesystems/xfs.nix22:34:10
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgyea, but I need to figure out how that's translated to available kernel modules22:34:47
@andreas.schraegle:helsinki-systems.de@andreas.schraegle:helsinki-systems.dehttps://github.com/NixOS/nixpkgs/blob/master/nixos/modules/tasks/filesystems/xfs.nix#L1622:34:58
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgah, so it isn't...22:35:17
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgdarn22:35:18
@andreas.schraegle:helsinki-systems.de@andreas.schraegle:helsinki-systems.dehttps://github.com/NixOS/nixpkgs/blob/master/nixos/modules/tasks/filesystems/btrfs.nix#L5622:35:36
@andreas.schraegle:helsinki-systems.de@andreas.schraegle:helsinki-systems.deyup. every module just does that afaict.22:35:45
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgyea so probably need to go through and add a bunch of explicit definitions of fs packages for initrd in each of those...22:36:30
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgdid not want to have to do that22:36:34
@k900:0upti.meK900 Looks like they already do that for extraUtils 22:37:29
@k900:0upti.meK900Just awkwardly 22:37:32
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgyea22:37:34
@elvishjerricco:matrix.org@elvishjerricco:matrix.org i'll probably go ahead and make a boot.initrd.systemd.fsPackages option or something, in case we decide to make it smarter later, e.g. by only copying fsck.${fsType} and mount.${fsType} or something 22:38:31
@elvishjerricco:matrix.org@elvishjerricco:matrix.org or more likely I'll just use extraBin to specify the exact commands already specified for scripted initrd in those modules 22:39:55
@elvishjerricco:matrix.org@elvishjerricco:matrix.org or... could just... make dumb fix... and add util-linux in a more special place instead of in system.fsPackages 22:43:37
@elvishjerricco:matrix.org@elvishjerricco:matrix.org

Could literally just do this:

diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index d28e6ed0e27..2999b84428f 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -558,7 +558,7 @@ in
       # Environment of PID 1
       systemd.managerEnvironment = {
         # Doesn't contain systemd itself - everything works so it seems to use the compiled-in value for its tools
-        PATH = lib.makeBinPath config.system.fsPackages;
+        PATH = lib.makeBinPath (config.system.fsPackages ++ [cfg.package.util-linux]);
         LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive";
         TZDIR = "/etc/zoneinfo";
         # If SYSTEMD_UNIT_PATH ends with an empty component (":"), the usual unit load path will be appended to the contents of the variable
diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix
index 97f02a8c963..399ea9eabe0 100644
--- a/nixos/modules/tasks/filesystems.nix
+++ b/nixos/modules/tasks/filesystems.nix
@@ -300,11 +300,7 @@ in
     boot.supportedFilesystems = map (fs: fs.fsType) fileSystems;
 
     # Add the mount helpers to the system path so that `mount' can find them.
-    system.fsPackages = [
-      pkgs.dosfstools
-      # This is needed for the main fsck utility wrapping the fs-specific ones.
-      pkgs.util-linux
-    ];
+    system.fsPackages = [ pkgs.dosfstools ];
 
     environment.systemPackages = with pkgs; [ fuse3 fuse ] ++ config.system.fsPackages;
 
22:46:41
@elvishjerricco:matrix.org@elvishjerricco:matrix.orghttps://github.com/NixOS/nixpkgs/pull/20139623:01:31
@elvishjerricco:matrix.org@elvishjerricco:matrix.org @ofborg test fsck systemd-initrd-simple would be how I make it do the tests, right? 23:02:16

Show newer messages


Back to Room ListRoom Version: 6