Checkin to see if lib gets fudo

This commit is contained in:
niten 2021-10-04 10:20:53 -07:00
parent 643f8d6df4
commit 3597d82f64
9 changed files with 46 additions and 31 deletions

View File

@ -30,6 +30,7 @@ in {
"niten@RUS.SELBY.CA" "niten@RUS.SELBY.CA"
"niten/root@RUS.SELBY.CA" "niten/root@RUS.SELBY.CA"
]; ];
email = "niten@fudo.org";
}; };
andrew = { andrew = {
@ -114,6 +115,7 @@ in {
home-directory = "/home/reaper"; home-directory = "/home/reaper";
k5login = k5login =
[ "reaper@FUDO.ORG" "reaper/root@FUDO.ORG" "reaper/admin@FUDO.ORG" ]; [ "reaper@FUDO.ORG" "reaper/root@FUDO.ORG" "reaper/admin@FUDO.ORG" ];
email = "reaper@fudo.org";
}; };
slickoil = { slickoil = {
@ -198,6 +200,7 @@ in {
# user-email = "xiaoxuan@fudo.org"; # user-email = "xiaoxuan@fudo.org";
# home-dir = "/home/fudo/xiaoxuan"; # home-dir = "/home/fudo/xiaoxuan";
# }; # };
email = "xiaoxuan@fudo.org";
}; };
thibor = { thibor = {
@ -488,6 +491,7 @@ in {
ldap-hashed-passwd = "{SSHA}dF/5NGkafL8M1kpa3LYZKdh0Pc7a02gA"; ldap-hashed-passwd = "{SSHA}dF/5NGkafL8M1kpa3LYZKdh0Pc7a02gA";
login-hashed-passwd = login-hashed-passwd =
"$6$a1q2Duoe35hd5$IaZGXPfqyGv9uq5DQm7DZq0vIHsUs39sLktBiBBqMiwl/f/Z4jSvNZLJp9DZJYe5u2qGBYh1ca.jsXvQA8FPZ/"; "$6$a1q2Duoe35hd5$IaZGXPfqyGv9uq5DQm7DZq0vIHsUs39sLktBiBBqMiwl/f/Z4jSvNZLJp9DZJYe5u2qGBYh1ca.jsXvQA8FPZ/";
email = "viator@informis.land";
}; };
}; };
} }

8
flake.lock generated
View File

@ -223,7 +223,7 @@
"niten-doom-config": "niten-doom-config" "niten-doom-config": "niten-doom-config"
}, },
"locked": { "locked": {
"narHash": "sha256-45L0HqvqGw7+s87MvKMR14cxEhBJHRnanmTpJlw7E78=", "narHash": "sha256-SU2+Swf6wHfyRGx3tsIh3iX/NWbsBgVCDeGPRgVuXEA=",
"path": "./nix-home", "path": "./nix-home",
"type": "path" "type": "path"
}, },
@ -346,11 +346,11 @@
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1632918953, "lastModified": 1633267966,
"narHash": "sha256-XY3TKBfhP7wCu/SeqrwIkTWkyYHy5W1yRR8pxyzRY9Y=", "narHash": "sha256-gFKvZ5AmV/dDTKXVxacPbXe4R0BsFpwtVaQxuIm2nnk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "ee90403e147b181300dffca5b0afa405e14f1945", "rev": "7daf35532d2d8bf5e6f7f962e6cd13a66d01a71d",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -6,6 +6,8 @@ with lib; {
./instance.nix ./instance.nix
./fudo-lib.nix
./fudo/acme-for-hostname.nix ./fudo/acme-for-hostname.nix
./fudo/authentication.nix ./fudo/authentication.nix
./fudo/backplane ./fudo/backplane
@ -14,7 +16,6 @@ with lib; {
./fudo/distributed-builds.nix ./fudo/distributed-builds.nix
./fudo/dns.nix ./fudo/dns.nix
./fudo/domains.nix ./fudo/domains.nix
./fudo-lib.nix
./fudo/garbage-collector.nix ./fudo/garbage-collector.nix
./fudo/git.nix ./fudo/git.nix
./fudo/global.nix ./fudo/global.nix

View File

@ -7,7 +7,7 @@ in
{ {
lib.overlays = [ lib.overlays = [
(final: prev: { (final: prev: {
fudo = { final.fudo = {
inherit ip dns; inherit ip dns;
}; };
}) })

View File

@ -8,8 +8,6 @@ let
traceout = out: builtins.trace out out; traceout = out: builtins.trace out out;
fudo-lib = import ../fudo-lib.nix { inherit lib; };
in { in {
options.fudo.local-network = with types; { options.fudo.local-network = with types; {
@ -110,20 +108,20 @@ in {
interfaces = cfg.dhcp-interfaces; interfaces = cfg.dhcp-interfaces;
extraConfig = '' extraConfig = ''
subnet ${fudo-lib.ip.getNetworkBase cfg.network} netmask ${ subnet ${lib.fudo.ip.getNetworkBase cfg.network} netmask ${
fudo-lib.ip.maskFromV32Network cfg.network lib.fudo.ip.maskFromV32Network cfg.network
} { } {
authoritative; authoritative;
option subnet-mask ${fudo-lib.ip.maskFromV32Network cfg.network}; option subnet-mask ${lib.fudo.ip.maskFromV32Network cfg.network};
option broadcast-address ${fudo-lib.ip.networkMaxIp cfg.network}; option broadcast-address ${lib.fudo.ip.networkMaxIp cfg.network};
option routers ${cfg.gateway}; option routers ${cfg.gateway};
option domain-name-servers ${concatStringsSep " " cfg.dns-servers}; option domain-name-servers ${concatStringsSep " " cfg.dns-servers};
option domain-name "${cfg.domain}"; option domain-name "${cfg.domain}";
option domain-search "${ option domain-search "${
concatStringsSep " " ([ cfg.domain ] ++ cfg.search-domains) concatStringsSep " " ([ cfg.domain ] ++ cfg.search-domains)
}"; }";
range ${fudo-lib.ip.networkMinIp cfg.dhcp-dynamic-network} ${ range ${lib.fudo.ip.networkMinIp cfg.dhcp-dynamic-network} ${
fudo-lib.ip.networkMaxButOneIp cfg.dhcp-dynamic-network lib.fudo.ip.networkMaxButOneIp cfg.dhcp-dynamic-network
}; };
} }
''; '';
@ -225,7 +223,7 @@ in {
${join-lines (mapAttrsToList hostSshFpRecords network.hosts)} ${join-lines (mapAttrsToList hostSshFpRecords network.hosts)}
${join-lines (mapAttrsToList cnameRecord network.aliases)} ${join-lines (mapAttrsToList cnameRecord network.aliases)}
${join-lines network.verbatim-dns-records} ${join-lines network.verbatim-dns-records}
${fudo-lib.dns.srvRecordsToBindZone network.srv-records} ${lib.fudo.dns.srvRecordsToBindZone network.srv-records}
''; '';
}] ++ blockZones; }] ++ blockZones;
}; };

View File

@ -3,7 +3,7 @@
with lib; with lib;
let let
user = import ../types/users.nix { inherit lib; }; user = import ../types/user.nix { inherit lib; };
list-includes = list: el: isNull (findFirst (this: this == el) null list); list-includes = list: el: isNull (findFirst (this: this == el) null list);
@ -100,10 +100,15 @@ in {
IdentityFile /etc/ssh/private_keys.d/%u.key IdentityFile /etc/ssh/private_keys.d/%u.key
''; '';
environment.etc = let environment.etc = mapAttrs' (username: userOpts:
privkey-users = filterAttrs (username: userOpts: userOpts.ssh-keys != null) sys.local-users; nameValuePair
in mapAttrs' (username: userOpts: "ssh/private_keys.d/${username}"
nameValuePair "ssh/private_keys.bd/${username}.key" userOpts.ssh-keys.private-key) privkey-users; {
text = concatStringsSep "\n"
(map (keypair: readFile keypair.public-key)
userOpts.ssh-keys);
})
sys.local-users;
users = { users = {
users = mapAttrs (username: userOpts: { users = mapAttrs (username: userOpts: {

View File

@ -2,7 +2,8 @@
with lib; with lib;
let let
user = import ./types/users.nix { inherit lib; }; user = import ./types/user.nix { inherit lib; };
in { in {
options.instance = with types; { options.instance = with types; {
hostname = mkOption { hostname = mkOption {
@ -31,7 +32,7 @@ in {
}; };
local-groups = mkOption { local-groups = mkOption {
type = listOf str; type = attrsOf (submodule user.groupOpts);
description = "List of groups which should be created on the local host."; description = "List of groups which should be created on the local host.";
}; };
@ -41,7 +42,7 @@ in {
}; };
local-users = mkOption { local-users = mkOption {
type = attrsOf user.userOpts; type = attrsOf (submodule user.userOpts);
description = "List of users who should have access to the local host"; description = "List of users who should have access to the local host";
}; };
}; };

View File

@ -1,6 +1,7 @@
{ lib, ... }: { lib, ... }:
{ with lib;
rec {
systemUserOpts = { username, ... }: { systemUserOpts = { username, ... }: {
options = with lib.types; { options = with lib.types; {
username = mkOption { username = mkOption {
@ -95,20 +96,25 @@
}; };
ssh-keys = mkOption { ssh-keys = mkOption {
type = nullOr (listOf (submodule sshKeyOpts)); type = listOf (submodule sshKeyOpts);
description = "Path to the user's public and private key files."; description = "Path to the user's public and private key files.";
default = []; default = [];
}; };
email = mkOption {
type = nullOr str;
description = "User's primary email address.";
default = null;
};
}; };
}; };
groupOpts = { group-name, ... }: { groupOpts = { group-name, ... }: {
options = with lib.types; { options = with lib.types; {
group-name = mkOption { # group-name = mkOption {
type = nullOr str; # description = "Group name.";
default = group-name; # default = group-name;
description = "Group name."; # };
};
description = mkOption { description = mkOption {
type = str; type = str;

@ -1 +1 @@
Subproject commit 94f5f2560a40b167ce368812c6b883bd7c6df5c1 Subproject commit 711576e6e4cede979b15cf9d1c8c3d42fb565a99