Compare commits
No commits in common. "1e80b3603777ce600ef8374d12d823c909e92408" and "ed550eafb115c78def25f2c88b54ce3f70daa6a6" have entirely different histories.
1e80b36037
...
ed550eafb1
11 changed files with 131 additions and 53 deletions
|
@ -6,14 +6,14 @@
|
||||||
deployArch = "x86_64-linux";
|
deployArch = "x86_64-linux";
|
||||||
mkDeployNodes = nodeDef:
|
mkDeployNodes = nodeDef:
|
||||||
builtins.mapAttrs
|
builtins.mapAttrs
|
||||||
(name: module: nodeDef name module)
|
(name: machine: nodeDef name machine)
|
||||||
self.machines;
|
self.machines.${deployArch};
|
||||||
in {
|
in {
|
||||||
deploy = {
|
deploy = {
|
||||||
sshUser = "root";
|
sshUser = "root";
|
||||||
user = "root";
|
user = "root";
|
||||||
|
|
||||||
nodes = mkDeployNodes (name: _module: let
|
nodes = mkDeployNodes (name: machine: let
|
||||||
nixosConfiguration = self.nixosConfigurations.${name};
|
nixosConfiguration = self.nixosConfigurations.${name};
|
||||||
machineArch = nixosConfiguration.config.facter.report.system;
|
machineArch = nixosConfiguration.config.facter.report.system;
|
||||||
in {
|
in {
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
{
|
{
|
||||||
|
machines.atlas = {
|
||||||
|
kubernetesNodeLabels.storageType = "slow";
|
||||||
|
|
||||||
|
nixosModule = {
|
||||||
facter.reportPath = ./facter.json;
|
facter.reportPath = ./facter.json;
|
||||||
|
|
||||||
lab = {
|
lab = {
|
||||||
|
@ -10,4 +14,6 @@
|
||||||
serverAddr = "https://jefke.dmz:6443";
|
serverAddr = "https://jefke.dmz:6443";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,51 @@
|
||||||
{...}: {
|
{
|
||||||
machines = {
|
nixpkgs,
|
||||||
atlas = import ./atlas;
|
flake-utils,
|
||||||
jefke = import ./jefke;
|
...
|
||||||
lewis = import ./lewis;
|
}:
|
||||||
warwick = import ./warwick;
|
flake-utils.lib.eachDefaultSystem (system: let
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
lib = pkgs.lib;
|
||||||
|
|
||||||
|
machineOpts = {config, ...}: {
|
||||||
|
options = {
|
||||||
|
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
|
||||||
|
./atlas
|
||||||
|
./jefke
|
||||||
|
./lewis
|
||||||
|
# ./talos.nix
|
||||||
|
];
|
||||||
|
})
|
||||||
|
.config
|
||||||
|
.machines;
|
||||||
|
})
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
{
|
{
|
||||||
|
machines.jefke = {
|
||||||
|
kubernetesNodeLabels.storageType = "fast";
|
||||||
|
|
||||||
|
nixosModule = {
|
||||||
facter.reportPath = ./facter.json;
|
facter.reportPath = ./facter.json;
|
||||||
|
|
||||||
lab = {
|
lab = {
|
||||||
|
@ -10,4 +14,6 @@
|
||||||
clusterInit = true;
|
clusterInit = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
{
|
{
|
||||||
|
machines.lewis = {
|
||||||
|
kubernetesNodeLabels = {
|
||||||
|
storageType = "fast";
|
||||||
|
hasMedia = "true";
|
||||||
|
};
|
||||||
|
|
||||||
|
nixosModule = {
|
||||||
facter.reportPath = ./facter.json;
|
facter.reportPath = ./facter.json;
|
||||||
|
|
||||||
lab = {
|
lab = {
|
||||||
|
@ -12,4 +19,6 @@
|
||||||
serverAddr = "https://jefke.dmz:6443";
|
serverAddr = "https://jefke.dmz:6443";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
9
machines/talos.nix
Normal file
9
machines/talos.nix
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
machines.talos = {
|
||||||
|
nixosModule = {lib, ...}: {
|
||||||
|
lab.storage.profile = "normal";
|
||||||
|
|
||||||
|
# boot.loader.systemd-boot.enable = lib.mkForce false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
{inputs, ...}: {
|
{
|
||||||
|
machines.warwick = {
|
||||||
|
nixosModule = {inputs, ...}: {
|
||||||
imports = [inputs.nixos-hardware.nixosModules.raspberry-pi-4];
|
imports = [inputs.nixos-hardware.nixosModules.raspberry-pi-4];
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
@ -14,4 +16,6 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
inputs,
|
inputs,
|
||||||
|
machine,
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
|
@ -15,6 +16,7 @@
|
||||||
./k3s
|
./k3s
|
||||||
./tailscale.nix
|
./tailscale.nix
|
||||||
./facter.nix
|
./facter.nix
|
||||||
|
machine.nixosModule
|
||||||
inputs.disko.nixosModules.disko
|
inputs.disko.nixosModules.disko
|
||||||
inputs.sops-nix.nixosModules.sops
|
inputs.sops-nix.nixosModules.sops
|
||||||
inputs.nix-snapshotter.nixosModules.nix-snapshotter
|
inputs.nix-snapshotter.nixosModules.nix-snapshotter
|
||||||
|
|
|
@ -38,7 +38,7 @@ in {
|
||||||
let
|
let
|
||||||
generated =
|
generated =
|
||||||
lib.attrsets.mapAttrsToList
|
lib.attrsets.mapAttrsToList
|
||||||
(name: _module: {
|
(name: machine: {
|
||||||
job_name = name;
|
job_name = name;
|
||||||
static_configs = [
|
static_configs = [
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
config,
|
config,
|
||||||
|
machine,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
config = {
|
config = {
|
||||||
|
|
16
nixos.nix
16
nixos.nix
|
@ -3,24 +3,22 @@
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
...
|
...
|
||||||
} @ inputs: let
|
} @ inputs: let
|
||||||
|
deployArch = "x86_64-linux";
|
||||||
|
machines = self.machines.${deployArch};
|
||||||
mkNixosSystems = systemDef:
|
mkNixosSystems = systemDef:
|
||||||
builtins.mapAttrs
|
builtins.mapAttrs
|
||||||
(
|
(
|
||||||
name: module:
|
name: machine:
|
||||||
nixpkgs.lib.nixosSystem (systemDef name module)
|
nixpkgs.lib.nixosSystem (systemDef name machine)
|
||||||
)
|
)
|
||||||
self.machines;
|
machines;
|
||||||
in {
|
in {
|
||||||
nixosConfigurations = mkNixosSystems (name: module: {
|
nixosConfigurations = mkNixosSystems (name: machine: {
|
||||||
specialArgs = {
|
specialArgs = {inherit self inputs machine machines;};
|
||||||
inherit self inputs;
|
|
||||||
inherit (self) machines;
|
|
||||||
};
|
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
"${self}/modules"
|
"${self}/modules"
|
||||||
{networking.hostName = name;}
|
{networking.hostName = name;}
|
||||||
module
|
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue