diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-04-10 21:48:51 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2021-04-14 23:39:08 +0000 |
commit | 03f8ca8da40dd26d0a2542fef51d28eb943d4442 (patch) | |
tree | fc53ce32d38ef81ab5200f953ff18c1605988433 /pkgs/os-specific/linux/spectrum/rootfs/default.nix | |
parent | c643e387ff1f048779b4c73bba60dae3bda84921 (diff) | |
download | nixpkgs-03f8ca8da40dd26d0a2542fef51d28eb943d4442.tar nixpkgs-03f8ca8da40dd26d0a2542fef51d28eb943d4442.tar.gz nixpkgs-03f8ca8da40dd26d0a2542fef51d28eb943d4442.tar.bz2 nixpkgs-03f8ca8da40dd26d0a2542fef51d28eb943d4442.tar.lz nixpkgs-03f8ca8da40dd26d0a2542fef51d28eb943d4442.tar.xz nixpkgs-03f8ca8da40dd26d0a2542fef51d28eb943d4442.tar.zst nixpkgs-03f8ca8da40dd26d0a2542fef51d28eb943d4442.zip |
spectrumPackages.makeRootfs: move to default.nix
There is no default rootfs any more, so we might as well repurpose the blessed filename. Message-Id: <20210411115740.29615-14-hi@alyssa.is> Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
Diffstat (limited to 'pkgs/os-specific/linux/spectrum/rootfs/default.nix')
-rw-r--r-- | pkgs/os-specific/linux/spectrum/rootfs/default.nix | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/spectrum/rootfs/default.nix b/pkgs/os-specific/linux/spectrum/rootfs/default.nix new file mode 100644 index 00000000000..56f2d15b103 --- /dev/null +++ b/pkgs/os-specific/linux/spectrum/rootfs/default.nix @@ -0,0 +1,58 @@ +{ runCommandNoCC, writeScript, writeReferencesToFile, makeFontsConf, lib +, dash, execline, s6, s6-rc, s6-portable-utils, s6-linux-utils, s6-linux-init, busybox +, mesa, squashfs-tools-ng, makeDBusConf, connman +}: + +{ services, rcServices ? {}, fonts ? [], path ? [] }: + +let + stage1 = import ./stage1.nix { + inherit writeScript lib + execline s6 s6-rc s6-portable-utils s6-linux-utils s6-linux-init busybox mesa + path; + }; + + makeServicesDir = import ./services.nix { + inherit runCommandNoCC writeScript lib execline; + }; + + makeRcServicesDir = import ./rc-services.nix { + inherit runCommandNoCC lib s6-rc; + }; + + fontsConf = makeFontsConf { fontDirectories = fonts; }; + + squashfs = runCommandNoCC "root-squashfs" {} '' + cd ${rootfs} + ( + grep -v ^${rootfs} ${writeReferencesToFile rootfs} + printf "%s\n" * + ) \ + | xargs tar -cP --owner root:0 --group root:0 --hard-dereference \ + | ${squashfs-tools-ng}/bin/tar2sqfs -c gzip -X level=1 $out + ''; + + rootfs = runCommandNoCC "rootfs" { passthru = { inherit squashfs; }; } '' + mkdir $out + cd $out + + mkdir -p bin sbin dev proc run sys tmp var/lib + ln -s /run var/run + ln -s ${dash}/bin/dash bin/sh + ln -s ${stage1} sbin/init + cp -r ${./etc} etc + chmod u+w etc + ln -s ${makeDBusConf { + suidHelper = "/run/dbus-daemon-launch-helper"; + serviceDirectories = [ connman ]; + }} etc/dbus-1 + + mkdir etc/fonts + ln -s ${fontsConf} etc/fonts/fonts.conf + + touch etc/login.defs + cp -r ${makeServicesDir { inherit services; }} etc/service + cp -r ${makeRcServicesDir { services = rcServices; }} etc/s6-rc + ''; +in +rootfs |