move s6-rc db creation to a module

This commit is contained in:
Daniel Barlow 2022-09-26 20:59:56 +01:00
parent bd6cbd373f
commit a427b9da5e
3 changed files with 18 additions and 6 deletions

View file

@ -8,6 +8,7 @@ let
./modules/base.nix ./modules/base.nix
({ lib, ... } : { config = { inherit (device) kernel; }; }) ({ lib, ... } : { config = { inherit (device) kernel; }; })
<liminix-config> <liminix-config>
./modules/s6-rc.nix
] nixpkgs.pkgs; ] nixpkgs.pkgs;
finalConfig = config // { finalConfig = config // {
packages = (with nixpkgs.pkgs; [ s6-init-files s6-rc ]) ++ packages = (with nixpkgs.pkgs; [ s6-init-files s6-rc ]) ++

View file

@ -17,10 +17,6 @@
, writeText , writeText
} : config : } : config :
let let
s6-rc-db = s6-rc-database.override {
services = builtins.attrValues config.services;
};
pseudofiles = writeText "pseudofiles" '' pseudofiles = writeText "pseudofiles" ''
/ d 0755 0 0 / d 0755 0 0
/bin d 0755 0 0 /bin d 0755 0 0
@ -42,8 +38,6 @@ let
/bin/init s 0755 0 0 ${s6-init-bin}/bin/init /bin/init s 0755 0 0 ${s6-init-bin}/bin/init
/bin/sh s 0755 0 0 ${busybox}/bin/sh /bin/sh s 0755 0 0 ${busybox}/bin/sh
/bin/busybox s 0755 0 0 ${busybox}/bin/busybox /bin/busybox s 0755 0 0 ${busybox}/bin/busybox
/etc/s6-rc d 0755 0 0
/etc/s6-rc/compiled s 0755 0 0 ${s6-rc-db}/compiled
/etc/passwd f 0644 0 0 echo "root::0:0:root:/:/bin/sh" /etc/passwd f 0644 0 0 echo "root::0:0:root:/:/bin/sh"
''; '';

17
modules/s6-rc.nix Normal file
View file

@ -0,0 +1,17 @@
{ config, pkgs, ... }:
let
s6-rc-db = pkgs.s6-rc-database.override {
services = builtins.attrValues config.services;
};
inherit (pkgs.pseudofile) dir symlink;
in {
config = {
environment = dir {
etc = dir {
s6-rc = dir {
compiled = symlink "${s6-rc-db}/compiled";
};
};
};
};
}