syndicate-flake/nixos/modules/synit/etc/default.nix

33 lines
1.1 KiB
Nix

{ config, lib, 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 = {
"syndicate/boot".source = substituteDirectory {
src = ./boot;
getty = "${pkgs.busybox}/bin/busybox getty";
inherit (config.services.getty) loginProgram;
};
"syndicate/core".source = substituteDirectory {
src = ./core;
hostnameOneShot =
"${pkgs.busybox}/bin/busybox hostname ${config.networking.hostName}";
inherit (pkgs) mdevd;
mdevdConf = pkgs.writeText "mdevd.conf" ''
.* 0:0 660 &importas -i MDEV MDEV backtick -E mdevdir { basename -- $MDEV } if { mkdir -p /run/etc/syndicate/machine/''${mdevdir} } redirfd -w 1 /run/etc/syndicate/machine/''${MDEV}.pr ${pkgs.nimPackages.syndicate_utils}/bin/preserve_process_environment
'';
mdevdPath = lib.strings.makeBinPath [ pkgs.execline pkgs.busybox ];
};
};
}