Compare commits

...

3 commits

Author SHA1 Message Date
c47437116b feat(modules): Introduce per node module import from meta
All checks were successful
Check meta / check_meta (push) Successful in 25s
Check meta / check_dns (push) Successful in 46s
build configuration / build_vault01 (push) Successful in 1m6s
build configuration / build_storage01 (push) Successful in 1m10s
build configuration / build_compute01 (push) Successful in 1m15s
build configuration / build_web02 (push) Successful in 53s
lint / check (push) Successful in 26s
build configuration / build_rescue01 (push) Successful in 49s
build configuration / build_web01 (push) Successful in 1m34s
build configuration / push_to_cache (push) Successful in 2m22s
2024-04-18 16:23:25 +02:00
46b550781e chore(hive): Simplify path 2024-04-18 16:06:43 +02:00
cbdbed1099 feat(infra): Add nodeMeta argument 2024-04-18 15:53:20 +02:00
7 changed files with 39 additions and 20 deletions

View file

@ -49,6 +49,8 @@ let
}; };
meta = (import ./meta) lib; meta = (import ./meta) lib;
nodeMeta = meta.nodes.${node};
}; };
in in
@ -64,16 +66,16 @@ in
}; };
defaults = defaults =
{ meta, name, ... }: { name, nodeMeta, ... }:
{ {
# Import the default modules # Import the default modules
imports = [ ./modules ]; imports = [ ./modules ];
# Include default secrets # Include default secrets
age-secrets.sources = [ (./machines + "/${name}/secrets") ]; age-secrets.sources = [ ./machines/${name}/secrets ];
# Deployment config is specified in meta.nodes.${node}.deployment # Deployment config is specified in meta.nodes.${node}.deployment
inherit (meta.nodes.${name}) deployment; inherit (nodeMeta) deployment;
nix = { nix = {
# Set NIX_PATH to the patched version of nixpkgs # Set NIX_PATH to the patched version of nixpkgs
@ -92,7 +94,7 @@ in
# Use the stateVersion declared in the metadata # Use the stateVersion declared in the metadata
system = { system = {
inherit (meta.nodes.${name}) stateVersion; inherit (nodeMeta) stateVersion;
}; };
}; };
} }

View file

@ -26,6 +26,8 @@
stateVersion = "23.05"; stateVersion = "23.05";
vm-cluster = "Hyperviseur NPS"; vm-cluster = "Hyperviseur NPS";
nix-modules = [ "services/crabfit" ];
}; };
compute01 = { compute01 = {
@ -53,6 +55,8 @@
storage01 = { storage01 = {
site = "pav01"; site = "pav01";
stateVersion = "23.11"; stateVersion = "23.11";
nix-modules = [ "services/forgejo-nix-runners" ];
}; };
vault01 = { vault01 = {

View file

@ -95,6 +95,14 @@ in
''; '';
}; };
nix-modules = mkOption {
type = listOf str;
default = [ ];
description = ''
List of modules to import from [nix-modules](https://git.hubrecht.ovh/hubrecht/nix-modules).
'';
};
admins = mkOption { admins = mkOption {
type = listOf str; type = listOf str;
default = [ ]; default = [ ];

View file

@ -32,7 +32,12 @@
# pris connaissance de la licence CeCILL, et que vous en avez accepté les # pris connaissance de la licence CeCILL, et que vous en avez accepté les
# termes. # termes.
{ lib, sources, ... }: {
lib,
nodeMeta,
sources,
...
}:
{ {
imports = imports =
@ -57,11 +62,12 @@
"${sources.attic}/nixos/atticd.nix" "${sources.attic}/nixos/atticd.nix"
"${sources.arkheon}/module.nix" "${sources.arkheon}/module.nix"
] ]
++ ((import sources.nix-modules { inherit lib; }).importModules [ ++ ((import sources.nix-modules { inherit lib; }).importModules (
"age-secrets" [
"services/crabfit" "age-secrets"
"services/forgejo-nix-runners" "services/bupstash"
"services/bupstash" "services/systemd-notify"
"services/systemd-notify" ]
]); ++ nodeMeta.nix-modules
));
} }

View file

@ -35,7 +35,7 @@
config, config,
lib, lib,
meta, meta,
name, nodeMeta,
... ...
}: }:
@ -49,7 +49,6 @@ let
types types
; ;
nodeMeta = meta.nodes.${name};
admins = admins =
meta.organization.groups.root meta.organization.groups.root
++ nodeMeta.admins ++ nodeMeta.admins

View file

@ -1,8 +1,7 @@
{ {
config, config,
meta,
name,
lib, lib,
nodeMeta,
... ...
}: }:
let let
@ -24,13 +23,13 @@ in
register = true; register = true;
update_all = true; update_all = true;
virtual = { virtual = {
enabled = meta.nodes.${name}.vm-cluster != null; enabled = nodeMeta.vm-cluster != null;
cluster_name = meta.nodes.${name}.vm-cluster; cluster_name = nodeMeta.vm-cluster;
}; };
purge_old_devices = true; purge_old_devices = true;
hostname_cmd = "echo ${hostName}.${domain}"; hostname_cmd = "echo ${hostName}.${domain}";
datacenter_location = { datacenter_location = {
driver = "cmd:echo ${meta.nodes.${name}.site}"; driver = "cmd:echo ${nodeMeta.site}";
regex = "(.*)"; regex = "(.*)";
}; };
device = { device = {

View file

@ -3,6 +3,7 @@
lib, lib,
meta, meta,
name, name,
nodeMeta,
... ...
}: }:
@ -42,7 +43,7 @@ in
inherit (net') hostId; inherit (net') hostId;
hostName = name; hostName = name;
domain = "${meta.nodes.${name}.site}.infra.dgnum.eu"; domain = "${nodeMeta.site}.infra.dgnum.eu";
useNetworkd = true; useNetworkd = true;
firewall.logRefusedConnections = false; firewall.logRefusedConnections = false;