2021-02-02 20:10:25 +01:00
|
|
|
inputs: {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
|
2021-04-11 00:25:36 +02:00
|
|
|
modules = [
|
|
|
|
../nixos-modules/default.nix
|
|
|
|
inputs.home-manager.nixosModules.home-manager
|
2021-06-15 21:25:16 +02:00
|
|
|
({ pkgs, config, lib, ... }:
|
2021-04-11 00:25:36 +02:00
|
|
|
let
|
|
|
|
inherit (config.magic_rb.pkgs) nixpkgs-unstable;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
home-manager.users."main" =
|
|
|
|
{ ... }:
|
|
|
|
{
|
|
|
|
imports = [ ../home-manager/modules/default.nix ];
|
|
|
|
|
|
|
|
magic_rb = {
|
|
|
|
pins = {
|
|
|
|
inherit (inputs)
|
|
|
|
nixpkgs
|
|
|
|
nixpkgs-unstable
|
|
|
|
nixpkgs-master
|
|
|
|
|
|
|
|
home-manager
|
|
|
|
nixng
|
|
|
|
fenix;
|
|
|
|
};
|
|
|
|
config = {
|
|
|
|
allowUnfree = true;
|
|
|
|
};
|
|
|
|
overlays = inputs.self.overlays;
|
|
|
|
|
|
|
|
programs = {
|
|
|
|
alacritty.enable = true;
|
2021-05-09 23:34:02 +02:00
|
|
|
bash = {
|
|
|
|
enable = true;
|
|
|
|
enableDirenv = true;
|
|
|
|
};
|
2021-04-19 20:05:53 +02:00
|
|
|
shh.enable = true;
|
2021-06-10 20:41:15 +02:00
|
|
|
ssh.enable = true;
|
2021-04-11 00:25:36 +02:00
|
|
|
emacs.enable = true;
|
|
|
|
xmonad.enable = true;
|
|
|
|
gpg.enable = true;
|
|
|
|
multimc.enable = true;
|
|
|
|
};
|
|
|
|
packageCollections = {
|
|
|
|
"3dPrinting".enable = true;
|
|
|
|
cmdline.enable = true;
|
|
|
|
graphical.enable = true;
|
|
|
|
rust.enable = true;
|
|
|
|
webdev.enable = true;
|
|
|
|
wine.enable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
home.stateVersion = "20.09";
|
|
|
|
};
|
|
|
|
|
|
|
|
magic_rb = {
|
|
|
|
grub = {
|
|
|
|
enable = true;
|
|
|
|
efi.enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
xserver = {
|
|
|
|
enable = true;
|
|
|
|
gpu = "nvidia";
|
|
|
|
xmonad = true;
|
|
|
|
|
2021-05-12 23:57:02 +02:00
|
|
|
qwertyNeo2 = true;
|
2021-06-27 18:55:40 +02:00
|
|
|
mimickInTty = true;
|
2021-04-11 00:25:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
pins = {
|
|
|
|
inherit (inputs)
|
|
|
|
nixpkgs
|
|
|
|
nixpkgs-unstable
|
|
|
|
nixpkgs-master
|
|
|
|
|
|
|
|
home-manager
|
|
|
|
nixng
|
|
|
|
fenix;
|
|
|
|
};
|
|
|
|
config = {
|
|
|
|
allowUnfree = true;
|
|
|
|
};
|
|
|
|
overlays = inputs.self.overlays;
|
|
|
|
|
|
|
|
erase-my-darlings = {
|
|
|
|
enable = true;
|
|
|
|
snapshot = "heater-zpool/local/root@blank";
|
|
|
|
};
|
|
|
|
|
|
|
|
hardware.heater = true;
|
2021-04-25 12:21:45 +02:00
|
|
|
sshdEmacs.enable = true;
|
2021-04-11 00:25:36 +02:00
|
|
|
flakes.enable = true;
|
|
|
|
pulseaudio.enable = true;
|
|
|
|
};
|
2021-02-02 20:10:25 +01:00
|
|
|
|
2021-04-11 00:25:36 +02:00
|
|
|
programs.steam.enable = true;
|
2021-06-10 20:41:15 +02:00
|
|
|
|
|
|
|
boot.binfmt.emulatedSystems = [
|
|
|
|
"aarch64-linux"
|
|
|
|
];
|
2021-04-11 00:25:36 +02:00
|
|
|
|
|
|
|
services.vault-agent = {
|
|
|
|
enable = true;
|
|
|
|
settings = {
|
|
|
|
vault = {
|
|
|
|
address = "https://vault.in.redalder.org:8200";
|
|
|
|
|
|
|
|
client_cert = "/etc/vault-agent/client.crt";
|
|
|
|
client_key = "/etc/vault-agent/client.key";
|
|
|
|
};
|
|
|
|
|
|
|
|
auto_auth = {
|
|
|
|
method = [
|
|
|
|
{
|
|
|
|
"cert" = {
|
|
|
|
name = "system-heater";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
template = [
|
|
|
|
{
|
|
|
|
source = pkgs.writeText "wg0.key.tpl" ''
|
|
|
|
{{ with secret "kv/data/systems/heater/wireguard" }}{{ .Data.data.private_key }}{{ end }}
|
|
|
|
'';
|
|
|
|
destination = "/var/secrets/wg0.key";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
source = pkgs.writeText "nomad.hcl.tpl" ''
|
|
|
|
client {
|
|
|
|
enabled = true
|
|
|
|
servers = [ "blowhole.in.redalder.org:4647" ]
|
|
|
|
|
|
|
|
options {
|
|
|
|
docker.privileged.enabled = "true"
|
|
|
|
}
|
|
|
|
|
|
|
|
cni_path = "${nixpkgs-unstable.cni-plugins}/bin"
|
|
|
|
}
|
|
|
|
|
|
|
|
{{ with secret "kv/data/systems/heater/nomad" }}
|
|
|
|
vault {
|
|
|
|
enabled = true
|
|
|
|
address = "https://vault.in.redalder.org:8200"
|
|
|
|
token = "{{ .Data.data.vault_token }}"
|
|
|
|
allow_unauthenticated = true
|
|
|
|
create_from_role = "nomad-cluster"
|
|
|
|
}
|
|
|
|
|
|
|
|
consul {
|
|
|
|
address = "blowhole.in.redalder.org:8500"
|
|
|
|
token = "{{ .Data.data.consul_token }}"
|
|
|
|
}
|
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
disable_update_check = true
|
|
|
|
datacenter = "homelab-1"
|
|
|
|
data_dir = "/var/lib/nomad"
|
|
|
|
'';
|
|
|
|
destination = "/var/secrets/nomad.hcl";
|
|
|
|
perms = "0644";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
2021-02-02 20:10:25 +01:00
|
|
|
|
2021-06-15 21:25:16 +02:00
|
|
|
services.openssh = {
|
|
|
|
enable = true;
|
|
|
|
extraConfig = ''
|
|
|
|
AcceptEnv INSIDE_EMACS
|
|
|
|
'';
|
|
|
|
};
|
2021-03-14 10:58:29 +01:00
|
|
|
|
2021-04-11 00:25:36 +02:00
|
|
|
services.nomad = {
|
2021-05-24 00:12:57 +02:00
|
|
|
enable = false; # Consul conflict, services go yeet
|
2021-05-09 23:34:02 +02:00
|
|
|
enableDocker = false;
|
2021-04-11 00:25:36 +02:00
|
|
|
dropPrivileges = false;
|
2021-03-14 22:22:45 +01:00
|
|
|
|
2021-04-11 00:25:36 +02:00
|
|
|
extraPackages = [ nixpkgs-unstable.consul ];
|
2021-03-14 10:58:29 +01:00
|
|
|
|
2021-04-11 00:25:36 +02:00
|
|
|
package = nixpkgs-unstable.nomad;
|
2021-03-14 10:58:29 +01:00
|
|
|
|
2021-04-11 00:25:36 +02:00
|
|
|
extraSettingsPaths = [ "/var/secrets/nomad.hcl" ];
|
2021-03-14 10:58:29 +01:00
|
|
|
};
|
|
|
|
|
2021-06-15 21:25:16 +02:00
|
|
|
systemd.services.wireguard-wg0.wantedBy = lib.mkForce [ ];
|
2021-04-11 00:25:36 +02:00
|
|
|
networking = {
|
|
|
|
firewall = {
|
|
|
|
allowedUDPPorts = [ 6666 ];
|
2021-04-25 10:30:50 +02:00
|
|
|
allowedTCPPorts = [ 22 ];
|
2021-04-11 00:25:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
wireguard.interfaces = {
|
|
|
|
wg0 = {
|
|
|
|
ips = [ "10.64.0.3/24" ];
|
|
|
|
listenPort = 6666;
|
|
|
|
|
|
|
|
privateKeyFile = "/var/secrets/wg0.key";
|
|
|
|
peers = [
|
|
|
|
{
|
|
|
|
publicKey = "h4g6vWjOB6RS0NbrP/Kvb2CZeutm/F+ZfDbJmEd1Dgk=";
|
|
|
|
allowedIPs = [ "10.64.0.0/24" ];
|
|
|
|
endpoint = "redalder.org:6666";
|
|
|
|
persistentKeepalive = 25;
|
2021-03-14 10:58:29 +01:00
|
|
|
}
|
2021-04-11 00:25:36 +02:00
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2021-05-09 23:34:02 +02:00
|
|
|
|
|
|
|
virtualisation.podman = {
|
|
|
|
enable = true;
|
|
|
|
dockerCompat = true;
|
|
|
|
};
|
2021-04-11 00:25:36 +02:00
|
|
|
})
|
2021-02-02 20:10:25 +01:00
|
|
|
] ++ [
|
2021-04-11 00:25:36 +02:00
|
|
|
({ pkgs, ... }: {
|
2021-02-02 20:10:25 +01:00
|
|
|
networking = {
|
|
|
|
hostName = "heater";
|
|
|
|
useDHCP = false;
|
|
|
|
interfaces.enp3s0.useDHCP = true;
|
2021-02-24 12:32:22 +01:00
|
|
|
|
|
|
|
firewall.enable = false;
|
2021-02-26 10:25:54 +01:00
|
|
|
hostId = "3457b383";
|
2021-02-02 20:10:25 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
time.timeZone = "Europe/Bratislava";
|
|
|
|
system.stateVersion = "20.09";
|
|
|
|
|
2021-03-14 10:58:29 +01:00
|
|
|
security.pki.certificates = [ (builtins.readFile ../redalder.org.crt) ];
|
2021-02-02 20:10:25 +01:00
|
|
|
})
|
|
|
|
];
|
|
|
|
}
|