my nix configs for my servers and desktop

Compare changes

Choose any two refs to compare.

+67
common/python-cuda-dev.nix
···
+
{
+
description = "A Nix-flake-based PyTorch development environment";
+
+
# CUDA binaries are cached by the community.
+
nixConfig = {
+
extra-substituters = [
+
"https://nix-community.cachix.org"
+
];
+
extra-trusted-public-keys = [
+
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
+
];
+
};
+
+
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
+
+
outputs = {
+
self,
+
nixpkgs,
+
}: let
+
supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
+
forEachSupportedSystem = f:
+
nixpkgs.lib.genAttrs supportedSystems (system:
+
f {
+
pkgs = import nixpkgs {
+
inherit system;
+
config.allowUnfree = true;
+
};
+
});
+
in {
+
devShells = forEachSupportedSystem ({pkgs}: let
+
libs = [
+
# PyTorch and Numpy depends on the following libraries.
+
pkgs.cudaPackages.cudatoolkit
+
pkgs.cudaPackages.cudnn
+
pkgs.stdenv.cc.cc.lib
+
pkgs.zlib
+
+
# PyTorch also needs to know where your local "lib/libcuda.so" lives.
+
# If you're not on NixOS, you should provide the right path (likely
+
# another one).
+
"/run/opengl-driver"
+
];
+
in {
+
default = pkgs.mkShell {
+
packages = [
+
pkgs.python312
+
pkgs.python312Packages.venvShellHook
+
];
+
+
env = {
+
CC = "${pkgs.gcc}/bin/gcc"; # For `torch.compile`.
+
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath libs;
+
};
+
+
venvDir = ".venv";
+
postVenvCreation = ''
+
# This is run only when creating the virtual environment.
+
pip install torch==2.5.1 numpy==2.2.2
+
'';
+
postShellHook = ''
+
# This is run every time you enter the devShell.
+
python3 -c "import torch; print('CUDA available' if torch.cuda.is_available() else 'CPU only')"
+
'';
+
};
+
});
+
};
+
}
+2
common/services.nix
···
zfs
nixos-generators
sqlite
+
bun
+
unzip
];
services.openssh.enable = true;
+189 -53
flake.lock
···
"systems": "systems"
},
"locked": {
-
"lastModified": 1750173260,
-
"narHash": "sha256-9P1FziAwl5+3edkfFcr5HeGtQUtrSdk/MksX39GieoA=",
+
"lastModified": 1760836749,
+
"narHash": "sha256-wyT7Pl6tMFbFrs8Lk/TlEs81N6L+VSybPfiIgzU8lbQ=",
"owner": "ryantm",
"repo": "agenix",
-
"rev": "531beac616433bac6f9e2a19feb8e99a22a66baf",
+
"rev": "2f0f812f69f3eb4140157fe15e12739adf82e32a",
"type": "github"
},
"original": {
···
"nixpkgs": "nixpkgs_2"
},
"locked": {
-
"lastModified": 1751705516,
-
"narHash": "sha256-Y099OGYWYHtpYFP4offuV6rldBnpUv4CYk+HwuaQwLU=",
+
"lastModified": 1760953099,
+
"narHash": "sha256-sOKx2YcHa+lWEvaEOIGqLN2WWk1Wf5z6KM02tdfhMtw=",
"owner": "catppuccin",
"repo": "nix",
-
"rev": "719bb50ca2c99bc9c077669a48bfd9815493a11d",
+
"rev": "f5b21876888265d2fee7fb0640d1b66a1c1c6503",
"type": "github"
},
"original": {
···
"type": "github"
}
},
+
"disko": {
+
"inputs": {
+
"nixpkgs": "nixpkgs_3"
+
},
+
"locked": {
+
"lastModified": 1736864502,
+
"narHash": "sha256-ItkIZyebGvNH2dK9jVGzJHGPtb6BSWLN8Gmef16NeY0=",
+
"owner": "nix-community",
+
"repo": "disko",
+
"rev": "0141aabed359f063de7413f80d906e1d98c0c123",
+
"type": "github"
+
},
+
"original": {
+
"owner": "nix-community",
+
"ref": "v1.11.0",
+
"repo": "disko",
+
"type": "github"
+
}
+
},
+
"flake-compat": {
+
"locked": {
+
"lastModified": 1696426674,
+
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
+
"owner": "edolstra",
+
"repo": "flake-compat",
+
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
+
"type": "github"
+
},
+
"original": {
+
"owner": "edolstra",
+
"repo": "flake-compat",
+
"type": "github"
+
}
+
},
"flake-utils": {
"inputs": {
"systems": "systems_2"
···
},
"flake-utils_3": {
"inputs": {
-
"systems": "systems_4"
+
"systems": "systems_5"
},
"locked": {
"lastModified": 1681202837,
···
]
},
"locked": {
-
"lastModified": 1751824240,
-
"narHash": "sha256-aDDC0CHTlL7QDKWWhdbEgVPK6KwWt+ca0QkmHYZxMzI=",
+
"lastModified": 1761235135,
+
"narHash": "sha256-cux9xeceLIER1lBxUa1gMafkz7gg5ntcUmJBynWdBWI=",
"owner": "nix-community",
"repo": "home-manager",
-
"rev": "fd9e55f5fac45a26f6169310afca64d56b681935",
+
"rev": "0adf9ba3f567da2d53af581a857aacf671aaa547",
"type": "github"
},
"original": {
···
]
},
"locked": {
-
"lastModified": 1743604125,
-
"narHash": "sha256-ZD61DNbsBt1mQbinAaaEqKaJk2RFo9R/j+eYWeGMx7A=",
+
"lastModified": 1752603129,
+
"narHash": "sha256-S+wmHhwNQ5Ru689L2Gu8n1OD6s9eU9n9mD827JNR+kw=",
"owner": "nix-community",
"repo": "home-manager",
-
"rev": "180fd43eea296e62ae68e079fcf56aba268b9a1a",
+
"rev": "e8c19a3cec2814c754f031ab3ae7316b64da085b",
"type": "github"
},
"original": {
···
"lix": {
"flake": false,
"locked": {
-
"lastModified": 1746827285,
-
"narHash": "sha256-hsFe4Tsqqg4l+FfQWphDtjC79WzNCZbEFhHI8j2KJzw=",
-
"rev": "47aad376c87e2e65967f17099277428e4b3f8e5a",
+
"lastModified": 1753223229,
+
"narHash": "sha256-tkT4aCZZE6IEmjYotOzKKa2rV3pGpH3ZREeQn7ACgdU=",
+
"rev": "7ac20fc47cf2f1b7469c7a2f379e5a3a51a6789a",
"type": "tarball",
-
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/47aad376c87e2e65967f17099277428e4b3f8e5a.tar.gz?rev=47aad376c87e2e65967f17099277428e4b3f8e5a"
+
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/7ac20fc47cf2f1b7469c7a2f379e5a3a51a6789a.tar.gz?rev=7ac20fc47cf2f1b7469c7a2f379e5a3a51a6789a"
},
"original": {
"type": "tarball",
-
"url": "https://git.lix.systems/lix-project/lix/archive/2.93.0.tar.gz"
+
"url": "https://git.lix.systems/lix-project/lix/archive/release-2.93.tar.gz"
}
},
"lix-module": {
···
]
},
"locked": {
-
"lastModified": 1746838955,
-
"narHash": "sha256-11R4K3iAx4tLXjUs+hQ5K90JwDABD/XHhsM9nkeS5N8=",
-
"rev": "cd2a9c028df820a83ca2807dc6c6e7abc3dfa7fc",
+
"lastModified": 1753282722,
+
"narHash": "sha256-KYMUrTV7H/RR5/HRnjV5R3rRIuBXMemyJzTLi50NFTs=",
+
"rev": "46a9e8fcfe4be72b4c7c8082ee11d2c42da1e873",
"type": "tarball",
-
"url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/cd2a9c028df820a83ca2807dc6c6e7abc3dfa7fc.tar.gz?rev=cd2a9c028df820a83ca2807dc6c6e7abc3dfa7fc"
+
"url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/46a9e8fcfe4be72b4c7c8082ee11d2c42da1e873.tar.gz?rev=46a9e8fcfe4be72b4c7c8082ee11d2c42da1e873"
},
"original": {
"type": "tarball",
-
"url": "https://git.lix.systems/lix-project/nixos-module/archive/2.93.0.tar.gz"
+
"url": "https://git.lix.systems/lix-project/nixos-module/archive/2.93.3-1.tar.gz"
}
},
"microvm": {
···
"spectrum": "spectrum"
},
"locked": {
-
"lastModified": 1751732733,
-
"narHash": "sha256-MuaFFGHdShvGdHKrd3PUI2om+njixdG/1dGlglRdK8Q=",
+
"lastModified": 1760574296,
+
"narHash": "sha256-S3gIp6Wd9vQ2RYDxcbHM2CIYgDtogbwzSdu38WABKaQ=",
"owner": "astro",
"repo": "microvm.nix",
-
"rev": "9d3d845ccb1a3f81747d027e95b110d4637468d0",
+
"rev": "42628f7c61b02d385ce2cb1f66f9be333ac20140",
"type": "github"
},
"original": {
···
},
"nixos-hardware": {
"locked": {
-
"lastModified": 1751432711,
-
"narHash": "sha256-136MeWtckSHTN9Z2WRNRdZ8oRP3vyx3L8UxeBYE+J9w=",
+
"lastModified": 1760958188,
+
"narHash": "sha256-2m1S4jl+GEDtlt2QqeHil8Ny456dcGSKJAM7q3j/BFU=",
"owner": "nixos",
"repo": "nixos-hardware",
-
"rev": "497ae1357f1ac97f1aea31a4cb74ad0d534ef41f",
+
"rev": "d6645c340ef7d821602fd2cd199e8d1eed10afbc",
"type": "github"
},
"original": {
···
},
"nixpkgs": {
"locked": {
-
"lastModified": 1745391562,
-
"narHash": "sha256-sPwcCYuiEopaafePqlG826tBhctuJsLx/mhKKM5Fmjo=",
+
"lastModified": 1754028485,
+
"narHash": "sha256-IiiXB3BDTi6UqzAZcf2S797hWEPCRZOwyNThJIYhUfk=",
"owner": "NixOS",
"repo": "nixpkgs",
-
"rev": "8a2f738d9d1f1d986b5a4cd2fd2061a7127237d7",
+
"rev": "59e69648d345d6e8fef86158c555730fa12af9de",
"type": "github"
},
"original": {
"owner": "NixOS",
-
"ref": "nixos-unstable",
+
"ref": "nixos-25.05",
"repo": "nixpkgs",
"type": "github"
}
},
+
"nixpkgs-stable": {
+
"locked": {
+
"lastModified": 1748437600,
+
"narHash": "sha256-hYKMs3ilp09anGO7xzfGs3JqEgUqFMnZ8GMAqI6/k04=",
+
"owner": "NixOS",
+
"repo": "nixpkgs",
+
"rev": "7282cb574e0607e65224d33be8241eae7cfe0979",
+
"type": "github"
+
},
+
"original": {
+
"id": "nixpkgs",
+
"ref": "nixos-25.05",
+
"type": "indirect"
+
}
+
},
+
"nixpkgs-unstable": {
+
"locked": {
+
"lastModified": 1723637854,
+
"narHash": "sha256-med8+5DSWa2UnOqtdICndjDAEjxr5D7zaIiK4pn0Q7c=",
+
"owner": "NixOS",
+
"repo": "nixpkgs",
+
"rev": "c3aa7b8938b17aebd2deecf7be0636000d62a2b9",
+
"type": "github"
+
},
+
"original": {
+
"id": "nixpkgs",
+
"ref": "nixos-unstable",
+
"type": "indirect"
+
}
+
},
"nixpkgs_2": {
"locked": {
-
"lastModified": 1750776420,
-
"narHash": "sha256-/CG+w0o0oJ5itVklOoLbdn2dGB0wbZVOoDm4np6w09A=",
+
"lastModified": 1760524057,
+
"narHash": "sha256-EVAqOteLBFmd7pKkb0+FIUyzTF61VKi7YmvP1tw4nEw=",
"owner": "NixOS",
"repo": "nixpkgs",
-
"rev": "30a61f056ac492e3b7cdcb69c1e6abdcf00e39cf",
+
"rev": "544961dfcce86422ba200ed9a0b00dd4b1486ec5",
"type": "github"
},
"original": {
···
},
"nixpkgs_3": {
"locked": {
-
"lastModified": 1751637120,
-
"narHash": "sha256-xVNy/XopSfIG9c46nRmPaKfH1Gn/56vQ8++xWA8itO4=",
+
"lastModified": 1736241350,
+
"narHash": "sha256-CHd7yhaDigUuJyDeX0SADbTM9FXfiWaeNyY34FL1wQU=",
+
"owner": "NixOS",
+
"repo": "nixpkgs",
+
"rev": "8c9fd3e564728e90829ee7dbac6edc972971cd0f",
+
"type": "github"
+
},
+
"original": {
+
"owner": "NixOS",
+
"ref": "nixpkgs-unstable",
+
"repo": "nixpkgs",
+
"type": "github"
+
}
+
},
+
"nixpkgs_4": {
+
"locked": {
+
"lastModified": 1761016216,
+
"narHash": "sha256-G/iC4t/9j/52i/nm+0/4ybBmAF4hzR8CNHC75qEhjHo=",
"owner": "nixos",
"repo": "nixpkgs",
-
"rev": "5c724ed1388e53cc231ed98330a60eb2f7be4be3",
+
"rev": "481cf557888e05d3128a76f14c76397b7d7cc869",
"type": "github"
},
"original": {
"owner": "nixos",
-
"ref": "nixos-unstable",
+
"ref": "nixos-25.05",
"repo": "nixpkgs",
"type": "github"
}
},
-
"nixpkgs_4": {
+
"nixpkgs_5": {
"locked": {
"lastModified": 1682134069,
"narHash": "sha256-TnI/ZXSmRxQDt2sjRYK/8j8iha4B4zP2cnQCZZ3vp7k=",
···
"type": "indirect"
}
},
+
"proxmox-nixos": {
+
"inputs": {
+
"flake-compat": "flake-compat",
+
"nixpkgs-stable": "nixpkgs-stable",
+
"nixpkgs-unstable": "nixpkgs-unstable",
+
"utils": "utils"
+
},
+
"locked": {
+
"lastModified": 1758650077,
+
"narHash": "sha256-ZeRtJimtk0Faiq7DPZEQNGipda3TaR4QXp0TAzu934Q=",
+
"owner": "SaumonNet",
+
"repo": "proxmox-nixos",
+
"rev": "ce8768f43b4374287cd8b88d8fa9c0061e749d9a",
+
"type": "github"
+
},
+
"original": {
+
"owner": "SaumonNet",
+
"repo": "proxmox-nixos",
+
"type": "github"
+
}
+
},
"root": {
"inputs": {
"agenix": "agenix",
"catppuccin": "catppuccin",
+
"disko": "disko",
"home-manager": "home-manager_2",
"lix-module": "lix-module",
"microvm": "microvm",
"nixos-hardware": "nixos-hardware",
-
"nixpkgs": "nixpkgs_3",
+
"nixpkgs": "nixpkgs_4",
+
"proxmox-nixos": "proxmox-nixos",
"vscode-server": "vscode-server",
"zen-browser": "zen-browser"
}
···
"spectrum": {
"flake": false,
"locked": {
-
"lastModified": 1751265943,
-
"narHash": "sha256-XoHSo6GEElzRUOYAEg/jlh5c8TDsyDESFIux3nU/NMc=",
+
"lastModified": 1759482047,
+
"narHash": "sha256-H1wiXRQHxxPyMMlP39ce3ROKCwI5/tUn36P8x6dFiiQ=",
"ref": "refs/heads/main",
-
"rev": "37c8663fab86fdb202fece339ef7ac7177ffc201",
-
"revCount": 904,
+
"rev": "c5d5786d3dc938af0b279c542d1e43bce381b4b9",
+
"revCount": 996,
"type": "git",
"url": "https://spectrum-os.org/git/spectrum"
},
···
"type": "github"
}
},
+
"systems_5": {
+
"locked": {
+
"lastModified": 1681028828,
+
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+
"owner": "nix-systems",
+
"repo": "default",
+
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+
"type": "github"
+
},
+
"original": {
+
"owner": "nix-systems",
+
"repo": "default",
+
"type": "github"
+
}
+
},
+
"utils": {
+
"inputs": {
+
"systems": "systems_4"
+
},
+
"locked": {
+
"lastModified": 1710146030,
+
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
+
"owner": "numtide",
+
"repo": "flake-utils",
+
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
+
"type": "github"
+
},
+
"original": {
+
"owner": "numtide",
+
"repo": "flake-utils",
+
"type": "github"
+
}
+
},
"vscode-server": {
"inputs": {
"flake-utils": "flake-utils_3",
-
"nixpkgs": "nixpkgs_4"
+
"nixpkgs": "nixpkgs_5"
},
"locked": {
-
"lastModified": 1750353031,
-
"narHash": "sha256-Bx7DOPLhkr8Z60U9Qw4l0OidzHoqLDKQH5rDV5ef59A=",
+
"lastModified": 1753541826,
+
"narHash": "sha256-foGgZu8+bCNIGeuDqQ84jNbmKZpd+JvnrL2WlyU4tuU=",
"owner": "nix-community",
"repo": "nixos-vscode-server",
-
"rev": "4ec4859b12129c0436b0a471ed1ea6dd8a317993",
+
"rev": "6d5f074e4811d143d44169ba4af09b20ddb6937d",
"type": "github"
},
"original": {
···
]
},
"locked": {
-
"lastModified": 1751779188,
-
"narHash": "sha256-o1PidAPLtSSqI6isos6v/e6s7t3zQ56NBYhXVaUesXc=",
+
"lastModified": 1761180075,
+
"narHash": "sha256-V4WLeUQ4gCGZiVihlXWBOZ/1FNcL0jM4zgTY1haJLvY=",
"owner": "0xc000022070",
"repo": "zen-browser-flake",
-
"rev": "b3200f40877a3e0a679070d96f8793a06105c06e",
+
"rev": "771a2604606905d8c0ffe3b818dc2cc5bd1405d8",
"type": "github"
},
"original": {
+37 -4
flake.nix
···
# flake.nix
{
inputs = {
-
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
+
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
nixos-hardware.url = "github:nixos/nixos-hardware/master";
+
proxmox-nixos.url = "github:SaumonNet/proxmox-nixos";
+
lix-module = {
-
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.93.0.tar.gz";
+
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.93.3-1.tar.gz";
inputs.nixpkgs.follows = "nixpkgs";
};
···
};
microvm.url = "github:astro/microvm.nix";
microvm.inputs.nixpkgs.follows = "nixpkgs";
+
+
disko.url = "github:nix-community/disko/v1.11.0";
catppuccin.url = "github:catppuccin/nix";
home-manager = {
···
./hosts/valefar
lix-module.nixosModules.default
vscode-server.nixosModules.default
-
microvm.nixosModules.host
+
proxmox-nixos.nixosModules.proxmox-ve
+
+
({ pkgs, lib, ... }: {
+
services.proxmox-ve = {
+
enable = true;
+
ipAddress = "10.0.0.30";
+
};
+
+
nixpkgs.overlays = [
+
proxmox-nixos.overlays.x86_64-linux
+
];
+
})
+
{ imports = builtins.attrValues nixosModules; }
];
};
···
{ imports = builtins.attrValues nixosModules; }
];
};
+
+
baal = nixpkgs.lib.nixosSystem {
+
system = "aarch64-linux";
+
specialArgs = {
+
inherit inputs;
+
system = "aarch64-linux";
+
};
+
modules = [
+
./hosts/baal
+
+
agenix.nixosModules.default
+
disko.nixosModules.disko
+
+
{ imports = builtins.attrValues nixosModules; }
+
+
];
+
};
};
};
-
}
+
}
+58
hosts/baal/default.nix
···
+
{ config, lib, pkgs, modulesPath, inputs, ... }:
+
{
+
imports = [
+
./hardware.nix
+
./secrets.nix
+
+
../../common/system.nix
+
../../common/users.nix
+
../../common/services.nix
+
+
../../host-secrets.nix
+
];
+
+
boot = {
+
loader = {
+
systemd-boot.enable = true;
+
efi = {
+
canTouchEfiVariables = true;
+
efiSysMountPoint = "/boot";
+
};
+
};
+
initrd.systemd.enable = true;
+
};
+
+
system.stateVersion = "24.11";
+
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
+
+
systemd.targets.multi-user.enable = true;
+
+
networking = {
+
hostName = "baal";
+
hostId = "aaaaaaaa";
+
networkmanager.enable = true;
+
};
+
+
services.fail2ban = {
+
enable = true;
+
# Ban IP after 5 failures
+
maxretry = 5;
+
ignoreIP = [
+
"10.0.0.0/8" "172.16.0.0/12" "192.168.0.0/16" "100.64.0.0/10"
+
];
+
bantime = "24h"; # Ban IPs for one day on the first ban
+
bantime-increment = {
+
enable = true; # Enable increment of bantime after each violation
+
multipliers = "1 2 4 8 16 32 64";
+
maxtime = "168h"; # Do not ban for more than 1 week
+
overalljails = true; # Calculate the bantime based on all the violations
+
};
+
};
+
+
virtualisation.docker = {
+
enable = true;
+
enableOnBoot = true;
+
};
+
+
documentation.enable = false;
+
}
+55
hosts/baal/hardware.nix
···
+
# Do not modify this file! It was generated by ‘nixos-generate-config’
+
# and may be overwritten by future invocations. Please make changes
+
# to /etc/nixos/configuration.nix instead.
+
{ config, lib, pkgs, modulesPath, ... }:
+
+
{
+
imports =
+
[ (modulesPath + "/profiles/qemu-guest.nix")
+
];
+
+
boot.initrd.availableKernelModules = [ "xhci_pci" "virtio_pci" "virtio_scsi" "usbhid" ];
+
boot.initrd.kernelModules = [ ];
+
boot.kernelModules = [ ];
+
boot.extraModulePackages = [ ];
+
+
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
+
# (the default) this is the recommended approach. When using systemd-networkd it's
+
# still possible to use this option, but it's recommended to use it in conjunction
+
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
+
networking.useDHCP = lib.mkDefault true;
+
# networking.interfaces.enp0s6.useDHCP = lib.mkDefault true;
+
+
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
+
+
disko.devices = {
+
disk = {
+
main = {
+
type = "disk";
+
device = "/dev/sda";
+
content = {
+
type = "gpt";
+
partitions = {
+
boot = {
+
size = "512M";
+
type = "EF00";
+
content = {
+
type = "filesystem";
+
format = "vfat";
+
mountpoint = "/boot";
+
};
+
};
+
root = {
+
size = "100%";
+
content = {
+
type = "filesystem";
+
format = "ext4";
+
mountpoint = "/";
+
};
+
};
+
};
+
};
+
};
+
};
+
};
+
}
+3
hosts/baal/secrets.nix
···
+
{
+
+
}
+16
hosts/buer/default.nix
···
useDHCP = false;
};
+
services.fail2ban = {
+
enable = true;
+
# Ban IP after 5 failures
+
maxretry = 5;
+
ignoreIP = [
+
"10.0.0.0/8" "172.16.0.0/12" "192.168.0.0/16" "100.64.0.0/10"
+
];
+
bantime = "24h"; # Ban IPs for one day on the first ban
+
bantime-increment = {
+
enable = true; # Enable increment of bantime after each violation
+
multipliers = "1 2 4 8 16 32 64";
+
maxtime = "168h"; # Do not ban for more than 1 week
+
overalljails = true; # Calculate the bantime based on all the violations
+
};
+
};
+
# Static IP configuration via systemd-networkd
systemd.network = {
enable = true;
-3
hosts/focalor/default.nix
···
virtualisation.docker = {
enable = true;
enableOnBoot = true;
-
package = pkgs.docker.override {
-
buildGoModule = pkgs.buildGo123Module;
-
};
};
# =============================================================================
-7
hosts/focalor/vfio.nix
···
package = pkgs.qemu_kvm;
runAsRoot = true;
swtpm.enable = true;
-
ovmf = {
-
enable = true;
-
packages = [(pkgs.OVMF.override {
-
secureBoot = true;
-
tpmSupport = true;
-
}).fd];
-
};
};
hooks.qemu = {
win11 = ./scripts/vm-win11-hook.sh;
+64
hosts/valefar/backup.nix
···
+
# Do not modify this file! It was generated by ‘nixos-generate-config’
+
# and may be overwritten by future invocations. Please make changes
+
# to /etc/nixos/configuration.nix instead.
+
{ config, lib, pkgs, modulesPath, ... }:
+
+
{
+
imports =
+
[ (modulesPath + "/installer/scan/not-detected.nix")
+
];
+
+
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "mpt3sas" "sd_mod" ];
+
boot.initrd.kernelModules = [ ];
+
boot.kernelModules = [ "kvm-amd" ];
+
boot.extraModulePackages = [ ];
+
+
fileSystems."/" = {
+
device = "/dev/disk/by-uuid/17b399da-2210-4493-9ae3-c65b20b992a0";
+
fsType = "ext4";
+
};
+
+
fileSystems."/boot" =
+
{ device = "/dev/disk/by-uuid/6340-211B";
+
fsType = "vfat";
+
options = [ "fmask=0022" "dmask=0022" ];
+
};
+
+
/* fileSystems."/garage" = {
+
device = "garage";
+
fsType = "zfs";
+
};
+
+
fileSystems."/storage" = {
+
device = "storage";
+
fsType = "zfs";
+
};*/
+
+
swapDevices = [ ];
+
+
# Fan Control
+
hardware.fancontrol = {
+
enable = false;
+
config = ''
+
INTERVAL=10
+
DEVPATH=hwmon1=devices/platform/nct6775.2592 hwmon2=devices/platform/coretemp.0
+
DEVNAME=hwmon1=nct6795 hwmon2=coretemp
+
FCTEMPS=hwmon1/pwm2=hwmon2/temp1_input hwmon1/pwm3=hwmon2/temp1_input
+
FCFANS=hwmon1/pwm2=hwmon1/fan2_input hwmon1/pwm3=hwmon1/fan3_input
+
MINTEMP=hwmon1/pwm2=20 hwmon1/pwm3=20
+
MAXTEMP=hwmon1/pwm2=65 hwmon1/pwm3=60
+
MINSTART=hwmon1/pwm2=38 hwmon1/pwm3=75
+
MINSTOP=hwmon1/pwm2=28 hwmon1/pwm3=75
+
MINPWM=hwmon1/pwm2=28 hwmon1/pwm3=75
+
MAXPWM=hwmon1/pwm2=150 hwmon1/pwm3=105
+
'';
+
};
+
+
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
+
# (the default) this is the recommended approach. When using systemd-networkd it's
+
# still possible to use this option, but it's recommended to use it in conjunction
+
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
+
networking.useDHCP = lib.mkDefault true;
+
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
+
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
+
}
+34 -15
hosts/valefar/default.nix
···
# IMPORTS
# =============================================================================
imports = [
-
# Host-specific hardware
./hardware.nix
./secrets.nix
../../common/nvidia.nix
-
# Common secrets
../../host-secrets.nix
-
# Common modules shared across hosts
../../common/system.nix
../../common/users.nix
../../common/services.nix
../../common/efi.nix
-
# Hardware-specific (commented out)
-
# ../../common/nvidia.nix
+
../../common/nvidia.nix
];
# =============================================================================
···
system.stateVersion = "24.11";
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
-
# Intel microcode updates
-
hardware.cpu.intel.updateMicrocode = lib.mkDefault
+
hardware.cpu.amd.updateMicrocode = lib.mkDefault
config.hardware.enableRedistributableFirmware;
# =============================================================================
···
networking.hostId = "2a07da90";
networking.firewall.enable = false;
+
services.proxmox-ve.bridges = [ "vmbr0" ];
+
systemd.network.networks."10-lan" = {
-
matchConfig.Name = ["enp6s0" "vm-*"];
+
matchConfig.Name = ["enp6s0"];
networkConfig = {
-
Bridge = "br0";
+
Bridge = "vmbr0";
};
};
systemd.network.netdevs."br0" = {
netdevConfig = {
-
Name = "br0";
+
Name = "vmbr0";
Kind = "bridge";
};
};
systemd.network.networks."10-lan-bridge" = {
-
matchConfig.Name = "br0";
+
matchConfig.Name = "vmbr0";
networkConfig = {
Address = ["10.0.0.30/24" "2601:5c2:8400:26c0::30/64"];
Gateway = "10.0.0.1";
···
"d /storage/immich/photos 0755 immich immich -"
"Z /storage/immich 0755 immich immich -"
"d /storage/tm_share 0755 regent users"
+
"Z /garage/ 0755 garage garage -"
];
# =============================================================================
···
nodejsPackage = pkgs.nodejs_20;
};
+
services.ollama = {
+
enable = true;
+
loadModels = ["deepseek-r1:1.5b" "gemma3:12b"];
+
acceleration = "cuda";
+
};
+
+
services.open-webui.enable = true;
+
# =============================================================================
# VIRTUALIZATION
# =============================================================================
virtualisation.docker = {
enable = true;
enableOnBoot = true;
-
package = pkgs.docker.override {
-
buildGoModule = pkgs.buildGo123Module;
+
};
+
+
services.fail2ban = {
+
enable = true;
+
# Ban IP after 5 failures
+
maxretry = 5;
+
ignoreIP = [
+
"10.0.0.0/8" "172.16.0.0/12" "192.168.0.0/16" "100.64.0.0/10"
+
];
+
bantime = "24h"; # Ban IPs for one day on the first ban
+
bantime-increment = {
+
enable = true; # Enable increment of bantime after each violation
+
multipliers = "1 2 4 8 16 32 64";
+
maxtime = "168h"; # Do not ban for more than 1 week
+
overalljails = true; # Calculate the bantime based on all the violations
};
};
···
# =============================================================================
# VIRTUAL MACHINES
# =============================================================================
-
systemd.services."microvm@".after = [ "microvm-virtiofsd@%i.service" ];
+
/*systemd.services."microvm@".after = [ "microvm-virtiofsd@%i.service" ];
microvm.vms = {
gameservers = {
···
microvm.autostart = [
"gameservers"
-
];
+
];*/
}
-80
hosts/valefar/gamevm.nix
···
-
{ config, lib, pkgs, modulesPath, microvm, inputs, ... }:
-
-
{
-
# =============================================================================
-
# IMPORTS
-
# =============================================================================
-
imports = [
-
# Common modules shared across hosts
-
../../common/system.nix
-
../../common/users.nix
-
../../common/services.nix
-
];
-
-
system.stateVersion = "25.05";
-
networking.hostName = "gameservers";
-
-
virtualisation.docker = {
-
enable = true;
-
enableOnBoot = true;
-
};
-
-
systemd.network.networks."20-lan" = {
-
matchConfig.Type = "ether";
-
networkConfig = {
-
Address = [
-
"10.0.0.31/24"
-
"2601:5c2:8400:26c0::31/64"
-
];
-
Gateway = "10.0.0.1";
-
DNS = [
-
"10.0.0.210"
-
"1.1.1.1"
-
"1.0.0.1"
-
];
-
IPv6AcceptRA = true;
-
DHCP = "no";
-
};
-
};
-
-
systemd.network.networks."19-docker" = {
-
matchConfig.Name = "veth*";
-
linkConfig = {
-
Unmanaged = true;
-
};
-
};
-
-
microvm = {
-
interfaces = [
-
{
-
type = "tap";
-
id = "vm-test1";
-
mac = "02:00:00:00:00:01";
-
}
-
];
-
-
shares = [
-
{
-
source = "/nix/store";
-
mountPoint = "/nix/.ro-store";
-
tag = "ro-store";
-
proto = "virtiofs";
-
}
-
{
-
source = "/etc/ssh";
-
mountPoint = "/etc/ssh";
-
tag = "ssh";
-
proto = "virtiofs";
-
}
-
{
-
source = "/home/regent/gamedata";
-
mountPoint = "/root/gamedata";
-
tag = "gamedata";
-
proto = "virtiofs";
-
}
-
];
-
-
vcpu = 4;
-
mem = 8192;
-
};
-
}
+12 -36
hosts/valefar/hardware.nix
···
[ (modulesPath + "/installer/scan/not-detected.nix")
];
-
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "mpt3sas" "sd_mod" ];
+
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "mpt3sas" "nvme" "usbhid" "uas" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
-
fileSystems."/" = {
-
device = "/dev/disk/by-uuid/17b399da-2210-4493-9ae3-c65b20b992a0";
-
fsType = "ext4";
-
};
+
fileSystems."/" =
+
{ device = "/dev/disk/by-uuid/e02d1d07-3bc8-4d1d-a301-6d589f4b4b6d";
+
fsType = "ext4";
+
};
fileSystems."/boot" =
-
{ device = "/dev/disk/by-uuid/6340-211B";
+
{ device = "/dev/disk/by-uuid/B3DE-0187";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
-
/* fileSystems."/garage" = {
-
device = "garage";
-
fsType = "zfs";
-
};
-
-
fileSystems."/storage" = {
-
device = "storage";
-
fsType = "zfs";
-
};*/
-
-
swapDevices = [ ];
-
-
# Fan Control
-
hardware.fancontrol = {
-
enable = false;
-
config = ''
-
INTERVAL=10
-
DEVPATH=hwmon1=devices/platform/nct6775.2592 hwmon2=devices/platform/coretemp.0
-
DEVNAME=hwmon1=nct6795 hwmon2=coretemp
-
FCTEMPS=hwmon1/pwm2=hwmon2/temp1_input hwmon1/pwm3=hwmon2/temp1_input
-
FCFANS=hwmon1/pwm2=hwmon1/fan2_input hwmon1/pwm3=hwmon1/fan3_input
-
MINTEMP=hwmon1/pwm2=20 hwmon1/pwm3=20
-
MAXTEMP=hwmon1/pwm2=65 hwmon1/pwm3=60
-
MINSTART=hwmon1/pwm2=38 hwmon1/pwm3=75
-
MINSTOP=hwmon1/pwm2=28 hwmon1/pwm3=75
-
MINPWM=hwmon1/pwm2=28 hwmon1/pwm3=75
-
MAXPWM=hwmon1/pwm2=150 hwmon1/pwm3=105
-
'';
-
};
+
swapDevices =
+
[ { device = "/dev/disk/by-uuid/c8f24f31-49e0-486c-9f63-1d31b2e36ce9"; }
+
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
+
# networking.interfaces.enp6s0.useDHCP = lib.mkDefault true;
+
+
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
-
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
}
+3 -2
modules/forgejo/default.nix
···
SSH_LISTEN_PORT = 2222;
SSH_PORT = 2222;
START_SSH_SERVER = true;
+
SSH_DOMAIN = "sgit.nekomimi.pet";
};
-
# service.DISABLE_REGISTRATION = true;
+
service.DISABLE_REGISTRATION = true;
actions = {
ENABLED = true;
DEFAULT_ACTIONS_URL = "github";
···
};
};
};
-
}
+
}
+4 -4
modules/garage/default.nix
···
config = mkIf cfg.enable {
services.garage = {
enable = true;
-
package = pkgs.garage;
+
package = pkgs.garage_2;
settings = {
metadata_dir = "/garage/metadata";
data_dir = "/garage/data";
db_engine = "lmdb";
-
replication_mode = "2";
+
replication_factor = 2;
rpc_bind_addr = "[::]:3901";
rpc_public_addr = "${config.networking.hostName}:3901";
rpc_secret_file = config.age.secrets."garage-rpc-secret".path;
···
metrics_token_file = config.age.secrets."garage-metrics-token".path;
};
bootstrap_peers = [
-
"d548d0c9ae9aec9e26fe0bd2ca3efe75f654fa350bad5cb02bc9aebc9850ba8f@[2a04:52c0:135:48d1::2]:3901" # buer
-
"5504cb25910dcef4a4312006691d651c099cde7c3a88df9ca79aa350571e6e65@[2601:5c2:8400:26c0:4ecc:6aff:fef7:98ca]:3901" #valefar
+
"d548d0c9ae9aec9e26fe0bd2ca3efe75f654fa350bad5cb02bc9aebc9850ba8f@[buer]:3901"
+
"5504cb25910dcef4a4312006691d651c099cde7c3a88df9ca79aa350571e6e65@[valefar]:3901"
];
};
};
secrets/build-token.age

This is a binary file and will not be displayed.

+10 -10
secrets/garage-admin-token.age
···
age-encryption.org/v1
-
-> ssh-ed25519 i9wBeA 8PLBgO1NF5MRPY/2WsmqQ31meGxLEq1CTOqo5ngwTFo
-
ymt1bCGSEN1jCb5zBc7gvaShzLKwT6Y5/J1/zO8PKWs
-
-> ssh-ed25519 UbxDgg JPYD8E0EDn2eBL0IltQtrgfTfFM4fqtRCjIqmrBb8is
-
QWzV5535zfi4wde4qY1TtWKwXEoSbkCRwpLt5R6k84I
-
-> ssh-ed25519 YYzA7Q YEIN85tSaLGmjECEGPVWrVtX3gXGXqy7NZEtnW86fkk
-
wPWnLtotf0JjJ+wPbz19DVYb8iXqXV9F61v54CAqoA4
-
-> ssh-ed25519 3RWqPQ P13HdiuAj6ZOqfw41dlZdim/Qz7Pu9sQkeRbAOfKo3M
-
9eI3OCu9corRl7Wnpa7o2d3JxtBR3ttJG021o8fDUL4
-
--- keY3p62HlGCBh2Wu9a9ZO6jcmLuk7bX1cJrRg+0BAQU
-
UO��ݵ�PRU]�����fp�s��U���W�9q�L��o�yv%�M0�K��S�I�[���;(�W("�3)���
+
-> ssh-ed25519 i9wBeA fg1LWmMYua0wvyimvg0ACEuZW/xQMG8BmdLm88TdZTU
+
ArN7CSKr0DDQ5y1W5RSfWfgdYJ6lmVpNcqdWoWLF3lk
+
-> ssh-ed25519 du7llw CcU5ZZufG24Vhkap2aHpgnx49bbF/VFE4b1TPAtE2CA
+
oP4hZZ1vl1GBzVHH1MbHGHen9lNNzn3IKeurT+LuB58
+
-> ssh-ed25519 YYzA7Q IKh3q1rcRds4lVvHuF/wsmTXgUcY/MmAUBS6QeGMPFI
+
eTdHuOwaBq/ikNyb/D1YJMWJ0JyAMmC2aJTcw2/f5Co
+
-> ssh-ed25519 3RWqPQ 16o8nTSNZyZZpedt5wwzFqU+p0GptbXK4n5s+PIsrwA
+
jZqX8fYZcvLO9wgKj0jz/Jxl+KawQq0x303HiqGVeew
+
--- qCeaSJ7KVru9VSYN04w845ZdqO0ELrPJ3JpgElzfMfk
+
�����Q�'�t[��;�F���IȆ#�`#;Oi��r�� Ka���&'m�5n>�1�: ��i����q&,k
secrets/garage-metrics-token.age

This is a binary file and will not be displayed.

+10 -11
secrets/garage-rpc-secret.age
···
age-encryption.org/v1
-
-> ssh-ed25519 i9wBeA zKsnT6qzLx1lwXUOqSvz288GQvRuTSC4h1r1/peo4kI
-
i/t/qhyZRcW3werLZMF6IY8YP5t/BcvyfsffDhz+toE
-
-> ssh-ed25519 UbxDgg VZuoyPwHuaysdcvJlx6ILndEjQ0hKQN4kaJGzwutzEU
-
zhGpGQYN6WiyJ9IXH/Kldfm1iTVcZYPvaUdxTyPfFbA
-
-> ssh-ed25519 YYzA7Q Qlj5Oas+FqgbCBJjjBjcD/rlndFmU3XaB7IPzeS47DM
-
rLs09r8RRq/SJd9oLJsDGibAZsKXo1SJ/qvi4Z4Vhhg
-
-> ssh-ed25519 3RWqPQ NfcoP0kzkhHXvjbtmsWhrTu6jJ4Cby2C35JqE17qxzk
-
wbWmgoZrN2hbblKEbEJ07IMI+ZZeVsOJLcEALYQ6tOo
-
--- nZymvWQjoVNZRlBMvYxiQt/IvT8LuNZFR4hQF6pJR04
-
]��~4F�Oު����`�ds��O
-
�>h���5����?����3�!�=s#�f R5�scx��݈J�]�����;f$X�nG�������g���
+
-> ssh-ed25519 i9wBeA 8jCNk6EVR5xRMZm8xcDU6+HbM6bPbOuJD0hkfD0z8V0
+
35OKqytIzelEGkCCZ6wZ/JntcKhkYnrXqC1tjcWem/Q
+
-> ssh-ed25519 du7llw +CSkWwDcxadmXUazTQ3ilexC9D/tDLGqq/JLmuXisSQ
+
o7LiFJDX39Jf9rVNNB3tWr59enehKGT8YE4IrH75754
+
-> ssh-ed25519 YYzA7Q gVw+pxR9ZjhIztMwv+qmVf9r24AaMc3PZoIwS8+aI3I
+
qQhalCXRuNsSeMgRaiPN5ho8eLza2TInJTNkHKecVGM
+
-> ssh-ed25519 3RWqPQ iCzv+xB1+FWrdeQJC9BUrPSjFifkNobbnAvnR1qQWBg
+
xGayQTVaxOJdA+dJPZmm8MOnvOScfrDbqcanq/FidTk
+
--- JmDhgmtt40ySOQuJOTsJf7CqE9duhGodJNxMV3SJmic
+
�W�E����e�R�`cY ��\^Ϡ �W��I��`~8�х(=nH�k0�����m~P��,�S���kb}&@�QR_�P36S)����W��C�3�
secrets/headscale-authkey.age

This is a binary file and will not be displayed.

+10 -10
secrets/headscale-oidc-key.path
···
age-encryption.org/v1
-
-> ssh-ed25519 i9wBeA DynOTJFDKsSyHKTG9XFAAcZf/T//KKyK8UG4aGgVH2c
-
o+ggJe/HZmPU+Ezw4u4m+l9bQ1furG7G4Oo7xS8PMAs
-
-> ssh-ed25519 UbxDgg b1XiosrWXL9WI1B7YnNSw16l1p4oa3zjDCCgkU/FxiU
-
MY8oubHMth/wDKn9kNOUkaY9ODvrKIn7DeZTuGxj4/g
-
-> ssh-ed25519 YYzA7Q 6ql+gutJfteQM75WL6ywEDA1+fIcYSpLPaTSKhqE1ic
-
tbwXx/feysvpOrxwpDi5B5PveSIbFH0qSsV6/xmo4hk
-
-> ssh-ed25519 3RWqPQ hNVnobsB1OB9woXtn1T1tXJL+1Dbasc9N2tjZdXa0Bw
-
9HlWIX7aroc8kTUW3rPlxvMSTSGJXbMcOEipdoQqnbw
-
--- h8toQGhp/wUgMkJ+RU0bV7E6pHRUM8mKLPcrDmbZ5NQ
-
!Ŵ�j֖n$�Z���$s9f���ωk�.ro�`�CU>˻�R�F;H;�}J�(�0��� U�YP
+
-> ssh-ed25519 i9wBeA Gtd2ftibBF2166KCpJiJt1W9kbwrTybKx4O561e7oQw
+
3ci7PJxYqoglIml6YiyJrffteIZN0aUWDN5z4sogcfs
+
-> ssh-ed25519 du7llw zxlkrcUyO4q4CsRAYMr8vp7LzdK2E/O9fQrCi6TxYXs
+
q3xdu3He3SXg29mKS8Fv3YWt2CkENucPtPYtXmw+dx4
+
-> ssh-ed25519 YYzA7Q VQFwGeDchwrEiI3mPsNK1yGQKupTnh5jLxLhVlPbbzU
+
tsPNihdGL/2VumVXuOKRnfPw7LBlr5xKOODAKY5ROyc
+
-> ssh-ed25519 3RWqPQ YrxOoecRxIrNHq93LvFMgk2h83a0Z3UtsYeXKeQd1xo
+
lUM0BU8KTBjR13TGQj88n5BA4b9JAjZALfu9fTSmpu8
+
--- 8WCStyJ9IerfsQD3pL4ag8tnmt7hBXZxR+aCfv4BjS0
+
7�E�rY�)�GI���G�*K�b����b+��>�m�{����K�!��m�����J:���{��2/��
+2 -1
secrets/secrets.nix
···
regent = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ0pU82lV9dSjkgYbdh9utZ5CDM2dPN70S5fBqN1m3Pb regent@orobas.local";
users = [ regent ];
-
valefar = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJlXq2lSfiWwRwIxsxhffW5FDGmjt0QKYN+BaikmRR71";
+
valefar = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIPu8CVFsnUxhvABEqv4+EBBOL8tva5HJFoV3hElAlD0";
buer = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMVhjwDcO8eleSoR8a37ZGGPvkHEgV+c8SYcy07SayPB";
focalor = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA518oTmTp5VG60/dBrLu7rlV1hh8muhMattoiGfmrei";
+
baal = "AAAAC3NzaC1lZDI1NTE5AAAAILdjRWunQNFeTTdnw4GaqL9G34oo4QuvrRE/jvxLdK1C";
systems = [ valefar buer focalor];
in
{