liminix/modules/base.nix

46 lines
1.2 KiB
Nix
Raw Normal View History

{ lib, pkgs, ...}:
2022-09-26 10:46:09 +00:00
let
inherit (lib) mkEnableOption mkOption types isDerivation hasAttr ;
inherit (pkgs.pseudofile) dir symlink;
2022-09-26 10:46:09 +00:00
type_service = types.package // {
name = "service";
description = "s6-rc service";
check = x: isDerivation x && hasAttr "serviceType" x;
};
2022-09-25 10:22:15 +00:00
in {
options = {
systemPackages = mkOption {
type = types.listOf types.package;
};
services = mkOption {
2022-09-26 10:46:09 +00:00
type = types.attrsOf type_service;
2022-09-25 10:22:15 +00:00
};
environment = mkOption { type = types.anything; };
2022-09-26 11:11:26 +00:00
kernel = {
config = mkOption {
# mostly the values are y n or m, but sometimes
# other strings are also used
type = types.attrsOf types.nonEmptyStr;
};
checkedConfig = mkOption {
type = types.attrsOf types.nonEmptyStr;
};
2022-09-25 10:22:15 +00:00
};
};
config = {
environment = dir {
etc = dir {
profile = symlink
(pkgs.writeScript ".profile" ''
PATH=${lib.makeBinPath (with pkgs; [ s6-init-bin busybox execline s6-linux-init s6-rc])}
export PATH
'');
passwd = { file = "root::0:0:root:/:/bin/sh\n"; };
group = { file = "root::0:\n"; };
};
};
};
2022-09-25 10:22:15 +00:00
}