liminix-fork/modules/base.nix
Daniel Barlow 696bbe6521 rename systemPackages as defaultProfile.packages
it doesn't work the same way as in nixos, so don't name it the same way
2022-09-27 16:47:42 +01:00

68 lines
1.9 KiB
Nix

{ lib, pkgs, config, ...}:
let
inherit (lib) mkEnableOption mkOption types isDerivation hasAttr ;
inherit (pkgs.pseudofile) dir symlink;
inherit (pkgs) busybox;
type_service = types.package // {
name = "service";
description = "s6-rc service";
check = x: isDerivation x && hasAttr "serviceType" x;
};
in {
options = {
# analogous to nixos systemPackages, but we don't symlink into
# /run/current-system, we just add the paths in /etc/profile
defaultProfile = {
packages = mkOption {
type = types.listOf types.package;
};
};
services = mkOption {
type = types.attrsOf type_service;
};
environment = mkOption { type = types.anything; };
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;
};
};
};
config = {
defaultProfile.packages = with pkgs;
[ s6-init-bin busybox execline s6-linux-init s6-rc ];
environment = dir {
bin = dir {
sh = symlink "${busybox}/bin/sh";
busybox = symlink "${busybox}/bin/busybox";
};
dev =
let node = type: major: minor: mode : { inherit type major minor mode; };
in dir {
null = node "c" "1" "3" "0666";
zero = node "c" "1" "5" "0666";
tty = node "c" "5" "0" "0666";
console = node "c" "5" "1" "0600";
pts = dir {};
};
etc = dir {
profile = symlink
(pkgs.writeScript ".profile" ''
PATH=${lib.makeBinPath config.defaultProfile.packages}
export PATH
'');
passwd = { file = "root::0:0:root:/:/bin/sh\n"; };
group = { file = "root::0:\n"; };
};
proc = dir {};
run = dir {};
sys = dir {};
};
};
}