machines: Add boilerplate for enabling modules and services
This commit is contained in:
parent
8cecf0eae8
commit
98f2077568
4 changed files with 71 additions and 22 deletions
|
@ -25,6 +25,11 @@ rec {
|
|||
*/
|
||||
singleAttr = name: value: { ${name} = value; };
|
||||
|
||||
/* Enables a list of modules. */
|
||||
enableAttrs' = enable: mapFuse (m: { ${m}.${enable} = true; });
|
||||
|
||||
enableModules = enableAttrs' "enable";
|
||||
|
||||
mapSingleFuse = f: mapFuse (x: singleAttr x (f x));
|
||||
|
||||
setDefault = default: mapFuse (name: { ${name} = default; });
|
||||
|
|
|
@ -1,6 +1,25 @@
|
|||
{ ... }:
|
||||
{ dgn-lib, ... }:
|
||||
|
||||
let
|
||||
inherit (dgn-lib)
|
||||
enableModules
|
||||
mkImports
|
||||
recursiveFuse;
|
||||
|
||||
# List of modules to enable
|
||||
enabledModules = [
|
||||
"dgn-dns"
|
||||
];
|
||||
|
||||
# List of services to enable
|
||||
enabledServices = [
|
||||
];
|
||||
in
|
||||
|
||||
recursiveFuse [
|
||||
(enableModules enabledModules)
|
||||
|
||||
{
|
||||
dgn-dns.enable = true;
|
||||
|
||||
imports = mkImports ./. enabledServices;
|
||||
}
|
||||
]
|
||||
|
|
|
@ -1,8 +1,24 @@
|
|||
# Edit this configuration file to define what should be installed on
|
||||
# your system. Help is available in the configuration.nix(5) man page
|
||||
# and in the NixOS manual (accessible by running `nixos-help`).
|
||||
{ dgn-lib, ... }:
|
||||
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
inherit (dgn-lib)
|
||||
enableModules
|
||||
mkImports
|
||||
recursiveFuse;
|
||||
|
||||
# List of modules to enable
|
||||
enabledModules = [
|
||||
];
|
||||
|
||||
# List of services to enable
|
||||
enabledServices = [
|
||||
];
|
||||
in
|
||||
|
||||
recursiveFuse [
|
||||
(enableModules enabledModules)
|
||||
|
||||
{
|
||||
imports = mkImports ./. enabledServices;
|
||||
}
|
||||
]
|
||||
|
|
|
@ -1,17 +1,26 @@
|
|||
# Edit this configuration file to define what should be installed on
|
||||
# your system. Help is available in the configuration.nix(5) man page
|
||||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||
{ dgn-lib, ... }:
|
||||
|
||||
{ name, ... }:
|
||||
let
|
||||
inherit (dgn-lib)
|
||||
enableModules
|
||||
mkImports
|
||||
recursiveFuse;
|
||||
|
||||
{
|
||||
imports =
|
||||
[
|
||||
./plausible.nix
|
||||
# ./wordpress
|
||||
# List of modules to enable
|
||||
enabledModules = [
|
||||
];
|
||||
|
||||
networking.hostName = name;
|
||||
# List of services to enable
|
||||
enabledServices = [
|
||||
"plausible"
|
||||
# "wordpress"
|
||||
];
|
||||
in
|
||||
|
||||
recursiveFuse [
|
||||
(enableModules enabledModules)
|
||||
|
||||
{
|
||||
imports = mkImports ./. enabledServices;
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue