nixos/hosts/faunus-ater/default.nix

114 lines
3.6 KiB
Nix
Raw Normal View History

2022-05-27 18:11:47 +02:00
{
pkgs,
lib,
config,
inputs,
2022-05-27 18:11:47 +02:00
...
}: let
sopsPath = key: config.sops.secrets.${key}.path;
in {
imports = [
inputs.nixos-hardware.nixosModules.common-cpu-intel #-cpu-only
2024-01-15 15:59:54 +01:00
../../modules/nginx-reverse-proxy.nix
../../hardware/asrock-z370-i3-black-box.nix
./modules/forgejo.nix
2024-01-15 15:59:54 +01:00
./modules/home-assistant.nix
./modules/hydra.nix
./modules/komga.nix
./modules/mealie.nix
./modules/nix-serve.nix
2024-01-15 15:59:54 +01:00
./modules/paperless.nix
./modules/photoprism.nix
./modules/restic.nix
./modules/seaweedfs.nix
2024-01-15 15:59:54 +01:00
./modules/timetagger.nix
./modules/trilium.nix
];
config = {
networking.hostName = "faunus-ater";
networking.hostId = "a4d7bec4";
networking.interfaces.eno1.useDHCP = true;
2022-05-27 18:11:47 +02:00
# === Make sure ZFS works ===
# Source: https://nixos.wiki/wiki/ZFS
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
Update lockfile Fix flake nixConfig, do not override cache.nixos. Fix Kernel version for hosts using zfs. Fix path change in nix-colors library. • Updated input '2i-emulator': 'github:klemens/2i-emulator/3bd74bdeffbc6340ef4455269090cf50d07e2e5f' (2020-06-07) → 'github:klemens/2i-emulator/dbd022bce6ef22a798c36c2b22915ab72b64822d' (2022-06-05) • Updated input 'cataclysm-dda': 'github:CleverRaven/Cataclysm-DDA/5f60b52c16d71e42824cdc6244dba937a954f383' (2022-05-14) → 'github:CleverRaven/Cataclysm-DDA/f6be61e24299d493f714b4b1fe5189deeb5a4c06' (2022-06-16) • Updated input 'colmena': 'github:zhaofengli/colmena/11289dd7ff71f75bd252525167c5a9f685c06bcf' (2022-04-04) → 'github:zhaofengli/colmena/1b3c272b5873f809c18434924d99967c73d4e2cf' (2022-06-10) • Updated input 'colmena/flake-compat': 'github:edolstra/flake-compat/64a525ee38886ab9028e6f61790de0832aa3ef03' (2022-03-25) → 'github:edolstra/flake-compat/b4a34015c698c7793d592d66adbab377907a2be8' (2022-04-19) • Updated input 'colmena/stable': 'github:NixOS/nixpkgs/0aac710801aec4ba545527cf41a5706028fe6271' (2022-04-03) → 'github:NixOS/nixpkgs/ec6eaba9dfcfdd11547d75a193e91e26701bf7e3' (2022-05-31) • Updated input 'colmena/utils': 'github:numtide/flake-utils/0f8662f1319ad6abf89b3380dd2722369fc51ade' (2022-03-26) → 'github:numtide/flake-utils/1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1' (2022-05-30) • Updated input 'fenix': 'github:nix-community/fenix/1d50f0152aabfb527e90488ed18d9e22190f14cf' (2022-04-15) → 'github:nix-community/fenix/720b54260dee864d2a21745bd2bb55223f58e297' (2022-06-16) • Updated input 'fenix/rust-analyzer-src': 'github:rust-analyzer/rust-analyzer/7ce3ca5aabb906ac06c5132ef5b333a7c3af1b98' (2022-04-14) → 'github:rust-lang/rust-analyzer/519d7484f3b1beb25dec9f2249adeaaa21033433' (2022-06-15) • Updated input 'home-manager': 'github:nix-community/home-manager/d49d68f4196d32c5039cb9e91d730cee894f6f14' (2022-04-15) → 'github:nix-community/home-manager/504d6de6a061993c3f585f9a86c6a9f68927b1c0' (2022-06-15) • Added input 'home-manager/flake-compat': 'github:edolstra/flake-compat/b4a34015c698c7793d592d66adbab377907a2be8' (2022-04-19) • Added input 'home-manager/nmd': 'gitlab:rycee/nmd/9e7a20e6ee3f6751f699f79c0b299390f81f7bcd' (2022-05-23) • Added input 'home-manager/nmt': 'gitlab:rycee/nmt/d83601002c99b78c89ea80e5e6ba21addcfe12ae' (2022-03-23) • Added input 'home-manager/utils': 'github:numtide/flake-utils/1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1' (2022-05-30) • Updated input 'hydra': 'github:NixOS/hydra/c44d9d9e917f8f02ddb5c01a8620c439993540b6' (2022-04-08) → 'github:NixOS/hydra/cf9f38e43fd81f9298e3f2ff50c8a6ee0acc3af0' (2022-05-31) • Updated input 'nickel': 'github:tweag/nickel/91d9b3e214646387338081fb0278fe75cb3444e9' (2022-04-14) → 'github:tweag/nickel/24bdbde6bc34d99c046a01744413f1152d3a9b4c' (2022-06-14) • Updated input 'nickel/flake-utils': 'github:numtide/flake-utils/0f8662f1319ad6abf89b3380dd2722369fc51ade' (2022-03-26) → 'github:numtide/flake-utils/04c1b180862888302ddfb2e3ad9eaa63afc60cf8' (2022-05-17) • Updated input 'nickel/pre-commit-hooks': 'github:cachix/pre-commit-hooks.nix/b6bc0b21e1617e2b07d8205e7fae7224036dfa4b' (2022-03-01) → 'github:cachix/pre-commit-hooks.nix/521a524771a8e93caddaa0ac1d67d03766a8b0b3' (2022-05-16) • Updated input 'nickel/rust-overlay': 'github:oxalica/rust-overlay/7c90e17cd7c0b9e81d5b23f78b482088ac9961d1' (2022-04-02) → 'github:oxalica/rust-overlay/3bc2619665745f5e6f2efc3d0664edad4f62201b' (2022-05-21) • Updated input 'nix-colors': 'github:Misterio77/nix-colors/fe9fd38b9ddc81afe5d45be6d286472de3f89f03' (2022-05-12) → 'github:Misterio77/nix-colors/2c2e107765b7b2e54b10d3fc2ffe5ed2ca2c7731' (2022-06-12) • Added input 'nix-colors/base16-schemes': 'github:base16-project/base16-schemes/7c247f734eac7f04518c6e28d098635ee8dcabf5' (2022-06-10) • Updated input 'nixForHydra/nixpkgs': 'github:NixOS/nixpkgs/82891b5e2c2359d7e58d08849e4c89511ab94234' (2021-09-28) → 'github:NixOS/nixpkgs/530a53dcbc9437363471167a5e4762c5fcfa34a1' (2022-02-19) • Updated input 'nixos-hardware': 'github:NixOS/nixos-hardware/1a0ccdbf4583ed0fce37eea7955e8ef90f840a9f' (2022-04-13) → 'github:NixOS/nixos-hardware/0cab18a48de7914ef8cad35dca0bb36868f3e1af' (2022-06-01) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/ff9efb0724de5ae0f9db9df2debefced7eb1571d' (2022-04-13) → 'github:NixOS/nixpkgs/6616de389ed55fba6eeba60377fc04732d5a207c' (2022-06-14) • Updated input 'nixpkgs-wayland': 'github:nix-community/nixpkgs-wayland/7edb849271e82862e343c9e86cf38cdc825ba5b0' (2022-04-10) → 'github:nix-community/nixpkgs-wayland/7846b63c3524cabd82778c308d6b3d3fa79211b8' (2022-06-16) • Updated input 'nixpkgs-wayland/cachix': 'github:nixos/nixpkgs/530a53dcbc9437363471167a5e4762c5fcfa34a1' (2022-02-19) → 'github:nixos/nixpkgs/9227bbe43157225414e990b87587ccb1665225d9' (2022-06-14) • Updated input 'nixpkgs-wayland/flake-compat': 'github:edolstra/flake-compat/64a525ee38886ab9028e6f61790de0832aa3ef03' (2022-03-25) → 'github:edolstra/flake-compat/b4a34015c698c7793d592d66adbab377907a2be8' (2022-04-19) • Added input 'nixpkgs-wayland/lib-aggregate': 'github:nix-community/lib-aggregate/e0059f35f3727b94ea833489fd40d9e666f8da79' (2022-06-12) • Added input 'nixpkgs-wayland/lib-aggregate/flake-utils': 'github:numtide/flake-utils/1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1' (2022-05-30) • Added input 'nixpkgs-wayland/lib-aggregate/nixpkgs-lib': 'github:nix-community/nixpkgs.lib/8f09bff20b363b80213186156168126674990368' (2022-06-12) • Updated input 'qmk-udev-rules': 'github:qmk/qmk_firmware/8de4065b099a99bcffe436a038616b0c31ade7c3' (2022-04-14) → 'github:qmk/qmk_firmware/8e128452db4a5c93f0214a1f6ea38e213445235c' (2022-06-16) • Updated input 'radicale_infcloud': 'github:Unrud/RadicaleInfCloud/3e8e476fc2ff1467ea05aa0944058288ccdadf92' (2022-01-19) → 'github:Unrud/RadicaleInfCloud/53d3a95af5b58cfa3242cef645f8d40c731a7d95' (2022-04-18) • Updated input 'sops-nix': 'github:Mic92/sops-nix/c2614c4fe61943b3d280ac1892fcebe6e8eaf8c8' (2022-04-12) → 'github:Mic92/sops-nix/f075361ecbde21535b38e41dfaa28a28f160855c' (2022-06-05) • Added input 'sops-nix/nixpkgs-21_11': 'github:NixOS/nixpkgs/2de556c4cd46a59e8ce2f85ee4dd400983213d45' (2022-06-04) • Added input 'sops-nix/nixpkgs-22_05': 'github:NixOS/nixpkgs/d6cb04299ce8964290ae7fdcb87aa50da0500b5c' (2022-06-04) • Updated input 'utils': 'github:gytis-ivaskevicius/flake-utils-plus/06dba5f3b4fa2cc0bfc98ce9cd6f9a4d8db11d46' (2022-03-14) → 'github:gytis-ivaskevicius/flake-utils-plus/f8d6d1f87b6177e3bc674c29f247bdbf897ba274' (2022-05-16)
2022-06-16 11:14:07 +02:00
# === Can't handle this ===
systemd.enableEmergencyMode = false;
2022-06-08 23:31:35 +02:00
# === Settings ===
settings.ssh.openOutsideVPN = true;
2022-05-27 18:11:47 +02:00
# === ZFS services ===
services.zfs.trim.enable = true;
services.zfs.autoScrub.enable = true;
services.zfs.autoScrub.pools = ["rpool"];
2022-05-27 18:11:47 +02:00
services.fwupd.enable = true;
powerManagement = {
enable = true;
powertop.enable = true;
cpuFreqGovernor = "powersave";
};
2024-01-15 15:59:54 +01:00
# === PODMAN ===
virtualisation.oci-containers.backend = "podman";
virtualisation.podman = {
enable = true;
dockerCompat = true;
extraPackages = with pkgs; [zfs];
};
# Override storage driver
virtualisation.containers.storage.settings = {
storage = {
driver = "zfs";
graphroot = "/var/lib/containers/storage";
runroot = "/run/containers/storage";
};
2022-06-01 19:18:08 +02:00
};
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
# === BACKUPS ===
services.restic.backups = {
# Make sure my 'active IO' disk get's saved once a day
zdirty = {
initialize = true;
repository = "/data/archive/dirty.bak";
timerConfig.OnCalendar = "daily";
paths = lib.singleton "/data/dirty";
pruneOpts = [
"--keep-daily 1"
"--keep-weekly 1"
"--keep-monthly 1"
"--keep-yearly 5"
];
passwordFile = sopsPath "internal-restic-password";
};
};
# === RUNTIME SECRETS ===
2024-01-15 15:59:54 +01:00
sops.defaultSopsFile = ../../secrets/hosts/faunus-ater/secrets.yaml;
sops.age.sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"];
sops.secrets = {
"internal-restic-password" = {};
};
2024-01-15 15:59:54 +01:00
# === SERVICE EXPOSURE ===
2023-10-30 15:35:55 +01:00
# All services that run here, that should be exposed need to be exposed on the VPN
networking.firewall.interfaces.${config.services.tailscale.interfaceName}.allowedTCPPorts = let
selectPort = _: config: config.port;
filterRunningHereAndExposed = lib.attrsets.filterAttrs (_: conf: conf.host == config.networking.hostName && conf ? external && conf.external);
2023-10-30 15:35:55 +01:00
in
lib.attrsets.mapAttrsToList selectPort (filterRunningHereAndExposed config.state.services);
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.05"; # Did you read the comment?
};
2022-05-27 18:11:47 +02:00
}