config-perso/hive.nix
2024-06-01 18:22:29 +02:00

185 lines
5.5 KiB
Nix

let
mods = import ./modules;
users = import ./users;
sources = import ./npins;
in
{
meta.nixpkgs = import sources.nixpkgs { };
meta.specialArgs = {
inherit mods users sources;
};
defaults =
{
name,
pkgs,
lib,
config,
...
}:
{
imports = [
"${sources.home-manager}/nixos"
"${sources.agenix}/modules/age.nix"
"${sources.disko}/module.nix"
];
options.system.build.anywhere = lib.mkOption {
type = lib.types.package;
readOnly = true;
};
config = {
boot.tmp.useTmpfs = true;
networking.hostName = name;
nix.package = pkgs.lix;
system.build.anywhere = pkgs.writeShellApplication {
name = "anywhere-deploy_${name}.sh";
runtimeInputs = [ pkgs.nixos-anywhere ];
text = ''
nixos-anywhere --store-paths ${config.system.build.diskoScriptNoDeps} ${config.system.build.toplevel} ${config.deployment.targetHost}
'';
};
};
};
kat-probook =
{
name,
nodes,
users,
...
}:
{
deployment.allowLocalDeployment = true;
imports = [
./machines/kat-probook/configuration.nix
(users.root { ssh = false; })
users.catvayor
];
nix.settings.trusted-users = [
"root"
"@wheel"
];
};
kat-r86s =
{ name, nodes, ... }:
{
deployment.targetHost = "r86s.kat";
imports = [
./machines/kat-r86s/configuration.nix
(users.root { ssh = true; })
];
};
kat-test =
{ name, nodes, ... }:
{
deployment = {
allowLocalDeployment = true;
targetHost = "test.kat";
};
imports = [
./machines/kat-test/configuration.nix
(users.root { ssh = true; })
users.catvayor
];
home-manager.users.catvayor = {
imports = [ mods.home.mail ];
};
};
kat-virt =
{ name, nodes, ... }:
{
deployment.targetHost = "virt.kat";
imports = [
./machines/kat-virt/configuration.nix
(users.root { ssh = true; })
];
users.users.root.openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCvi5VUsDrwS4XqQQfFFIx1JoRDPVdtChUQWqKFbPFtP8gH51woXiKtKRbDebL0z/EmkdYKxxIkzixHTR5xQXjo8JiFZbwldZi5IvMr3x//ad9sVyOhmbRx1DXLKjyOdWyo+w0vORvbEDu2lHktfSvhHGrvUHfFc3EY+cAl7IImgGEeGNPruAuNkN90Lth9QgwJVsdOEs9j7hwwKtpfMMETL5tkW34Nu7io03+SaPxwi2xLuWTdTklfZ7GWYtG2w/hFkzDbkW97rp5dxB1HO58cPqyRlqyfhZFpiUmWlyuMba3Tip6JarCa52IpFffEIDR0CSeh5CFPoeppo/TPDiXDie370TjjQpxJiG+9PobBhmChH5FmQ/lksffI/WimqpVO7Ixf5cYiHN5Z0mgJgZsXwI3YPICQLA8ebSKHA8+mdmkunDmCBRaBj1qEgkp/UoYqXT6BjBm07nOsnL+3SG/yfx4fLotgWtdm2mkjEAG+OGVR7G3Vk/POxn0EqX7Z+gU= sylvain@idefix"
];
};
kat-traque =
{ name, nodes, ... }:
{
deployment.targetHost = "traque.kat";
imports = [
./machines/kat-traque/configuration.nix
(users.root { ssh = true; })
];
users.users.root.openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCvi5VUsDrwS4XqQQfFFIx1JoRDPVdtChUQWqKFbPFtP8gH51woXiKtKRbDebL0z/EmkdYKxxIkzixHTR5xQXjo8JiFZbwldZi5IvMr3x//ad9sVyOhmbRx1DXLKjyOdWyo+w0vORvbEDu2lHktfSvhHGrvUHfFc3EY+cAl7IImgGEeGNPruAuNkN90Lth9QgwJVsdOEs9j7hwwKtpfMMETL5tkW34Nu7io03+SaPxwi2xLuWTdTklfZ7GWYtG2w/hFkzDbkW97rp5dxB1HO58cPqyRlqyfhZFpiUmWlyuMba3Tip6JarCa52IpFffEIDR0CSeh5CFPoeppo/TPDiXDie370TjjQpxJiG+9PobBhmChH5FmQ/lksffI/WimqpVO7Ixf5cYiHN5Z0mgJgZsXwI3YPICQLA8ebSKHA8+mdmkunDmCBRaBj1qEgkp/UoYqXT6BjBm07nOsnL+3SG/yfx4fLotgWtdm2mkjEAG+OGVR7G3Vk/POxn0EqX7Z+gU= sylvain@idefix"
];
};
kat-iso =
{
name,
pkgs,
modulesPath,
...
}:
{
deployment = {
allowLocalDeployment = false;
targetHost = null;
};
imports = [
(modulesPath + "/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix")
(users.root { ssh = true; })
];
networking = {
networkmanager.enable = true;
wireless.enable = false;
};
console.keyMap = "fr";
environment.systemPackages = with pkgs; [
perl
git
];
boot.supportedFilesystems = [ "bcachefs" ];
programs.zsh.enable = true;
services.openssh.enable = true;
services.qemuGuest.enable = true;
boot.kernelParams = [ "console=ttyS0" ];
environment.etc = {
"config_base.nix" = {
mode = "0444";
text = ''
{ config, lib, pkgs, ... }: {
imports = [ ./hardware-configuration.nix ];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.supportedFilesystems = [ "bcachefs" ];
boot.kernelPackages = pkgs.linuxPackages_latest;
# networking.networkmanager.enable = true;
networking.hostName = "kat-undefined";
time.timeZone = "Europe/Paris";
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "fr";
};
#services.netbird.enable = true;
services.qemuGuest.enable = true;
services.openssh.enable = true;
users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAA16foz+XzwKwyIR4wFgNIAE3Y7AfXyEsUZFVVz8Rie catvayor@katvayor"
];
system.stateVersion = "23.11";
}
'';
};
};
};
}