use deployment flake for cluster options

This commit is contained in:
Astro 2023-02-10 01:17:10 +01:00
parent ddd9f1a371
commit 0c52c5655e
5 changed files with 29 additions and 99 deletions

View File

@ -208,6 +208,26 @@
"url": "https://gitea.c3d2.de/astro/caveman.git"
}
},
"deployment": {
"inputs": {
"zentralwerk": [
"zentralwerk"
]
},
"locked": {
"lastModified": 1675987794,
"narHash": "sha256-3R2+WvqIYFNGxeuIXDRFCfHVYtHmJZ8oTVcp/b6YQZA=",
"ref": "refs/heads/main",
"rev": "631c31f921e13c8373d39e74f99e45d5c47e4c4d",
"revCount": 1,
"type": "git",
"url": "https://gitea.c3d2.de/C3D2/deployment.git"
},
"original": {
"type": "git",
"url": "https://gitea.c3d2.de/C3D2/deployment.git"
}
},
"fenix": {
"inputs": {
"nixpkgs": [
@ -512,6 +532,7 @@
"buzzrelay": "buzzrelay",
"c3d2-user-module": "c3d2-user-module",
"caveman": "caveman",
"deployment": "deployment",
"fenix": "fenix",
"flake-parts": "flake-parts",
"flake-utils": "flake-utils",

View File

@ -81,6 +81,12 @@
nixpkgs-lib.follows = "nixos";
};
};
deployment = {
url = "git+https://gitea.c3d2.de/C3D2/deployment.git";
inputs = {
zentralwerk.follows = "zentralwerk";
};
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixos";
@ -215,7 +221,7 @@
};
};
outputs = inputs@{ self, alert2muc, c3d2-user-module, fenix, harmonia, heliwatch, microvm, naersk, nixos, nixos-hardware, nixos-modules, buzz2elastic, buzzrelay, caveman, oparl-scraper, scrapers, secrets, skyflake, sshlogd, sops-nix, spacemsg, ticker, tigger, yammat, zentralwerk, ... }:
outputs = inputs@{ self, alert2muc, c3d2-user-module, deployment, fenix, harmonia, heliwatch, microvm, naersk, nixos, nixos-hardware, nixos-modules, buzz2elastic, buzzrelay, caveman, oparl-scraper, scrapers, secrets, skyflake, sshlogd, sops-nix, spacemsg, ticker, tigger, yammat, zentralwerk, ... }:
let
inherit (nixos) lib;
@ -770,7 +776,7 @@
c3d2.nncp.neigh = import ./modules/nncp-relays.nix;
};
cluster = ./modules/cluster;
cluster-options = ./modules/cluster/customization/options.nix;
cluster-options = deployment.nixosModules.deployment-options;
cluster-network = ./modules/cluster/network.nix;
microvm.imports = [
microvm.nixosModules.microvm

View File

@ -29,8 +29,6 @@ let
in
{
imports = [ ./option-types.nix ];
microvm = {
inherit (config.deployment) mem vcpu hypervisor;

View File

@ -1,42 +0,0 @@
{ lib, ... }:
{
options.deployment = with lib; {
vcpu = mkOption {
type = types.int;
};
mem = mkOption {
type = types.int;
};
hypervisor = mkOption {
type = types.enum [
"qemu"
"cloud-hypervisor"
"firecracker"
"crosvm"
"kvmtool"
];
};
networks = mkOption {
type = with types; listOf str;
};
persistedShares = mkOption {
type = with types; listOf str;
};
extraShares = mkOption {
type = with types; listOf (submodule {
options = {
source = mkOption {
type = str;
};
mountPoint = mkOption {
type = str;
};
};
});
};
needForSpeed = mkOption {
type = types.bool;
};
};
}

View File

@ -1,53 +0,0 @@
{ zentralwerk, config, lib, ... }:
# our custom options
#
# IF ANYBODY changes anything in this customization for skyflake
# please give notice in the admins chat prior to doing so
{
options.deployment = with lib; {
vcpu = mkOption {
default = 4;
};
mem = mkOption {
default = 512;
};
hypervisor = mkOption {
default = "cloud-hypervisor";
};
networks = mkOption {
default = builtins.attrNames (
lib.filterAttrs (_: { hosts4, hosts6, ... }:
hosts4 ? ${config.networking.hostName} ||
lib.filterAttrs (_: hosts6:
hosts6 ? ${config.networking.hostName}
) hosts6 != {}
) zentralwerk.lib.config.site.net
);
};
persistedShares = mkOption {
default = [ "/etc" "/home" "/var" ];
};
extraShares = mkOption {
default = [];
description = ''
Extra shares. THESE MUST BE AVAILABLE ON ALL MICROVM HOSTS!
'';
};
needForSpeed = mkOption {
default = false;
description = ''
Prefer deployment on Nomad clients with a higher c3d2.cpuSpeed
'';
};
};
config = {
# HACK: Avoid conflicts when building a NixOS configuration on Hydra
boot.loader.grub.enable = false;
fileSystems."/" = lib.mkDefault {
device = "rootfs";
fsType = "tmpfs";
options = [ "size=50%,mode=0755" ];
};
};
}