25 Commits

Author SHA1 Message Date
DerGrumpf 4a9bfcaf26 Changed to VPS Installer 2026-07-10 19:28:01 +02:00
DerGrumpf 4619826e15 chore: track assets with git lfs 2026-06-30 21:30:34 +02:00
DerGrumpf 65d1577cc6 Changed Avatars to Miku 2026-06-30 21:30:02 +02:00
DerGrumpf 70ab04e947 Fixed Home Manager API Change 2026-06-30 00:53:47 +02:00
DerGrumpf 57bed639e8 Reworked Hyprland dir 2026-06-30 00:32:15 +02:00
DerGrumpf a0f6f9052b Added impermanence to home manager 2026-06-30 00:27:15 +02:00
DerGrumpf f1c99682ac Added disko setup for desktop 2026-06-30 00:01:44 +02:00
DerGrumpf 649942096f Added disko setup for desktop 2026-06-30 00:00:47 +02:00
DerGrumpf 6668c810d3 Added Fixed Wireguard ips to hosts dns lookup 2026-06-29 18:13:11 +02:00
DerGrumpf 73ff128705 Reorderd Secrets to match a structure 2026-06-29 12:17:55 +02:00
DerGrumpf a24e82bf5a Swapped volatile Tailscale ips for fixed wireguard ips 2026-06-29 11:29:17 +02:00
DerGrumpf cbfb1fef0e Setup Wireguard configuration 2026-06-29 11:24:19 +02:00
DerGrumpf 23ecd70457 Changed name from Mjolnir to Draupnir 2026-06-28 23:29:04 +02:00
DerGrumpf 15182d6de3 Changed name from Mjolnir to Draupnir 2026-06-28 23:28:32 +02:00
DerGrumpf 708b00ac61 Added Impermanence and Disko setup to Proxy 2026-06-28 23:23:56 +02:00
DerGrumpf 75bd7875cb Fixed WAL writing of postgres backup 2026-06-28 19:34:34 +02:00
DerGrumpf a292eb6b09 Added Impermanence to services runned by cyper-controller 2026-06-28 15:02:42 +02:00
DerGrumpf bbf95a5a8c Added Install script for hosts 2026-06-28 00:18:08 +02:00
DerGrumpf b7edb85dd8 Fixed Home manager sops nix 2026-06-27 23:10:07 +02:00
DerGrumpf bd56dec0b1 Fixed sops secret path for home manager; added automatic tailscale auth 2026-06-27 22:10:55 +02:00
DerGrumpf 57f6b25a9e Added Disko setup; And test impermanence on node 1 & 2 2026-06-27 21:43:29 +02:00
DerGrumpf e2e63fbcab Added Disko setup 2026-06-27 10:00:19 +02:00
DerGrumpf 60d9a97ae8 WIP: Added Hardware configurations for node servers as a test 2026-06-24 19:27:57 +02:00
DerGrumpf dbcba53ede WIP: Groundwork for impermanence setup for nixos and home 2026-06-24 19:07:40 +02:00
DerGrumpf b9a7d03a59 Init feature/impermanence 2026-06-24 10:20:42 +02:00
108 changed files with 1664 additions and 972 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
result result
result-* result-*
*.qcow2 *.qcow2
extra_files/* extra-files/*
# Ignore everything in the secrets directory # Ignore everything in the secrets directory
secrets/* secrets/*
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+18 -1
View File
@@ -1,6 +1,7 @@
{ {
pkgs, pkgs,
primaryUser, primaryUser,
lib,
... ...
}: }:
{ {
@@ -8,6 +9,7 @@
./settings.nix ./settings.nix
./homebrew.nix ./homebrew.nix
./yabai.nix ./yabai.nix
./wireguard.nix
]; ];
# nix config # nix config
@@ -50,6 +52,12 @@
info.enable = false; # Skip info pages info.enable = false; # Skip info pages
}; };
# Mirrored Network conf
networking.knownNetworkServices = [
"Wi-Fi"
"Ethernet"
];
# homebrew installation manager # homebrew installation manager
nix-homebrew = { nix-homebrew = {
user = primaryUser; user = primaryUser;
@@ -59,15 +67,24 @@
# macOS-specific settings # macOS-specific settings
programs.fish.enable = true; programs.fish.enable = true;
environment.shells = [ pkgs.fish ];
system.primaryUser = primaryUser; system.primaryUser = primaryUser;
users.users.${primaryUser} = { users.users.${primaryUser} = {
home = "/Users/${primaryUser}"; home = "/Users/${primaryUser}";
shell = pkgs.fish; shell = pkgs.fish;
openssh.authorizedKeys.keyFiles = [ ../secrets/ssh-key ]; openssh.authorizedKeys.keyFiles = [ ../secrets/ssh-key ];
}; };
environment = { environment = {
shells = [ pkgs.fish ];
systemPath = [ "/opt/homebrew/bin" ]; systemPath = [ "/opt/homebrew/bin" ];
pathsToLink = [ "/Applications" ]; pathsToLink = [ "/Applications" ];
etc."hosts".text = lib.mkAfter ''
10.10.0.1 proxy.cyperpunk.de
10.10.0.2 controller.cyperpunk.de
10.10.0.3 mac.cyperpunk.de
10.10.0.30 node1.cyperpunk.de
10.10.0.31 node2.cyperpunk.de
10.10.0.40 desktop.cyperpunk.de
'';
}; };
} }
+40
View File
@@ -0,0 +1,40 @@
{
config,
pkgs,
hostName,
...
}:
{
sops.secrets."network/wireguard/${hostName}" = {
mode = "0400";
};
launchd.daemons.wireguard = {
script = ''
set -e
mkdir -p /etc/wireguard
PRIVATE_KEY=$(cat ${config.sops.secrets."network/wireguard/${hostName}".path})
cat > /etc/wireguard/wg0.conf << EOF
[Interface]
Address = $WG_IP
PrivateKey = $PRIVATE_KEY
[Peer]
PublicKey = NjMYaUZO/iPRM/J46qyPPuWYg5oSeAUxjocMs/hYTXs=
Endpoint = 178.254.8.35:51820
AllowedIPs = 10.10.0.0/24
PersistentKeepalive = 25
EOF
chmod 600 /etc/wireguard/wg0.conf
${pkgs.wireguard-tools}/bin/wg-quick up wg0
'';
environment.WG_IP = "";
serviceConfig = {
Label = "org.wireguard.wg0";
RunAtLoad = true;
KeepAlive = false;
StandardOutPath = "/var/log/wireguard.log";
StandardErrorPath = "/var/log/wireguard.log";
};
};
}
Generated
+239 -30
View File
@@ -57,11 +57,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1782117778, "lastModified": 1782648384,
"narHash": "sha256-x6vIJpJziw3Hs0JKKDP+AeRPWwqyMDOmK6I26tqbYj4=", "narHash": "sha256-OlHdAqdXasZk1U+Zf9n+ivqHL9kj/UD0DFO4yYTNBYc=",
"owner": "catppuccin", "owner": "catppuccin",
"repo": "nix", "repo": "nix",
"rev": "e98afe2dfd950bda4e6a8ef32bb563ec2f04505a", "rev": "f2c7dd14ecce785c206a39466cbe227ff62e3803",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -90,6 +90,48 @@
"type": "github" "type": "github"
} }
}, },
"disko": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1781152676,
"narHash": "sha256-RxWs5ND31KzTG7wvMM+PMfUjyNpmIEr999lqNARaM5o=",
"owner": "nix-community",
"repo": "disko",
"rev": "ff8702b4de27f72b4c78573dfb89ec74e36abdf1",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "disko",
"type": "github"
}
},
"disko_2": {
"inputs": {
"nixpkgs": [
"nixos-anywhere",
"nixpkgs"
]
},
"locked": {
"lastModified": 1781152676,
"narHash": "sha256-RxWs5ND31KzTG7wvMM+PMfUjyNpmIEr999lqNARaM5o=",
"owner": "nix-community",
"repo": "disko",
"rev": "ff8702b4de27f72b4c78573dfb89ec74e36abdf1",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "master",
"repo": "disko",
"type": "github"
}
},
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
@@ -209,11 +251,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1782358560, "lastModified": 1781788787,
"narHash": "sha256-vCcLh9pw3XO/+Lxk8r6xv6QnoCrTfGqiACcI7O637Wg=", "narHash": "sha256-YqlTCRRhGvNjcJejPeMuHrYQ/TVhOO2MV/nEGMWb8nk=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "3a70e333f2950c302e875c44cfcfaff3f80f36bc", "rev": "d456f483f157d4b706416005da226234b9c116ff",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -223,6 +265,27 @@
"type": "github" "type": "github"
} }
}, },
"home-manager_2": {
"inputs": {
"nixpkgs": [
"impermanence",
"nixpkgs"
]
},
"locked": {
"lastModified": 1768598210,
"narHash": "sha256-kkgA32s/f4jaa4UG+2f8C225Qvclxnqs76mf8zvTVPg=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "c47b2cc64a629f8e075de52e4742de688f930dc6",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"hyprcursor": { "hyprcursor": {
"inputs": { "inputs": {
"hyprlang": "hyprlang", "hyprlang": "hyprlang",
@@ -320,11 +383,11 @@
"xdph": "xdph" "xdph": "xdph"
}, },
"locked": { "locked": {
"lastModified": 1782366482, "lastModified": 1781796010,
"narHash": "sha256-J+yvgoF+zbYZHJkGxfMCPWa8L3i5Nm7Xlgfw2Eky/Xs=", "narHash": "sha256-bIqjZgUfp3vba/C1UJLVqTo8zdpfqMDvuwWrHmqDWm4=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "Hyprland", "repo": "Hyprland",
"rev": "c9e1a6c3a05c0310424f99c6b90af1164340af99", "rev": "ae1690c2138313d988c81f5c25a9d0b6fadfd3b1",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -647,6 +710,25 @@
"type": "github" "type": "github"
} }
}, },
"impermanence": {
"inputs": {
"home-manager": "home-manager_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1769548169,
"narHash": "sha256-03+JxvzmfwRu+5JafM0DLbxgHttOQZkUtDWBmeUkN8Y=",
"owner": "nix-community",
"repo": "impermanence",
"rev": "7b1d382faf603b6d264f58627330f9faa5cba149",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "impermanence",
"type": "github"
}
},
"nix-homebrew": { "nix-homebrew": {
"inputs": { "inputs": {
"brew-src": "brew-src" "brew-src": "brew-src"
@@ -665,6 +747,27 @@
"type": "github" "type": "github"
} }
}, },
"nix-vm-test": {
"inputs": {
"nixpkgs": [
"nixos-anywhere",
"nixpkgs"
]
},
"locked": {
"lastModified": 1781506385,
"narHash": "sha256-kvTBHLiqB911yf2D9VThIRfB6Ai/E2H9+mVF0wR+9AY=",
"owner": "numtide",
"repo": "nix-vm-test",
"rev": "2071ebc1f5b2a2e0211a2ca38c4e678092df76a5",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "nix-vm-test",
"type": "github"
}
},
"nixcord": { "nixcord": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_2",
@@ -675,11 +778,11 @@
"nixpkgs-nixcord": "nixpkgs-nixcord" "nixpkgs-nixcord": "nixpkgs-nixcord"
}, },
"locked": { "locked": {
"lastModified": 1782349937, "lastModified": 1781775854,
"narHash": "sha256-2haY6BBTL+yCblUup/P9t3D8sUTMSqIok68n+qGjjYI=", "narHash": "sha256-0eb1+zKSTwgD3qsBm7UiuRabahHQNkTP94Z/s3nMK60=",
"owner": "kaylorben", "owner": "kaylorben",
"repo": "nixcord", "repo": "nixcord",
"rev": "afdacaafb10aa459dfabbb8af99e4b0deb74f1d2", "rev": "b92ceb7923c87dfcfcf84415407b0ca63e17548b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -688,6 +791,72 @@
"type": "github" "type": "github"
} }
}, },
"nixos-anywhere": {
"inputs": {
"disko": "disko_2",
"nix-vm-test": "nix-vm-test",
"nixos-images": "nixos-images",
"nixos-stable": "nixos-stable",
"nixpkgs": [
"nixpkgs"
],
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1782285665,
"narHash": "sha256-ISUNn+z9+BIDGRrNAmEfghvzFmDgKtGHGEYqIDvGeWk=",
"owner": "nix-community",
"repo": "nixos-anywhere",
"rev": "4b74194d2927a7741d023b3fd2a0d252059f75ee",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-anywhere",
"type": "github"
}
},
"nixos-images": {
"inputs": {
"nixos-stable": [
"nixos-anywhere",
"nixos-stable"
],
"nixos-unstable": [
"nixos-anywhere",
"nixpkgs"
]
},
"locked": {
"lastModified": 1781778781,
"narHash": "sha256-CYnhWtKIr0xbxQT6N0X1j0FsmCG+cDV498jyO0xevwQ=",
"owner": "nix-community",
"repo": "nixos-images",
"rev": "94cbd4c8da5f130f188af04293514926a947b380",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-images",
"type": "github"
}
},
"nixos-stable": {
"locked": {
"lastModified": 1782116945,
"narHash": "sha256-G3tw/IXmaH6IQ2upZvhuN9sG8CkuX+BLuJDpE8hz0Ds=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "34268251cf5547d39063f2c5ea9a196246f7f3a6",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-26.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1780749050, "lastModified": 1780749050,
@@ -736,6 +905,22 @@
} }
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": {
"lastModified": 1768564909,
"narHash": "sha256-Kell/SpJYVkHWMvnhqJz/8DqQg2b6PguxVWOuadbHCc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e4bae1bd10c9c57b2cf517953ab70060a828ee6f",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1781577229, "lastModified": 1781577229,
"narHash": "sha256-lrp67w8AulE9Ks53n27I45ADSzbOCn4H+CNW1Ck8B+8=", "narHash": "sha256-lrp67w8AulE9Ks53n27I45ADSzbOCn4H+CNW1Ck8B+8=",
@@ -751,13 +936,13 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_3": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1781607440, "lastModified": 1782175435,
"narHash": "sha256-rxO+uc/KFbSJp+pgyXRuAX6QlG9hJdnt0BXpEQRXY+U=", "narHash": "sha256-EMzXKmnOtBQ2MnvpiNOm7E+kOMvdPrIKaeg52Tip2Uk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3e41b24abd260e8f71dbe2f5737d24122f972158", "rev": "89570f24e97e614aa34aa9ab1c927b6578a43775",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -770,15 +955,15 @@
"nixvim": { "nixvim": {
"inputs": { "inputs": {
"flake-parts": "flake-parts_2", "flake-parts": "flake-parts_2",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_4",
"systems": "systems_3" "systems": "systems_3"
}, },
"locked": { "locked": {
"lastModified": 1782254890, "lastModified": 1781713417,
"narHash": "sha256-kjsEECqhpPnJWqhooXp6tWh2qGQftCPAo2G1GvZtKdw=", "narHash": "sha256-Kaj44jTNmnaFhKrcADx8nXmUYPa7l2HYfb7m6lEPy7Q=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixvim", "repo": "nixvim",
"rev": "dbf9550dba8448b03e11d58e5695d6c44a464554", "rev": "caee4e5d4161778815f522d9ea1c9e3dc42462b7",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -795,11 +980,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1782389847, "lastModified": 1781800183,
"narHash": "sha256-eP8eqJcG07GXr/mNOm6xS4ws+7sKw8pPk9xbAf11tb8=", "narHash": "sha256-NcRZr/JQiAvqC2qCyMxcfx/98Hf1epwdtjcbwKHeMf8=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "a573a709b3b6778499500cdea3ea134faef25218", "rev": "0559d992b12ee209570bb325d79e90007b13da52",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -835,13 +1020,16 @@
"inputs": { "inputs": {
"catppuccin": "catppuccin", "catppuccin": "catppuccin",
"darwin": "darwin", "darwin": "darwin",
"disko": "disko",
"home-manager": "home-manager", "home-manager": "home-manager",
"hyprcursor": "hyprcursor", "hyprcursor": "hyprcursor",
"hyprland": "hyprland", "hyprland": "hyprland",
"hyprland-plugins": "hyprland-plugins", "hyprland-plugins": "hyprland-plugins",
"impermanence": "impermanence",
"nix-homebrew": "nix-homebrew", "nix-homebrew": "nix-homebrew",
"nixcord": "nixcord", "nixcord": "nixcord",
"nixpkgs": "nixpkgs_2", "nixos-anywhere": "nixos-anywhere",
"nixpkgs": "nixpkgs_3",
"nixvim": "nixvim", "nixvim": "nixvim",
"nur": "nur", "nur": "nur",
"sops-nix": "sops-nix", "sops-nix": "sops-nix",
@@ -855,11 +1043,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1782165805, "lastModified": 1780547341,
"narHash": "sha256-478kKQBvK6SYTOdN2h9jhKJv94nbXRbFMfuL1WshErg=", "narHash": "sha256-Gq8KNx5A7hBB3uGJaj6eQfLDIz5YdLu92gqBcvHvoUo=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "56b24064fdcaedca53553b1a6d607fd23b613a24", "rev": "9ed65852b6257fbeae4355bc24ecfea307ca759a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -876,11 +1064,11 @@
"systems": "systems_4" "systems": "systems_4"
}, },
"locked": { "locked": {
"lastModified": 1782031037, "lastModified": 1781425310,
"narHash": "sha256-a7oWSyS7SN81UOqVt481yIEMDsMpaJ7GNdV6Eaz5Yqg=", "narHash": "sha256-GTBka4Df/ZOacmisI/DI2LICyNChEqn/giah83LucdM=",
"owner": "Gerg-L", "owner": "Gerg-L",
"repo": "spicetify-nix", "repo": "spicetify-nix",
"rev": "9cb27462cfd20edac174353f1e95bc03aa888863", "rev": "aeaf7c81a45d3761da61cb05bfc370ac6d1b0441",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -950,6 +1138,27 @@
"type": "github" "type": "github"
} }
}, },
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nixos-anywhere",
"nixpkgs"
]
},
"locked": {
"lastModified": 1780220602,
"narHash": "sha256-eynAfOmbmxJnkp7YewvCEbShNnnYJ9gLLqkzsYtBPeM=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "db947814a175b7ca6ded66e21383d938df01c227",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"xdph": { "xdph": {
"inputs": { "inputs": {
"hyprland-protocols": [ "hyprland-protocols": [
+79 -92
View File
@@ -5,6 +5,23 @@
# monorepo w/ recipes ("derivations") # monorepo w/ recipes ("derivations")
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# declarative disk layout
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
# declarative impermanence
impermanence = {
url = "github:nix-community/impermanence";
};
# declarative installer
nixos-anywhere = {
url = "github:nix-community/nixos-anywhere";
inputs.nixpkgs.follows = "nixpkgs";
};
# declarative Configs # declarative Configs
home-manager = { home-manager = {
url = "github:nix-community/home-manager/master"; url = "github:nix-community/home-manager/master";
@@ -84,86 +101,54 @@
hyprland, hyprland,
sops-nix, sops-nix,
nur, nur,
impermanence,
disko,
nixos-anywhere,
... ...
}@inputs: }@inputs:
let let
primaryUser = "phil"; primaryUser = "phil";
/* installer = nixpkgs.lib.nixosSystem {
mkIso - Build a NixOS image for a given target. system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
{
nixpkgs = {
config.allowUnfree = true;
hostPlatform = "x86_64-linux";
};
}
./hosts/installer/configuration.nix
];
};
Available targets (imageModule imageBuildAttr): mkInstall =
ISO (minimal) : "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix" "isoImage"
ISO (graphical): "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix" "isoImage"
Amazon EC2 : "${nixpkgs}/nixos/modules/virtualisation/amazon-image.nix" "amazonImage"
Linode : "${nixpkgs}/nixos/modules/virtualisation/linode-image.nix" "linodeImage"
Proxmox LXC : "${nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix" "tarball"
Google Cloud : "${nixpkgs}/nixos/modules/virtualisation/google-compute-image.nix" "googleComputeImage"
Azure : "${nixpkgs}/nixos/modules/virtualisation/azure-image.nix" "azureImage"
QEMU (runnable): "${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix" "vm"
QEMU (headless): "${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix" "vmWithBootLoader"
- Claude Sonnet 4.6
*/
mkIso =
{ {
hostName, hostName,
isDarwin ? false, target ? "192.168.2.99",
isServer ? false,
imageModule ? "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix",
imageBuildAttr ? "isoImage",
}: }:
(nixpkgs.lib.nixosSystem { let
system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.x86_64-linux;
specialArgs = { in
inherit {
inputs type = "app";
primaryUser program = "${
self pkgs.writeShellApplication {
hostName name = "install-${hostName}";
isDarwin runtimeInputs = [ nixos-anywhere.packages.x86_64-linux.nixos-anywhere ];
isServer text = ''
; EXTRA_FILES="''${1:-./extra-files}"
}; TARGET="''${2:-${target}}"
modules = [ nixos-anywhere \
imageModule --flake .#${hostName} \
{ --extra-files "$EXTRA_FILES" \
nixpkgs.overlays = [ --chown /persist/secrets/age-key.txt "$(id -u ${primaryUser})":100 \
inputs.nur.overlays.default root@"$TARGET"
(import ./overlays { inherit (inputs) nur; }) '';
];
} }
{ nixpkgs.config.allowUnfree = true; } }/bin/install-${hostName}";
{ nixpkgs.hostPlatform = "x86_64-linux"; } };
{ networking.hostName = hostName; }
./hosts/${hostName}/configuration.nix
./nixos
inputs.sops-nix.nixosModules.sops
inputs.home-manager.nixosModules.home-manager
{
home-manager = {
extraSpecialArgs = {
inherit
inputs
primaryUser
self
hostName
isDarwin
isServer
;
};
users.${primaryUser} = import ./home;
backupFileExtension = "backup";
useGlobalPkgs = true;
useUserPackages = true;
sharedModules = [
{
programs.nixvim.nixpkgs.source = inputs.nixpkgs;
}
];
};
}
];
}).config.system.build.${imageBuildAttr};
mkSystem = mkSystem =
{ {
@@ -205,11 +190,6 @@
backupFileExtension = "hm-backup"; backupFileExtension = "hm-backup";
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
sharedModules = [
{
programs.nixvim.nixpkgs.source = inputs.nixpkgs;
}
];
}; };
} }
]; ];
@@ -224,6 +204,8 @@
[ [
{ nixpkgs.hostPlatform = system; } { nixpkgs.hostPlatform = system; }
./nixos ./nixos
inputs.impermanence.nixosModules.impermanence
inputs.disko.nixosModules.disko
]; ];
in in
@@ -235,6 +217,8 @@
in in
{ {
nixosConfigurations = { nixosConfigurations = {
"installer" = installer;
"cyper-desktop" = mkSystem { "cyper-desktop" = mkSystem {
hostName = "cyper-desktop"; hostName = "cyper-desktop";
system = "x86_64-linux"; system = "x86_64-linux";
@@ -272,25 +256,28 @@
}; };
packages.x86_64-linux = { packages.x86_64-linux = {
cyper-desktop-iso = mkIso { hostName = "cyper-desktop"; }; installer = self.nixosConfigurations.installer.config.system.build.isoImage;
cyper-controller-iso = mkIso {
hostName = "cyper-controller";
isServer = true;
};
cyper-proxy-iso = mkIso {
hostName = "cyper-proxy";
isServer = true;
};
cyper-node-1-iso = mkIso {
hostName = "cyper-node-1";
isServer = true;
};
cyper-node-2-iso = mkIso {
hostName = "cyper-node-2";
isServer = true;
};
}; };
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-tree; formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-tree;
apps.x86_64-linux = {
install-cyper-node-1 = mkInstall {
hostName = "cyper-node-1";
};
install-cyper-node-2 = mkInstall {
hostName = "cyper-node-2";
};
install-cyper-controller = mkInstall {
hostName = "cyper-controller";
};
install-cyper-proxy = mkInstall {
hostName = "cyper-proxy";
target = ""; # KVM console IP
};
install-cyper-desktop = mkInstall {
hostName = "cyper-desktop";
};
};
}; };
} }
+7 -7
View File
@@ -43,8 +43,8 @@
enableNixpkgsReleaseCheck = false; enableNixpkgsReleaseCheck = false;
stateVersion = "26.05"; stateVersion = "26.05";
sessionVariables = lib.mkIf (!isDarwin && !isServer) { sessionVariables = lib.mkIf (!isDarwin && !isServer) {
GROQ_API_KEY = config.sops.secrets.GROQ_API_KEY.path; GROQ_API_KEY = config.sops.secrets."api_keys/groq".path;
OPENWEATHER_API_KEY = config.sops.secrets.OPENWEATHER_API_KEY.path; OPENWEATHER_API_KEY = config.sops.secrets."api_keys/openweather".path;
}; };
file = lib.mkIf (!isServer) { file = lib.mkIf (!isServer) {
"Pictures/Avatar" = { "Pictures/Avatar" = {
@@ -65,15 +65,15 @@
if isDarwin then if isDarwin then
"/Users/${primaryUser}/.config/nix/secrets/keys.txt" "/Users/${primaryUser}/.config/nix/secrets/keys.txt"
else else
"/home/${primaryUser}/.config/nix/secrets/keys.txt"; "/persist/secrets/age-key.txt";
secrets = { secrets = {
GROQ_API_KEY = { }; "api_keys/groq" = { };
OPENWEATHER_API_KEY = { }; "api_keys/openweather" = { };
ssh_private_key = { "ssh/private_key" = {
path = if isDarwin then "/Users/${primaryUser}/.ssh/ssh" else "/home/${primaryUser}/.ssh/ssh"; path = if isDarwin then "/Users/${primaryUser}/.ssh/ssh" else "/home/${primaryUser}/.ssh/ssh";
mode = "0600"; mode = "0600";
}; };
ssh_github_key = { "ssh/github_key" = {
path = if isDarwin then "/Users/${primaryUser}/.ssh/github" else "/home/${primaryUser}/.ssh/github"; path = if isDarwin then "/Users/${primaryUser}/.ssh/github" else "/home/${primaryUser}/.ssh/github";
mode = "0600"; mode = "0600";
}; };
+1 -1
View File
@@ -1,4 +1,4 @@
_: { {
imports = [ imports = [
./hyprland ./hyprland
./rofi ./rofi
-6
View File
@@ -8,12 +8,6 @@ in
packages = with pkgs; [ packages = with pkgs; [
adwaita-icon-theme adwaita-icon-theme
]; ];
#pointerCursor = {
# gtk.enable = true;
# name = "catppuccin-mocha-sapphire-cursors";
# package = pkgs.catppuccin-cursors.mochaSapphire;
# size = 24;
#};
file = { file = {
".config/gtk-4.0/gtk.css".source = "${theme}/share/themes/${theme_name}/gtk-4.0/gtk.css"; ".config/gtk-4.0/gtk.css".source = "${theme}/share/themes/${theme_name}/gtk-4.0/gtk.css";
".config/gtk-4.0/gtk-dark.css".source = "${theme}/share/themes/${theme_name}/gtk-4.0/gtk-dark.css"; ".config/gtk-4.0/gtk-dark.css".source = "${theme}/share/themes/${theme_name}/gtk-4.0/gtk-dark.css";
+1
View File
@@ -15,6 +15,7 @@
pamixer pamixer
brightnessctl brightnessctl
playerctl playerctl
waypaper
]; ];
systemd.user.targets.hyprland-session.Unit.Wants = [ "xdg-desktop-autostart.target" ]; systemd.user.targets.hyprland-session.Unit.Wants = [ "xdg-desktop-autostart.target" ];
+1 -3
View File
@@ -1,6 +1,4 @@
{ ... }:
{ {
# Hypridle configuration
services.hypridle = { services.hypridle = {
enable = true; enable = true;
settings = { settings = {
@@ -8,7 +6,7 @@
after_sleep_cmd = "hyprctl dispatch dpms on"; after_sleep_cmd = "hyprctl dispatch dpms on";
ignore_dbus_inhibit = false; ignore_dbus_inhibit = false;
lock_cmd = "hyprlock"; lock_cmd = "hyprlock";
before_sleep_cmd = "notify-send -u critical \"I'm getting sleepy I'll see you in my code dreams 💖\" --icon=$HOME/.config/hypr/avatar.png --app-name=Hyprlock"; before_sleep_cmd = "notify-send -u critical \"I'm getting sleepy I'll see you in my code dreams 💖\" --app-name=Hyprlock";
}; };
listener = [ listener = [
+13 -16
View File
@@ -1,8 +1,4 @@
{ ... }:
{ {
# Hyprlock configuration
programs.hyprlock = { programs.hyprlock = {
enable = true; enable = true;
settings = { settings = {
@@ -18,7 +14,7 @@
background = [ background = [
{ {
path = "~/Pictures/Wallpapers/lucy_with_cat.png"; path = "$HOME/Pictures/Wallpapers/lucy_with_cat.png";
blur_passes = 1; blur_passes = 1;
blur_size = 5; blur_size = 5;
} }
@@ -81,7 +77,7 @@
outline_thickness = 4; outline_thickness = 4;
dots_size = 0.2; dots_size = 0.2;
dots_spacing = 0.2; dots_spacing = 0.2;
dots_center = "true"; dots_center = true;
outer_color = "$red"; outer_color = "$red";
inner_color = "$surface0"; inner_color = "$surface0";
font_color = "$text"; font_color = "$text";
@@ -97,16 +93,17 @@
valign = "center"; valign = "center";
}; };
image = { image = [
monitor = ""; {
path = "~/.config/hypr/avatar/avatar.png"; monitor = "";
size = 300; path = "$HOME/Pictures/Avatar/miku_happy_sparkels.png";
border_color = "$teal"; size = 300;
position = "0, 75"; border_color = "$teal";
halign = "center"; position = "0, 75";
valign = "center"; halign = "center";
}; valign = "center";
}
];
}; };
}; };
} }
-1
View File
@@ -1,4 +1,3 @@
{ ... }:
{ {
services.mako = { services.mako = {
enable = true; enable = true;
+3 -3
View File
@@ -6,10 +6,10 @@
platformTheme.name = "kvantum"; platformTheme.name = "kvantum";
}; };
home.packages = lib.mkIf (!pkgs.stdenv.isDarwin) ( home.packages = lib.mkIf (!pkgs.stdenv.isDarwin) (
with pkgs; with pkgs.kdePackages;
[ [
kdePackages.qt6ct qt6ct
kdePackages.qtstyleplugin-kvantum qtstyleplugin-kvantum
] ]
); );
} }
+3 -3
View File
@@ -150,11 +150,11 @@
format = "{}"; format = "{}";
return-type = "json"; return-type = "json";
exec = '' exec = ''
curl -sf --max-time 10 "https://api.openweathermap.org/data/2.5/weather?lat=52.281311&lon=10.527029&appid=$(cat ~/.config/sops-nix/secrets/OPENWEATHER_API_KEY)&units=metric&lang=en" | jq -c '{text: "\(.name) \(.main.temp)C°"}' curl -sf --max-time 10 "https://api.openweathermap.org/data/2.5/weather?lat=52.281311&lon=10.527029&appid=$(cat ~/.config/sops-nix/secrets/api_keys/openweather)&units=metric&lang=en" | jq -c '{text: "\(.name) \(.main.temp)C°"}'
''; '';
interval = 120; interval = 120;
on-click = '' on-click = ''
data=$(curl -sf --max-time 10 "https://api.openweathermap.org/data/2.5/weather?lat=52.281311&lon=10.527029&appid=$(cat ~/.config/sops-nix/secrets/OPENWEATHER_API_KEY)&units=metric&lang=en") data=$(curl -sf --max-time 10 "https://api.openweathermap.org/data/2.5/weather?lat=52.281311&lon=10.527029&appid=$(cat ~/.config/sops-nix/secrets/api_keys/openweather)&units=metric&lang=en")
city=$(echo "$data" | jq -r '.name') city=$(echo "$data" | jq -r '.name')
temp=$(echo "$data" | jq -r '.main.temp') temp=$(echo "$data" | jq -r '.main.temp')
feels=$(echo "$data" | jq -r '.main.feels_like') feels=$(echo "$data" | jq -r '.main.feels_like')
@@ -163,7 +163,7 @@
clouds=$(echo "$data" | jq -r '.clouds.all') clouds=$(echo "$data" | jq -r '.clouds.all')
sunrise=$(echo "$data" | jq -r '.sys.sunrise | strftime("%H:%M")') sunrise=$(echo "$data" | jq -r '.sys.sunrise | strftime("%H:%M")')
sunset=$(echo "$data" | jq -r '.sys.sunset | strftime("%H:%M")') sunset=$(echo "$data" | jq -r '.sys.sunset | strftime("%H:%M")')
notify-send "$city" "Temperature: $temp °C\nFeels Like: $feels °C\nHumidity: $humidity%\nWind: $wind m/s\nClouds: $clouds%\nSunrise at: $sunrise\nSunset at: $sunset" -u normal --icon="$HOME/Pictures/Avatar/avatar_weather_no_bg.png" notify-send "$city" "Temperature: $temp °C\nFeels Like: $feels °C\nHumidity: $humidity%\nWind: $wind m/s\nClouds: $clouds%\nSunrise at: $sunrise\nSunset at: $sunset" -u normal --icon="$HOME/Pictures/Avatar/miku_window_no_bg.png"
''; '';
}; };
+7 -5
View File
@@ -13,12 +13,14 @@
// (import ./dual.nix { inherit compositor; }) // (import ./dual.nix { inherit compositor; })
); );
home.packages = lib.mkIf (!pkgs.stdenv.isDarwin) (with pkgs; [ cava ]); home = {
packages = lib.mkIf (!pkgs.stdenv.isDarwin) (with pkgs; [ cava ]);
home.file = lib.mkIf (!pkgs.stdenv.isDarwin) { file = lib.mkIf (!pkgs.stdenv.isDarwin) {
".config/waybar" = { ".config/waybar" = {
source = ./configs; source = ./configs;
recursive = true; recursive = true;
};
}; };
}; };
} }
-31
View File
@@ -1,31 +0,0 @@
{
widgets = {
"niri/workspaces" = {
format = "{icon}";
format-icons = {
default = "";
active = "";
};
};
"custom/swaync" = {
tooltip = false;
format = "{icon}";
format-icons = {
notification = "<span foreground='red'><sup></sup></span>";
none = " ";
dnd-notification = "<span foreground='red'><sup></sup></span>";
dnd-none = " ";
inhibited-notification = "<span foreground='red'><sup></sup></span>";
inhibited-none = " ";
dnd-inhibited-notification = "<span foreground='red'><sup></sup></span>";
dnd-inhibited-none = " ";
};
return-type = "json";
exec-if = "which swaync-client";
exec = "swaync-client -swb";
on-click = "swaync-client -t -sw";
on-click-right = "swaync-client -d -sw";
escape = true;
};
};
}
+5 -1
View File
@@ -1,4 +1,4 @@
{ pkgs, ... }: { pkgs, primaryUser, ... }:
let let
addons = pkgs.nur.repos.rycee.firefox-addons; addons = pkgs.nur.repos.rycee.firefox-addons;
readJson = path: builtins.readFile path; readJson = path: builtins.readFile path;
@@ -22,6 +22,10 @@ let
}; };
in in
{ {
home.persistence."/persist/home".directories = [
".mozilla/firefox/${primaryUser}"
];
programs.floorp = { programs.floorp = {
enable = true; enable = true;
+11
View File
@@ -0,0 +1,11 @@
{
home.persistence."/persist/home" = {
hideMounts = true;
directories = [
".config/nix"
"Documents"
"Downloads"
"Pictures"
];
};
}
+5 -7
View File
@@ -1,6 +1,4 @@
{ pkgs, ... }:
{ {
# Avante: AI-powered coding assistant (Cursor-like experience in Neovim)
programs.nixvim = { programs.nixvim = {
plugins = { plugins = {
markdown-preview.enable = true; markdown-preview.enable = true;
@@ -14,7 +12,7 @@
providers = { providers = {
groq = { groq = {
__inherited_from = "openai"; __inherited_from = "openai";
api_key_name = "cmd:cat /home/phil/.config/sops-nix/secrets/GROQ_API_KEY"; api_key_name = "cmd:cat /home/phil/.config/sops-nix/secrets/api_keys/groq";
endpoint = "https://api.groq.com/openai/v1/"; endpoint = "https://api.groq.com/openai/v1/";
model = "qwen/qwen3-32b"; model = "qwen/qwen3-32b";
system_promt = "You are a helpful coding assistant. Always respond in plain markdown format without using tool calls or JSON structures."; system_promt = "You are a helpful coding assistant. Always respond in plain markdown format without using tool calls or JSON structures.";
@@ -29,10 +27,10 @@
}; };
ollama = { ollama = {
endpoint = "http://100.86.56.71:11434"; # tailscale IP, no /v1 suffix endpoint = "http://10.10.0.2:11434";
model = "qwen2.5:3b"; # swap for "llama3.2:3b" or "deepseek-r1:1.5b" model = "qwen2.5:3b";
timeout = 60000; # local + small model can be slow on first load timeout = 60000;
disable_tools = true; # these small models aren't reliable at tool calling disable_tools = true;
is_env_set.__raw = ''require("avante.providers.ollama").check_endpoint_alive''; is_env_set.__raw = ''require("avante.providers.ollama").check_endpoint_alive'';
extra_request_body = { extra_request_body = {
options = { options = {
+35 -2
View File
@@ -5,7 +5,6 @@
programs.nixvim = { programs.nixvim = {
plugins.conform-nvim = { plugins.conform-nvim = {
enable = true; enable = true;
settings = { settings = {
formatters_by_ft = { formatters_by_ft = {
lua = [ "stylua" ]; lua = [ "stylua" ];
@@ -13,6 +12,40 @@
python = [ "black" ]; python = [ "black" ];
rust = [ "rustfmt" ]; rust = [ "rustfmt" ];
rasi = [ "prettierd" ]; rasi = [ "prettierd" ];
c = [ "clang_format" ];
cpp = [ "clang_format" ];
};
formatters.clang_format = {
# If the file has a project .clang-format (walking up from the
# file itself, not nvim's cwd), use it - this is how a real
# kernel checkout, or any other C/C++ project's own style,
# gets respected automatically. Otherwise fall back to an
# inline approximation of kernel style instead of plain LLVM,
# since that's the sane default for one-off C files.
prepend_args = {
__raw = ''
function(self, ctx)
local found = vim.fs.find(
{ ".clang-format", "_clang-format" },
{ path = ctx.filename, upward = true }
)[1]
if found then
return { "-style=file" }
end
return {
"-style={BasedOnStyle: LLVM, IndentWidth: 8, UseTab: Always, "
.. "TabWidth: 8, BreakBeforeBraces: Linux, ColumnLimit: 80, "
.. "IndentCaseLabels: false, PointerAlignment: Right, "
.. "DerivePointerAlignment: false, SpaceBeforeParens: ControlStatements, "
.. "SpacesInParentheses: false, SpaceAfterCStyleCast: false, "
.. "AllowShortIfStatementsOnASingleLine: false, AllowShortBlocksOnASingleLine: false, "
.. "AllowShortFunctionsOnASingleLine: None, AllowShortLoopsOnASingleLine: false, "
.. "ReflowComments: false}"
}
end
'';
};
}; };
format_on_save = { format_on_save = {
@@ -21,7 +54,6 @@
}; };
}; };
}; };
# Install formatters # Install formatters
extraPackages = with pkgs; [ extraPackages = with pkgs; [
stylua stylua
@@ -29,6 +61,7 @@
black black
rustfmt rustfmt
prettierd prettierd
clang-tools # provides clang-format
]; ];
}; };
} }
+2
View File
@@ -32,6 +32,8 @@
programs.nixvim = { programs.nixvim = {
enable = true; enable = true;
nixpkgs.source = inputs.nixpkgs;
defaultEditor = true; defaultEditor = true;
enableMan = false; enableMan = false;
+2
View File
@@ -29,6 +29,7 @@
installRustc = true; installRustc = true;
}; };
pylsp.enable = true; # Python language server pylsp.enable = true; # Python language server
clangd.enable = true;
}; };
# Keymaps for LSP actions # Keymaps for LSP actions
@@ -85,6 +86,7 @@
lua-language-server lua-language-server
nil nil
rust-analyzer rust-analyzer
clang-tools
]; ];
}; };
} }
+9 -1
View File
@@ -1,9 +1,17 @@
{ lib, inputs, ... }: {
lib,
inputs,
...
}:
{ {
imports = [ imports = [
inputs.nixcord.homeModules.nixcord inputs.nixcord.homeModules.nixcord
]; ];
home.persistence."/persist/home".directories = [
".config/vesktop"
];
programs.nixcord = { programs.nixcord = {
enable = true; enable = true;
discord = lib.mkForce { enable = false; }; discord = lib.mkForce { enable = false; };
+27 -20
View File
@@ -2,6 +2,7 @@
config, config,
pkgs, pkgs,
lib, lib,
primaryUser,
... ...
}: }:
let let
@@ -20,26 +21,32 @@ in
}; };
}; };
home.packages = with pkgs; [ home = {
git packages = with pkgs; [
git-lfs git
openssh git-lfs
]; openssh
];
home.activation.obsidianVault = lib.hm.dag.entryAfter [ "writeBoundary" ] '' persistence."/persist/home".directories = [
export PATH="${gitBin}:${gitLfsBin}:$PATH" "Notes"
export GIT_SSH_COMMAND="${sshBinary} -o StrictHostKeyChecking=accept-new" ];
export GIT_LFS_SKIP_SMUDGE=1
if [ ! -d "${vaultPath}/.git" ]; then activation.obsidianVault = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
echo "Cloning Obsidian vault (LFS objects will be pulled separately)..." export PATH="${gitBin}:${gitLfsBin}:$PATH"
${gitBin}/git clone "${vaultRepo}" "${vaultPath}" export GIT_SSH_COMMAND="${sshBinary} -o StrictHostKeyChecking=accept-new"
${gitLfsBin}/git-lfs install --local "${vaultPath}" export GIT_LFS_SKIP_SMUDGE=1
${gitBin}/git -C "${vaultPath}" lfs pull
else if [ ! -d "${vaultPath}/.git" ]; then
echo "Pulling latest changes for Obsidian vault..." echo "Cloning Obsidian vault (LFS objects will be pulled separately)..."
${gitBin}/git -C "${vaultPath}" pull ${gitBin}/git clone "${vaultRepo}" "${vaultPath}"
${gitBin}/git -C "${vaultPath}" lfs pull ${gitLfsBin}/git-lfs install --local "${vaultPath}"
fi ${gitBin}/git -C "${vaultPath}" lfs pull
''; else
echo "Pulling latest changes for Obsidian vault..."
${gitBin}/git -C "${vaultPath}" pull
${gitBin}/git -C "${vaultPath}" lfs pull
fi
'';
};
} }
+1 -1
View File
@@ -12,7 +12,7 @@ _: {
npm = "@ai-sdk/openai-compatible"; npm = "@ai-sdk/openai-compatible";
name = "Ollama (tailscale)"; name = "Ollama (tailscale)";
options = { options = {
baseURL = "http://100.86.56.71:11434/v1"; baseURL = "http://10.10.0.2:11434/v1";
}; };
models = { models = {
"llama3.2:3b" = { "llama3.2:3b" = {
+33 -42
View File
@@ -2,26 +2,43 @@
pkgs, pkgs,
isDarwin, isDarwin,
lib, lib,
primaryUser,
... ...
}: }:
{ {
home.packages = with pkgs; [ home = {
eza # ls replacement packages = with pkgs; [
tdf # terminal pdf viewer eza # ls replacement
jq # json parser tdf # terminal pdf viewer
fastfetch # system stats jq # json parser
tabiew # Table viewer fastfetch # system stats
glow # MD Viewer tabiew # Table viewer
fd # find alternative glow # MD Viewer
bat # cat alternative fd # find alternative
ripgrep # grep alternative bat # cat alternative
dnsutils ripgrep # grep alternative
dnsutils
# Fun stuff # Fun stuff
zoxide zoxide
lolcat lolcat
cmatrix cmatrix
]; ];
persistence = lib.mkIf (!isDarwin) {
"/persist/home" = {
directories = [ ".local/share/zoxide" ];
files = [ ".local/share/fish/fish_history" ];
};
};
file = {
".config/fastfetch/config.jsonc".source = ./fastfetch.jsonc;
".config/tabiew/theme.toml".source = ./tabiew.toml;
".config/kitty/tab_bar.py".source = ./tab_bar.py;
".hushlogin" = lib.mkIf isDarwin { text = ""; }; # Suppress Login
};
};
programs = { programs = {
kitty = { kitty = {
@@ -243,30 +260,4 @@
}; };
}; };
home = {
file = {
".config/fastfetch/config.jsonc".source = ./fastfetch.jsonc;
".config/tabiew/theme.toml".source = ./tabiew.toml;
".config/kitty/tab_bar.py".source = ./tab_bar.py;
".hushlogin" = lib.mkIf isDarwin { text = ""; }; # Suppress Login
# Link LLM std template
".config/io.datasette.llm/templates/std.yaml".text = ''
system: |
You are a concise technical assistant running on an Intel Mac (x86_64-darwin)
with nix-darwin and home-manager.
Rules:
- Always respond in valid markdown
- Be concise and direct, no unnecessary explanation
- Prefer code blocks for commands and code
- You have access to these tools in the shell: nvim, fish, git,
eza, bat, ripgrep, fzf, yazi, glow, llm, zoxide, fastfetch,
nix, darwin-rebuild, brew
- When suggesting nix config changes, use the nix language
- nix-switch rebuilds the system config
- nix-check validates the flake without building
'';
};
};
} }
+9 -1
View File
@@ -1,9 +1,17 @@
{ pkgs, inputs, ... }: {
pkgs,
inputs,
...
}:
{ {
imports = [ imports = [
inputs.spicetify-nix.homeManagerModules.default inputs.spicetify-nix.homeManagerModules.default
]; ];
home.persistence."/persist/home".directories = [
".config/spotify"
];
programs.spicetify = programs.spicetify =
let let
spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.system}; spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.system};
+13 -1
View File
@@ -1,5 +1,6 @@
{ {
imports = [ imports = [
./disko.nix
./hardware-configuration.nix ./hardware-configuration.nix
./smb.nix ./smb.nix
../../nixos/roles/monitoring.nix ../../nixos/roles/monitoring.nix
@@ -11,7 +12,6 @@
../../nixos/roles/gitea.nix ../../nixos/roles/gitea.nix
../../nixos/roles/vaultwarden.nix ../../nixos/roles/vaultwarden.nix
../../nixos/roles/frontpage ../../nixos/roles/frontpage
#../../nixos/roles/paperless-ngx.nix
../../nixos/roles/octoprint.nix ../../nixos/roles/octoprint.nix
../../nixos/roles/matrix/postgres-backup.nix ../../nixos/roles/matrix/postgres-backup.nix
../../nixos/roles/kanidm.nix ../../nixos/roles/kanidm.nix
@@ -22,6 +22,17 @@
useNetworkd = true; useNetworkd = true;
useDHCP = false; useDHCP = false;
firewall.enable = true; firewall.enable = true;
wireguard.interfaces.wg0 = {
ips = [ "10.10.0.2/24" ];
peers = [
{
publicKey = "NjMYaUZO/iPRM/J46qyPPuWYg5oSeAUxjocMs/hYTXs=";
endpoint = "178.254.8.35:51820";
allowedIPs = [ "10.10.0.0/24" ];
persistentKeepalive = 25;
}
];
};
}; };
systemd.network = { systemd.network = {
@@ -45,5 +56,6 @@
}; };
efi.canTouchEfiVariables = true; efi.canTouchEfiVariables = true;
}; };
system.stateVersion = "26.05"; system.stateVersion = "26.05";
} }
+62
View File
@@ -0,0 +1,62 @@
{
disko.devices.disk.main = {
type = "disk";
device = "/dev/sda";
content = {
type = "gpt";
partitions = {
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"fmask=0022"
"dmask=0022"
];
extraArgs = [
"-n"
"NIXBOOT"
];
};
};
swap = {
size = "8G";
content = {
type = "swap";
extraArgs = [
"-L"
"NIXSWAP"
];
};
};
nix = {
size = "80G";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/nix";
extraArgs = [
"-L"
"NIXSTORE"
];
};
};
persist = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/persist";
extraArgs = [
"-L"
"NIXPERSIST"
];
};
};
};
};
};
}
@@ -5,7 +5,6 @@
primaryUser, primaryUser,
... ...
}: }:
{ {
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
@@ -17,25 +16,21 @@
"ahci" "ahci"
"usb_storage" "usb_storage"
"sd_mod" "sd_mod"
"nvme"
]; ];
initrd.kernelModules = [ ]; initrd.kernelModules = [ ];
kernelModules = [ "kvm-intel" ]; kernelModules = [ "kvm-intel" ];
extraModulePackages = [ ]; extraModulePackages = [ ];
zfs.forceImportRoot = false;
}; };
fileSystems = { fileSystems = {
"/" = lib.mkForce { "/" = {
device = "/dev/disk/by-label/NIXROOT"; device = "none";
fsType = "ext4"; fsType = "tmpfs";
};
"/boot" = lib.mkForce {
device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat";
options = [ options = [
"fmask=0022" "defaults"
"dmask=0022" "size=6G"
"mode=755"
]; ];
}; };
@@ -71,6 +66,8 @@
]; ];
}; };
"/nix".neededForBoot = true;
"/persist".neededForBoot = true;
}; };
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
@@ -80,12 +77,7 @@
"d /storage/backup 0755 ${primaryUser} users -" "d /storage/backup 0755 ${primaryUser} users -"
]; ];
swapDevices = [ networking.useDHCP = lib.mkDefault true;
{ nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
device = "/swapfile";
size = 4096;
}
];
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
} }
+3 -2
View File
@@ -1,11 +1,12 @@
{ {
pkgs, pkgs,
primaryUser, primaryUser,
config,
... ...
}: }:
{ {
sops.secrets.smb_passwd = { }; sops.secrets."network/smb_passwd" = { };
users.users.${primaryUser}.extraGroups = [ "sambashare" ]; users.users.${primaryUser}.extraGroups = [ "sambashare" ];
@@ -93,7 +94,7 @@
sleep 1 sleep 1
done done
PASSWORD=$(cat /run/secrets/smb_passwd) PASSWORD=$(cat ${config.sops.secrets."network/smb_passwd".path})
(echo "$PASSWORD"; echo "$PASSWORD") | ${pkgs.samba}/bin/smbpasswd -a -s ${primaryUser} || \ (echo "$PASSWORD"; echo "$PASSWORD") | ${pkgs.samba}/bin/smbpasswd -a -s ${primaryUser} || \
(echo "$PASSWORD"; echo "$PASSWORD") | ${pkgs.samba}/bin/smbpasswd -s ${primaryUser} (echo "$PASSWORD"; echo "$PASSWORD") | ${pkgs.samba}/bin/smbpasswd -s ${primaryUser}
''; '';
+17 -2
View File
@@ -1,11 +1,24 @@
{ ... }:
{ {
imports = [ ./hardware-configuration.nix ]; imports = [
./disko.nix
./hardware-configuration.nix
];
networking = { networking = {
useNetworkd = true; useNetworkd = true;
useDHCP = false; useDHCP = false;
firewall.enable = true; firewall.enable = true;
wireguard.interfaces.wg0 = {
ips = [ "10.10.0.40/24" ];
peers = [
{
publicKey = "NjMYaUZO/iPRM/J46qyPPuWYg5oSeAUxjocMs/hYTXs=";
endpoint = "178.254.8.35:51820";
allowedIPs = [ "10.10.0.0/24" ];
persistentKeepalive = 25;
}
];
};
}; };
systemd.network = { systemd.network = {
@@ -50,4 +63,6 @@
virtualisation.docker.enable = true; virtualisation.docker.enable = true;
users.users.phil.extraGroups = [ "docker" ]; users.users.phil.extraGroups = [ "docker" ];
programs.fuse.userAllowOther = true;
} }
+68
View File
@@ -0,0 +1,68 @@
{
disko.devices.disk.main = {
type = "disk";
device = "/dev/sda";
content = {
type = "gpt";
partitions = {
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"fmask=0022"
"dmask=0022"
];
extraArgs = [
"-n"
"NIXBOOT"
];
};
};
swap = {
size = "4G";
content = {
type = "swap";
extraArgs = [
"-L"
"NIXSWAP"
];
};
};
nix = {
size = "110G";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/nix";
mountOptions = [ "defaults" ];
extraArgs = [
"-L"
"NIXSTORE"
];
};
};
persist = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/persist";
extraArgs = [
"-L"
"NIXPERSIST"
];
};
};
};
};
};
}
+10 -15
View File
@@ -31,35 +31,32 @@
extraModprobeConfig = '' extraModprobeConfig = ''
options v4l2loopback exclusive_caps=1 card_label="Virtual Camera" options v4l2loopback exclusive_caps=1 card_label="Virtual Camera"
''; '';
zfs.forceImportRoot = false;
}; };
sops = { sops = {
secrets.smb_passwd = { }; secrets."network/smb_passwd" = { };
templates.smb_credentials = { templates.smb_credentials = {
content = '' content = ''
username=${primaryUser} username=${primaryUser}
password=${config.sops.placeholder.smb_passwd} password=${config.sops.placeholder."network/smb_passwd"}
''; '';
}; };
}; };
fileSystems = { fileSystems = {
"/" = { "/" = {
device = "/dev/disk/by-label/NIXROOT"; device = "none";
fsType = "ext4"; fsType = "tmpfs";
};
"/boot" = {
device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat";
options = [ options = [
"fmask=0022" "defaults"
"dmask=0022" "size=4G"
"mode=755"
]; ];
}; };
"/nix".neededForBoot = true;
"/persist".neededForBoot = true;
"/storage" = { "/storage" = {
device = "/dev/disk/by-label/STORAGE"; device = "/dev/disk/by-label/STORAGE";
fsType = "ext4"; fsType = "ext4";
@@ -99,8 +96,6 @@
"d /shares/storage-backup 0775 ${primaryUser} users -" "d /shares/storage-backup 0775 ${primaryUser} users -"
]; ];
swapDevices = [ ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware = { hardware = {
+3 -1
View File
@@ -1 +1,3 @@
{ ... }: { } {
launchd.daemons.wireguard.environment.WG_IP = "10.10.0.3/24";
}
+12
View File
@@ -1,5 +1,6 @@
{ {
imports = [ imports = [
./disko.nix
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
@@ -7,6 +8,17 @@
useNetworkd = true; useNetworkd = true;
useDHCP = false; useDHCP = false;
firewall.enable = true; firewall.enable = true;
wireguard.interfaces.wg0 = {
ips = [ "10.10.0.30/24" ];
peers = [
{
publicKey = "NjMYaUZO/iPRM/J46qyPPuWYg5oSeAUxjocMs/hYTXs=";
endpoint = "178.254.8.35:51820";
allowedIPs = [ "10.10.0.0/24" ];
persistentKeepalive = 25;
}
];
};
}; };
systemd.network = { systemd.network = {
+68
View File
@@ -0,0 +1,68 @@
{
disko.devices.disk.main = {
type = "disk";
device = "/dev/sda";
content = {
type = "gpt";
partitions = {
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"fmask=0022"
"dmask=0022"
];
extraArgs = [
"-n"
"NIXBOOT"
];
};
};
swap = {
size = "4G";
content = {
type = "swap";
extraArgs = [
"-L"
"NIXSWAP"
];
};
};
nix = {
size = "50G";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/nix";
mountOptions = [ "defaults" ];
extraArgs = [
"-L"
"NIXSTORE"
];
};
};
persist = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/persist";
extraArgs = [
"-L"
"NIXPERSIST"
];
};
};
};
};
};
}
+8 -21
View File
@@ -4,7 +4,6 @@
modulesPath, modulesPath,
... ...
}: }:
{ {
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
@@ -20,34 +19,22 @@
initrd.kernelModules = [ ]; initrd.kernelModules = [ ];
kernelModules = [ "kvm-intel" ]; kernelModules = [ "kvm-intel" ];
extraModulePackages = [ ]; extraModulePackages = [ ];
zfs.forceImportRoot = false;
}; };
fileSystems = { fileSystems = {
"/" = { "/" = {
device = "/dev/disk/by-label/NIXROOT"; device = "none";
fsType = "ext4"; fsType = "tmpfs";
};
"/boot" = {
device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat";
options = [ options = [
"fmask=0022" "defaults"
"dmask=0022" "size=2G"
"mode=755"
]; ];
}; };
"/nix".neededForBoot = true;
"/persist".neededForBoot = true;
}; };
swapDevices = [
{
device = "/swapfile";
size = 4096;
}
];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
} }
+12
View File
@@ -1,5 +1,6 @@
{ {
imports = [ imports = [
./disko.nix
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
@@ -7,6 +8,17 @@
useNetworkd = true; useNetworkd = true;
useDHCP = false; useDHCP = false;
firewall.enable = true; firewall.enable = true;
wireguard.interfaces.wg0 = {
ips = [ "10.10.0.31/24" ];
peers = [
{
publicKey = "NjMYaUZO/iPRM/J46qyPPuWYg5oSeAUxjocMs/hYTXs=";
endpoint = "178.254.8.35:51820";
allowedIPs = [ "10.10.0.0/24" ];
persistentKeepalive = 25;
}
];
};
}; };
systemd.network = { systemd.network = {
+68
View File
@@ -0,0 +1,68 @@
{
disko.devices.disk.main = {
type = "disk";
device = "/dev/sda";
content = {
type = "gpt";
partitions = {
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"fmask=0022"
"dmask=0022"
];
extraArgs = [
"-n"
"NIXBOOT"
];
};
};
swap = {
size = "4G";
content = {
type = "swap";
extraArgs = [
"-L"
"NIXSWAP"
];
};
};
nix = {
size = "50G";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/nix";
mountOptions = [ "defaults" ];
extraArgs = [
"-L"
"NIXSTORE"
];
};
};
persist = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/persist";
extraArgs = [
"-L"
"NIXPERSIST"
];
};
};
};
};
};
}
+8 -21
View File
@@ -4,7 +4,6 @@
modulesPath, modulesPath,
... ...
}: }:
{ {
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
@@ -20,34 +19,22 @@
initrd.kernelModules = [ ]; initrd.kernelModules = [ ];
kernelModules = [ "kvm-intel" ]; kernelModules = [ "kvm-intel" ];
extraModulePackages = [ ]; extraModulePackages = [ ];
zfs.forceImportRoot = false;
}; };
fileSystems = { fileSystems = {
"/" = { "/" = {
device = "/dev/disk/by-label/NIXROOT"; device = "none";
fsType = "ext4"; fsType = "tmpfs";
};
"/boot" = {
device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat";
options = [ options = [
"fmask=0022" "defaults"
"dmask=0022" "size=2G"
"mode=755"
]; ];
}; };
"/nix".neededForBoot = true;
"/persist".neededForBoot = true;
}; };
swapDevices = [
{
device = "/swapfile";
size = 4096;
}
];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
} }
+35 -6
View File
@@ -1,6 +1,7 @@
{ ... }: { ... }:
{ {
imports = [ imports = [
./disko.nix
./hardware-configuration.nix ./hardware-configuration.nix
../../nixos/roles/nginx.nix ../../nixos/roles/nginx.nix
# ../../nixos/roles/jitsi.nix # ../../nixos/roles/jitsi.nix
@@ -13,18 +14,18 @@
interfaces.ens3 = { interfaces.ens3 = {
ipv4.addresses = [ ipv4.addresses = [
{ {
address = "178.254.8.35"; address = "195.90.219.9";
prefixLength = 23; prefixLength = 22;
} }
]; ];
ipv6.addresses = [ ipv6.addresses = [
{ {
address = "2a00:6800:3:1094::1"; address = "2a00:6800:3:113e::1";
prefixLength = 64; prefixLength = 64;
} }
]; ];
}; };
defaultGateway = "178.254.8.1"; defaultGateway = "195.90.216.1";
defaultGateway6 = { defaultGateway6 = {
address = "2a00:6800:3::1"; address = "2a00:6800:3::1";
@@ -36,18 +37,46 @@
"178.254.16.141" "178.254.16.141"
]; ];
wireguard.interfaces.wg0 = {
ips = [ "10.10.0.1/24" ];
listenPort = 51820;
peers = [
{
publicKey = "EvML4de3CReNW8aF+lJAsPZ+p6FICOyjCsAZJBwIwX8=";
allowedIPs = [ "10.10.0.2/32" ];
}
{
publicKey = "WkY45tGnNZQuJTf1MPN6I92spxHts/kpzXRSZE9se2c=";
allowedIPs = [ "10.10.0.3/32" ];
}
{
publicKey = "oAstNd7Wxpj2PqSyS87q+8y8WtaLK7hZ5Ytfncml9EM=";
allowedIPs = [ "10.10.0.40/32" ];
}
{
publicKey = "GrFH3I5QqjRij7Jl+eOL6Ou6zK6MtH5/kAsA5AmGckM=";
allowedIPs = [ "10.10.0.30/32" ];
}
{
publicKey = "IddGAijZVCVxGj/aMasjfroIy9r8Owar4MO9xfvNNBY=";
allowedIPs = [ "10.10.0.31/32" ];
}
];
};
firewall.allowedTCPPorts = [ firewall.allowedTCPPorts = [
80 80
443 443
51820
]; ];
hosts = { hosts = {
"178.254.8.35" = [ "195.90.219.9" = [
"cyperpunk.de" "cyperpunk.de"
"matrix.cyperpunk.de" "matrix.cyperpunk.de"
]; ];
"2a00:6800:3:1094::1" = [ "2a00:6800:3:113e::1" = [
"cyperpunk.de" "cyperpunk.de"
"matrix.cyperpunk.de" "matrix.cyperpunk.de"
]; ];
+65
View File
@@ -0,0 +1,65 @@
{
disko.devices.disk.main = {
type = "disk";
device = "/dev/vda";
content = {
type = "gpt";
partitions = {
boot = {
size = "1M";
type = "EF02";
};
ESP = {
size = "512M";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"fmask=0022"
"dmask=0022"
];
extraArgs = [
"-n"
"NIXBOOT"
];
};
};
swap = {
size = "4G";
content = {
type = "swap";
extraArgs = [
"-L"
"NIXSWAP"
];
};
};
nix = {
size = "40G";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/nix";
extraArgs = [
"-L"
"NIXSTORE"
];
};
};
persist = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/persist";
extraArgs = [
"-L"
"NIXPERSIST"
];
};
};
};
};
};
}
+10 -17
View File
@@ -5,11 +5,6 @@
]; ];
boot = { boot = {
loader.grub = {
enable = true;
device = "/dev/vda";
};
initrd = { initrd = {
availableKernelModules = [ availableKernelModules = [
"ata_piix" "ata_piix"
@@ -21,26 +16,24 @@
]; ];
kernelModules = [ ]; kernelModules = [ ];
}; };
kernel.sysctl."net.ipv4.ip_forward" = 1;
kernelModules = [ ]; kernelModules = [ ];
extraModulePackages = [ ]; extraModulePackages = [ ];
zfs.forceImportRoot = false;
}; };
fileSystems = { fileSystems = {
"/" = { "/" = {
device = "/dev/disk/by-label/NIXROOT"; device = "none";
fsType = "ext4"; fsType = "tmpfs";
};
"/boot" = {
device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat";
options = [ options = [
"fmask=0022" "defaults"
"dmask=0022" "size=2G"
"mode=755"
]; ];
}; };
};
swapDevices = [ ]; "/nix".neededForBoot = true;
"/persist".neededForBoot = true;
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
} }
+86
View File
@@ -0,0 +1,86 @@
{ modulesPath, pkgs, ... }:
{
imports = [ (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") ];
boot.zfs.forceImportRoot = false;
time.timeZone = "Europe/Berlin";
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_ADDRESS = "de_DE.UTF-8";
LC_IDENTIFICATION = "de_DE.UTF-8";
LC_MEASUREMENT = "de_DE.UTF-8";
LC_MONETARY = "de_DE.UTF-8";
LC_NAME = "de_DE.UTF-8";
LC_NUMERIC = "de_DE.UTF-8";
LC_PAPER = "de_DE.UTF-8";
LC_TELEPHONE = "de_DE.UTF-8";
LC_TIME = "de_DE.UTF-8";
};
};
services.openssh = {
enable = true;
openFirewall = true;
settings = {
PermitRootLogin = "yes";
PasswordAuthentication = false;
};
};
users.users = {
root.openssh.authorizedKeys.keyFiles = [
../../secrets/ssh-key
];
phil = {
isNormalUser = true;
password = "nixos";
extraGroups = [ "wheel" ];
openssh.authorizedKeys.keyFiles = [
../../secrets/ssh-key
];
};
};
security.sudo = {
enable = true;
wheelNeedsPassword = false;
};
networking = {
useNetworkd = true;
useDHCP = false;
firewall.enable = false;
};
systemd.network = {
enable = true;
networks."10-ethernet" = {
matchConfig.Name = "en*";
networkConfig = {
#Address = "192.168.2.99/24";
#Gateway = "192.168.2.1";
#DNS = "192.168.2.2";
Address = "195.90.219.9/22";
Gateway = "195.90.216.1";
DNS = [
"178.254.16.151"
"178.254.16.141"
];
DHCP = "no";
};
};
};
environment.systemPackages = with pkgs; [
htop
lsscsi
pciutils
usbutils
nvme-cli
];
system.stateVersion = "26.05";
}
+27 -12
View File
@@ -11,8 +11,9 @@
imports = [ imports = [
./sops.nix ./sops.nix
./locale.nix ./locale.nix
./tailscale.nix ./wireguard.nix
./ssh.nix ./ssh.nix
./impermanence.nix
] ]
++ lib.optionals (!isServer) [ ++ lib.optionals (!isServer) [
./regreet.nix ./regreet.nix
@@ -22,9 +23,11 @@
./catppuccin.nix ./catppuccin.nix
]; ];
sops.secrets."nix_cache_priv_key" = { sops.secrets = {
"nix/cache_priv_key" = {
mode = "0400"; mode = "0400";
};
"nix/cachix_auth_token" = { };
}; };
nix = { nix = {
@@ -47,7 +50,7 @@
"https://nix-community.cachix.org" "https://nix-community.cachix.org"
"https://cyper-cache.cachix.org" "https://cyper-cache.cachix.org"
]; ];
secret-key-files = [ config.sops.secrets."nix_cache_priv_key".path ]; secret-key-files = [ config.sops.secrets."nix/cache_priv_key".path ];
trusted-public-keys = [ trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
@@ -112,8 +115,6 @@
}; };
}; };
sops.secrets.cachix_auth_token = { };
systemd.services.cachix-push = { systemd.services.cachix-push = {
description = "Push new store paths to Cachix"; description = "Push new store paths to Cachix";
after = [ "multi-user.target" ]; after = [ "multi-user.target" ];
@@ -121,14 +122,28 @@
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
RemainAfterExit = true; RemainAfterExit = true;
ExecStart = "${pkgs.bash}/bin/bash -c 'CACHIX_AUTH_TOKEN=$(cat ${config.sops.secrets.cachix_auth_token.path}) ${pkgs.nix}/bin/nix path-info --recursive /run/current-system | CACHIX_AUTH_TOKEN=$(cat ${config.sops.secrets.cachix_auth_token.path}) ${pkgs.cachix}/bin/cachix push cyper-cache'"; ExecStart = "${pkgs.bash}/bin/bash -c 'CACHIX_AUTH_TOKEN=$(cat ${
config.sops.secrets."nix/cachix_auth_token".path
}) ${pkgs.nix}/bin/nix path-info --recursive /run/current-system | CACHIX_AUTH_TOKEN=$(cat ${
config.sops.secrets."nix/cachix_auth_token".path
}) ${pkgs.cachix}/bin/cachix push cyper-cache'";
}; };
}; };
networking.firewall.allowedTCPPorts = [ networking = {
9002 hosts = {
3100 "10.10.0.1" = [ "proxy.cyperpunk.de" ];
]; "10.10.0.2" = [ "controller.cyperpunk.de" ];
"10.10.0.3" = [ "mac.cyperpunk.de" ];
"10.10.0.30" = [ "node1.cyperpunk.de" ];
"10.10.0.31" = [ "node2.cyperpunk.de" ];
"10.10.0.40" = [ "desktop.cyperpunk.de" ];
};
firewall.allowedTCPPorts = [
9002
3100
];
};
users.users.${primaryUser} = { users.users.${primaryUser} = {
home = "/home/${primaryUser}"; home = "/home/${primaryUser}";
+18
View File
@@ -0,0 +1,18 @@
_: {
environment.persistence."/persist" = {
hideMounts = true;
files = [
"/etc/machine-id"
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub"
"/etc/ssh/ssh_host_rsa_key"
"/etc/ssh/ssh_host_rsa_key.pub"
];
directories = [
"/var/lib/nixos"
"/var/lib/systemd"
"/var/log"
"/var/lib/tailscale"
];
};
}
+24 -18
View File
@@ -1,6 +1,7 @@
{ {
lib, lib,
pkgs, pkgs,
primaryUser,
... ...
}: }:
{ {
@@ -8,35 +9,46 @@
"greetd/background.png".source = ../assets/wallpapers/lucy_with_cat.png; "greetd/background.png".source = ../assets/wallpapers/lucy_with_cat.png;
"greetd/environments".text = '' "greetd/environments".text = ''
Hyprland Hyprland
niri-session
fish fish
''; '';
}; };
programs.regreet = { programs.regreet = {
enable = false; enable = true;
cageArgs = [ cageArgs = [
"-s" "-s"
"-m" "-m"
"last" "last"
]; ];
theme = {
name = "catppuccin-mocha-standard-sky-dark";
package = pkgs.catppuccin-gtk;
};
cursorTheme = {
name = "catppuccin-mocha-sapphire-cursors";
package = pkgs.catppuccin-cursors.mochaSapphire;
};
iconTheme = {
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
};
font = {
name = "FiraCode Nerd Font Propo";
size = 12;
package = pkgs.nerd-fonts.fira-code;
};
settings = { settings = {
background = { background = {
path = "/etc/greetd/background.png"; path = "/etc/greetd/background.png";
fit = "Fill"; fit = "Fill";
}; };
GTK = { GTK = {
application_prefer_dark_theme = true; application_prefer_dark_theme = true;
cursor_theme_name = lib.mkForce "catppuccin-mocha-dark-cursors"; cursor_theme_name = lib.mkForce "catppuccin-mocha-sapphire-cursors";
font_name = lib.mkForce "FiraCode Nerd Font Propo 12"; font_name = lib.mkForce "FiraCode Nerd Font Propo 12";
icon_theme_name = lib.mkForce "Papirus-Dark"; icon_theme_name = lib.mkForce "Papirus-Dark";
theme_name = lib.mkForce "catppuccin-mocha-standard-mauve-dark"; theme_name = lib.mkForce "catppuccin-mocha-standard-sky-dark";
}; };
commands = { commands = {
reboot = [ reboot = [
"systemctl" "systemctl"
@@ -46,16 +58,10 @@
"systemctl" "systemctl"
"poweroff" "poweroff"
]; ];
x11_prefix = [
"startx"
"/usr/bin/env"
];
}; };
appearance = { appearance = {
greeting_msg = "Hey there!"; greeting_msg = "Hey there!";
}; };
widget.clock = { widget.clock = {
format = "%A %d.%m.%Y %T"; format = "%A %d.%m.%Y %T";
resolution = "500ms"; resolution = "500ms";
@@ -69,12 +75,12 @@
enable = true; enable = true;
settings = { settings = {
default_session = { default_session = {
command = "${pkgs.tuigreet}/bin/tuigreet --cmd start-hyprland"; command = "${pkgs.greetd.regreet}/bin/regreet";
user = "greeter"; user = "greeter";
}; };
initial_session = { initial_session = {
command = "Hyprland"; command = "start-hyprland";
user = "phil"; user = primaryUser;
}; };
}; };
}; };
+9 -1
View File
@@ -1,5 +1,13 @@
{ ... }:
{ {
environment.persistence."/persist".directories = [
{
directory = "/var/lib/filebrowser";
user = "filebrowser";
group = "filebrowser";
mode = "0750";
}
];
services.filebrowser = { services.filebrowser = {
enable = true; enable = true;
+29 -2
View File
@@ -13,7 +13,7 @@ let
"/var/lib/flame-${name}:/app/data" "/var/lib/flame-${name}:/app/data"
] ]
++ extraVolumes; ++ extraVolumes;
environmentFiles = [ config.sops.secrets."flame_${name}_password".path ]; environmentFiles = [ config.sops.secrets."services/flame/${name}_password".path ];
}; };
instances = [ instances = [
@@ -29,8 +29,35 @@ let
]; ];
in in
{ {
environment.persistence."/persist".directories = [
{
directory = "/var/lib/flame-phil";
user = "root";
group = "root";
mode = "0755";
}
{
directory = "/var/lib/flame-calvin";
user = "root";
group = "root";
mode = "0755";
}
{
directory = "/var/lib/docker";
user = "root";
group = "root";
mode = "0710";
}
{
directory = "/var/lib/private";
user = "root";
group = "root";
mode = "0700";
}
];
sops.secrets = lib.listToAttrs ( sops.secrets = lib.listToAttrs (
map ({ name, ... }: lib.nameValuePair "flame_${name}_password" { }) instances map ({ name, ... }: lib.nameValuePair "services/flame/${name}_password" { }) instances
); );
virtualisation = { virtualisation = {
+24 -10
View File
@@ -2,7 +2,6 @@
pkgs, pkgs,
lib, lib,
config, config,
primaryUser,
... ...
}: }:
@@ -20,33 +19,48 @@ let
in in
{ {
sops.secrets = { sops.secrets = {
"gitea/dbPassword" = { "services/gitea/db_password" = {
owner = "gitea"; owner = "gitea";
group = "gitea"; group = "gitea";
mode = "0444"; mode = "0444";
}; };
"gitea/internalToken" = { "services/gitea/internal_token" = {
owner = "gitea"; owner = "gitea";
group = "gitea"; group = "gitea";
}; };
"gitea/lfsJwtSecret" = { "services/gitea/lfs_jwt_secret" = {
owner = "gitea"; owner = "gitea";
group = "gitea"; group = "gitea";
}; };
"gitea/mailerPassword" = { "services/gitea/mailer_password" = {
owner = "gitea"; owner = "gitea";
group = "gitea"; group = "gitea";
}; };
"gitea/runnerToken" = { "services/gitea/runner_token" = {
mode = "0444"; mode = "0444";
}; };
"kanidm_gitea_secret" = { "kanidm/gitea_secret" = {
owner = "gitea"; owner = "gitea";
group = "gitea"; group = "gitea";
mode = "0444"; mode = "0444";
}; };
}; };
environment.persistence."/persist".directories = [
{
directory = "/var/lib/gitea";
user = "gitea";
group = "gitea";
mode = "0750";
}
{
directory = "/var/lib/postgresql";
user = "postgres";
group = "postgres";
mode = "0750";
}
];
systemd.services = { systemd.services = {
gitea-db-password = { gitea-db-password = {
description = "Set gitea postgres user password"; description = "Set gitea postgres user password";
@@ -60,7 +74,7 @@ in
RemainAfterExit = true; RemainAfterExit = true;
}; };
script = '' script = ''
pass=$(cat ${config.sops.secrets."gitea/dbPassword".path}) pass=$(cat ${config.sops.secrets."services/gitea/db_password".path})
${pkgs.postgresql_14}/bin/psql -c \ ${pkgs.postgresql_14}/bin/psql -c \
"ALTER USER gitea WITH PASSWORD '$pass';" "ALTER USER gitea WITH PASSWORD '$pass';"
''; '';
@@ -111,7 +125,7 @@ in
port = 5432; port = 5432;
name = "gitea"; name = "gitea";
user = "gitea"; user = "gitea";
passwordFile = config.sops.secrets."gitea/dbPassword".path; passwordFile = config.sops.secrets."services/gitea/db_password".path;
}; };
settings = { settings = {
@@ -207,7 +221,7 @@ in
gitea-actions-runner.instances."cyper_nix" = { gitea-actions-runner.instances."cyper_nix" = {
enable = true; enable = true;
url = "https://git.cyperpunk.de"; url = "https://git.cyperpunk.de";
tokenFile = config.sops.secrets."gitea/runnerToken".path; tokenFile = config.sops.secrets."services/gitea/runner_token".path;
name = "cyper-controller"; name = "cyper-controller";
labels = [ "nix:host" ]; labels = [ "nix:host" ];
+9
View File
@@ -5,6 +5,15 @@ let
certDir = "/var/lib/kanidm/tls"; certDir = "/var/lib/kanidm/tls";
in in
{ {
environment.persistence."/persist".directories = [
{
directory = "/var/lib/kanidm";
user = "kanidm";
group = "kanidm";
mode = "0750";
}
];
systemd.services.kanidm-selfsigned-cert = { systemd.services.kanidm-selfsigned-cert = {
description = "Generate self-signed TLS certificate for Kanidm"; description = "Generate self-signed TLS certificate for Kanidm";
wantedBy = [ "kanidm.service" ]; wantedBy = [ "kanidm.service" ];
+9
View File
@@ -149,6 +149,15 @@ let
in in
{ {
environment.persistence."/persist".directories = [
{
directory = "/var/lib/containers";
user = "root";
group = "root";
mode = "0700";
}
];
services.nginx.virtualHosts = { services.nginx.virtualHosts = {
"cinny.cyperpunk.de" = { "cinny.cyperpunk.de" = {
forceSSL = true; forceSSL = true;
+3 -4
View File
@@ -1,15 +1,14 @@
{ config, lib, ... }: { config, lib, ... }:
{ {
sops.secrets = { sops.secrets = {
coturn_static_auth_secret = { "matrix/coturn_static_auth_secret" = {
owner = "turnserver"; owner = "turnserver";
group = "turnserver"; group = "turnserver";
}; };
coturn_static_auth_secret_synapse = { coturn_static_auth_secret_synapse = {
owner = "matrix-synapse"; owner = "matrix-synapse";
group = "matrix-synapse"; group = "matrix-synapse";
key = "coturn_static_auth_secret"; key = "matrix/coturn_static_auth_secret";
}; };
}; };
@@ -21,7 +20,7 @@
min-port = 49000; min-port = 49000;
max-port = 50000; max-port = 50000;
use-auth-secret = true; use-auth-secret = true;
static-auth-secret-file = config.sops.secrets.coturn_static_auth_secret.path; static-auth-secret-file = config.sops.secrets."matrix/coturn_static_auth_secret".path;
realm = "turn.cyperpunk.de"; realm = "turn.cyperpunk.de";
cert = "${config.security.acme.certs.${realm}.directory}/full.pem"; cert = "${config.security.acme.certs.${realm}.directory}/full.pem";
pkey = "${config.security.acme.certs.${realm}.directory}/key.pem"; pkey = "${config.security.acme.certs.${realm}.directory}/key.pem";
+1 -1
View File
@@ -6,7 +6,7 @@
./synapse.nix ./synapse.nix
./livekit.nix ./livekit.nix
./clients.nix ./clients.nix
./mjolnir.nix ./draupnir.nix
./coturn.nix ./coturn.nix
./maubot.nix ./maubot.nix
./discord-bridge.nix ./discord-bridge.nix
+21 -6
View File
@@ -1,20 +1,29 @@
{ config, lib, ... }: { config, lib, ... }:
{ {
sops.secrets = { sops.secrets = {
discord_bot_token = { "matrix/bridges/discord/bot_token" = {
owner = "mautrix-discord"; owner = "mautrix-discord";
group = "mautrix-discord"; group = "mautrix-discord";
}; };
discord_client_id = { "matrix/bridges/discord/client_id" = {
owner = "mautrix-discord"; owner = "mautrix-discord";
group = "mautrix-discord"; group = "mautrix-discord";
}; };
discord_pickle_key = { "matrix/bridges/discord/pickle_key" = {
owner = "mautrix-discord"; owner = "mautrix-discord";
group = "mautrix-discord"; group = "mautrix-discord";
}; };
}; };
environment.persistence."/persist".directories = [
{
directory = "/var/lib/mautrix-discord";
user = "mautrix-discord";
group = "mautrix-discord";
mode = "0750";
}
];
systemd = { systemd = {
services = { services = {
mautrix-discord-env = { mautrix-discord-env = {
@@ -26,9 +35,15 @@
}; };
script = '' script = ''
mkdir -p /run/mautrix-discord mkdir -p /run/mautrix-discord
echo "DISCORD_BOT_TOKEN=$(cat ${config.sops.secrets.discord_bot_token.path})" > /run/mautrix-discord/env echo "DISCORD_BOT_TOKEN=$(cat ${
echo "DISCORD_CLIENT_ID=$(cat ${config.sops.secrets.discord_client_id.path})" >> /run/mautrix-discord/env config.sops.secrets."matrix/bridges/discord/bot_token".path
echo "DISCORD_PICKLE_KEY=$(cat ${config.sops.secrets.discord_pickle_key.path})" >> /run/mautrix-discord/env })" > /run/mautrix-discord/env
echo "DISCORD_CLIENT_ID=$(cat ${
config.sops.secrets."matrix/bridges/discord/client_id".path
})" >> /run/mautrix-discord/env
echo "DISCORD_PICKLE_KEY=$(cat ${
config.sops.secrets."matrix/bridges/discord/pickle_key".path
})" >> /run/mautrix-discord/env
chmod 600 /run/mautrix-discord/env chmod 600 /run/mautrix-discord/env
chown mautrix-discord:mautrix-discord /run/mautrix-discord/env chown mautrix-discord:mautrix-discord /run/mautrix-discord/env
''; '';
+22
View File
@@ -0,0 +1,22 @@
{ config, ... }:
{
sops.secrets."matrix/draupnir_access_token" = { };
environment.persistence."/persist".directories = [
{
directory = "/var/lib/private";
user = "root";
group = "root";
mode = "0700";
}
];
services.draupnir = {
enable = true;
secrets.accessToken = config.sops.secrets."matrix/draupnir_access_token".path;
settings = {
homeserverUrl = "https://matrix.cyperpunk.de";
managementRoom = "!eErCimyDjLSebHjpJA:cyperpunk.de";
};
};
}
+13 -11
View File
@@ -1,18 +1,20 @@
{ config, ... }: { config, ... }:
{ {
sops.secrets.livekit_key_file = { }; sops.secrets."matrix/livekit_key_file" = { };
services.livekit = { services = {
enable = true; livekit = {
openFirewall = true; enable = true;
settings.room.auto_create = false; openFirewall = true;
keyFile = config.sops.secrets.livekit_key_file.path; settings.room.auto_create = false;
}; keyFile = config.sops.secrets."matrix/livekit_key_file".path;
};
services.lk-jwt-service = { lk-jwt-service = {
enable = true; enable = true;
livekitUrl = "wss://cyperpunk.de/livekit/sfu"; livekitUrl = "wss://cyperpunk.de/livekit/sfu";
keyFile = config.sops.secrets.livekit_key_file.path; keyFile = config.sops.secrets."matrix/livekit_key_file".path;
};
}; };
systemd.services.lk-jwt-service.environment.LIVEKIT_FULL_ACCESS_HOMESERVERS = "cyperpunk.de"; systemd.services.lk-jwt-service.environment.LIVEKIT_FULL_ACCESS_HOMESERVERS = "cyperpunk.de";
+14 -3
View File
@@ -1,8 +1,19 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
environment.systemPackages = with pkgs; [ environment = {
maubot systemPackages = with pkgs; [
]; maubot
];
persistence."/persist".directories = [
{
directory = "/var/lib/maubot";
user = "maubot";
group = "maubot";
mode = "0750";
}
];
};
services = { services = {
maubot = { maubot = {
+31 -8
View File
@@ -1,24 +1,39 @@
{ config, lib, ... }: { config, lib, ... }:
{ {
sops.secrets = { sops.secrets = {
meta_as_token = { "matrix/bridges/meta/as_token" = {
owner = "mautrix-meta-facebook"; owner = "mautrix-meta-facebook";
group = "mautrix-meta"; group = "mautrix-meta";
}; };
meta_hs_token = { "matrix/bridges/meta/hs_token" = {
owner = "mautrix-meta-facebook"; owner = "mautrix-meta-facebook";
group = "mautrix-meta"; group = "mautrix-meta";
}; };
instagram_as_token = { "matrix/bridges/instagram/as_token" = {
owner = "mautrix-meta-instagram"; owner = "mautrix-meta-instagram";
group = "mautrix-meta"; group = "mautrix-meta";
}; };
instagram_hs_token = { "matrix/bridges/instagram/hs_token" = {
owner = "mautrix-meta-instagram"; owner = "mautrix-meta-instagram";
group = "mautrix-meta"; group = "mautrix-meta";
}; };
}; };
environment.persistence."/persist".directories = [
{
directory = "/var/lib/mautrix-meta-facebook";
user = "mautrix-meta-facebook";
group = "mautrix-meta";
mode = "0750";
}
{
directory = "/var/lib/mautrix-meta-instagram";
user = "mautrix-meta-instagram";
group = "mautrix-meta";
mode = "0750";
}
];
systemd.services = { systemd.services = {
mautrix-meta-facebook-env = { mautrix-meta-facebook-env = {
before = [ "mautrix-meta-facebook-registration.service" ]; before = [ "mautrix-meta-facebook-registration.service" ];
@@ -29,8 +44,12 @@
}; };
script = '' script = ''
mkdir -p /run/mautrix-meta-facebook mkdir -p /run/mautrix-meta-facebook
echo "META_AS_TOKEN=$(cat ${config.sops.secrets.meta_as_token.path})" > /run/mautrix-meta-facebook/env echo "META_AS_TOKEN=$(cat ${
echo "META_HS_TOKEN=$(cat ${config.sops.secrets.meta_hs_token.path})" >> /run/mautrix-meta-facebook/env config.sops.secrets."matrix/bridges/meta/as_token".path
})" > /run/mautrix-meta-facebook/env
echo "META_HS_TOKEN=$(cat ${
config.sops.secrets."matrix/bridges/meta/hs_token".path
})" >> /run/mautrix-meta-facebook/env
chmod 600 /run/mautrix-meta-facebook/env chmod 600 /run/mautrix-meta-facebook/env
chown mautrix-meta-facebook:mautrix-meta /run/mautrix-meta-facebook/env chown mautrix-meta-facebook:mautrix-meta /run/mautrix-meta-facebook/env
''; '';
@@ -45,8 +64,12 @@
}; };
script = '' script = ''
mkdir -p /run/mautrix-meta-instagram mkdir -p /run/mautrix-meta-instagram
echo "INSTAGRAM_AS_TOKEN=$(cat ${config.sops.secrets.instagram_as_token.path})" > /run/mautrix-meta-instagram/env echo "INSTAGRAM_AS_TOKEN=$(cat ${
echo "INSTAGRAM_HS_TOKEN=$(cat ${config.sops.secrets.instagram_hs_token.path})" >> /run/mautrix-meta-instagram/env config.sops.secrets."matrix/bridges/instagram/as_token".path
})" > /run/mautrix-meta-instagram/env
echo "INSTAGRAM_HS_TOKEN=$(cat ${
config.sops.secrets."matrix/bridges/instagram/hs_token".path
})" >> /run/mautrix-meta-instagram/env
chmod 600 /run/mautrix-meta-instagram/env chmod 600 /run/mautrix-meta-instagram/env
chown mautrix-meta-instagram:mautrix-meta /run/mautrix-meta-instagram/env chown mautrix-meta-instagram:mautrix-meta /run/mautrix-meta-instagram/env
''; '';
-17
View File
@@ -1,17 +0,0 @@
{ config, ... }:
{
sops.secrets.mjolnir_access_token = { };
services.draupnir = {
enable = true;
secrets.accessToken = config.sops.secrets.mjolnir_access_token.path;
settings = {
homeserverUrl = "https://matrix.cyperpunk.de";
managementRoom = "!eErCimyDjLSebHjpJA:cyperpunk.de";
};
};
}
#curl -X POST https://matrix.cyperpunk.de/_matrix/client/v3/login \
# -H "Content-Type: application/json" \
# -d '{"type":"m.login.password ","user":"mjolnir","password":"i318HXBRkt)Lh$nOPwq#6n9z&<W[XJ&2c4$Zf>7jV}-uQCE{<plwk;LZ)10*N<~1"}'
+32 -46
View File
@@ -1,12 +1,11 @@
{ {
config, config,
pkgs, pkgs,
lib,
... ...
}: }:
{ {
sops.secrets = { sops.secrets = {
pg_replication_password = { "postgres/replication_password" = {
owner = "root"; owner = "root";
group = "root"; group = "root";
}; };
@@ -18,12 +17,10 @@
description = "PostgreSQL WAL streaming replica (Docker)"; description = "PostgreSQL WAL streaming replica (Docker)";
requires = [ requires = [
"docker.service" "docker.service"
"tailscaled.service"
"network-online.target" "network-online.target"
]; ];
after = [ after = [
"docker.service" "docker.service"
"tailscaled.service"
"network-online.target" "network-online.target"
]; ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
@@ -32,64 +29,53 @@
Type = "simple"; Type = "simple";
Restart = "on-failure"; Restart = "on-failure";
RestartSec = "10s"; RestartSec = "10s";
TimeoutStartSec = "0";
}; };
preStart = '' preStart = ''
DATADIR="/storage/backup/postgresql-replica" DATADIR="/storage/backup/postgresql-replica"
PG_PASS=$(cat ${config.sops.secrets.pg_replication_password.path}) PG_PASS=$(cat ${config.sops.secrets."postgres/replication_password".path})
${pkgs.docker}/bin/docker pull postgres:17
${pkgs.docker}/bin/docker pull postgres:17 if [ ! -f "$DATADIR/PG_VERSION" ]; then
echo "No data dir found running pg_basebackup..."
if [ ! -f "$DATADIR/PG_VERSION" ]; then rm -rf "$DATADIR"
echo "No data dir found running pg_basebackup..." ${pkgs.docker}/bin/docker run --rm \
rm -rf "$DATADIR" -e PGPASSWORD="$PG_PASS" \
-v "/storage/backup:/out" \
${pkgs.docker}/bin/docker run --rm \ --network host \
-e PGPASSWORD="$PG_PASS" \ postgres:17 \
-v "/storage/backup:/out" \ pg_basebackup \
--network host \ --host=10.10.0.1 \
postgres:17 \ --port=5432 \
pg_basebackup \ --username=replicator \
--host=100.109.10.91 \ --pgdata=/out/postgresql-replica \
--port=5432 \ --wal-method=stream \
--username=replicator \ --checkpoint=fast \
--pgdata=/out/postgresql-replica \ --progress \
--wal-method=stream \ --verbose
--checkpoint=fast \ touch "$DATADIR/standby.signal"
--progress \ cat > "$DATADIR/postgresql.auto.conf" <<EOF
--verbose primary_conninfo = 'host=10.10.0.1 port=5432 user=replicator password=$PG_PASS application_name=cyper-controller sslmode=disable'
# standby signal
touch "$DATADIR/standby.signal"
# primary conninfo
cat > "$DATADIR/postgresql.auto.conf" <<EOF
primary_conninfo = 'host=100.109.10.91 port=5432 user=replicator password=$PG_PASS application_name=cyper-controller sslmode=require'
EOF EOF
cat > "$DATADIR/postgresql.conf" <<EOF
# minimal postgresql.conf
cat > "$DATADIR/postgresql.conf" <<EOF
hot_standby = on hot_standby = on
hot_standby_feedback = on hot_standby_feedback = on
wal_receiver_timeout = '60s' wal_receiver_timeout = '60s'
port = 5434 port = 5434
listen_addresses = '*' listen_addresses = '*'
EOF EOF
chown -R 999:999 "$DATADIR"
chown -R 999:999 "$DATADIR" fi
fi if [ ! -f "$DATADIR/postgresql.conf" ]; then
cat > "$DATADIR/postgresql.conf" <<EOF
# ensure postgresql.conf exists on subsequent starts
if [ ! -f "$DATADIR/postgresql.conf" ]; then
cat > "$DATADIR/postgresql.conf" <<EOF
hot_standby = on hot_standby = on
hot_standby_feedback = on hot_standby_feedback = on
wal_receiver_timeout = '60s' wal_receiver_timeout = '60s'
port = 5434 port = 5434
listen_addresses = '*' listen_addresses = '*'
EOF EOF
chown 999:999 "$DATADIR/postgresql.conf" chown 999:999 "$DATADIR/postgresql.conf"
fi fi
''; '';
script = '' script = ''
+66 -40
View File
@@ -34,45 +34,59 @@ let
in in
{ {
sops.secrets = { sops.secrets = {
matrix_macaroon_secret = { }; "matrix/macaroon_secret" = { };
matrix_registration_secret = { "matrix/registration_secret" = {
owner = "matrix-synapse"; owner = "matrix-synapse";
group = "matrix-synapse"; group = "matrix-synapse";
}; };
pg_replication_password = { "postgres/replication_password" = {
owner = "postgres"; owner = "postgres";
group = "postgres"; group = "postgres";
}; };
kanidm_synapse_secret = { "kanidm/synapse_secret" = {
owner = "matrix-synapse"; owner = "matrix-synapse";
group = "matrix-synapse"; group = "matrix-synapse";
}; };
}; };
systemd.tmpfiles.rules = [ environment.persistence."/persist".directories = [
"d /var/www/matrix 0755 nginx nginx -" {
"L+ /var/www/matrix/index.html 0644 nginx nginx - ${matrixIndexHtml}" directory = "/var/lib/matrix-synapse";
"L+ /var/www/matrix/register.php 0644 nginx nginx - ${matrixRegisterPhp}" user = "matrix-synapse";
"L+ /var/www/matrix/style.css 0644 nginx nginx - ${matrixStyleCss}" group = "matrix-synapse";
"L+ /var/www/matrix/app.js 0644 nginx nginx - ${matrixAppJs}" mode = "0700";
}
{
directory = "/var/lib/postgresql";
user = "postgres";
group = "postgres";
mode = "0750";
}
{
directory = "/var/lib/acme";
user = "acme";
group = "acme";
mode = "0755";
}
]; ];
services.phpfpm.pools.matrix = {
user = "nginx";
group = "nginx";
settings = {
"listen.owner" = "nginx";
"listen.group" = "nginx";
"pm" = "dynamic";
"pm.max_children" = 10;
"pm.start_servers" = 2;
"pm.min_spare_servers" = 1;
"pm.max_spare_servers" = 3;
};
phpPackage = pkgs.php.withExtensions ({ enabled, all }: enabled ++ [ all.curl ]);
};
services = { services = {
phpfpm.pools.matrix = {
user = "nginx";
group = "nginx";
settings = {
"listen.owner" = "nginx";
"listen.group" = "nginx";
"pm" = "dynamic";
"pm.max_children" = 10;
"pm.start_servers" = 2;
"pm.min_spare_servers" = 1;
"pm.max_spare_servers" = 3;
};
phpPackage = pkgs.php.withExtensions ({ enabled, all }: enabled ++ [ all.curl ]);
};
matrix-synapse = { matrix-synapse = {
enable = true; enable = true;
settings = { settings = {
@@ -81,8 +95,8 @@ in
enable_registration = false; enable_registration = false;
trusted_key_servers = [ { server_name = "matrix.org"; } ]; trusted_key_servers = [ { server_name = "matrix.org"; } ];
suppress_key_server_warning = true; suppress_key_server_warning = true;
registration_shared_secret_path = config.sops.secrets.matrix_registration_secret.path; registration_shared_secret_path = config.sops.secrets."matrix/registration_secret".path;
macaroon_secret_key = "$__file{${config.sops.secrets.matrix_macaroon_secret.path}}"; macaroon_secret_key = "$__file{${config.sops.secrets."matrix/macaroon_secret".path}}";
matrix_rtc = { matrix_rtc = {
enabled = true; enabled = true;
transports = [ transports = [
@@ -135,7 +149,7 @@ in
type = "metrics"; type = "metrics";
bind_addresses = [ bind_addresses = [
"127.0.0.1" "127.0.0.1"
"100.109.10.91" "10.10.0.1"
]; ];
resources = [ ]; resources = [ ];
} }
@@ -148,7 +162,7 @@ in
idp_name = "Kanidm"; idp_name = "Kanidm";
issuer = "https://auth.cyperpunk.de/oauth2/openid/synapse"; issuer = "https://auth.cyperpunk.de/oauth2/openid/synapse";
client_id = "synapse"; client_id = "synapse";
client_secret_path = config.sops.secrets.kanidm_synapse_secret.path; client_secret_path = config.sops.secrets."kanidm/synapse_secret".path;
scopes = [ scopes = [
"openid" "openid"
"profile" "profile"
@@ -236,10 +250,11 @@ in
wal_level = "replica"; wal_level = "replica";
max_wal_senders = 5; max_wal_senders = 5;
wal_keep_size = "512MB"; wal_keep_size = "512MB";
listen_addresses = lib.mkForce "127.0.0.1,100.109.10.91"; listen_addresses = lib.mkForce "127.0.0.1,10.10.0.1";
ssl = true;
}; };
authentication = lib.mkAfter '' authentication = lib.mkAfter ''
host replication replicator 100.0.0.0/8 scram-sha-256 hostssl replication replicator 10.10.0.2/32 scram-sha-256
''; '';
}; };
@@ -251,15 +266,26 @@ in
}; };
}; };
systemd.services = { systemd = {
matrix-synapse.serviceConfig.ReadOnlyPaths = [ services = {
"/var/lib/mautrix-discord" matrix-synapse.serviceConfig.ReadOnlyPaths = [
"/var/lib/mautrix-whatsapp" "/var/lib/mautrix-discord"
"/var/lib/mautrix-whatsapp"
];
postgresql.postStart = lib.mkAfter ''
PG_PASS=$(cat ${config.sops.secrets."postgres/replication_password".path})
${config.services.postgresql.package}/bin/psql -U postgres -c \
"ALTER ROLE replicator WITH PASSWORD '$PG_PASS';"
'';
};
tmpfiles.rules = [
"d /var/www/matrix 0755 nginx nginx -"
"L+ /var/www/matrix/index.html 0644 nginx nginx - ${matrixIndexHtml}"
"L+ /var/www/matrix/register.php 0644 nginx nginx - ${matrixRegisterPhp}"
"L+ /var/www/matrix/style.css 0644 nginx nginx - ${matrixStyleCss}"
"L+ /var/www/matrix/app.js 0644 nginx nginx - ${matrixAppJs}"
]; ];
postgresql.postStart = lib.mkAfter ''
PG_PASS=$(cat ${config.sops.secrets.pg_replication_password.path})
${config.services.postgresql.package}/bin/psql -U postgres -c \
"ALTER ROLE replicator WITH PASSWORD '$PG_PASS';"
'';
}; };
} }
+35 -24
View File
@@ -1,29 +1,40 @@
{ ... }:
{ {
services.postgresql = {
ensureUsers = [
{
name = "mautrix-whatsapp";
ensureDBOwnership = true;
}
];
ensureDatabases = [ "mautrix-whatsapp" ];
};
services.mautrix-whatsapp = { environment.persistence."/persist".directories = [
enable = true; {
settings = { directory = "/var/lib/mautrix-whatsapp";
homeserver = { user = "mautrix-whatsapp";
address = "http://127.0.0.1:8008"; group = "mautrix-whatsapp";
domain = "cyperpunk.de"; mode = "0750";
}; }
database = { ];
type = "postgres";
uri = "postgres:///mautrix-whatsapp?host=/run/postgresql&sslmode=disable"; services = {
}; postgresql = {
bridge.permissions = { ensureUsers = [
"cyperpunk.de" = "user"; {
"@dergrumpf:cyperpunk.de" = "admin"; name = "mautrix-whatsapp";
ensureDBOwnership = true;
}
];
ensureDatabases = [ "mautrix-whatsapp" ];
};
mautrix-whatsapp = {
enable = true;
settings = {
homeserver = {
address = "http://127.0.0.1:8008";
domain = "cyperpunk.de";
};
database = {
type = "postgres";
uri = "postgres:///mautrix-whatsapp?host=/run/postgresql&sslmode=disable";
};
bridge.permissions = {
"cyperpunk.de" = "user";
"@dergrumpf:cyperpunk.de" = "admin";
};
}; };
}; };
}; };
+18 -9
View File
@@ -27,20 +27,29 @@ in
imports = [ ./gs-exporter.nix ]; imports = [ ./gs-exporter.nix ];
sops.secrets = { sops.secrets = {
grafana_secret_key = { "services/grafana/secret_key" = {
owner = "grafana"; owner = "grafana";
group = "grafana"; group = "grafana";
}; };
kanidm_grafana_secret = { "kanidm/grafana_secret" = {
owner = "grafana"; owner = "grafana";
group = "grafana"; group = "grafana";
}; };
zyxel_pass = { "network/zyxel_pass" = {
group = "gs1200-exporter"; group = "gs1200-exporter";
mode = "0440"; mode = "0440";
}; };
}; };
environment.persistence."/persist".directories = [
{
directory = "/var/lib/grafana";
user = "grafana";
group = "grafana";
mode = "0750";
}
];
users.groups.gs1200-exporter = { }; users.groups.gs1200-exporter = { };
services = { services = {
@@ -69,7 +78,7 @@ in
serve_from_sub_path = true; serve_from_sub_path = true;
}; };
security = { security = {
secret_key = "$__file{${config.sops.secrets.grafana_secret_key.path}}"; secret_key = "$__file{${config.sops.secrets."services/grafana/secret_key".path}}";
allow_embedding = true; allow_embedding = true;
cookie_samesite = "none"; cookie_samesite = "none";
cookie_secure = true; cookie_secure = true;
@@ -82,7 +91,7 @@ in
enabled = true; enabled = true;
name = "Kanidm"; name = "Kanidm";
client_id = "grafana"; client_id = "grafana";
client_secret = "$__file{${config.sops.secrets.kanidm_grafana_secret.path}}"; client_secret = "$__file{${config.sops.secrets."kanidm/grafana_secret".path}}";
scopes = "openid profile email"; scopes = "openid profile email";
auth_url = "https://auth.cyperpunk.de/ui/oauth2"; auth_url = "https://auth.cyperpunk.de/ui/oauth2";
token_url = "https://auth.cyperpunk.de/oauth2/token"; token_url = "https://auth.cyperpunk.de/oauth2/token";
@@ -125,7 +134,7 @@ in
metrics_path = "/_synapse/metrics"; metrics_path = "/_synapse/metrics";
static_configs = [ static_configs = [
{ {
targets = [ "100.109.10.91:9009" ]; targets = [ "10.10.0.1:9009" ];
labels = { labels = {
instance = "cyper-proxy"; instance = "cyper-proxy";
job = "master"; job = "master";
@@ -149,7 +158,7 @@ in
job_name = "postgresql-proxy"; job_name = "postgresql-proxy";
static_configs = [ static_configs = [
{ {
targets = [ "100.109.10.91:9188" ]; targets = [ "10.10.0.1:9188" ];
labels = { labels = {
instance = "cyper-proxy"; instance = "cyper-proxy";
}; };
@@ -172,13 +181,13 @@ in
zyxel1 = { zyxel1 = {
address = "192.168.2.3"; address = "192.168.2.3";
port = 9934; port = 9934;
passwordFile = config.sops.secrets.zyxel_pass.path; passwordFile = config.sops.secrets."network/zyxel_pass".path;
group = "gs1200-exporter"; group = "gs1200-exporter";
}; };
zyxel2 = { zyxel2 = {
address = "192.168.2.4"; address = "192.168.2.4";
port = 9935; port = 9935;
passwordFile = config.sops.secrets.zyxel_pass.path; passwordFile = config.sops.secrets."network/zyxel_pass".path;
group = "gs1200-exporter"; group = "gs1200-exporter";
}; };
}; };
+1 -2
View File
@@ -1,7 +1,6 @@
_: _:
let let
upstream = "10.10.0.2";
upstream = "100.86.56.71";
mkProxy = port: { mkProxy = port: {
forceSSL = true; forceSSL = true;
+10
View File
@@ -48,6 +48,16 @@ let
in in
{ {
nixpkgs.overlays = [ octoprint-overlay ]; nixpkgs.overlays = [ octoprint-overlay ];
environment.persistence."/persist".directories = [
{
directory = "/var/lib/octoprint";
user = "octoprint";
group = "octoprint";
mode = "0750";
}
];
services.octoprint = { services.octoprint = {
enable = true; enable = true;
host = "0.0.0.0"; host = "0.0.0.0";
+6 -7
View File
@@ -1,11 +1,10 @@
{ config, ... }: { config, ... }:
{ {
sops.secrets = { sops.secrets = {
paperless_admin = { "services/paperless/admin" = {
owner = "paperless"; owner = "paperless";
}; };
paperless_oidc_secret = { "services/paperless/oidc_secret" = {
owner = "paperless"; owner = "paperless";
}; };
}; };
@@ -18,14 +17,14 @@
consumptionDir = "/storage/fast/paperless/consume"; consumptionDir = "/storage/fast/paperless/consume";
dataDir = "/storage/fast/paperless"; dataDir = "/storage/fast/paperless";
configureTika = true; configureTika = true;
passwordFile = config.sops.secrets.paperless_admin.path; passwordFile = config.sops.secrets."services/paperless/admin".path;
settings = { settings = {
PAPERLESS_USE_X_FORWARDED_HOST = true; PAPERLESS_USE_X_FORWARDED_HOST = true;
PAPERLESS_USE_X_FORWARDED_PORT = true; PAPERLESS_USE_X_FORWARDED_PORT = true;
PAPERLESS_ALLOWED_HOSTS = "ngx.cyperpunk.de,100.109.179.25,localhost"; PAPERLESS_ALLOWED_HOSTS = "ngx.cyperpunk.de,10.10.0.2,localhost";
PAPERLESS_CSRF_TRUSTED_ORIGINS = [ PAPERLESS_CSRF_TRUSTED_ORIGINS = [
"https://ngx.cyperpunk.de" "https://ngx.cyperpunk.de"
"http://100.109.179.25:28101" "http://10.10.0.2:28101"
]; ];
PAPERLESS_OCR_LANGUAGE = "deu+eng"; PAPERLESS_OCR_LANGUAGE = "deu+eng";
PAPERLESS_CONSUMER_POLLING = 60; PAPERLESS_CONSUMER_POLLING = 60;
@@ -54,7 +53,7 @@
requires = [ "systemd-tmpfiles-setup.service" ]; requires = [ "systemd-tmpfiles-setup.service" ];
}; };
paperless-web = { paperless-web = {
serviceConfig.EnvironmentFiles = [ config.sops.secrets.paperless_oidc_secret.path ]; serviceConfig.EnvironmentFiles = [ config.sops.secrets."services/paperless/oidc_secret".path ];
}; };
}; };
}; };
-2
View File
@@ -11,8 +11,6 @@ let
port = 11080; port = 11080;
in in
{ {
boot.kernel.sysctl."vm.overcommit_memory" = lib.mkForce "1";
services.searx = { services.searx = {
enable = true; enable = true;
package = pkgs.searxng; package = pkgs.searxng;
+9
View File
@@ -1,6 +1,15 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
environment.persistence."/persist".directories = [
{
directory = "/var/lib/unifi";
user = "unifi";
group = "unifi";
mode = "0750";
}
];
services.unifi = { services.unifi = {
enable = true; enable = true;
unifiPackage = pkgs.unifi; unifiPackage = pkgs.unifi;

Some files were not shown because too many files have changed in this diff Show More