1
0
Fork 0
nixos/options/machine.nix

114 lines
2.9 KiB
Nix

{ config, lib, ... }:
with builtins;
with lib;
let
cfg = config.machine;
metapkgs = (lists.forEach
(attrNames (filterAttrs (n: v: v == "regular" ) (readDir ../pkgs/pkgsets)))
(v: replaceStrings [ ".nix" ] [ "" ] v));
pkgOption = pname: {
name = pname;
value = rec {
pkgwrap = mkOption {
type = types.listOf types.package;
default = cfg.pkgsets."${pname}".pkgs;
description = ''
Package Wrapper for packages using a wrapper function (like python, emacs, haskell, ...)
'';
};
pkgs = mkOption {
type = with types; listOf (nullOr attrs);
default = [];
description = ''
${pname} package list.
'';
};
};
};
in {
options.machine = {
pkgs = mkOption {
type = (types.listOf (types.enum metapkgs));
default = [ "base" ];
description = ''
The list of metapackages to be installed.
'';
};
pkgsets = listToAttrs (map pkgOption metapkgs);
services = mkOption {
type = types.listOf types.str;
default = [];
description = ''
List of services to be enabled.
'';
};
conffiles = mkOption {
type = types.listOf types.str;
default = [ "zsh" ];
description = ''
List of configuration files to be enabled.
'';
};
hostName = mkOption {
type = types.str;
description = ''
The Machines HostName
'';
};
secretPath = mkOption {
type = types.str;
default = (findFirst (elem: elem.prefix == "secretPath") { path = "/secret"; } builtins.nixPath).path;
description = ''
Path to you systems secret folder containing files with sensitive information.
'';
};
administrators = mkOption {
type = types.listOf types.attrs;
description = ''
List of administrative users.
'';
};
domain = mkOption {
type = types.str;
default = "localhost";
description = ''
The Machines domain name.
'';
};
extraDomains = mkOption {
type = types.listOf types.str;
default = [];
description = ''
Extra domains used in various services.
'';
};
mailAccounts = mkOption {
type = types.listOf types.attrs;
default = [];
description = ''
List of mail account user names.
'';
};
vHosts = mkOption {
type = types.listOf types.attrs;
default = [];
description = ''
Domain - Service mappings for nginx vHost config.
'';
};
desktop.wms = mkOption {
type = types.listOf types.str;
default = [];
description = ''
The list of wms to be enabled.
'';
};
};
imports = [
(mkAliasOptionModule [ "machine" "firewall" ] [ "networking" "firewall" ])
(mkAliasOptionModule [ "machine" "allowUnfree" ] [ "nixpkgs" "config" "allowUnfree" ])
];
}