chore: Refactor meta to a module architecture
Get rid of the weird half nix half module stuff.
This commit is contained in:
parent
9d24c766f3
commit
e0759140cc
39 changed files with 712 additions and 663 deletions
|
@ -98,7 +98,7 @@ The general metadata is declared in `meta/nodes.nix`, the main values to declare
|
||||||
Create the directory `secrets` in the configuration folder, and add a `secrets.nix` file containing :
|
Create the directory `secrets` in the configuration folder, and add a `secrets.nix` file containing :
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
(import ../../../keys).mkSecrets [ "host02" ] [
|
(import ../../../keys.nix).mkSecrets [ "host02" ] [
|
||||||
# List of secrets for host02
|
# List of secrets for host02
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
{
|
{
|
||||||
sources ? import ./npins,
|
sources ? import ./sources.nix,
|
||||||
pkgs ? import sources.nixos-unstable { },
|
pkgs ? sources.bootstrapNixpkgs,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
86
hive.nix
86
hive.nix
|
@ -4,45 +4,33 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
|
# TODO: change comments to ### \n # [text] \n #
|
||||||
|
|
||||||
let
|
let
|
||||||
sources' = import ./npins;
|
### Init some tooling
|
||||||
|
|
||||||
# Patch sources directly
|
sources = import ./sources.nix;
|
||||||
sources =
|
|
||||||
builtins.mapAttrs (patch.base { pkgs = import sources'.nixos-unstable { }; }).applyPatches'
|
inherit (sources) bootstrapNixpkgs;
|
||||||
sources';
|
|
||||||
|
lib = bootstrapNixpkgs.lib.extend (_: _: {
|
||||||
|
extra = import ./lib/nix-lib;
|
||||||
|
});
|
||||||
|
|
||||||
|
nix-lib = lib.extra; # TODO: Assess perf penalty of fixed point
|
||||||
|
# TODO same but using bootstrapnixpkgs for nix-lib instanciation
|
||||||
|
# original statement: import ./lib/nix-lib;
|
||||||
|
|
||||||
nix-lib = import ./lib/nix-lib;
|
|
||||||
inherit (nix-lib) mapSingleFuse;
|
inherit (nix-lib) mapSingleFuse;
|
||||||
|
|
||||||
patch = import ./lib/nix-patches { patchFile = ./patches; };
|
### Let's build meta
|
||||||
|
metadata = (import ./meta) lib;
|
||||||
|
|
||||||
nodes' = import ./meta/nodes;
|
nodes = builtins.attrNames metadata.nodes;
|
||||||
nodes = builtins.attrNames nodes';
|
|
||||||
|
|
||||||
mkNode = node: {
|
### Nixpkgs instanciation
|
||||||
deployment.systemType = system node;
|
|
||||||
};
|
|
||||||
|
|
||||||
nixpkgs' = import ./meta/nixpkgs.nix;
|
nixpkgs' = import ./meta/nixpkgs.nix;
|
||||||
# All supported nixpkgs versions × systems, instanciated
|
|
||||||
nixpkgs = mapSingleFuse (s: mapSingleFuse (mkSystemNixpkgs s) nixpkgs'.versions) nixpkgs'.systems;
|
|
||||||
|
|
||||||
# Get the configured nixos version for the node,
|
|
||||||
# defaulting to the one defined in meta/nixpkgs
|
|
||||||
version = node: nodes'.${node}.nixpkgs.version;
|
|
||||||
system = node: nodes'.${node}.nixpkgs.system;
|
|
||||||
category = node: nixpkgs'.categories.${system node};
|
|
||||||
|
|
||||||
nodePkgs = node: nixpkgs.${system node}.${version node};
|
|
||||||
|
|
||||||
# Builds a patched version of nixpkgs, only as the source
|
|
||||||
mkNixpkgs' =
|
|
||||||
v:
|
|
||||||
patch.mkNixpkgsSrc rec {
|
|
||||||
src = sources'.${name};
|
|
||||||
name = "nixos-${v}";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Build up the nixpkgs configuration for Liminix embedded systems
|
# Build up the nixpkgs configuration for Liminix embedded systems
|
||||||
mkLiminixConfig =
|
mkLiminixConfig =
|
||||||
|
@ -58,20 +46,34 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
# Build up the arguments to instantiate a nixpkgs given a system and a version.
|
# Build up the arguments to instantiate a nixpkgs given a system and a version.
|
||||||
mkNixpkgsConfig =
|
mkNixpkgsConfig =
|
||||||
system:
|
system:
|
||||||
{
|
{
|
||||||
nixos = _: { };
|
nixos = _: { }; # TODO: add nix-pkgs overlay here
|
||||||
zyxel-nwa50ax = mkLiminixConfig system;
|
zyxel-nwa50ax = mkLiminixConfig system;
|
||||||
netconf = _: { };
|
netconf = _: { };
|
||||||
}
|
}
|
||||||
.${system} or (throw "Unknown system: ${system} for nixpkgs configuration instantiation");
|
.${system} or (throw "Unknown system: ${system} for nixpkgs configuration instantiation");
|
||||||
|
|
||||||
# Instanciates the required nixpkgs version
|
# Instanciates the required nixpkgs version
|
||||||
mkSystemNixpkgs = system: version: import (mkNixpkgs' version) (mkNixpkgsConfig system version);
|
mkSystemNixpkgs = system: version:
|
||||||
|
import sources."nixos-${version}" (mkNixpkgsConfig system version);
|
||||||
|
|
||||||
###
|
# All supported nixpkgs versions × systems, instanciated
|
||||||
|
nixpkgs = mapSingleFuse (s: mapSingleFuse (mkSystemNixpkgs s) nixpkgs'.versions) nixpkgs'.systems;
|
||||||
|
|
||||||
|
|
||||||
|
# Get the configured nixos version for the node,
|
||||||
|
# defaulting to the one defined in meta/nixpkgs
|
||||||
|
version = node: metadata.nodes.${node}.nixpkgs.version;
|
||||||
|
system = node: metadata.nodes.${node}.nixpkgs.system;
|
||||||
|
category = node: nixpkgs'.categories.${system node};
|
||||||
|
|
||||||
|
nodePkgs = node: nixpkgs.${system node}.${version node};
|
||||||
|
|
||||||
|
##########
|
||||||
# Function to create arguments based on the node
|
# Function to create arguments based on the node
|
||||||
#
|
#
|
||||||
mkArgs = node: rec {
|
mkArgs = node: rec {
|
||||||
|
@ -80,11 +82,19 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
sourcePkgs = nodePkgs node;
|
sourcePkgs = nodePkgs node;
|
||||||
meta = (import ./meta) lib;
|
meta = metadata;
|
||||||
|
|
||||||
nodeMeta = meta.nodes.${node};
|
nodeMeta = metadata.nodes.${node};
|
||||||
nodePath = "machines/${category node}/${node}";
|
nodePath = "machines/${category node}/${node}";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
##########
|
||||||
|
# Module for each node (quite empty since almost everything is in the default module)
|
||||||
|
#
|
||||||
|
mkNode = node: {
|
||||||
|
deployment.systemType = system node;
|
||||||
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -95,7 +105,10 @@ in
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit nixpkgs sources;
|
inherit nixpkgs sources;
|
||||||
|
|
||||||
dgn-keys = import ./keys;
|
dgn-keys = import ./lib/keys {
|
||||||
|
meta = metadata;
|
||||||
|
inherit lib;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nodeSpecialArgs = mapSingleFuse mkArgs nodes;
|
nodeSpecialArgs = mapSingleFuse mkArgs nodes;
|
||||||
|
@ -219,5 +232,6 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
// (mapSingleFuse mkNode nodes)
|
// (mapSingleFuse mkNode nodes)
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
{ lib, pkgs, ... }:
|
{ lib, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
dgn-keys = import ../keys;
|
dgn-keys = import ../keys.nix;
|
||||||
|
|
||||||
dgn-members = (import ../meta lib).organization.groups.root;
|
dgn-members = (import ../meta lib).config.organization.groups.root;
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
13
keys.nix
Normal file
13
keys.nix
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# SPDX-FileCopyrightText: 2024 Tom Hubrecht <tom.hubrecht@dgnum.eu>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
|
let
|
||||||
|
_sources = import ../npins;
|
||||||
|
|
||||||
|
inherit (import _sources.nixpkgs { }) lib;
|
||||||
|
|
||||||
|
meta = (import ../meta lib).config;
|
||||||
|
|
||||||
|
in
|
||||||
|
import ./lib/keys { inherit meta lib; }
|
|
@ -1,20 +1,15 @@
|
||||||
|
# SPDX-FileCopyrightText: 2024 Ryan Lahfa <ryan.lahfa@dgnum.eu>
|
||||||
# SPDX-FileCopyrightText: 2024 Tom Hubrecht <tom.hubrecht@dgnum.eu>
|
# SPDX-FileCopyrightText: 2024 Tom Hubrecht <tom.hubrecht@dgnum.eu>
|
||||||
|
# SPDX-FileContributor: Maurice Debray <maurice.debray@dgnum.eu>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
|
{ meta, lib }:
|
||||||
let
|
let
|
||||||
_sources = import ../npins;
|
inherit (import ../nix-lib) setDefault unique;
|
||||||
|
|
||||||
inherit (import _sources.nixos-unstable { }) lib;
|
|
||||||
|
|
||||||
meta = import ../meta lib;
|
|
||||||
|
|
||||||
inherit (import ../lib/nix-lib) setDefault unique;
|
|
||||||
|
|
||||||
getAttr = lib.flip builtins.getAttr;
|
getAttr = lib.flip builtins.getAttr;
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
_memberKeys = builtins.mapAttrs (_: v: v.sshKeys) meta.organization.members;
|
_memberKeys = builtins.mapAttrs (_: v: v.sshKeys) meta.organization.members;
|
||||||
_builderKeys = builtins.mapAttrs (_: v: v.builderKeys) meta.organization.members;
|
_builderKeys = builtins.mapAttrs (_: v: v.builderKeys) meta.organization.members;
|
||||||
|
@ -32,22 +27,25 @@ rec {
|
||||||
# List of keys for the root group
|
# List of keys for the root group
|
||||||
rootKeys = getMemberKeys meta.organization.groups.root;
|
rootKeys = getMemberKeys meta.organization.groups.root;
|
||||||
|
|
||||||
# All keys that can access a node
|
# All admins for a node
|
||||||
getNodeKeys' =
|
getNodeAdmins =
|
||||||
node:
|
node:
|
||||||
let
|
meta.organization.groups.root
|
||||||
names = [ node ] ++
|
++ meta.nodes.${node}.admins
|
||||||
meta.nodes.${node}.admins
|
|
||||||
++ (builtins.concatMap (g: meta.organization.groups.${g}) meta.nodes.${node}.adminGroups);
|
++ (builtins.concatMap (g: meta.organization.groups.${g}) meta.nodes.${node}.adminGroups);
|
||||||
in
|
|
||||||
unique (getMemberKeys names ++ getNodeKeys [ node ]);
|
# All keys needed for secret encryption
|
||||||
|
getSecretKeys = node: unique (getMemberKeys (getNodeAdmins node) ++ getNodeKeys [ node ]);
|
||||||
|
|
||||||
# List of keys for all machines wide secrets
|
# List of keys for all machines wide secrets
|
||||||
machineKeys = rootKeys ++ (getNodeKeys (builtins.attrNames meta.nodes));
|
machineKeys = rootKeys ++ (getNodeKeys (builtins.attrNames meta.nodes));
|
||||||
|
|
||||||
mkSecrets = nodes: setDefault { publicKeys = unique (builtins.concatMap getNodeKeys' nodes); };
|
mkSecrets = nodes: setDefault { publicKeys = unique (builtins.concatMap getSecretKeys nodes); };
|
||||||
|
|
||||||
machineKeysBySystem = system:
|
machineKeysBySystem =
|
||||||
|
system:
|
||||||
rootKeys
|
rootKeys
|
||||||
++ (getNodeKeys (builtins.attrNames (lib.filterAttrs (_: v: v.nixpkgs.system == system) meta.nodes)));
|
++ (getNodeKeys (
|
||||||
|
builtins.attrNames (lib.filterAttrs (_: v: v.nixpkgs.system == system) meta.nodes)
|
||||||
|
));
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
(import ../../../../keys).mkSecrets
|
(import ../../../../keys.nix).mkSecrets
|
||||||
[ "bridge01" ]
|
[ "bridge01" ]
|
||||||
[
|
[
|
||||||
# List of secrets for bridge01
|
# List of secrets for bridge01
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
(import ../../../../keys).mkSecrets
|
(import ../../../../keys.nix).mkSecrets
|
||||||
[ "build01" ]
|
[ "build01" ]
|
||||||
[
|
[
|
||||||
"forgejo_runners-token_file"
|
"forgejo_runners-token_file"
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
sources,
|
sources,
|
||||||
|
dgn-keys,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
@ -68,6 +69,9 @@ in
|
||||||
meta = {
|
meta = {
|
||||||
organization.groups.root = [ ];
|
organization.groups.root = [ ];
|
||||||
};
|
};
|
||||||
|
dgn-keys = dgn-keys // {
|
||||||
|
getNodeAdmins = _: [ ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
path-translations = [
|
path-translations = [
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
(import ../../../../../keys).mkSecrets
|
(import ../../../../../keys.nix).mkSecrets
|
||||||
[ "compute01" ]
|
[ "compute01" ]
|
||||||
[
|
[
|
||||||
"kanidm-password_admin"
|
"kanidm-password_admin"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
(import ../../../../keys).mkSecrets
|
(import ../../../../keys.nix).mkSecrets
|
||||||
[ "compute01" ]
|
[ "compute01" ]
|
||||||
[
|
[
|
||||||
# List of secrets for compute01
|
# List of secrets for compute01
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
(import ../../../../keys).mkSecrets
|
(import ../../../../keys.nix).mkSecrets
|
||||||
[ "geo01" ]
|
[ "geo01" ]
|
||||||
[
|
[
|
||||||
# List of secrets for geo01
|
# List of secrets for geo01
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
(import ../../../../keys).mkSecrets
|
(import ../../../../keys.nix).mkSecrets
|
||||||
[ "geo02" ]
|
[ "geo02" ]
|
||||||
[
|
[
|
||||||
# List of secrets for geo02
|
# List of secrets for geo02
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifer: EUPL-1.2
|
# SPDX-License-Identifer: EUPL-1.2
|
||||||
|
|
||||||
(import ../../../../keys).mkSecrets
|
(import ../../../../keys.nix).mkSecrets
|
||||||
[ "hypervisor01" ]
|
[ "hypervisor01" ]
|
||||||
[
|
[
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifer: EUPL-1.2
|
# SPDX-License-Identifer: EUPL-1.2
|
||||||
|
|
||||||
(import ../../../../keys).mkSecrets
|
(import ../../../../keys.nix).mkSecrets
|
||||||
[ "hypervisor02" ]
|
[ "hypervisor02" ]
|
||||||
[
|
[
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifer: EUPL-1.2
|
# SPDX-License-Identifer: EUPL-1.2
|
||||||
|
|
||||||
(import ../../../../keys).mkSecrets
|
(import ../../../../keys.nix).mkSecrets
|
||||||
[ "hypervisor03" ]
|
[ "hypervisor03" ]
|
||||||
[
|
[
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
(import ../../../../keys).mkSecrets
|
(import ../../../../keys.nix).mkSecrets
|
||||||
[ "rescue01" ]
|
[ "rescue01" ]
|
||||||
[
|
[
|
||||||
# List of secrets for rescue01
|
# List of secrets for rescue01
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
(import ../../../../keys).mkSecrets
|
(import ../../../../keys.nix).mkSecrets
|
||||||
[ "storage01" ]
|
[ "storage01" ]
|
||||||
[
|
[
|
||||||
# List of secrets for storage01
|
# List of secrets for storage01
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifer: EUPL-1.2
|
# SPDX-License-Identifer: EUPL-1.2
|
||||||
|
|
||||||
(import ../../../../keys).mkSecrets
|
(import ../../../../keys.nix).mkSecrets
|
||||||
[ "tower01" ]
|
[ "tower01" ]
|
||||||
[
|
[
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
(import ../../../../keys).mkSecrets
|
(import ../../../../keys.nix).mkSecrets
|
||||||
[ "vault01" ]
|
[ "vault01" ]
|
||||||
[
|
[
|
||||||
# List of secrets for vault01
|
# List of secrets for vault01
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
(import ../../../../keys).mkSecrets
|
(import ../../../../keys.nix).mkSecrets
|
||||||
[ "web01" ]
|
[ "web01" ]
|
||||||
[
|
[
|
||||||
# List of secrets for web01
|
# List of secrets for web01
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
(import ../../../../keys).mkSecrets
|
(import ../../../../keys.nix).mkSecrets
|
||||||
[ "web02" ]
|
[ "web02" ]
|
||||||
[
|
[
|
||||||
# List of secrets for web02
|
# List of secrets for web02
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
(import ../../../../keys).mkSecrets
|
(import ../../../../keys.nix).mkSecrets
|
||||||
[ "web03" ]
|
[ "web03" ]
|
||||||
[
|
[
|
||||||
# List of secrets for web03
|
# List of secrets for web03
|
||||||
|
|
|
@ -12,11 +12,9 @@ lib:
|
||||||
(lib.evalModules {
|
(lib.evalModules {
|
||||||
modules = [
|
modules = [
|
||||||
./options.nix
|
./options.nix
|
||||||
{
|
./network.nix
|
||||||
network = import ./network.nix;
|
./nodes
|
||||||
nodes = import ./nodes;
|
./organization.nix
|
||||||
organization = import ./organization.nix;
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
class = "dgnumMeta";
|
class = "dgnumMeta";
|
||||||
}).config
|
}).config
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
{
|
{
|
||||||
|
network = {
|
||||||
bridge01 = {
|
bridge01 = {
|
||||||
hostId = "f57f3ba0";
|
hostId = "f57f3ba0";
|
||||||
|
|
||||||
|
@ -306,4 +307,5 @@
|
||||||
hostId = "8afc7749";
|
hostId = "8afc7749";
|
||||||
netbirdIp = "100.80.157.46";
|
netbirdIp = "100.80.157.46";
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
# SPDX-FileContributor: Ryan Lahfa <ryan.lahfa@dgnum.eu>
|
# SPDX-FileContributor: Ryan Lahfa <ryan.lahfa@dgnum.eu>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
{
|
||||||
builtins.foldl' (nodes: path: nodes // import path) { } [
|
imports = [
|
||||||
./liminix.nix
|
./liminix.nix
|
||||||
./nixos.nix
|
./nixos.nix
|
||||||
./netconf.nix
|
./netconf.nix
|
||||||
]
|
];
|
||||||
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
# }
|
# }
|
||||||
|
|
||||||
{
|
{
|
||||||
|
nodes = {
|
||||||
ap01 = {
|
ap01 = {
|
||||||
site = "unknown";
|
site = "unknown";
|
||||||
adminGroups = [ "fai" ];
|
adminGroups = [ "fai" ];
|
||||||
|
@ -29,4 +30,5 @@
|
||||||
version = "24.05";
|
version = "24.05";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
{
|
{
|
||||||
|
nodes = {
|
||||||
netcore01 = {
|
netcore01 = {
|
||||||
site = "pot01";
|
site = "pot01";
|
||||||
|
|
||||||
|
@ -76,4 +77,5 @@
|
||||||
system = "netconf";
|
system = "netconf";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
- luj01 -> VM de Luj
|
- luj01 -> VM de Luj
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
nodes = {
|
||||||
bridge01 = {
|
bridge01 = {
|
||||||
site = "hyp01";
|
site = "hyp01";
|
||||||
|
|
||||||
|
@ -74,7 +75,6 @@
|
||||||
|
|
||||||
compute01 = {
|
compute01 = {
|
||||||
site = "pav01";
|
site = "pav01";
|
||||||
|
|
||||||
sshKeys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE/YluSVS+4h3oV8CIUj0OmquyJXju8aEQy0Jz210vTu" ];
|
sshKeys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE/YluSVS+4h3oV8CIUj0OmquyJXju8aEQy0Jz210vTu" ];
|
||||||
|
|
||||||
hashedPassword = "$y$j9T$2nxZHq84G7fWvWMEaGavE/$0ADnmD9qMpXJJ.rWWH9086EakvZ3wAg0mSxZYugOf3C";
|
hashedPassword = "$y$j9T$2nxZHq84G7fWvWMEaGavE/$0ADnmD9qMpXJJ.rWWH9086EakvZ3wAg0mSxZYugOf3C";
|
||||||
|
@ -224,6 +224,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
nix-modules = [
|
nix-modules = [
|
||||||
|
"services/forgejo-nix-runners"
|
||||||
"services/netbird/server.nix"
|
"services/netbird/server.nix"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -244,13 +245,6 @@
|
||||||
system = "nixos";
|
system = "nixos";
|
||||||
};
|
};
|
||||||
|
|
||||||
deployment = {
|
|
||||||
sshOptions = [
|
|
||||||
"-J"
|
|
||||||
"root@vault01.hyp01.infra.dgnum.eu"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
admins = [ "ecoppens" ];
|
admins = [ "ecoppens" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -321,4 +315,5 @@
|
||||||
system = "nixos";
|
system = "nixos";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
{
|
{
|
||||||
|
organization = {
|
||||||
members = {
|
members = {
|
||||||
agroudiev = {
|
agroudiev = {
|
||||||
name = "Antoine Groudiev";
|
name = "Antoine Groudiev";
|
||||||
|
@ -197,4 +198,5 @@
|
||||||
# Videos DGNum
|
# Videos DGNum
|
||||||
peertube.admins = [ "thubrecht" ];
|
peertube.admins = [ "thubrecht" ];
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
# Nix expression to check if meta module is evaluating correctly.
|
# Nix expression to check if meta module is evaluating correctly.
|
||||||
# To do so run `nix-build ./verify.nix`
|
# To do so run `nix-build ./verify.nix`
|
||||||
let
|
let
|
||||||
sources = import ../npins;
|
sources = import ../sources.nix;
|
||||||
pkgs = import sources.nixos-unstable { };
|
pkgs = sources.bootstrapNixpkgs;
|
||||||
|
|
||||||
dns = import sources."dns.nix" { inherit pkgs; };
|
dns = import sources."dns.nix" { inherit pkgs; };
|
||||||
in
|
in
|
||||||
|
|
|
@ -5,12 +5,11 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
|
name,
|
||||||
dgn-keys,
|
dgn-keys,
|
||||||
meta,
|
|
||||||
nodeMeta,
|
nodeMeta,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
mkDefault
|
mkDefault
|
||||||
|
@ -22,11 +21,6 @@ let
|
||||||
types
|
types
|
||||||
;
|
;
|
||||||
|
|
||||||
admins =
|
|
||||||
meta.organization.groups.root
|
|
||||||
++ nodeMeta.admins
|
|
||||||
++ (builtins.concatMap (g: meta.organization.groups.${g}) nodeMeta.adminGroups);
|
|
||||||
|
|
||||||
cfg = config.dgn-access-control;
|
cfg = config.dgn-access-control;
|
||||||
in
|
in
|
||||||
|
|
||||||
|
@ -53,7 +47,7 @@ in
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
# Admins have root access to the node
|
# Admins have root access to the node
|
||||||
dgn-access-control.users.root = mkDefault admins;
|
dgn-access-control.users.root = mkDefault (dgn-keys.getNodeAdmins name);
|
||||||
users.mutableUsers = false;
|
users.mutableUsers = false;
|
||||||
users.users = builtins.mapAttrs (
|
users.users = builtins.mapAttrs (
|
||||||
username: members:
|
username: members:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
(import ../../../../keys).mkSecrets
|
(import ../../../../keys.nix).mkSecrets
|
||||||
[ ]
|
[ ]
|
||||||
[
|
[
|
||||||
"compute01.key"
|
"compute01.key"
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
{ netbox-agent.publicKeys = (import ../../../../keys).machineKeysBySystem "nixos"; }
|
{ netbox-agent.publicKeys = (import ../../../../keys.nix).machineKeysBySystem "nixos"; }
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
{ mail.publicKeys = (import ../../../keys).machineKeysBySystem "nixos"; }
|
{ mail.publicKeys = (import ../../../keys.nix).machineKeysBySystem "nixos"; }
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
{ __arkheon-token_file.publicKeys = (import ../../../keys).machineKeysBySystem "nixos"; }
|
{ __arkheon-token_file.publicKeys = (import ../../../keys.nix).machineKeysBySystem "nixos"; }
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EUPL-1.2
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
(import ../../../keys).mkSecrets
|
(import ../../../keys.nix).mkSecrets
|
||||||
[
|
[
|
||||||
"storage01"
|
"storage01"
|
||||||
"tower01"
|
"tower01"
|
||||||
|
|
23
sources.nix
Normal file
23
sources.nix
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# SPDX-FileCopyrightText: 2024 Ryan Lahfa <ryan.lahfa@dgnum.eu>
|
||||||
|
# SPDX-FileCopyrightText: 2024 Tom Hubrecht <tom.hubrecht@dgnum.eu>
|
||||||
|
# SPDX-FileContributor: Maurice Debray <maurice.debray@dgnum.eu>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
|
let
|
||||||
|
sources' = import ./npins;
|
||||||
|
|
||||||
|
bootstrapNixpkgs = import sources'.nixos-unstable { };
|
||||||
|
|
||||||
|
patch = (import ./lib/nix-patches { patchFile = ./patches; }).base {
|
||||||
|
pkgs = bootstrapNixpkgs;
|
||||||
|
};
|
||||||
|
|
||||||
|
sources = builtins.mapAttrs (
|
||||||
|
k: src:
|
||||||
|
patch.applyPatches {
|
||||||
|
inherit src;
|
||||||
|
name = k;
|
||||||
|
}
|
||||||
|
) sources';
|
||||||
|
in sources // { bootstrapNixpkgs = bootstrapNixpkgs; unpatchedSources = sources; }
|
|
@ -7,7 +7,7 @@
|
||||||
let
|
let
|
||||||
inherit (lib) attrNames genAttrs;
|
inherit (lib) attrNames genAttrs;
|
||||||
|
|
||||||
nodes = attrNames (import ../meta/nodes);
|
nodes = attrNames (import ../meta lib).nodes;
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue