1
0

Compare commits

..

17 Commits

Author SHA1 Message Date
Flake Update Bot
f54dfc570f Update nixpkgs 2025-11-23-02-03 2025-11-23 03:04:20 +01:00
abca7b69d6 flake.nix: Remove reference to patched nixpkgs for carbon, as the issue is patched upstream now 2025-11-22 22:55:48 +01:00
77268f9243 hosts/carbon: Disable use of service.wg-clerie
"Oh this is where I still used the old wg-clerie module"
2025-11-22 22:54:37 +01:00
87884154eb pkgs/nixfiles-docs: Add hydra link to build output 2025-11-22 22:45:37 +01:00
7ed74d376b pkgs/nixfiles-docs: Init docs 2025-11-22 22:39:27 +01:00
7c8832c1cd pkgs/nixfiles-docs-options: Generate docs for module options 2025-11-22 21:55:32 +01:00
7c9fe54051 pkgs/nixfiles-docs-options: Remove file added by accident 2025-11-22 21:53:37 +01:00
8760cd7832 modules/minecraft-server: Fix syntax errors in options specification 2025-11-22 21:40:00 +01:00
079934aaeb modules/policyrouting: Remove obsolte module policyrouting 2025-11-22 21:33:07 +01:00
b1787611f5 modules/wg-clerie: Remove modules.wg-clerie as it is replaced by profiles.clerie.wg-clerie 2025-11-22 21:31:47 +01:00
69a04cac3f hosts/krypton,profiles/firefox,profiles/desktop: Migrate options to new nixpkgs version 2025-11-21 20:28:39 +01:00
6e8adf8eb5 Merge remote-tracking branch 'origin/updated-inputs-2025-11-21-02-03' 2025-11-21 19:43:29 +01:00
626834c2a4 profiles/desktop: Migrate logind option rename 2025-11-21 19:09:22 +01:00
bd1716eb23 hosts/carbon: Don't send IPv4 to ppp tunnel 2025-11-21 18:33:42 +01:00
a5125e92a6 profiles/router: Add applications to debug conntrack more 2025-11-21 18:28:42 +01:00
Flake Update Bot
50f2f01437 Update nixpkgs 2025-11-21-02-03 2025-11-21 03:03:17 +01:00
2606338b56 pkgs/ds-lite-dhcpcd-hook: Netcologne can't handle Tunnel Encapsulation Limit, so don't send these options in the DS-Lite tunnel 2025-11-20 20:03:38 +01:00
21 changed files with 95 additions and 192 deletions

14
docs/mkdocs.yml Normal file
View File

@@ -0,0 +1,14 @@
docs_dir: pages
site_name: clerie's nixfiles
repo_url: https://git.clerie.de/clerie/nixfiles
repo_name: clerie/nixfiles
edit_uri: src/branch/master/docs/pages/
theme:
name: material
features:
- content.action.edit
- navigation.indexes
- navigation.tabs
palette:
primary: deep purple

View File

@@ -0,0 +1 @@
# Options

1
docs/pages/index.md Normal file
View File

@@ -0,0 +1 @@
# Home

23
flake.lock generated
View File

@@ -552,22 +552,6 @@
"type": "github"
}
},
"nixpkgs-carbon": {
"locked": {
"lastModified": 1751206202,
"narHash": "sha256-VjK8pEv4cfDpCTh4KW1go98kP25j7KdTNEce342Bh/Y=",
"owner": "clerie",
"repo": "nixpkgs",
"rev": "ac4ac98609c1b30c378458ab7207a9a5b5148457",
"type": "github"
},
"original": {
"owner": "clerie",
"ref": "clerie/always-setup-netdevs",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-regression": {
"locked": {
"lastModified": 1643052045,
@@ -666,11 +650,11 @@
},
"nixpkgs_5": {
"locked": {
"lastModified": 1763283776,
"narHash": "sha256-Y7TDFPK4GlqrKrivOcsHG8xSGqQx3A6c+i7novT85Uk=",
"lastModified": 1763678758,
"narHash": "sha256-+hBiJ+kG5IoffUOdlANKFflTT5nO3FrrR2CA3178Y5s=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "50a96edd8d0db6cc8db57dab6bb6d6ee1f3dc49a",
"rev": "117cc7f94e8072499b0a7aa4c52084fa4e11cc9b",
"type": "github"
},
"original": {
@@ -768,7 +752,6 @@
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_5",
"nixpkgs-0dc1c7": "nixpkgs-0dc1c7",
"nixpkgs-carbon": "nixpkgs-carbon",
"nurausstieg": "nurausstieg",
"rainbowrss": "rainbowrss",
"scan-to-gpg": "scan-to-gpg",

View File

@@ -1,7 +1,6 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-carbon.url = "github:clerie/nixpkgs/clerie/always-setup-netdevs";
# for etesync-dav
nixpkgs-0dc1c7.url = "github:NixOS/nixpkgs/0dc1c7294c13f5d1dd6eccab4f75d268d7296efe";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";

View File

@@ -60,4 +60,10 @@
ip46tables -t mangle -A forward-mangle -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
'';
networking.firewall.extraCommands = ''
# Reject all IPv4 traffic that tries to enter and leave the PPP tunnel
iptables -I INPUT -i ppp-ncfttb -j DROP
iptables -I OUTPUT -o ppp-ncfttb -j DROP
'';
}

View File

@@ -1,10 +1,10 @@
{ ... }:
{
services.wg-clerie = {
enable = true;
ipv6s = [ "2a01:4f8:c0c:15f1::8111/128" ];
ipv4s = [ "10.20.30.111/32" ];
defaultViaVPN = false;
};
# services.wg-clerie = {
# enable = true;
# ipv6s = [ "2a01:4f8:c0c:15f1::8111/128" ];
# ipv4s = [ "10.20.30.111/32" ];
# defaultViaVPN = false;
# };
}

View File

@@ -1,9 +0,0 @@
{ pkgs, ... }:
{
services.udev.packages = [
pkgs.android-udev-rules
];
}

View File

@@ -5,7 +5,6 @@
[
./hardware-configuration.nix
./android.nix
./backup.nix
./etesync-dav.nix
#./initrd.nix

View File

@@ -2,7 +2,6 @@
{
imports = [
./policyrouting
./akne
./backup
./bijwerken
@@ -14,7 +13,6 @@
./nginx-port-forward
./nixfiles
./update-from-hydra
./wg-clerie
./wireguard-initrd
];
}

View File

@@ -42,7 +42,7 @@ let
default = null;
description = ''
Directory to store Minecraft database and other state/data files.
When null defaulting to /var/lib/minecraft-server-${name}
When null defaulting to /var/lib/minecraft-server-''${name}
'';
};
@@ -50,7 +50,7 @@ let
type = types.package;
default = pkgs.papermc;
defaultText = "pkgs.papermc";
example = literalExample "pkgs.minecraft-server_1_12_2";
example = literalExpression "pkgs.minecraft-server_1_12_2";
description = "Version of minecraft-server to run.";
};

View File

@@ -1,50 +0,0 @@
{ config, lib, ... }:
with lib;
let
cfg = config.petabyte.policyrouting;
ruleOpts = { ... }: {
options = {
prio = mkOption {
type = types.int;
};
rule = mkOption {
type = types.str;
};
};
};
in {
options = {
petabyte.policyrouting = {
enable = mkEnableOption "Declarative Policy-Routing";
rules = mkOption {
type = with types; listOf (submodule ruleOpts);
default = [];
};
rules6 = mkOption {
type = with types; listOf (submodule ruleOpts);
default = [];
};
rules4 = mkOption {
type = with types; listOf (submodule ruleOpts);
default = [];
};
};
};
config = mkIf cfg.enable {
petabyte.policyrouting.rules = [
{ rule = "lookup main"; prio = 32000; }
];
networking.localCommands = ''
set -x
ip -6 rule flush
ip -4 rule flush
${concatMapStringsSep "\n" ({ prio, rule }: "ip -6 rule add ${rule} prio ${toString prio}") (cfg.rules ++ cfg.rules6)}
${concatMapStringsSep "\n" ({ prio, rule }: "ip -4 rule add ${rule} prio ${toString prio}") (cfg.rules ++ cfg.rules4)}
'';
};
}

View File

@@ -1,94 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.wg-clerie;
in
{
options = {
services.wg-clerie = {
enable = mkEnableOption "VPN for public static IP";
privateKeyFile = mkOption {
type = with types; nullOr str;
default = null;
description = "Path to file containing private key for wireguard interface";
};
ipv6s = mkOption {
type = with types; listOf str;
default = [];
description = "IPv6 interface addresses";
};
ipv4s = mkOption {
type = with types; listOf str;
default = [];
description = "IPv4 interface addresses";
};
defaultViaVPN = mkOption {
type = types.bool;
default = true;
description = "Use VPN default route for a protocol, if that protocol is unavailable in the underlay";
};
};
};
config = mkIf cfg.enable {
networking.iproute2.enable = true;
networking.iproute2.rttablesExtraConfig = ''
200 wg-clerie
'';
petabyte.policyrouting = {
enable = true;
rules6 = (concatMap (ip: [
{ rule = "from ${ip} lookup wg-clerie"; prio = 19000; }
{ rule = "from ${ip} unreachable"; prio = 19001; }
]) cfg.ipv6s) ++ [
# Do not reach VPN server via VPN
{ rule = "to 2a01:4f8:c0c:15f1::1/128 ipproto udp dport 51820 lookup main"; prio = 20000; }
{ rule = "to 2a01:4f8:c0c:15f1::1/128 ipproto udp dport 51820 unreachable"; prio = 20001; }
# Try direct routing first, fallback to VPN
{ rule = "lookup main"; prio = 21000; }
] ++ (if cfg.defaultViaVPN then [
{ rule = "lookup wg-clerie"; prio = 21001; }
] else []) ++ [
{ rule = "unreachable"; prio = 22000; }
];
rules4 = (concatMap (ip: [
{ rule = "from ${ip} lookup wg-clerie"; prio = 19000; }
{ rule = "from ${ip} unreachable"; prio = 19001; }
]) cfg.ipv4s) ++ [
# Do not reach VPN server via VPN
{ rule = "to 78.47.183.82/32 ipproto udp dport 51820 lookup main"; prio = 20000; }
{ rule = "to 78.47.183.82/32 ipproto udp dport 51820 unreachable"; prio = 20001; }
# Try direct routing first, fallback to VPN
{ rule = "lookup main"; prio = 21000; }
] ++ (if cfg.defaultViaVPN then [
{ rule = "lookup wg-clerie"; prio = 21001; }
] else []) ++ [
{ rule = "unreachable"; prio = 22000; }
];
};
networking.wireguard.enable = true;
networking.wireguard.interfaces = {
wg-clerie = {
privateKeyFile = if cfg.privateKeyFile != null then cfg.privateKeyFile else
config.sops.secrets.wg-clerie.path;
ips = cfg.ipv6s ++ cfg.ipv4s;
table = "wg-clerie";
peers = [
{
# Fallback to legacy IP if there is no route to VPN server
endpoint = "$(ip route get 2a01:4f8:c0c:15f1::1 ipproto udp dport 51820 &>/dev/null && echo '[2a01:4f8:c0c:15f1::1]:51820' || echo '78.47.183.82:51820')";
persistentKeepalive = 25;
dynamicEndpointRefreshSeconds = 5;
allowedIPs = [ "0.0.0.0/0" "::/0" "10.20.30.0/24" "2a01:4f8:c0c:15f1::/113" ];
publicKey = "2p1Jqs3bkXbXHFWE6vp1yxHIFoUaZQEARS2nJzbkuBA=";
}
];
};
};
};
}

View File

@@ -83,7 +83,7 @@ if TUNNEL_INTERFACE_CONFIG="$(ip --json link show "${TUNNEL_INTERFACE_NAME}")";
if [[ "${TUNNEL_INTERFACE_ORIGIN_ADDRESS}" != "${WAN_INTERFACE_ADDRESS}" || "${TUNNEL_INTERFACE_REMOTE_ADDRESS}" != "${AFTR_ADDRESS}" || "${TUNNEL_INTERFACE_OPERSTATE}" != "UNKNOWN" ]]; then
log_tunnel "Bad configuration, fixing tunnel parameter"
ip tunnel change "${TUNNEL_INTERFACE_NAME}" mode ipip6 local "${WAN_INTERFACE_ADDRESS}" remote "${AFTR_ADDRESS}"
ip tunnel change "${TUNNEL_INTERFACE_NAME}" mode ipip6 local "${WAN_INTERFACE_ADDRESS}" remote "${AFTR_ADDRESS}" encaplimit none
ip link set "$TUNNEL_INTERFACE_NAME" up
else
log_tunnel "Tunnel already configured"
@@ -91,7 +91,7 @@ if TUNNEL_INTERFACE_CONFIG="$(ip --json link show "${TUNNEL_INTERFACE_NAME}")";
else
log_tunnel "Setting up DS-Lite tunnel"
ip tunnel add "${TUNNEL_INTERFACE_NAME}" mode ipip6 local "${WAN_INTERFACE_ADDRESS}" remote "${AFTR_ADDRESS}"
ip tunnel add "${TUNNEL_INTERFACE_NAME}" mode ipip6 local "${WAN_INTERFACE_ADDRESS}" remote "${AFTR_ADDRESS}" encaplimit none
ip link set "$TUNNEL_INTERFACE_NAME" up
fi

View File

@@ -0,0 +1,26 @@
{
lib,
writeText,
...
}:
let
evaluatedModules = lib.evalModules {
modules = [
../../modules
../../profiles
{
_module.check = false;
}
];
};
in
writeText "options.json" (
builtins.toJSON (
lib.filter (opt: !opt.internal && !(lib.head opt.loc == "_module")) (
lib.optionAttrSetToDocList evaluatedModules.options
)
)
)

View File

@@ -0,0 +1,27 @@
{
stdenv,
mkdocs-material
}:
stdenv.mkDerivation {
name = "nixfiles-docs";
src = ../../docs;
buildInputs = [
mkdocs-material
];
buildPhase = ''
python3 -m mkdocs build
'';
installPhase = ''
mkdir -p $out
cp -r ./site/* $out/
mkdir -p $out/nix-support
echo "doc manual $out" >> $out/nix-support/hydra-build-products
'';
}

View File

@@ -27,6 +27,8 @@ final: prev: {
"http.server" = final.callPackage ./http.server {};
nix-remove-result-links = final.callPackage ./nix-remove-result-links {};
nixfiles-auto-install = final.callPackage ./nixfiles/nixfiles-auto-install.nix {};
nixfiles-docs = final.python3.pkgs.callPackage ./nixfiles-docs {};
nixfiles-docs-options = final.callPackage ./nixfiles-docs-options {};
nixfiles-generate-config = final.callPackage ./nixfiles/nixfiles-generate-config.nix {};
nixfiles-generate-backup-secrets = final.callPackage ./nixfiles/nixfiles-generate-backup-secrets.nix {};
nixfiles-update-ssh-host-keys = final.callPackage ./nixfiles/nixfiles-update-ssh-host-keys.nix {};

View File

@@ -11,7 +11,7 @@ with lib;
roboto
roboto-mono
noto-fonts
noto-fonts-emoji
noto-fonts-color-emoji
comfortaa
] ++ (if pkgs ? "noto-fonts-cjk-sans" then [ pkgs.noto-fonts-cjk-sans ] else [ pkgs.noto-fonts-cjk ]);

View File

@@ -8,7 +8,7 @@ with lib;
boot.resumeDevice = lib.optionalString ((lib.length config.swapDevices) > 0) (lib.head config.swapDevices).device;
services.logind = {
lidSwitch = "suspend-then-hibernate";
settings.Login.HandleLidSwitch = "suspend-then-hibernate";
};
systemd.sleep.extraConfig = ''
HibernateDelaySec=30m

View File

@@ -12,8 +12,6 @@ with lib;
programs.firefox.enable = true;
programs.firefox.package = pkgs.firefox-wayland;
programs.firefox.policies = {
AutofillAddressEnabled = false;
AutofillCreditCardEnabled = false;

View File

@@ -11,8 +11,10 @@ with lib;
config = mkIf config.profiles.clerie.router.enable {
environment.systemPackages = with pkgs; [
wireguard-tools
conntrack-tools
iptstate # show conntrack table
tcpdump
wireguard-tools
];
boot.kernel.sysctl = {