Compare commits

..

9 Commits

Author SHA1 Message Date
soraefir
a7edc932a8 Fix VPS 2026-05-02 19:25:11 +02:00
soraefir
ae82eaa500 Fix 2026-05-02 10:32:08 +02:00
soraefir
e24e96f091 Fix VPS 2026-05-02 10:30:52 +02:00
soraefir
b42579f8cd Fix 2026-05-02 10:29:56 +02:00
soraefir
0192a1ace0 Fix boot 2026-05-02 10:29:21 +02:00
soraefir
dcc5c440f7 fix avalon 2026-05-02 10:12:36 +02:00
soraefir
1ceb440026 fix 2026-05-02 09:51:08 +02:00
bot
25b2e3e05f Merge pull request 'Lock file maintenance' (#271) from renovate/lock-file-maintenance into main 2026-05-02 04:03:53 +02:00
Renovate Bot
c823dbab4d Lock file maintenance 2026-05-02 02:03:51 +00:00
12 changed files with 68 additions and 49 deletions

30
flake.lock generated
View File

@@ -174,11 +174,11 @@
}, },
"nixUnstable": { "nixUnstable": {
"locked": { "locked": {
"lastModified": 1776949667, "lastModified": 1777548390,
"narHash": "sha256-GMSVw35Q+294GlrTUKlx087E31z7KurReQ1YHSKp5iw=", "narHash": "sha256-WacE23EbHTsBKvr8cu+1DFNbP6Rh1brHUH5SDUI0NQI=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "01fbdeef22b76df85ea168fbfe1bfd9e63681b30", "rev": "7aaa00e7cc9be6c316cb5f6617bd740dd435c59d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -190,11 +190,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1776734388, "lastModified": 1777428379,
"narHash": "sha256-vl3dkhlE5gzsItuHoEMVe+DlonsK+0836LIRDnm6MXQ=", "narHash": "sha256-ypxFOeDz+CqADEQNL72haqGjvZQdBR5Vc7pyx2JDttI=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "10e7ad5bbcb421fe07e3a4ad53a634b0cd57ffac", "rev": "755f5aa91337890c432639c60b6064bb7fe67769",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -221,11 +221,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1776877367, "lastModified": 1777268161,
"narHash": "sha256-EHq1/OX139R1RvBzOJ0aMRT3xnWyqtHBRUBuO1gFzjI=", "narHash": "sha256-bxrdOn8SCOv8tN4JbTF/TXq7kjo9ag4M+C8yzzIRYbE=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0726a0ecb6d4e08f6adced58726b95db924cef57", "rev": "1c3fe55ad329cbcb28471bb30f05c9827f724c76",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -241,11 +241,11 @@
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_2"
}, },
"locked": { "locked": {
"lastModified": 1777162113, "lastModified": 1777684559,
"narHash": "sha256-76X5+aK1TyKAcuSCJHBI2p51Kd81xEQ0AEl3aQNlbQU=", "narHash": "sha256-0QXkkTPUnHLeMjb+FYVbCSbboVkTjeEnyPXOzb7A2Z0=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nur", "repo": "nur",
"rev": "d6d97ae13c82041a36b4f3cff4af35b54f0e40ba", "rev": "ed879a8036a7255c34ec4b17dd4db087bff8f874",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -274,11 +274,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1776771786, "lastModified": 1777338324,
"narHash": "sha256-DRFGPfFV6hbrfO9a1PH1FkCi7qR5FgjSqsQGGvk1rdI=", "narHash": "sha256-bc+ZZCmOTNq86/svGnw0tVpH7vJaLYvGLLKFYP08Q8E=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "bef289e2248991f7afeb95965c82fbcd8ff72598", "rev": "8eaee5c45428b28b8c47a83e4c09dccec5f279b5",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -1,4 +1,21 @@
{ config, lib, pkgs, ... }: { { config, lib, pkgs, ... }: let
systemsDir = ../../../../../systems;
systemNames = lib.attrNames (lib.filterAttrs
(name: type: type == "directory" && builtins.pathExists (systemsDir + "/${name}/cfg.nix"))
(builtins.readDir systemsDir));
# Use a helper to check if the attribute path exists safely
# This prevents the "attribute 'net' missing" error
isValidPeer = p:
(p ? syscfg.net.wg.enable) &&
(p.syscfg.net.wg.enable == true) &&
(p.syscfg.net.wg.pubkey != config.syscfg.net.wg.pubkey);
importedConfigs = map (name: import (systemsDir + "/${name}/cfg.nix")) systemNames;
activePeers = builtins.filter isValidPeer importedConfigs;
in
{
imports = [ ./forwarding.nix ]; imports = [ ./forwarding.nix ];
config = lib.mkIf (config.syscfg.net.wg.enable) { config = lib.mkIf (config.syscfg.net.wg.enable) {
networking.wireguard = { networking.wireguard = {
@@ -10,18 +27,13 @@
config.sops.secrets."${config.syscfg.hostname}_wg_priv".path; config.sops.secrets."${config.syscfg.hostname}_wg_priv".path;
listenPort = 1515; listenPort = 1515;
mtu = 1340; mtu = 1340;
postSetup = if config.syscfg.net.wg.server.enable then ''
for keyfile in /run/secrets/*_wg_pub; do
if [ -f "$keyfile" ]; then
${pkgs.wireguard-tools}/bin/wg set wg0 \
peer "$(cat "$keyfile")" \
allowed-ips 10.10.1.0/24,fd10:10:10::0/64
fi
done
'' else '''';
peers = peers =
if config.syscfg.net.wg.server.enable then if config.syscfg.net.wg.server.enable then
[] map (p: {
name = p.syscfg.hostname;
publicKey = p.syscfg.net.wg.pubkey;
allowedIPs = [ p.syscfg.net.wg.ip4 p.syscfg.net.wg.ip6 ];
}) activePeers
else else
[{ [{
allowedIPs = [ "10.10.1.0/24" "fd10:10:10::0/64" ]; allowedIPs = [ "10.10.1.0/24" "fd10:10:10::0/64" ];

View File

@@ -16,5 +16,4 @@
group = config.users.users.${config.syscfg.defaultUser}.group; group = config.users.users.${config.syscfg.defaultUser}.group;
}; };
sops.secrets."${config.syscfg.hostname}_wg_priv" = { }; sops.secrets."${config.syscfg.hostname}_wg_priv" = { };
sops.secrets."${config.syscfg.hostname}_wg_pub" = { };
} }

File diff suppressed because one or more lines are too long

View File

@@ -28,12 +28,7 @@ in {
group = config.users.users.${config.syscfg.defaultUser}.group; group = config.users.users.${config.syscfg.defaultUser}.group;
}; };
"${config.syscfg.hostname}_wg_priv" = { }; "${config.syscfg.hostname}_wg_priv" = { };
"${config.syscfg.hostname}_wg_pub" = { };
} }
(lib.genAttrs
(map (peer: "${peer}_wg_pub") config.syscfg.net.wg.server.peers)
(_: { mode = "0444"; })
)
(lib.genAttrs (lib.genAttrs
(map (peer: "${peer}_ssh_pub") ["iriy" "avalon" "valinor"]) (map (peer: "${peer}_ssh_pub") ["iriy" "avalon" "valinor"])
(_: { mode = "0444"; }) (_: { mode = "0444"; })

View File

@@ -42,6 +42,10 @@ let
type = types.str; type = types.str;
default = ""; default = "";
}; };
pubkey = mkOption {
type = types.str;
default = "";
};
server = { server = {
enable = mkOption { enable = mkOption {
type = types.bool; type = types.bool;

View File

@@ -26,10 +26,13 @@
cli = true; cli = true;
virt = true; virt = true;
}; };
wg = { net = {
enable = true; wg = {
ip4 = "10.10.1.2/32"; enable = true;
ip6 = "fd10:10:10::2/128"; ip4 = "10.10.1.2/32";
ip6 = "fd10:10:10::2/128";
pubkey = "QlvpTiK6s/lIha9vKmo+teSy2Nw52qWLYatYjxVan3U=";
};
}; };
}; };
} }

View File

@@ -22,6 +22,7 @@
enable = true; enable = true;
ip4 = "10.10.1.1/32"; ip4 = "10.10.1.1/32";
ip6 = "fd10:10:10::1/128"; ip6 = "fd10:10:10::1/128";
pubkey = "NFBJvYXZC+bd62jhrKnM7/pugidWhgR6+C5qIiUiq3Q=";
server = { server = {
enable = true; enable = true;
peers = ["avalon" "iriy" "valinor"]; peers = ["avalon" "iriy" "valinor"];

View File

@@ -1,4 +1,4 @@
{ config, inputs, ... }: { { config, lib, inputs, ... }: {
imports = [ ./hardware.nix ]; imports = [ ./hardware.nix ];
services.openssh.enable = true; services.openssh.enable = true;

View File

@@ -1,17 +1,26 @@
{ config, lib, pkgs, modulesPath, ... }: { { config, lib, pkgs, modulesPath, ... }: {
imports = [ (modulesPath + "/profiles/qemu-guest.nix" ) ];
boot.kernelPackages = pkgs.linuxPackages_latest; boot.kernelPackages = pkgs.linuxPackages_latest;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
boot.loader.grub.device = "/dev/sda";
boot.loader.systemd-boot.enable = lib.mkForce false;
boot.loader.grub = {
enable = true;
device = "/dev/sda";
efiSupport = true;
};
boot.initrd.availableKernelModules = boot.initrd.availableKernelModules =
[ "ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi" ]; [ "ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi" ];
boot.initrd.kernelModules = [ "nvme" ]; boot.initrd.kernelModules = [ "nvme" ];
fileSystems."/" = { fileSystems."/" = {
device = "/dev/sda3"; device = "/dev/disk/by-uuid/25df457a-21d0-41ab-9de5-88ffc00e3469";
fsType = "btrfs"; fsType = "btrfs";
}; };
fileSystems."/boot" = { fileSystems."/boot" = {
device = "/dev/sda2"; device = "/dev/disk/by-uuid/F24E-74FA";
fsType = "vfat"; fsType = "vfat";
options = [ "defaults" ]; options = [ "defaults" ];
}; };

View File

@@ -30,6 +30,7 @@
enable = true; enable = true;
ip4 = "10.10.1.7/32"; ip4 = "10.10.1.7/32";
ip6 = "fd10:10:10::7/128"; ip6 = "fd10:10:10::7/128";
pubkey = "6d1bINFmH12ACAJLDOwfFIZgmNHV/FGGk0YJyDP50HQ=";
}; };
}; };
}; };

View File

@@ -31,6 +31,7 @@
enable = true; enable = true;
ip4 = "10.10.1.5/32"; ip4 = "10.10.1.5/32";
ip6 = "fd10:10:10::5/128"; ip6 = "fd10:10:10::5/128";
pubkey = "EUYd/dMdGcbxiWJXHhQhCXV00cr87pxiW1HExwCTGg0=";
}; };
}; };
}; };