1 # Edit this configuration file to define what should be installed on
2 # your system. Help is available in the configuration.nix(5) man page, on
3 # https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
5 { config, lib, pkgs, inputs, ... } @ args:
9 [ # Include the results of the hardware scan.
10 ./hardware-configuration.nix
13 # Use the GRUB 2 boot loader.
14 boot.loader.systemd-boot.enable = true;
15 # boot.loader.grub.efiSupport = true;
16 # boot.loader.grub.efiInstallAsRemovable = true;
17 # boot.loader.efi.efiSysMountPoint = "/boot/efi";
18 # Define on which hard drive you want to install Grub.
19 # boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
21 nix.settings.experimental-features = [ "nix-command" "flakes" ];
22 nix.settings.download-buffer-size = 500000000;
26 options = "--delete-older-than 30d";
28 nix.optimise.automatic = true;
29 system.autoUpgrade = {
32 flake = inputs.self.outPath;
35 randomizedDelaySec = "45min";
38 networking.hostName = "netcup"; # Define your hostname.
40 networking.firewall = {
51 time.timeZone = "Europe/Amsterdam";
53 # Configure network proxy if necessary
54 # networking.proxy.default = "http://user:password@proxy:port/";
55 # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
57 # Select internationalisation properties.
58 i18n.defaultLocale = "de_DE.UTF-8";
60 font = "Lat2-Terminus16";
61 keyMap = "de-latin1-nodeadkeys";
62 # useXkbConfig = true; # use xkb.options in tty.
65 # Define a user account. Don't forget to set a password with ‘passwd’.
68 extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
69 packages = with pkgs; [
78 useDefaultShell = true;
80 users.groups.live = {};
84 sudo.wheelNeedsPassword = false;
87 nixpkgs.config.allowUnfree = true;
90 (inputs.ps-flakes.overlays.cgit)
91 (inputs.ps-flakes.overlays.gitweb)
92 (inputs.nix-minecraft.overlay)
95 # List packages installed in system profile. To search, run:
97 environment.systemPackages = with pkgs; [
98 vim wget file git fzf bat
109 python312Packages.pygments
114 environment.shellAliases = {
115 snrs = "sudo nixos-rebuild switch --flake /etc/nixos#default";
116 snrt = "sudo nixos-rebuild test --flake /etc/nixos#default";
117 snrb = "sudo nixos-rebuild boot --flake /etc/nixos#default";
118 senc = "sudo ${pkgs.helix}/bin/hx /etc/nixos/configuration.nix";
122 system.activationScripts.githook =
124 githooksRepo = pkgs.fetchgit {
125 url = "git://psch.dev/git-hooks";
126 rev = "1a40e097c8854d5a0e65c070addaa7e3337635c0";
127 hash = "sha256-KNKnP/3hhQQlildzRF+skYHtV+7Xg1MQMPi2DDEHGAI=";
132 PATH=$PATH:${lib.makeBinPath [ pkgs.git pkgs.sudo pkgs.python3 ]} sudo -u git ${githooksRepo}/git-hooks/post-receive
143 shell = "${pkgs.git}/bin/git-shell";
144 packages = with pkgs; [
145 python3 # for blog git-hook
148 users.groups.git = {};
153 init.defaultBranch = "main";
154 user.name = "Patrick";
155 user.email = "patrick.schoenberger@posteo.de";
159 services.gitDaemon = {
161 basePath = "/srv/git";
162 repositories = [ "/srv/git" ];
167 # Enable the OpenSSH daemon.
172 AllowTcpForwarding no
173 AllowAgentForwarding no
174 PasswordAuthentication no
179 services.qemuGuest.enable = true;
180 # virtualisation.qemu.guestAgent.enable = true;
181 programs.mosh.enable = true;
183 services.minecraft-servers = {
191 motd = "A Place on Earth";
195 package = pkgs.fabricServers.fabric-1_20_1;
197 # loaderVersion = "";
200 mods = pkgs.linkFarmFromDrvs "mods" (
201 builtins.attrValues {
202 Fabric-API = pkgs.fetchurl {
203 url = "https://cdn.modrinth.com/data/P7dR8mSH/versions/UapVHwiP/fabric-api-0.92.6%2B1.20.1.jar";
204 sha256 = "sha256-Ds5QR22jaSERqwS3WUXFRY5w2YzQae78BEqz5Xl33us=";
206 GlitchCore = pkgs.fetchurl {
207 url = "https://cdn.modrinth.com/data/s3dmwKy5/versions/25HLOiOl/GlitchCore-fabric-1.20.1-0.0.1.1.jar";
208 sha256 = "sha256-+359QjXKv4OVR4vEKu9rv9u++JUd3x9w9zcZ4LJMmcw=";
210 TerraBlender = pkgs.fetchurl {
211 url = "https://cdn.modrinth.com/data/kkmrDlKT/versions/J1S3aA8i/TerraBlender-fabric-1.20.1-3.0.1.10.jar";
212 sha256 = "sha256-0C2aoszwkSZLD87wdkQSi4I7NCGgK/xAORoBqhzNCiQ=";
214 BiomesOPlenty = pkgs.fetchurl {
215 url = "https://cdn.modrinth.com/data/HXF82T3G/versions/eZaag2ca/BiomesOPlenty-fabric-1.20.1-19.0.0.96.jar";
216 sha256 = "sha256-A4Kp4TNMtzbE8Nhs8NACEG1qmEU6cJlQ678Ok5gx6nI=";
228 psch.dev ps.run pasch.cc {
231 reverse_proxy http://localhost:3000
237 @assets path /cgit.css /cgit.png /favicon.ico /robots.txt
245 root ${pkgs.cgit}/cgit
249 reverse_proxy unix//run/fcgiwrap-git.sock {
251 env CGIT_CONFIG ${pkgs.writeText "cgitrc" ''
252 snapshots=tar tar.gz zip
255 enable-log-filecount=1
256 enable-log-linecount=1
261 favicon=/git/favicon.ico
262 module-link=/%s/commit/?id=%s
263 clone-url=https://$HTTP_HOST/git/$CGIT_REPO_URL git://$HTTP_HOST/$CGIT_REPO_URL git@$HTTP_HOST:$CGIT_REPO_URL
266 about-filter=${pkgs.writeShellScript "markdown-filter" ''
267 echo '<div class="markdown-body">'
268 ${pkgs.md4c}/bin/md2html --github --ftables
271 # source-filter=${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py
272 head-include=/srv/cgithub/head-include.html
273 footer=/srv/cgithub/footer.html
280 env SCRIPT_FILENAME ${pkgs.cgit}/cgit/cgit.cgi
286 basic_auth /julius_cam/* { test $2a$14$iKv0GlwavCunG0zQbaf2fOl4r4/8k8gDKUVUouu9Q3o.MfSDkp6Te }
291 respond "The Website is under Construction."
294 reverse_proxy http://localhost:8080 {
303 # virtualHosts."git.psch.dev".extraConfig = ''
304 # reverse_proxy unix//run/anubis/anubis-cgit.sock
306 services.caddy.virtualHosts."gitweb.ps.run".extraConfig = ''
313 reverse_proxy unix//run/fcgiwrap-git.sock {
315 env GITWEB_CONFIG ${pkgs.writeText "gitweb.conf" ''
316 $projectroot = "/srv/git";
318 $feature{'pathinfo'}{'default'} = [1];
319 $default_projects_order = "age";
321 $site_html_head_string = "<meta xmlns=\"http://www.w3.org/1999/xhtml\" name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />";
323 env SCRIPT_FILENAME ${pkgs.gitweb}/gitweb.cgi
328 # virtualHosts."gitweb.psch.dev".extraConfig = ''
329 # reverse_proxy unix//run/anubis/anubis-gitweb.sock
338 # instances.cgit.settings.TARGET = "http://localhost:8082/cgit";
339 # instances.gitweb.settings.TARGET = "http://localhost:8082";
342 services.fcgiwrap.instances."git" = {
343 process.user = "git";
344 process.group = "git";
345 socket.user = "caddy";
346 socket.group = "caddy";
351 repositoryRoot = "/srv/git2";
355 ROOT_URL = "https://ps.run/src";
358 REQUIRE_SIGNIN_VIEW = false;
361 REQUIRE_SIGNIN_VIEW = false;
362 DISABLE_REGISTRATION = true;
366 users.users.forgejo.extraGroups = [ "git" ];
368 users.users.chirp = {
371 home = "/var/lib/chirp";
374 users.groups.chirp = {};
376 systemd.services.poster-splitter =
378 poster-splitter-src = "/var/lib/postersplitter/repo";
381 description = "Poster Splitter";
382 wantedBy = [ "multi-user.target" ];
383 after = [ "network.target" ];
389 WorkingDirectory = "${poster-splitter-src}";
391 ExecStart = "${pkgs.bash}/bin/bash -c 'PATH=$PATH:${lib.makeBinPath [ pkgs.bash pkgs.python3 ]} LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib/ /var/lib/postersplitter/run.sh'";
392 Restart = "on-failure";
401 "deploy-poster-splitter" = {
402 id = "deploy-poster-splitter";
403 response-message = "Deployed Poster Splitter";
404 execute-command = "/var/lib/postersplitter/deploy.sh";
405 command-working-directory = "/var/lib/postersplitter";
406 pass-environment-to-command = [
407 { source = "string"; envname = "PATH"; name = "${lib.makeBinPath [ pkgs.coreutils pkgs.sudo pkgs.systemd pkgs.openssh pkgs.git pkgs.bash pkgs.python3 pkgs.git ]}"; }
411 type = "payload-hmac-sha1";
415 name = "X-Hub-Signature";
422 services.caddy.virtualHosts."postersplitter.de".extraConfig = ''
423 # Route 1: Der Webhook
424 # Leitet Anfragen an /hooks/ an den Webhook-Dienst
425 @webhook path /hooks/*
427 reverse_proxy 127.0.0.1:8102
430 # Route 2: Die Flask App (alles andere)
431 # Muss NACH der Webhook-Route kommen
432 @all not path /hooks/*
434 reverse_proxy 127.0.0.1:8101
437 users.users.poster = {
440 home = "/var/lib/postersplitter";
442 useDefaultShell = true;
443 packages = with pkgs; [
447 users.groups.poster = {};
449 systemd.services.chirp = {
450 description = "Chirp SystemD Service";
451 wantedBy = ["multi-user.target"];
452 after = ["network.target"];
454 WorkingDirectory = "/var/lib/chirp";
455 ExecStart = "${args.inputs.chirp.packages.${pkgs.system}.default}/bin/chirp";
467 fqdn = "mail.psch.dev";
468 domains = [ "psch.dev" ];
470 # A list of all login accounts. To create the password hashes, use
471 # nix-shell -p mkpasswd --run 'mkpasswd -sm bcrypt'
474 hashedPassword = "$2b$05$dd65mMjWxZNc.MK4YUwLgeRMInJHvwNTazptImrw4paRqyX/p4TQG";
475 aliases = ["p@psch.dev" "patrick@psch.dev"];
479 certificateScheme = "manual";
480 certificateFile = "/var/lib/caddy/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/mail.psch.dev/mail.psch.dev.crt";
481 keyFile = "/var/lib/caddy/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/mail.psch.dev/mail.psch.dev.key";
483 # security.acme.acceptTerms = true;
484 # security.acme.defaults.email = "patrick.schoenberger@posteo.de";
486 # Copy the NixOS configuration file and link it from the resulting system
487 # (/run/current-system/configuration.nix). This is useful in case you
488 # accidentally delete configuration.nix.
489 # system.copySystemConfiguration = true;
491 # This option defines the first version of NixOS you have installed on this particular machine,
492 # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
494 # Most users should NEVER change this value after the initial install, for any reason,
495 # even if you've upgraded your system to a new NixOS release.
497 # This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
498 # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
499 # to actually do that.
501 # This value being lower than the current NixOS release does NOT mean your system is
502 # out of date, out of support, or vulnerable.
504 # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
505 # and migrated your data accordingly.
507 # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
508 system.stateVersion = "24.05"; # Did you read the comment?