{ config, pkgs, ... }: let substituteDirectory = args: pkgs.stdenvNoCC.mkDerivation ({ name = if args ? name then args.name else baseNameOf (toString args.src); builder = ./substitute-dir.sh; preferLocalBuild = true; allowSubstitutes = false; } // args); in { environment.etc = { "mdev.conf".text = '' .* 0:0 660 ''; "syndicate/boot".source = substituteDirectory { src = ./boot; getty = "${pkgs.busybox}/bin/busybox getty"; inherit (config.services.getty) loginProgram; }; "syndicate/core".source = substituteDirectory { src = ./core; inherit (pkgs) mdevd; hostnameOneShot = "${pkgs.busybox}/bin/busybox hostname ${config.networking.hostName}"; }; }; }