mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-13 05:05:29 +03:00
initrd: Optional systemd-based initrd
This commit is contained in:
parent
25113740a5
commit
2d4ebf1259
7 changed files with 385 additions and 14 deletions
|
@ -291,16 +291,10 @@ in rec {
|
|||
};
|
||||
};
|
||||
|
||||
serviceConfig = { name, config, ... }: {
|
||||
mkServiceConfig = path: { name, config, ... }: {
|
||||
config = mkMerge
|
||||
[ { # Default path for systemd services. Should be quite minimal.
|
||||
path = mkAfter
|
||||
[ pkgs.coreutils
|
||||
pkgs.findutils
|
||||
pkgs.gnugrep
|
||||
pkgs.gnused
|
||||
systemd
|
||||
];
|
||||
path = mkAfter path;
|
||||
environment.PATH = "${makeBinPath config.path}:${makeSearchPathOutput "bin" "sbin" config.path}";
|
||||
}
|
||||
(mkIf (config.preStart != "")
|
||||
|
@ -330,6 +324,16 @@ in rec {
|
|||
];
|
||||
};
|
||||
|
||||
serviceConfig = mkServiceConfig [
|
||||
pkgs.coreutils
|
||||
pkgs.findutils
|
||||
pkgs.gnugrep
|
||||
pkgs.gnused
|
||||
systemd
|
||||
];
|
||||
|
||||
initrdServiceConfig = mkServiceConfig [];
|
||||
|
||||
mountConfig = { config, ... }: {
|
||||
config = {
|
||||
mountConfig =
|
||||
|
@ -387,6 +391,15 @@ in rec {
|
|||
'';
|
||||
};
|
||||
|
||||
initrdServiceToUnit = name: def:
|
||||
{ inherit (def) aliases wantedBy requiredBy enable;
|
||||
text = commonUnitText def +
|
||||
''
|
||||
[Service]
|
||||
${attrsToSection def.serviceConfig}
|
||||
'';
|
||||
};
|
||||
|
||||
socketToUnit = name: def:
|
||||
{ inherit (def) aliases wantedBy requiredBy enable;
|
||||
text = commonUnitText def +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue