Restructure and clean up code
This commit is contained in:
parent
660191ab42
commit
6dd363a2a8
37 changed files with 17 additions and 1423 deletions
16
machines/atlas.nix
Normal file
16
machines/atlas.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
machines.atlas = {
|
||||
arch = "x86_64-linux";
|
||||
kubernetesNodeLabels.storageType = "slow";
|
||||
|
||||
nixosModule.lab = {
|
||||
storage.profile = "kubernetes";
|
||||
tailscale.enable = true;
|
||||
|
||||
k3s = {
|
||||
enable = true;
|
||||
serverAddr = "https://jefke.dmz:6443";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
59
machines/default.nix
Normal file
59
machines/default.nix
Normal file
|
@ -0,0 +1,59 @@
|
|||
{ nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
lib = pkgs.lib;
|
||||
|
||||
machineOpts = { config, ... }: {
|
||||
options = {
|
||||
arch = lib.mkOption {
|
||||
default = null;
|
||||
type = with lib.types; nullOr str;
|
||||
description = ''
|
||||
CPU architecture of this machine.
|
||||
'';
|
||||
};
|
||||
|
||||
isRaspberryPi = lib.mkOption {
|
||||
default = false;
|
||||
type = lib.types.bool;
|
||||
};
|
||||
|
||||
nixosModule = lib.mkOption {
|
||||
default = { ... }: { };
|
||||
type = lib.types.anything;
|
||||
description = ''
|
||||
Customized configuration for this machine in the form of a NixOS module.
|
||||
'';
|
||||
};
|
||||
|
||||
kubernetesNodeLabels = lib.mkOption {
|
||||
default = null;
|
||||
type = with lib.types; nullOr attrs;
|
||||
description = ''
|
||||
Any labels to add to the Kubernetes node.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
allOpts = {
|
||||
options = {
|
||||
machines = lib.mkOption {
|
||||
type = with lib.types; attrsOf (submodule machineOpts);
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
machines = (lib.modules.evalModules {
|
||||
modules = [
|
||||
allOpts
|
||||
./warwick.nix
|
||||
./atlas.nix
|
||||
./jefke.nix
|
||||
./lewis.nix
|
||||
# ./talos.nix
|
||||
# ./pikvm.nix
|
||||
];
|
||||
}).config.machines;
|
||||
})
|
16
machines/jefke.nix
Normal file
16
machines/jefke.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
machines.jefke = {
|
||||
arch = "x86_64-linux";
|
||||
kubernetesNodeLabels.storageType = "fast";
|
||||
|
||||
nixosModule.lab = {
|
||||
storage.profile = "kubernetes";
|
||||
tailscale.enable = true;
|
||||
|
||||
k3s = {
|
||||
enable = true;
|
||||
clusterInit = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
23
machines/lewis.nix
Normal file
23
machines/lewis.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
machines.lewis = {
|
||||
arch = "x86_64-linux";
|
||||
kubernetesNodeLabels = {
|
||||
storageType = "fast";
|
||||
hasMedia = "true";
|
||||
};
|
||||
|
||||
nixosModule = {
|
||||
lab = {
|
||||
storage.profile = "kubernetes";
|
||||
backups.enable = true;
|
||||
data-sharing.enable = true;
|
||||
tailscale.enable = true;
|
||||
|
||||
k3s = {
|
||||
enable = true;
|
||||
serverAddr = "https://jefke.dmz:6443";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
23
machines/pikvm.nix
Normal file
23
machines/pikvm.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
machines.pikvm = {
|
||||
arch = "aarch64-linux";
|
||||
isRaspberryPi = true;
|
||||
|
||||
nixosModule = { config, inputs, lib, ... }: {
|
||||
# imports = [ "${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix" ];
|
||||
lab = {
|
||||
storage.profile = "pi";
|
||||
};
|
||||
|
||||
environment.systemPackages = with inputs.nixpkgs.legacyPackages.aarch64-linux; [
|
||||
(mplayer.override {
|
||||
v4lSupport = true;
|
||||
})
|
||||
ffmpeg
|
||||
v4l-utils
|
||||
];
|
||||
|
||||
boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ];
|
||||
};
|
||||
};
|
||||
}
|
11
machines/talos.nix
Normal file
11
machines/talos.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
machines.talos = {
|
||||
arch = "x86_64-linux";
|
||||
|
||||
nixosModule = { lib, ... }: {
|
||||
lab.storage.profile = "normal";
|
||||
|
||||
# boot.loader.systemd-boot.enable = lib.mkForce false;
|
||||
};
|
||||
};
|
||||
}
|
18
machines/warwick.nix
Normal file
18
machines/warwick.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
machines.warwick = {
|
||||
arch = "aarch64-linux";
|
||||
isRaspberryPi = true;
|
||||
|
||||
nixosModule = { lib, ... }: {
|
||||
lab = {
|
||||
storage.profile = "pi";
|
||||
monitoring.server.enable = true;
|
||||
|
||||
tailscale = {
|
||||
advertiseExitNode = true;
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Reference in a new issue