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
|
2021-08-18 22:18:42 +02:00
|
|
|
inputs.dwarffs.nixosModules.dwarffs
|
2021-04-11 00:25:36 +02:00
|
|
|
inputs.home-manager.nixosModules.home-manager
|
2021-08-18 22:18:42 +02:00
|
|
|
|
2021-08-19 18:14:15 +02:00
|
|
|
({ pkgs, config, lib, secret, ... }:
|
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 = {
|
2021-09-07 07:55:53 +02:00
|
|
|
optimisation.march = "znver2";
|
2021-07-03 20:41:04 +02:00
|
|
|
pins = inputs;
|
2021-04-11 00:25:36 +02:00
|
|
|
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-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;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-10-21 00:33:17 +02:00
|
|
|
services.syncthing.enable = true;
|
|
|
|
|
2021-04-11 00:25:36 +02:00
|
|
|
home.stateVersion = "20.09";
|
|
|
|
};
|
|
|
|
|
|
|
|
magic_rb = {
|
2021-09-07 07:55:53 +02:00
|
|
|
optimisation.march = "znver2";
|
2021-04-11 00:25:36 +02:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2021-07-03 20:41:04 +02:00
|
|
|
pins = inputs;
|
2021-04-11 00:25:36 +02:00
|
|
|
config = {
|
|
|
|
allowUnfree = true;
|
|
|
|
};
|
|
|
|
overlays = inputs.self.overlays;
|
|
|
|
|
2021-08-08 00:04:09 +02:00
|
|
|
erase-my-darlings.zfs = {
|
2021-04-11 00:25:36 +02:00
|
|
|
enable = true;
|
|
|
|
snapshot = "heater-zpool/local/root@blank";
|
|
|
|
};
|
|
|
|
|
|
|
|
hardware.heater = true;
|
2021-04-25 12:21:45 +02:00
|
|
|
sshdEmacs.enable = true;
|
2021-08-18 22:18:42 +02:00
|
|
|
flakes = {
|
|
|
|
enable = true;
|
|
|
|
nixMaster = true;
|
|
|
|
};
|
2021-04-11 00:25:36 +02:00
|
|
|
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 = {
|
2021-08-19 18:14:15 +02:00
|
|
|
address = "https://${secret.network.ips.vault.vpn}:8200";
|
2021-04-11 00:25:36 +02:00
|
|
|
|
|
|
|
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
|
2021-08-19 18:14:15 +02:00
|
|
|
servers = [ "${secret.network.ips.blowhole.dns}:4647" ]
|
2021-04-11 00:25:36 +02:00
|
|
|
|
|
|
|
options {
|
|
|
|
docker.privileged.enabled = "true"
|
|
|
|
}
|
|
|
|
|
|
|
|
cni_path = "${nixpkgs-unstable.cni-plugins}/bin"
|
|
|
|
}
|
|
|
|
|
|
|
|
{{ with secret "kv/data/systems/heater/nomad" }}
|
|
|
|
vault {
|
|
|
|
enabled = true
|
2021-08-19 18:14:15 +02:00
|
|
|
address = "https://${secret.network.ips.vault.vpn}:8200"
|
2021-04-11 00:25:36 +02:00
|
|
|
token = "{{ .Data.data.vault_token }}"
|
|
|
|
allow_unauthenticated = true
|
|
|
|
create_from_role = "nomad-cluster"
|
|
|
|
}
|
|
|
|
|
|
|
|
consul {
|
2021-08-19 18:14:15 +02:00
|
|
|
address = "${secret.network.ips.blowhole.dns}:8500"
|
2021-04-11 00:25:36 +02:00
|
|
|
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-08-19 18:23:14 +02:00
|
|
|
environment.systemPackages =
|
2021-09-14 21:56:43 +02:00
|
|
|
(with pkgs;
|
|
|
|
[ (steam.override
|
|
|
|
{ extraPkgs = pkgs: with pkgs; [ pango harfbuzz libthai ];
|
|
|
|
extraLibraries = pkgs: with config.hardware.opengl;
|
|
|
|
if pkgs.hostPlatform.is64bit
|
|
|
|
then [ package ] ++ extraPackages
|
|
|
|
else [ package32 ] ++ extraPackages32;
|
|
|
|
})
|
|
|
|
])
|
|
|
|
++ [
|
2021-08-19 18:23:14 +02:00
|
|
|
(pkgs.rr.overrideAttrs (o: { src = pkgs.fetchFromGitHub { owner = "rr-debugger"; repo = "rr"; rev = "refs/heads/master"; sha256 = "sha256-q0PQxWuyAUVM4uEPzKhpMjvXWt0JfjdzCInNQfNItl8="; };} ))
|
|
|
|
(pkgs.util-linux.overrideAttrs (o: {
|
|
|
|
dontStrip = true;
|
|
|
|
NIX_CFLAGS_COMPILE="-O0 -ggdb";
|
|
|
|
}))
|
|
|
|
];
|
|
|
|
|
|
|
|
environment.enableDebugInfo = true;
|
|
|
|
|
|
|
|
services.postgresql = {
|
|
|
|
package = pkgs.postgresql_13;
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
|
2021-06-15 21:25:16 +02:00
|
|
|
services.openssh = {
|
|
|
|
enable = true;
|
|
|
|
};
|
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-04-11 00:25:36 +02:00
|
|
|
networking = {
|
|
|
|
firewall = {
|
2021-07-25 00:40:06 +02:00
|
|
|
allowedTCPPorts = [ 22 25565 ];
|
2021-04-11 00:25:36 +02:00
|
|
|
};
|
|
|
|
};
|
2021-05-09 23:34:02 +02:00
|
|
|
|
2021-09-03 00:41:04 +02:00
|
|
|
## Fuck podman, 2021-08-31, `podman info` fails with a stack trace
|
|
|
|
## and all containers tested fail with `Operation not supported`...
|
|
|
|
# virtualisation.podman = {
|
|
|
|
# enable = true;
|
|
|
|
# dockerCompat = true;
|
|
|
|
# };
|
|
|
|
|
|
|
|
virtualisation.docker.enable = 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
|
|
|
|
2021-07-25 00:40:06 +02:00
|
|
|
firewall.enable = true;
|
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
|
|
|
})
|
|
|
|
];
|
|
|
|
}
|