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

View file

@ -26,6 +26,8 @@
stateVersion = "23.05";
vm-cluster = "Hyperviseur NPS";
nix-modules = [ "services/crabfit" ];
};
compute01 = {
@ -53,6 +55,8 @@
storage01 = {
site = "pav01";
stateVersion = "23.11";
nix-modules = [ "services/forgejo-nix-runners" ];
};
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 {
type = listOf str;
default = [ ];

View file

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

View file

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

View file

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

View file

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