Compare commits
10 Commits
3168d35e07
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
f3dc466c56
|
|||
|
2e521e76e0
|
|||
|
8c8c077d9c
|
|||
|
af0003f6db
|
|||
|
78676a8bc7
|
|||
|
9ff5a87561
|
|||
|
b4074ce04f
|
|||
|
d55b02f766
|
|||
|
4aebe3c389
|
|||
|
b596a6f6a5
|
@@ -65,127 +65,87 @@
|
|||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.x86_64-linux.pkgs;
|
pkgs = nixpkgs.legacyPackages.x86_64-linux.pkgs;
|
||||||
|
inherit (nixpkgs) lib;
|
||||||
|
|
||||||
|
# Build a host's nixosConfiguration from the shared boilerplate.
|
||||||
|
# Per-host differences are expressed as flags / extraModules rather
|
||||||
|
# than copy-pasted module blocks.
|
||||||
|
mkHost =
|
||||||
|
{ hostname # name of the ./<hostname> and ./home/<hostname> dirs
|
||||||
|
, system ? "x86_64-linux"
|
||||||
|
, homeHost ? hostname # which home/<...> config to use (iso reuses nixy)
|
||||||
|
, packages ? true # import common/packages.nix
|
||||||
|
, suspend ? true # import common/suspend.nix
|
||||||
|
, hardware ? true # import <hostname>/hardware-configuration.nix
|
||||||
|
, sops ? true # wire sops-nix
|
||||||
|
, hm ? true # wire home-manager
|
||||||
|
, hmBackup ? true # set home-manager.backupFileExtension
|
||||||
|
, nixosLib ? nixpkgs.lib # nixosSystem source (iso uses `nixos`)
|
||||||
|
, extraModules ? [ ]
|
||||||
|
}:
|
||||||
|
nixosLib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
modules =
|
||||||
|
[
|
||||||
|
{ _module.args = inputs; }
|
||||||
|
{ _module.args.system = system; }
|
||||||
|
{ nix.registry.nixpkgs.flake = nixpkgs; }
|
||||||
|
]
|
||||||
|
++ lib.optional packages ./common/packages.nix
|
||||||
|
++ lib.optional suspend ./common/suspend.nix
|
||||||
|
++ [ (./. + "/${hostname}/configuration.nix") ]
|
||||||
|
++ lib.optional hardware (./. + "/${hostname}/hardware-configuration.nix")
|
||||||
|
++ lib.optional sops sops-nix.nixosModules.sops
|
||||||
|
++ lib.optionals hm [
|
||||||
|
home-manager.nixosModules.home-manager
|
||||||
|
{
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.users.akill = import (./home + "/${homeHost}/home.nix");
|
||||||
|
home-manager.extraSpecialArgs = { inherit inputs system; };
|
||||||
|
}
|
||||||
|
]
|
||||||
|
++ lib.optional (hm && hmBackup) { home-manager.backupFileExtension = "home_backup"; }
|
||||||
|
++ extraModules;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
nixy = nixpkgs.lib.nixosSystem rec {
|
nixy = mkHost { hostname = "nixy"; };
|
||||||
system = "x86_64-linux";
|
|
||||||
modules = [
|
|
||||||
{ _module.args = inputs; }
|
|
||||||
{ _module.args.system = system; }
|
|
||||||
{ nix.registry.nixpkgs.flake = nixpkgs; }
|
|
||||||
./common/packages.nix
|
|
||||||
./common/suspend.nix
|
|
||||||
./nixy/configuration.nix
|
|
||||||
./nixy/hardware-configuration.nix
|
|
||||||
sops-nix.nixosModules.sops
|
|
||||||
home-manager.nixosModules.home-manager
|
|
||||||
{
|
|
||||||
home-manager.useGlobalPkgs = true;
|
|
||||||
home-manager.useUserPackages = true;
|
|
||||||
home-manager.users.akill = import ./home/nixy/home.nix;
|
|
||||||
home-manager.extraSpecialArgs = { inherit inputs system; };
|
|
||||||
home-manager.backupFileExtension = "home_backup";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
fuji = nixpkgs.lib.nixosSystem rec {
|
fuji = mkHost { hostname = "fuji"; };
|
||||||
system = "x86_64-linux";
|
|
||||||
modules = [
|
|
||||||
{ _module.args = inputs; }
|
|
||||||
{ _module.args.system = system; }
|
|
||||||
{ nix.registry.nixpkgs.flake = nixpkgs; }
|
|
||||||
./common/packages.nix
|
|
||||||
./common/suspend.nix
|
|
||||||
./fuji/configuration.nix
|
|
||||||
./fuji/hardware-configuration.nix
|
|
||||||
sops-nix.nixosModules.sops
|
|
||||||
home-manager.nixosModules.home-manager
|
|
||||||
{
|
|
||||||
home-manager.useGlobalPkgs = true;
|
|
||||||
home-manager.useUserPackages = true;
|
|
||||||
home-manager.users.akill = import ./home/fuji/home.nix;
|
|
||||||
home-manager.extraSpecialArgs = { inherit inputs system; };
|
|
||||||
home-manager.backupFileExtension = "home_backup";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
nixy_iso = nixos.lib.nixosSystem rec {
|
nixy_iso = mkHost {
|
||||||
system = "x86_64-linux";
|
hostname = "nixy";
|
||||||
modules = [
|
hardware = false;
|
||||||
{ _module.args = inputs; }
|
nixosLib = nixos.lib;
|
||||||
{ _module.args.system = system; }
|
extraModules = [
|
||||||
{ nix.registry.nixpkgs.flake = nixpkgs; }
|
|
||||||
{ isoImage.squashfsCompression = "gzip -Xcompression-level 1"; }
|
{ isoImage.squashfsCompression = "gzip -Xcompression-level 1"; }
|
||||||
./common/packages.nix
|
|
||||||
./common/suspend.nix
|
|
||||||
./nixy/configuration.nix
|
|
||||||
"${nixos}/nixos/modules/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix"
|
"${nixos}/nixos/modules/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix"
|
||||||
sops-nix.nixosModules.sops
|
|
||||||
home-manager.nixosModules.home-manager
|
|
||||||
{
|
|
||||||
home-manager.useGlobalPkgs = true;
|
|
||||||
home-manager.useUserPackages = true;
|
|
||||||
home-manager.users.akill = import ./home/nixy/home.nix;
|
|
||||||
home-manager.extraSpecialArgs = { inherit inputs system; };
|
|
||||||
home-manager.backupFileExtension = "home_backup";
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
mediabox = nixpkgs.lib.nixosSystem rec {
|
mediabox = mkHost {
|
||||||
system = "x86_64-linux";
|
hostname = "mediabox";
|
||||||
modules = [
|
hmBackup = false;
|
||||||
{ _module.args = inputs; }
|
extraModules = [ ./modules/qbittorrent.nix ];
|
||||||
{ _module.args.system = system; }
|
|
||||||
{ nix.registry.nixpkgs.flake = nixpkgs; }
|
|
||||||
./common/packages.nix
|
|
||||||
./common/suspend.nix
|
|
||||||
./mediabox/configuration.nix
|
|
||||||
./mediabox/hardware-configuration.nix
|
|
||||||
./modules/qbittorrent.nix
|
|
||||||
sops-nix.nixosModules.sops
|
|
||||||
home-manager.nixosModules.home-manager
|
|
||||||
{
|
|
||||||
home-manager.useGlobalPkgs = true;
|
|
||||||
home-manager.useUserPackages = true;
|
|
||||||
home-manager.users.akill = import ./home/mediabox/home.nix;
|
|
||||||
home-manager.extraSpecialArgs = { inherit inputs system; };
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
blue = nixpkgs.lib.nixosSystem rec {
|
blue = mkHost {
|
||||||
system = "x86_64-linux";
|
hostname = "blue";
|
||||||
modules = [
|
suspend = false;
|
||||||
{ _module.args = inputs; }
|
sops = false;
|
||||||
{ _module.args.system = system; }
|
hmBackup = false;
|
||||||
{ nix.registry.nixpkgs.flake = nixpkgs; }
|
|
||||||
./blue/configuration.nix
|
|
||||||
./blue/hardware-configuration.nix
|
|
||||||
./common/packages.nix
|
|
||||||
home-manager.nixosModules.home-manager
|
|
||||||
{
|
|
||||||
home-manager.useGlobalPkgs = true;
|
|
||||||
home-manager.useUserPackages = true;
|
|
||||||
home-manager.users.akill = import ./home/blue/home.nix;
|
|
||||||
home-manager.extraSpecialArgs = { inherit inputs system; };
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
magpie = nixpkgs.lib.nixosSystem rec {
|
magpie = mkHost {
|
||||||
|
hostname = "magpie";
|
||||||
system = "aarch64-linux";
|
system = "aarch64-linux";
|
||||||
modules = [
|
packages = false;
|
||||||
{ _module.args = inputs; }
|
suspend = false;
|
||||||
{ _module.args.system = system; }
|
hm = false;
|
||||||
{ nix.registry.nixpkgs.flake = nixpkgs; }
|
extraModules = [
|
||||||
./magpie/configuration.nix
|
|
||||||
./magpie/hardware-configuration.nix
|
|
||||||
simple-nixos-mailserver.nixosModule
|
simple-nixos-mailserver.nixosModule
|
||||||
sops-nix.nixosModules.sops
|
|
||||||
(builtins.toPath "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix")
|
(builtins.toPath "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix")
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|||||||
+29
-131
@@ -10,7 +10,7 @@ let
|
|||||||
USER = "akill";
|
USER = "akill";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ./wireguard.nix ];
|
||||||
|
|
||||||
system = {
|
system = {
|
||||||
stateVersion = "23.05";
|
stateVersion = "23.05";
|
||||||
@@ -29,22 +29,6 @@ in
|
|||||||
group = config.users.users.nobody.group;
|
group = config.users.users.nobody.group;
|
||||||
};
|
};
|
||||||
|
|
||||||
"wg_privkey" = {
|
|
||||||
sopsFile = ./secrets/wg_privkey.yaml;
|
|
||||||
};
|
|
||||||
|
|
||||||
"wg_preshared/nixy" = {
|
|
||||||
sopsFile = ../common/secrets/wg_preshared.yaml;
|
|
||||||
};
|
|
||||||
|
|
||||||
"wg_privkey_proton" = {
|
|
||||||
sopsFile = ./secrets/wg_privkey_proton.yaml;
|
|
||||||
};
|
|
||||||
|
|
||||||
"wg_endpoint_proton" = {
|
|
||||||
sopsFile = ./secrets/wg_privkey_proton.yaml;
|
|
||||||
};
|
|
||||||
|
|
||||||
"borgbase_enc_key" = {
|
"borgbase_enc_key" = {
|
||||||
sopsFile = ./secrets/borgbase_enc_key.yaml;
|
sopsFile = ./secrets/borgbase_enc_key.yaml;
|
||||||
owner = config.users.users.${USER}.name;
|
owner = config.users.users.${USER}.name;
|
||||||
@@ -58,6 +42,8 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
nix = {
|
nix = {
|
||||||
|
daemonCPUSchedPolicy = "idle";
|
||||||
|
daemonIOSchedClass = "idle";
|
||||||
optimise.automatic = true;
|
optimise.automatic = true;
|
||||||
gc.automatic = true;
|
gc.automatic = true;
|
||||||
gc.options = "--delete-older-than 7d";
|
gc.options = "--delete-older-than 7d";
|
||||||
@@ -81,9 +67,15 @@ in
|
|||||||
'';
|
'';
|
||||||
blacklistedKernelModules = [ ];
|
blacklistedKernelModules = [ ];
|
||||||
|
|
||||||
|
consoleLogLevel = 3;
|
||||||
initrd.compressor = "zstd";
|
initrd.compressor = "zstd";
|
||||||
|
initrd.verbose = false;
|
||||||
initrd.kernelModules = [ ];
|
initrd.kernelModules = [ ];
|
||||||
initrd.systemd.enable = true;
|
initrd.systemd.enable = true;
|
||||||
|
initrd.luks.devices."cryptroot" = {
|
||||||
|
allowDiscards = true;
|
||||||
|
bypassWorkqueues = true;
|
||||||
|
};
|
||||||
binfmt.emulatedSystems = [
|
binfmt.emulatedSystems = [
|
||||||
"wasm32-wasi"
|
"wasm32-wasi"
|
||||||
"x86_64-windows"
|
"x86_64-windows"
|
||||||
@@ -91,8 +83,10 @@ in
|
|||||||
kernelParams = [
|
kernelParams = [
|
||||||
"xe.force_probe=a7a0"
|
"xe.force_probe=a7a0"
|
||||||
"i915.force_probe=!a7a0"
|
"i915.force_probe=!a7a0"
|
||||||
|
"quiet"
|
||||||
|
"udev.log_level=3"
|
||||||
];
|
];
|
||||||
#kernelPackages = pkgs.linuxPackages_latest;
|
kernelPackages = pkgs.linuxPackages_latest;
|
||||||
kernel.sysctl = {
|
kernel.sysctl = {
|
||||||
"net.core.default_qdisc" = "fq";
|
"net.core.default_qdisc" = "fq";
|
||||||
"net.ipv4.tcp_congestion_control" = "bbr";
|
"net.ipv4.tcp_congestion_control" = "bbr";
|
||||||
@@ -110,12 +104,18 @@ in
|
|||||||
"net.ipv4.conf.default.send_redirects" = 0;
|
"net.ipv4.conf.default.send_redirects" = 0;
|
||||||
"net.ipv6.conf.all.accept_redirects" = 0;
|
"net.ipv6.conf.all.accept_redirects" = 0;
|
||||||
"net.ipv6.conf.default.accept_redirects" = 0;
|
"net.ipv6.conf.default.accept_redirects" = 0;
|
||||||
|
# zram tuning (recommended by upstream zram docs)
|
||||||
|
"vm.swappiness" = 180;
|
||||||
|
"vm.page-cluster" = 0;
|
||||||
|
"vm.watermark_boost_factor" = 0;
|
||||||
|
"vm.watermark_scale_factor" = 125;
|
||||||
};
|
};
|
||||||
loader.efi.canTouchEfiVariables = true;
|
loader.efi.canTouchEfiVariables = true;
|
||||||
loader.systemd-boot = {
|
loader.systemd-boot = {
|
||||||
editor = false;
|
editor = false;
|
||||||
enable = true;
|
enable = true;
|
||||||
memtest86.enable = true;
|
memtest86.enable = true;
|
||||||
|
configurationLimit = 10;
|
||||||
};
|
};
|
||||||
nixStoreMountOpts = [ "ro" ];
|
nixStoreMountOpts = [ "ro" ];
|
||||||
supportedFilesystems = [
|
supportedFilesystems = [
|
||||||
@@ -193,21 +193,6 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
wireguard.interfaces = {
|
|
||||||
wg0 = {
|
|
||||||
ips = [ "10.100.0.6/24" ];
|
|
||||||
privateKeyFile = config.sops.secrets."wg_privkey".path;
|
|
||||||
peers = [
|
|
||||||
{
|
|
||||||
publicKey = builtins.readFile ../magpie/wg_pubkey;
|
|
||||||
presharedKeyFile = config.sops.secrets."wg_preshared/nixy".path;
|
|
||||||
allowedIPs = [ "10.100.0.0/24" ];
|
|
||||||
endpoint = "5.75.229.224:51820";
|
|
||||||
persistentKeepalive = 25;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
time.timeZone = "Europe/Sarajevo";
|
time.timeZone = "Europe/Sarajevo";
|
||||||
@@ -279,6 +264,11 @@ in
|
|||||||
sway.enable = true;
|
sway.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
xdg.portal = {
|
||||||
|
enable = true;
|
||||||
|
wlr.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
documentation.dev.enable = true;
|
documentation.dev.enable = true;
|
||||||
|
|
||||||
systemd = {
|
systemd = {
|
||||||
@@ -305,103 +295,6 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
"netns@" = {
|
|
||||||
description = "%I network namespace";
|
|
||||||
before = [ "network.target" ];
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "oneshot";
|
|
||||||
RemainAfterExit = true;
|
|
||||||
ExecStart = "${pkgs.iproute2}/bin/ip netns add %I";
|
|
||||||
ExecStop = "${pkgs.iproute2}/bin/ip netns del %I";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
"wg_proton" = {
|
|
||||||
description = "wg network interface";
|
|
||||||
bindsTo = [ "netns@wg.service" ];
|
|
||||||
requires = [ "network-online.target" ];
|
|
||||||
wants = [ "dnscrypt-proxy_proton.service" ];
|
|
||||||
after = [ "netns@wg.service" ];
|
|
||||||
before = [ "dnscrypt-proxy_proton.service" ];
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "oneshot";
|
|
||||||
RemainAfterExit = true;
|
|
||||||
ExecStart = pkgs.writers.writeBash "wg-up" ''
|
|
||||||
set -e
|
|
||||||
ENDPOINT_IP=$(${pkgs.coreutils-full}/bin/cat "${config.sops.secrets."wg_endpoint_proton".path}")
|
|
||||||
${pkgs.iproute2}/bin/ip link add proton_wg type wireguard
|
|
||||||
${pkgs.iproute2}/bin/ip link set proton_wg netns wg
|
|
||||||
${pkgs.iproute2}/bin/ip -n wg address add 10.2.0.2/32 dev proton_wg
|
|
||||||
${pkgs.iproute2}/bin/ip netns exec wg \
|
|
||||||
${pkgs.wireguard-tools}/bin/wg set "proton_wg" private-key "${
|
|
||||||
config.sops.secrets."wg_privkey_proton".path
|
|
||||||
}"
|
|
||||||
${pkgs.iproute2}/bin/ip netns exec wg \
|
|
||||||
${pkgs.wireguard-tools}/bin/wg set "proton_wg" peer "g6DkXWKI/68RsLjROIwCEcyB/ZhyK5Q7OWcz1TtqER0=" \
|
|
||||||
endpoint "$ENDPOINT_IP:51820" \
|
|
||||||
persistent-keepalive "25" \
|
|
||||||
allowed-ips "0.0.0.0/0"
|
|
||||||
${pkgs.iproute2}/bin/ip -n wg link set lo up
|
|
||||||
${pkgs.iproute2}/bin/ip -n wg link set proton_wg up
|
|
||||||
${pkgs.iproute2}/bin/ip -n wg route add default dev proton_wg
|
|
||||||
'';
|
|
||||||
ExecStop = pkgs.writers.writeBash "wg-down" ''
|
|
||||||
${pkgs.iproute2}/bin/ip -n wg route del default dev proton_wg
|
|
||||||
${pkgs.iproute2}/bin/ip -n wg link del proton_wg
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
"dnscrypt-proxy_proton" = {
|
|
||||||
description = "DNSCrypt-proxy client proton";
|
|
||||||
wants = [
|
|
||||||
"network-online.target"
|
|
||||||
"nss-lookup.target"
|
|
||||||
];
|
|
||||||
before = [ "nss-lookup.target" ];
|
|
||||||
after = [ "wg_proton.service" ];
|
|
||||||
partOf = [ "wg_proton.service" ];
|
|
||||||
serviceConfig = {
|
|
||||||
AmbientCapabilities = "CAP_NET_BIND_SERVICE";
|
|
||||||
CacheDirectory = "dnscrypt-proxy";
|
|
||||||
DynamicUser = true;
|
|
||||||
ExecStart = "${pkgs.dnscrypt-proxy}/bin/dnscrypt-proxy -config ${config.services.dnscrypt-proxy.configFile}";
|
|
||||||
LockPersonality = true;
|
|
||||||
LogsDirectory = "dnscrypt-proxy";
|
|
||||||
MemoryDenyWriteExecute = true;
|
|
||||||
NetworkNamespacePath = "/var/run/netns/wg";
|
|
||||||
NonBlocking = true;
|
|
||||||
NoNewPrivileges = true;
|
|
||||||
PrivateDevices = true;
|
|
||||||
ProtectClock = true;
|
|
||||||
ProtectControlGroups = true;
|
|
||||||
ProtectHome = true;
|
|
||||||
ProtectHostname = true;
|
|
||||||
ProtectKernelLogs = true;
|
|
||||||
ProtectKernelModules = true;
|
|
||||||
ProtectKernelTunables = true;
|
|
||||||
ProtectSystem = "strict";
|
|
||||||
Restart = "always";
|
|
||||||
RestrictAddressFamilies = [
|
|
||||||
"AF_INET"
|
|
||||||
"AF_INET6"
|
|
||||||
];
|
|
||||||
RestrictNamespaces = true;
|
|
||||||
RestrictRealtime = true;
|
|
||||||
RuntimeDirectory = "dnscrypt-proxy";
|
|
||||||
StateDirectory = "dnscrypt-proxy";
|
|
||||||
SystemCallArchitectures = "native";
|
|
||||||
SystemCallFilter = [
|
|
||||||
"@system-service"
|
|
||||||
"@chown"
|
|
||||||
"~@aio"
|
|
||||||
"~@keyring"
|
|
||||||
"~@memlock"
|
|
||||||
"~@setuid"
|
|
||||||
"~@timer"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
coredump.enable = false;
|
coredump.enable = false;
|
||||||
@@ -418,12 +311,17 @@ in
|
|||||||
envfs.enable = true;
|
envfs.enable = true;
|
||||||
fstrim.enable = true;
|
fstrim.enable = true;
|
||||||
fwupd.enable = true;
|
fwupd.enable = true;
|
||||||
|
journald.storage = "volatile";
|
||||||
ntp.enable = true;
|
ntp.enable = true;
|
||||||
openssh.enable = true;
|
openssh.enable = true;
|
||||||
power-profiles-daemon.enable = false;
|
power-profiles-daemon.enable = false;
|
||||||
printing.enable = true;
|
printing.enable = true;
|
||||||
userborn.enable = true;
|
scx = {
|
||||||
|
enable = true;
|
||||||
|
scheduler = "scx_lavd";
|
||||||
|
};
|
||||||
upower.enable = lib.mkForce false;
|
upower.enable = lib.mkForce false;
|
||||||
|
userborn.enable = true;
|
||||||
|
|
||||||
greetd = {
|
greetd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|||||||
@@ -0,0 +1,149 @@
|
|||||||
|
{ config
|
||||||
|
, pkgs
|
||||||
|
, lib
|
||||||
|
, ...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
sops.secrets = {
|
||||||
|
"wg_privkey" = {
|
||||||
|
sopsFile = ./secrets/wg_privkey.yaml;
|
||||||
|
};
|
||||||
|
|
||||||
|
"wg_preshared/nixy" = {
|
||||||
|
sopsFile = ../common/secrets/wg_preshared.yaml;
|
||||||
|
};
|
||||||
|
|
||||||
|
"wg_privkey_proton" = {
|
||||||
|
sopsFile = ./secrets/wg_privkey_proton.yaml;
|
||||||
|
};
|
||||||
|
|
||||||
|
"wg_endpoint_proton" = {
|
||||||
|
sopsFile = ./secrets/wg_privkey_proton.yaml;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Personal mesh: dials into the magpie hub (10.100.0.0/24)
|
||||||
|
networking.wireguard.interfaces = {
|
||||||
|
wg0 = {
|
||||||
|
ips = [ "10.100.0.6/24" ];
|
||||||
|
privateKeyFile = config.sops.secrets."wg_privkey".path;
|
||||||
|
peers = [
|
||||||
|
{
|
||||||
|
publicKey = builtins.readFile ../magpie/wg_pubkey;
|
||||||
|
presharedKeyFile = config.sops.secrets."wg_preshared/nixy".path;
|
||||||
|
allowedIPs = [ "10.100.0.0/24" ];
|
||||||
|
endpoint = "5.75.229.224:51820";
|
||||||
|
persistentKeepalive = 25;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd = {
|
||||||
|
services = {
|
||||||
|
# ProtonVPN split tunnel: proton_wg lives inside the `wg` network
|
||||||
|
# namespace; anything that should egress over Proton is launched
|
||||||
|
# with `ip netns exec wg ...`.
|
||||||
|
"netns@" = {
|
||||||
|
description = "%I network namespace";
|
||||||
|
before = [ "network.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
ExecStart = "${pkgs.iproute2}/bin/ip netns add %I";
|
||||||
|
ExecStop = "${pkgs.iproute2}/bin/ip netns del %I";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"wg_proton" = {
|
||||||
|
description = "wg network interface";
|
||||||
|
bindsTo = [ "netns@wg.service" ];
|
||||||
|
requires = [ "network-online.target" ];
|
||||||
|
wants = [ "dnscrypt-proxy_proton.service" ];
|
||||||
|
after = [ "netns@wg.service" ];
|
||||||
|
before = [ "dnscrypt-proxy_proton.service" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
ExecStart = pkgs.writers.writeBash "wg-up" ''
|
||||||
|
set -e
|
||||||
|
ENDPOINT_IP=$(${pkgs.coreutils-full}/bin/cat "${config.sops.secrets."wg_endpoint_proton".path}")
|
||||||
|
${pkgs.iproute2}/bin/ip link add proton_wg type wireguard
|
||||||
|
${pkgs.iproute2}/bin/ip link set proton_wg netns wg
|
||||||
|
${pkgs.iproute2}/bin/ip -n wg address add 10.2.0.2/32 dev proton_wg
|
||||||
|
${pkgs.iproute2}/bin/ip netns exec wg \
|
||||||
|
${pkgs.wireguard-tools}/bin/wg set "proton_wg" private-key "${
|
||||||
|
config.sops.secrets."wg_privkey_proton".path
|
||||||
|
}"
|
||||||
|
${pkgs.iproute2}/bin/ip netns exec wg \
|
||||||
|
${pkgs.wireguard-tools}/bin/wg set "proton_wg" peer "${lib.fileContents ../common/wg_pubkey_proton}" \
|
||||||
|
endpoint "$ENDPOINT_IP:51820" \
|
||||||
|
persistent-keepalive "25" \
|
||||||
|
allowed-ips "0.0.0.0/0"
|
||||||
|
${pkgs.iproute2}/bin/ip -n wg link set lo up
|
||||||
|
${pkgs.iproute2}/bin/ip -n wg link set proton_wg up
|
||||||
|
${pkgs.iproute2}/bin/ip -n wg route add default dev proton_wg
|
||||||
|
'';
|
||||||
|
ExecStop = pkgs.writers.writeBash "wg-down" ''
|
||||||
|
${pkgs.iproute2}/bin/ip -n wg route del default dev proton_wg
|
||||||
|
${pkgs.iproute2}/bin/ip -n wg link del proton_wg
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"dnscrypt-proxy_proton" = {
|
||||||
|
description = "DNSCrypt-proxy client proton";
|
||||||
|
wants = [
|
||||||
|
"network-online.target"
|
||||||
|
"nss-lookup.target"
|
||||||
|
];
|
||||||
|
before = [ "nss-lookup.target" ];
|
||||||
|
after = [ "wg_proton.service" ];
|
||||||
|
partOf = [ "wg_proton.service" ];
|
||||||
|
serviceConfig = {
|
||||||
|
AmbientCapabilities = "CAP_NET_BIND_SERVICE";
|
||||||
|
CacheDirectory = "dnscrypt-proxy";
|
||||||
|
DynamicUser = true;
|
||||||
|
ExecStart = "${pkgs.dnscrypt-proxy}/bin/dnscrypt-proxy -config ${config.services.dnscrypt-proxy.configFile}";
|
||||||
|
LockPersonality = true;
|
||||||
|
LogsDirectory = "dnscrypt-proxy";
|
||||||
|
MemoryDenyWriteExecute = true;
|
||||||
|
NetworkNamespacePath = "/var/run/netns/wg";
|
||||||
|
NonBlocking = true;
|
||||||
|
NoNewPrivileges = true;
|
||||||
|
PrivateDevices = true;
|
||||||
|
ProtectClock = true;
|
||||||
|
ProtectControlGroups = true;
|
||||||
|
ProtectHome = true;
|
||||||
|
ProtectHostname = true;
|
||||||
|
ProtectKernelLogs = true;
|
||||||
|
ProtectKernelModules = true;
|
||||||
|
ProtectKernelTunables = true;
|
||||||
|
ProtectSystem = "strict";
|
||||||
|
Restart = "always";
|
||||||
|
RestrictAddressFamilies = [
|
||||||
|
"AF_INET"
|
||||||
|
"AF_INET6"
|
||||||
|
];
|
||||||
|
RestrictNamespaces = true;
|
||||||
|
RestrictRealtime = true;
|
||||||
|
RuntimeDirectory = "dnscrypt-proxy";
|
||||||
|
StateDirectory = "dnscrypt-proxy";
|
||||||
|
SystemCallArchitectures = "native";
|
||||||
|
SystemCallFilter = [
|
||||||
|
"@system-service"
|
||||||
|
"@chown"
|
||||||
|
"~@aio"
|
||||||
|
"~@keyring"
|
||||||
|
"~@memlock"
|
||||||
|
"~@setuid"
|
||||||
|
"~@timer"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Don't bring wg0 up at boot
|
||||||
|
targets."wireguard-wg0".wantedBy = lib.mkForce [ ];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -96,6 +96,7 @@ in
|
|||||||
bars = [ ];
|
bars = [ ];
|
||||||
startup = [
|
startup = [
|
||||||
{ command = "exec ${quickshell_bar}/bin/quickshell-bar"; }
|
{ command = "exec ${quickshell_bar}/bin/quickshell-bar"; }
|
||||||
|
{ command = "swaymsg 'workspace 1; layout tabbed'"; }
|
||||||
];
|
];
|
||||||
|
|
||||||
keybindings = {
|
keybindings = {
|
||||||
|
|||||||
+8
-1
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
autocd = true;
|
autocd = true;
|
||||||
enableCompletion = true;
|
enableCompletion = false;
|
||||||
defaultKeymap = "viins";
|
defaultKeymap = "viins";
|
||||||
dotDir = config.home.homeDirectory;
|
dotDir = config.home.homeDirectory;
|
||||||
|
|
||||||
@@ -116,6 +116,13 @@
|
|||||||
RPS1="{{$BUBBLEWRAP_DIR}}"
|
RPS1="{{$BUBBLEWRAP_DIR}}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
autoload -Uz compinit
|
||||||
|
if [[ -n $(print -r -- ~/.zcompdump(Nmh-24)) ]]; then
|
||||||
|
compinit -C
|
||||||
|
else
|
||||||
|
compinit
|
||||||
|
fi
|
||||||
|
|
||||||
# Recompile .zcompdump if stale
|
# Recompile .zcompdump if stale
|
||||||
if [[ -f ~/.zcompdump && ( ! -f ~/.zcompdump.zwc || ~/.zcompdump -nt ~/.zcompdump.zwc ) ]]; then
|
if [[ -f ~/.zcompdump && ( ! -f ~/.zcompdump.zwc || ~/.zcompdump -nt ~/.zcompdump.zwc ) ]]; then
|
||||||
zcompile ~/.zcompdump
|
zcompile ~/.zcompdump
|
||||||
|
|||||||
+9
-11
@@ -43,8 +43,8 @@ in
|
|||||||
};
|
};
|
||||||
qt = {
|
qt = {
|
||||||
enable = true;
|
enable = true;
|
||||||
style.name = "adwaita-dark";
|
style.name = "breeze";
|
||||||
platformTheme.name = "gtk";
|
platformTheme.name = "kde6";
|
||||||
};
|
};
|
||||||
|
|
||||||
fonts.fontconfig.enable = true;
|
fonts.fontconfig.enable = true;
|
||||||
@@ -182,12 +182,12 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
# Workaround for QtWebEngine screen flicker/flash on Wayland+Intel
|
|
||||||
qt.args = [
|
qt.args = [
|
||||||
"disable-gpu-compositing"
|
"ignore-gpu-blocklist"
|
||||||
"enable-features=VaapiVideoDecoder,VaapiVideoEncoder"
|
"disable-gpu-memory-buffer-video-frames=false"
|
||||||
|
"enable-features=VaapiIgnoreDriverChecks,VaapiVideoDecoder,AcceleratedVideoDecoder,AcceleratedVideoDecodeLinuxGL,AcceleratedVideoEncoder,Vulkan,DefaultANGLEVulkan,VulkanFromANGLE,FluentOverlayScrollbar,MiddleClickAutoscroll"
|
||||||
];
|
];
|
||||||
colors.webpage.preferred_color_scheme = "dark";
|
|
||||||
content.notifications.enabled = false;
|
content.notifications.enabled = false;
|
||||||
content.pdfjs = true;
|
content.pdfjs = true;
|
||||||
content.webgl = false;
|
content.webgl = false;
|
||||||
@@ -209,6 +209,9 @@ in
|
|||||||
tabs.width = "12%";
|
tabs.width = "12%";
|
||||||
zoom.default = "125%";
|
zoom.default = "125%";
|
||||||
};
|
};
|
||||||
|
extraConfig = ''
|
||||||
|
c.qt.environ = {"QTWEBENGINE_FORCE_USE_GBM": "0"}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
git = {
|
git = {
|
||||||
@@ -285,11 +288,6 @@ in
|
|||||||
${pkgs.coreutils}/bin/rm $ALL_IMGS
|
${pkgs.coreutils}/bin/rm $ALL_IMGS
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
/*
|
|
||||||
refresh_i3status = pkgs.writeShellScriptBin "refresh_i3status" ''
|
|
||||||
${pkgs.coreutils}/bin/sleep 1 && ${pkgs.procps}/bin/pkill -USR1 i3status-rs
|
|
||||||
'';
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
enable = true;
|
enable = true;
|
||||||
events = {
|
events = {
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ in
|
|||||||
kdePackages.kdegraphics-thumbnailers
|
kdePackages.kdegraphics-thumbnailers
|
||||||
kdePackages.kdenlive
|
kdePackages.kdenlive
|
||||||
kdePackages.okular
|
kdePackages.okular
|
||||||
|
kdePackages.yakuake
|
||||||
kicad
|
kicad
|
||||||
kodi-wayland
|
kodi-wayland
|
||||||
komikku
|
komikku
|
||||||
|
|||||||
Reference in New Issue
Block a user