Browse Source

More progress

main
Dustin Frisch 1 week ago
parent
commit
db43a2090f
No known key found for this signature in database GPG Key ID: B4C3BF012D9B26BE
  1. 11
      client/default.nix
  2. 15
      clients.nix
  3. 24
      flake.nix
  4. 53
      machines/nfs/nfs.nix
  5. 2
      sops-config.nix

11
client/default.nix

@ -1,7 +1,12 @@
id:
{ lib, ... }: { lib, ... }:
with lib; with lib;
let
client = (import ../clients.nix).${id};
in
{ {
imports = [ imports = [
./hardware.nix ./hardware.nix
@ -14,9 +19,15 @@ with lib;
deployment = { deployment = {
targetHost = "10.32.45.150"; targetHost = "10.32.45.150";
tags = [ "client" ];
};
_module.args = {
inherit id client;
}; };
networking = { networking = {
hostName = mkForce "client-${id}";
useDHCP = mkForce true; useDHCP = mkForce true;
}; };

15
clients.nix

@ -0,0 +1,15 @@
{
"01" = {
mac = "";
};
"02" = {
mac = "";
};
"03" = {
mac = "";
};
"04" = {
mac = "";
};
}

24
flake.nix

@ -53,6 +53,8 @@
# List of all machine names as defined in the machines directory # List of all machine names as defined in the machines directory
machines = builtins.attrNames (builtins.readDir ./machines); machines = builtins.attrNames (builtins.readDir ./machines);
clients = builtins.attrNames (import ./clients.nix);
in in
{ {
colmena = { colmena = {
@ -76,15 +78,24 @@
deployment.replaceUnknownProfiles = false; deployment.replaceUnknownProfiles = false;
}; };
}
"client" = ./client;
} // (builtins.listToAttrs (builtins.map
# Machines
// (builtins.listToAttrs (builtins.map
(name: { (name: {
inherit name; inherit name;
value = ./machines/${name}; value = ./machines/${name};
}) })
machines));
machines))
# Clients
// (builtins.listToAttrs (builtins.map
(id: {
name = "client-${id}";
value = (import ./client) id;
})
clients))
;
} // flake-utils.lib.eachDefaultSystem (system: { } // flake-utils.lib.eachDefaultSystem (system: {
checks = { checks = {
@ -130,12 +141,13 @@
''; '';
}; };
packages.disks =
packages.disks =
let let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
hive = colmena.lib.makeHive self.outputs.colmena; hive = colmena.lib.makeHive self.outputs.colmena;
in pkgs.linkFarm "linuxlab-testing" (builtins.mapAttrs
in
pkgs.linkFarm "linuxlab-testing" (builtins.mapAttrs
(_: node: node.config.system.build.diskoImages) (_: node: node.config.system.build.diskoImages)
hive.nodes); hive.nodes);
}); });

53
machines/nfs/nfs.nix

@ -1,3 +1,7 @@
{ pkgs, lib, ... }:
with lib;
{ {
services.nfs.server = { services.nfs.server = {
enable = true; enable = true;
@ -9,5 +13,54 @@
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
2049 # NFSv4 2049 # NFSv4
]; ];
environment.systemPackages = with pkgs; [
quota
];
disko.devices = {
disk = genAttrs [
"pci-0000:00:17.0-ata-1"
"pci-0000:00:17.0-ata-2"
"pci-0000:00:17.0-ata-3"
"pci-0000:00:17.0-ata-4"
]
(path: {
type = "disk";
device = "/dev/disk/by-path/${path}";
content = {
type = "mdraid";
name = "home";
};
});
mdadm = {
home = {
type = "mdadm";
level = 5;
content = {
type = "gpt";
partitions = {
primary = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/home";
extraArgs = [
"-Oquota"
"-Equotatype=usrquota"
];
mountOptions = [
"defaults"
"quota"
];
};
};
};
};
};
};
};
} }

2
sops-config.nix

@ -14,7 +14,7 @@ let
}; };
hosts = { hosts = {
"nfs" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIENsd6EdgIn5jhqXUEyPckoViHLLsYM2on/liwf1IO8p";
"nfs" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMA+Q4wLe0AuZ8OC5BKJLrvmpKcy+6a8Iez9hCSVgtX8";
"ldap" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFhkh5L4jYl/i4E+lBVDppHcoiohR/gDricyV2wY/3Np"; "ldap" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFhkh5L4jYl/i4E+lBVDppHcoiohR/gDricyV2wY/3Np";
"installer" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOrc58WlxYKaPNO1J8j8KQxOLJooc9fIxp6gZZoB4Y7o"; "installer" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOrc58WlxYKaPNO1J8j8KQxOLJooc9fIxp6gZZoB4Y7o";
}; };

Loading…
Cancel
Save