2019-10-23 03:44:17 +02:00
|
|
|
{ config, lib, ... }:
|
2019-03-17 11:43:14 +01:00
|
|
|
|
2019-10-23 03:44:17 +02:00
|
|
|
with builtins;
|
2019-03-17 11:43:14 +01:00
|
|
|
with lib;
|
|
|
|
|
2019-10-23 03:44:17 +02:00
|
|
|
let
|
|
|
|
cfg = config.machine;
|
2019-11-11 18:41:30 +01:00
|
|
|
fn = import (toString ../fn.nix) { inherit lib; };
|
|
|
|
metapkgs = let
|
2020-03-27 13:25:54 +01:00
|
|
|
pPath = (toString ../pkgsets);
|
2019-11-11 18:41:30 +01:00
|
|
|
in (lists.forEach (fn.lsfRec pPath true) (v: replaceStrings [ "${pPath}/" "/" ".nix" ] [ "" "::" "" ] v));
|
2019-10-23 03:44:17 +02:00
|
|
|
pkgOption = pname: {
|
|
|
|
name = pname;
|
|
|
|
value = rec {
|
|
|
|
pkgwrap = mkOption {
|
2019-11-17 23:13:50 +01:00
|
|
|
type = with types; oneOf [ package (listOf package) ];
|
2020-03-27 13:25:54 +01:00
|
|
|
default = (fn.pkgFilter cfg.pkgsets."${pname}".pkgs);
|
2019-10-23 03:44:17 +02:00
|
|
|
description = ''
|
|
|
|
Package Wrapper for packages using a wrapper function (like python, emacs, haskell, ...)
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
pkgs = mkOption {
|
2019-11-17 23:13:50 +01:00
|
|
|
type = types.unspecified;
|
2019-10-23 03:44:17 +02:00
|
|
|
default = [];
|
|
|
|
description = ''
|
|
|
|
${pname} package list.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in {
|
2019-03-17 11:43:14 +01:00
|
|
|
options.machine = {
|
|
|
|
pkgs = mkOption {
|
2019-10-23 03:44:17 +02:00
|
|
|
type = (types.listOf (types.enum metapkgs));
|
2019-10-08 13:15:38 +02:00
|
|
|
default = [ "base" ];
|
2019-03-17 11:43:14 +01:00
|
|
|
description = ''
|
|
|
|
The list of metapackages to be installed.
|
|
|
|
'';
|
|
|
|
};
|
2019-11-17 23:13:50 +01:00
|
|
|
# Package names containing '::' are sub packages and should not have their own pkgset.
|
|
|
|
pkgsets = listToAttrs (map pkgOption (lists.filter (v: !(strings.hasInfix "::" v)) metapkgs));
|
2019-03-17 11:43:14 +01:00
|
|
|
services = mkOption {
|
2019-09-05 15:20:56 +02:00
|
|
|
type = types.listOf types.str;
|
2019-10-08 13:15:38 +02:00
|
|
|
default = [];
|
2019-03-17 11:43:14 +01:00
|
|
|
description = ''
|
|
|
|
List of services to be enabled.
|
|
|
|
'';
|
|
|
|
};
|
2019-03-20 02:57:59 +01:00
|
|
|
conffiles = mkOption {
|
2019-09-05 15:20:56 +02:00
|
|
|
type = types.listOf types.str;
|
2019-10-08 13:15:38 +02:00
|
|
|
default = [ "zsh" ];
|
2019-03-20 02:57:59 +01:00
|
|
|
description = ''
|
|
|
|
List of configuration files to be enabled.
|
|
|
|
'';
|
|
|
|
};
|
2019-03-17 11:43:14 +01:00
|
|
|
hostName = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
description = ''
|
|
|
|
The Machines HostName
|
|
|
|
'';
|
|
|
|
};
|
2021-10-28 15:13:40 +02:00
|
|
|
useNetworkd = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Disables dhcpcd and enables networkd.
|
|
|
|
'';
|
|
|
|
};
|
2019-12-14 07:46:00 +01:00
|
|
|
binaryCaches = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [];
|
|
|
|
description = ''
|
|
|
|
Adds binary caches to both nix.trustedBinaryCaches and nix.binaryCaches. ("https://cache.nixos.org" is kept by default)
|
|
|
|
'';
|
|
|
|
};
|
2019-08-28 15:56:19 +02:00
|
|
|
secretPath = mkOption {
|
2019-09-05 15:20:56 +02:00
|
|
|
type = types.str;
|
2020-03-28 20:03:48 +01:00
|
|
|
default = let sPathVal = (tryEval <secretPath>).value;
|
|
|
|
in fn.ifelse (sPathVal != false) sPathVal "/secret";
|
2019-08-28 15:56:19 +02:00
|
|
|
description = ''
|
|
|
|
Path to you systems secret folder containing files with sensitive information.
|
|
|
|
'';
|
|
|
|
};
|
2019-04-13 00:05:39 +02:00
|
|
|
administrators = mkOption {
|
|
|
|
type = types.listOf types.attrs;
|
|
|
|
description = ''
|
|
|
|
List of administrative users.
|
|
|
|
'';
|
|
|
|
};
|
2019-03-23 02:50:48 +01:00
|
|
|
domain = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "localhost";
|
|
|
|
description = ''
|
|
|
|
The Machines domain name.
|
|
|
|
'';
|
|
|
|
};
|
2019-10-08 13:15:38 +02:00
|
|
|
extraDomains = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [];
|
|
|
|
description = ''
|
|
|
|
Extra domains used in various services.
|
|
|
|
'';
|
|
|
|
};
|
2019-08-27 16:01:04 +02:00
|
|
|
mailAccounts = mkOption {
|
2019-08-27 23:32:46 +02:00
|
|
|
type = types.listOf types.attrs;
|
2019-10-08 13:15:38 +02:00
|
|
|
default = [];
|
2019-08-27 16:01:04 +02:00
|
|
|
description = ''
|
|
|
|
List of mail account user names.
|
|
|
|
'';
|
|
|
|
};
|
2019-06-22 23:58:08 +02:00
|
|
|
vHosts = mkOption {
|
|
|
|
type = types.listOf types.attrs;
|
2019-10-08 13:15:38 +02:00
|
|
|
default = [];
|
2019-06-22 23:58:08 +02:00
|
|
|
description = ''
|
|
|
|
Domain - Service mappings for nginx vHost config.
|
|
|
|
'';
|
|
|
|
};
|
2019-05-04 13:47:21 +02:00
|
|
|
desktop.wms = mkOption {
|
2019-09-05 15:20:56 +02:00
|
|
|
type = types.listOf types.str;
|
2019-05-04 13:47:21 +02:00
|
|
|
default = [];
|
|
|
|
description = ''
|
|
|
|
The list of wms to be enabled.
|
|
|
|
'';
|
|
|
|
};
|
2019-03-17 11:43:14 +01:00
|
|
|
};
|
2019-10-08 13:15:38 +02:00
|
|
|
imports = [
|
|
|
|
(mkAliasOptionModule [ "machine" "firewall" ] [ "networking" "firewall" ])
|
|
|
|
(mkAliasOptionModule [ "machine" "allowUnfree" ] [ "nixpkgs" "config" "allowUnfree" ])
|
|
|
|
];
|
2019-03-17 11:43:14 +01:00
|
|
|
}
|