nixos/filesystems: Make most simple filesystems compatible with systemd

This includes disabling some features in the initrd by default, this is
only done when the new initrd is used. Namely, ext and bcache are
disabled by default. bcache gets an own enable option while ext is
detected like any other filesystem.
This commit is contained in:
Janne Heß
2022-04-16 20:46:32 +01:00
parent 858b460f3c
commit 160fb93fdc
11 changed files with 51 additions and 24 deletions

View File

@@ -1,13 +1,23 @@
{ pkgs, ... }:
{ config, lib, pkgs, ... }:
{
options.boot.initrd.services.bcache.enable = (lib.mkEnableOption "bcache support in the initrd") // {
visible = false; # only works with systemd stage 1
};
environment.systemPackages = [ pkgs.bcache-tools ];
config = {
services.udev.packages = [ pkgs.bcache-tools ];
environment.systemPackages = [ pkgs.bcache-tools ];
boot.initrd.extraUdevRulesCommands = ''
cp -v ${pkgs.bcache-tools}/lib/udev/rules.d/*.rules $out/
'';
services.udev.packages = [ pkgs.bcache-tools ];
boot.initrd.extraUdevRulesCommands = lib.mkIf (!config.boot.initrd.systemd.enable) ''
cp -v ${pkgs.bcache-tools}/lib/udev/rules.d/*.rules $out/
'';
boot.initrd.services.udev = lib.mkIf config.boot.initrd.services.bcache.enable {
packages = [ pkgs.bcache-tools ];
binPackages = [ pkgs.bcache-tools ];
};
};
}