nixos/options/machine.nix

124 lines
3.4 KiB
Nix
Raw Normal View History

{ config, lib, ... }:
with builtins;
with lib;
let
cfg = config.machine;
fn = import (toString ../fn.nix) { inherit lib; };
metapkgs = let
pPath = (toString ../pkgsets);
in (lists.forEach (fn.lsfRec pPath true) (v: replaceStrings [ "${pPath}/" "/" ".nix" ] [ "" "::" "" ] v));
pkgOption = pname: {
name = pname;
value = rec {
pkgwrap = mkOption {
type = with types; oneOf [ package (listOf package) ];
default = (fn.pkgFilter cfg.pkgsets."${pname}".pkgs);
description = ''
Package Wrapper for packages using a wrapper function (like python, emacs, haskell, ...)
'';
};
pkgs = mkOption {
type = types.unspecified;
default = [];
description = ''
${pname} package list.
'';
};
};
};
in {
options.machine = {
pkgs = mkOption {
type = (types.listOf (types.enum metapkgs));
2019-10-08 13:15:38 +02:00
default = [ "base" ];
description = ''
The list of metapackages to be installed.
'';
};
# Package names containing '::' are sub packages and should not have their own pkgset.
pkgsets = listToAttrs (map pkgOption (lists.filter (v: !(strings.hasInfix "::" v)) metapkgs));
services = mkOption {
2019-09-05 15:20:56 +02:00
type = types.listOf types.str;
2019-10-08 13:15:38 +02:00
default = [];
description = ''
List of services to be enabled.
'';
};
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" ];
description = ''
List of configuration files to be enabled.
'';
};
hostName = mkOption {
type = types.str;
description = ''
The Machines HostName
'';
};
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)
'';
};
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";
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.
'';
};
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.
'';
};
mailAccounts = mkOption {
type = types.listOf types.attrs;
2019-10-08 13:15:38 +02:00
default = [];
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.
'';
};
desktop.wms = mkOption {
2019-09-05 15:20:56 +02:00
type = types.listOf types.str;
default = [];
description = ''
The list of wms to be enabled.
'';
};
};
2019-10-08 13:15:38 +02:00
imports = [
(mkAliasOptionModule [ "machine" "firewall" ] [ "networking" "firewall" ])
(mkAliasOptionModule [ "machine" "allowUnfree" ] [ "nixpkgs" "config" "allowUnfree" ])
];
}