Compare commits
10 Commits
updated-in
...
updated-in
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f54dfc570f | ||
| abca7b69d6 | |||
| 77268f9243 | |||
| 87884154eb | |||
| 7ed74d376b | |||
| 7c8832c1cd | |||
| 7c9fe54051 | |||
| 8760cd7832 | |||
| 079934aaeb | |||
| b1787611f5 |
14
docs/mkdocs.yml
Normal file
14
docs/mkdocs.yml
Normal 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
|
||||||
1
docs/pages/Options/index.md
Normal file
1
docs/pages/Options/index.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# Options
|
||||||
1
docs/pages/index.md
Normal file
1
docs/pages/index.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# Home
|
||||||
23
flake.lock
generated
23
flake.lock
generated
@@ -552,22 +552,6 @@
|
|||||||
"type": "github"
|
"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": {
|
"nixpkgs-regression": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1643052045,
|
"lastModified": 1643052045,
|
||||||
@@ -666,11 +650,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_5": {
|
"nixpkgs_5": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1763421233,
|
"lastModified": 1763678758,
|
||||||
"narHash": "sha256-Stk9ZYRkGrnnpyJ4eqt9eQtdFWRRIvMxpNRf4sIegnw=",
|
"narHash": "sha256-+hBiJ+kG5IoffUOdlANKFflTT5nO3FrrR2CA3178Y5s=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "89c2b2330e733d6cdb5eae7b899326930c2c0648",
|
"rev": "117cc7f94e8072499b0a7aa4c52084fa4e11cc9b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -768,7 +752,6 @@
|
|||||||
"nixos-hardware": "nixos-hardware",
|
"nixos-hardware": "nixos-hardware",
|
||||||
"nixpkgs": "nixpkgs_5",
|
"nixpkgs": "nixpkgs_5",
|
||||||
"nixpkgs-0dc1c7": "nixpkgs-0dc1c7",
|
"nixpkgs-0dc1c7": "nixpkgs-0dc1c7",
|
||||||
"nixpkgs-carbon": "nixpkgs-carbon",
|
|
||||||
"nurausstieg": "nurausstieg",
|
"nurausstieg": "nurausstieg",
|
||||||
"rainbowrss": "rainbowrss",
|
"rainbowrss": "rainbowrss",
|
||||||
"scan-to-gpg": "scan-to-gpg",
|
"scan-to-gpg": "scan-to-gpg",
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
nixpkgs-carbon.url = "github:clerie/nixpkgs/clerie/always-setup-netdevs";
|
|
||||||
# for etesync-dav
|
# for etesync-dav
|
||||||
nixpkgs-0dc1c7.url = "github:NixOS/nixpkgs/0dc1c7294c13f5d1dd6eccab4f75d268d7296efe";
|
nixpkgs-0dc1c7.url = "github:NixOS/nixpkgs/0dc1c7294c13f5d1dd6eccab4f75d268d7296efe";
|
||||||
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
{ ... }:
|
{ ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
services.wg-clerie = {
|
# services.wg-clerie = {
|
||||||
enable = true;
|
# enable = true;
|
||||||
ipv6s = [ "2a01:4f8:c0c:15f1::8111/128" ];
|
# ipv6s = [ "2a01:4f8:c0c:15f1::8111/128" ];
|
||||||
ipv4s = [ "10.20.30.111/32" ];
|
# ipv4s = [ "10.20.30.111/32" ];
|
||||||
defaultViaVPN = false;
|
# defaultViaVPN = false;
|
||||||
};
|
# };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./policyrouting
|
|
||||||
./akne
|
./akne
|
||||||
./backup
|
./backup
|
||||||
./bijwerken
|
./bijwerken
|
||||||
@@ -14,7 +13,6 @@
|
|||||||
./nginx-port-forward
|
./nginx-port-forward
|
||||||
./nixfiles
|
./nixfiles
|
||||||
./update-from-hydra
|
./update-from-hydra
|
||||||
./wg-clerie
|
|
||||||
./wireguard-initrd
|
./wireguard-initrd
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ let
|
|||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Directory to store Minecraft database and other state/data files.
|
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;
|
type = types.package;
|
||||||
default = pkgs.papermc;
|
default = pkgs.papermc;
|
||||||
defaultText = "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.";
|
description = "Version of minecraft-server to run.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -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)}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -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=";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
26
pkgs/nixfiles-docs-options/default.nix
Normal file
26
pkgs/nixfiles-docs-options/default.nix
Normal 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
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
27
pkgs/nixfiles-docs/default.nix
Normal file
27
pkgs/nixfiles-docs/default.nix
Normal 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
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
@@ -27,6 +27,8 @@ final: prev: {
|
|||||||
"http.server" = final.callPackage ./http.server {};
|
"http.server" = final.callPackage ./http.server {};
|
||||||
nix-remove-result-links = final.callPackage ./nix-remove-result-links {};
|
nix-remove-result-links = final.callPackage ./nix-remove-result-links {};
|
||||||
nixfiles-auto-install = final.callPackage ./nixfiles/nixfiles-auto-install.nix {};
|
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-config = final.callPackage ./nixfiles/nixfiles-generate-config.nix {};
|
||||||
nixfiles-generate-backup-secrets = final.callPackage ./nixfiles/nixfiles-generate-backup-secrets.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 {};
|
nixfiles-update-ssh-host-keys = final.callPackage ./nixfiles/nixfiles-update-ssh-host-keys.nix {};
|
||||||
|
|||||||
Reference in New Issue
Block a user