krebs: extract users into separate module

This commit is contained in:
tv 2022-11-23 16:37:32 +01:00
parent b065ee81dc
commit c084136980
2 changed files with 21 additions and 16 deletions

View File

@ -56,6 +56,7 @@ let
./tinc_graphs.nix ./tinc_graphs.nix
./upstream ./upstream
./urlwatch.nix ./urlwatch.nix
./users.nix
./xresources.nix ./xresources.nix
./zones.nix ./zones.nix
]; ];
@ -66,10 +67,6 @@ let
api = { api = {
enable = mkEnableOption "krebs"; enable = mkEnableOption "krebs";
users = mkOption {
type = with types; attrsOf user;
};
sitemap = mkOption { sitemap = mkOption {
default = {}; default = {};
type = types.attrsOf types.sitemap.entry; type = types.attrsOf types.sitemap.entry;
@ -112,18 +109,6 @@ let
krebs.dns.search-domain = mkDefault "r"; krebs.dns.search-domain = mkDefault "r";
krebs.users = {
krebs = {
home = "/krebs";
mail = "spam@krebsco.de";
};
root = {
home = "/root";
pubkey = config.krebs.build.host.ssh.pubkey;
uid = 0;
};
};
services.openssh.hostKeys = services.openssh.hostKeys =
let inherit (config.krebs.build.host.ssh) privkey; in let inherit (config.krebs.build.host.ssh) privkey; in
mkIf (privkey != null) [privkey]; mkIf (privkey != null) [privkey];

20
krebs/3modules/users.nix Normal file
View File

@ -0,0 +1,20 @@
{ config, ... }: let
lib = import ../../lib;
in {
options.krebs.users = lib.mkOption {
type = with lib.types; attrsOf user;
};
config = lib.mkIf config.krebs.enable {
krebs.users = {
krebs = {
home = "/krebs";
mail = "spam@krebsco.de";
};
root = {
home = "/root";
pubkey = config.krebs.build.host.ssh.pubkey;
uid = 0;
};
};
};
}