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 = {
34 networking.hostName = "pschdev"; # Define your hostname.
36 networking.firewall = {
38 allowedTCPPorts = [ 80 443 7777 9418 ];
42 time.timeZone = "Europe/Amsterdam";
44 # Configure network proxy if necessary
45 # networking.proxy.default = "http://user:password@proxy:port/";
46 # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
48 # Select internationalisation properties.
49 i18n.defaultLocale = "de_DE.UTF-8";
51 font = "Lat2-Terminus16";
52 keyMap = "de-latin1-nodeadkeys";
53 # useXkbConfig = true; # use xkb.options in tty.
56 # Define a user account. Don't forget to set a password with ‘passwd’.
59 extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
60 packages = with pkgs; [
69 useDefaultShell = true;
71 users.groups.live = {};
75 sudo.wheelNeedsPassword = false;
78 nixpkgs.config.allowUnfree = true;
81 (inputs.psch-flakes.overlays.cgit)
84 # List packages installed in system profile. To search, run:
86 environment.systemPackages = with pkgs; [
87 vim wget file git fzf bat
96 python312Packages.pygments
101 environment.shellAliases = {
102 snrs = "sudo nixos-rebuild switch --flake /etc/nixos#default";
103 snrt = "sudo nixos-rebuild test --flake /etc/nixos#default";
104 snrb = "sudo nixos-rebuild boot --flake /etc/nixos#default";
105 senc = "sudo ${pkgs.helix}/bin/hx /etc/nixos/configuration.nix";
109 system.activationScripts.githook =
111 githooksRepo = pkgs.fetchgit {
112 url = "git://psch.dev/git-hooks";
113 rev = "1a40e097c8854d5a0e65c070addaa7e3337635c0";
114 hash = "sha256-KNKnP/3hhQQlildzRF+skYHtV+7Xg1MQMPi2DDEHGAI=";
119 PATH=$PATH:${lib.makeBinPath [ pkgs.git pkgs.sudo pkgs.python3 ]} sudo -u git ${githooksRepo}/git-hooks/post-receive
130 shell = "${pkgs.git}/bin/git-shell";
131 packages = with pkgs; [
132 python3 # for blog git-hook
135 users.groups.git = {};
140 init.defaultBranch = "main";
141 user.name = "Patrick";
142 user.email = "patrick.schoenberger@posteo.de";
146 services.gitDaemon = {
148 basePath = "/srv/git";
149 repositories = [ "/srv/git" ];
154 # Enable the OpenSSH daemon.
159 AllowTcpForwarding no
160 AllowAgentForwarding no
161 PasswordAuthentication no
166 services.qemuGuest.enable = true;
167 # virtualisation.qemu.guestAgent.enable = true;
168 programs.mosh.enable = true;
173 virtualHosts."tnx.sh".extraConfig = ''
174 respond "The Website is under Construction."
176 virtualHosts."psch.dev".extraConfig = ''
177 basic_auth /julius_cam/* { test $2a$14$iKv0GlwavCunG0zQbaf2fOl4r4/8k8gDKUVUouu9Q3o.MfSDkp6Te }
181 virtualHosts."chirp.psch.dev".extraConfig = ''
182 reverse_proxy http://localhost:8080 {
186 virtualHosts."mail.psch.dev".extraConfig = ''
190 services.caddy.virtualHosts."git.psch.dev".extraConfig = ''
193 @assets path /cgit.css /cgit.png /favicon.ico /robots.txt
201 root ${pkgs.cgit}/cgit
205 reverse_proxy unix//run/fcgiwrap-git.sock {
207 env CGIT_CONFIG ${pkgs.writeText "cgitrc" ''
208 snapshots=tar tar.gz zip
211 enable-log-filecount=1
212 enable-log-linecount=1
215 module-link=/%s/commit/?id=%s
216 clone-url=https://git.psch.dev/$CGIT_REPO_URL git://psch.dev/$CGIT_REPO_URL ssh://git@psch.dev/~/$CGIT_REPO_URL
220 about-filter=${pkgs.writeShellScript "markdown-filter" ''
221 echo '<div class="markdown-body">'
222 ${pkgs.md4c}/bin/md2html --github --ftables
225 # source-filter=${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py
226 head-include=/srv/cgithub/head-include.html
227 footer=/srv/cgithub/footer.html
234 env SCRIPT_FILENAME ${pkgs.cgit}/cgit/cgit.cgi
239 # virtualHosts."git.psch.dev".extraConfig = ''
240 # reverse_proxy unix//run/anubis/anubis-cgit.sock
242 services.caddy.virtualHosts."gitweb.psch.dev".extraConfig = ''
249 reverse_proxy unix//run/fcgiwrap-git.sock {
251 env GITWEB_CONFIG ${pkgs.writeText "gitweb.conf" ''
252 $projectroot = "/srv/git";
254 $feature{'pathinfo'}{'default'} = [1];
255 $default_projects_order = "age";
257 $site_html_head_string = "<meta xmlns=\"http://www.w3.org/1999/xhtml\" name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />";
259 env SCRIPT_FILENAME ${pkgs.gitweb}/gitweb.cgi
264 # virtualHosts."gitweb.psch.dev".extraConfig = ''
265 # reverse_proxy unix//run/anubis/anubis-gitweb.sock
274 # instances.cgit.settings.TARGET = "http://localhost:8082/cgit";
275 # instances.gitweb.settings.TARGET = "http://localhost:8082";
278 services.fcgiwrap.instances."git" = {
279 process.user = "git";
280 process.group = "git";
281 socket.user = "caddy";
282 socket.group = "caddy";
285 users.users.chirp = {
288 home = "/var/lib/chirp";
291 users.groups.chirp = {};
293 systemd.services.chirp = {
294 description = "Chirp SystemD Service";
295 wantedBy = ["multi-user.target"];
296 after = ["network.target"];
298 WorkingDirectory = "/var/lib/chirp";
299 ExecStart = "${args.inputs.chirp.packages.${pkgs.system}.default}/bin/chirp";
311 fqdn = "mail.psch.dev";
312 domains = [ "psch.dev" ];
314 # A list of all login accounts. To create the password hashes, use
315 # nix-shell -p mkpasswd --run 'mkpasswd -sm bcrypt'
318 hashedPassword = "$2b$05$dd65mMjWxZNc.MK4YUwLgeRMInJHvwNTazptImrw4paRqyX/p4TQG";
319 aliases = ["p@psch.dev" "patrick@psch.dev"];
323 certificateScheme = "manual";
324 certificateFile = "/var/lib/caddy/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/mail.psch.dev/mail.psch.dev.crt";
325 keyFile = "/var/lib/caddy/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/mail.psch.dev/mail.psch.dev.key";
327 # security.acme.acceptTerms = true;
328 # security.acme.defaults.email = "patrick.schoenberger@posteo.de";
330 # Copy the NixOS configuration file and link it from the resulting system
331 # (/run/current-system/configuration.nix). This is useful in case you
332 # accidentally delete configuration.nix.
333 # system.copySystemConfiguration = true;
335 # This option defines the first version of NixOS you have installed on this particular machine,
336 # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
338 # Most users should NEVER change this value after the initial install, for any reason,
339 # even if you've upgraded your system to a new NixOS release.
341 # This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
342 # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
343 # to actually do that.
345 # This value being lower than the current NixOS release does NOT mean your system is
346 # out of date, out of support, or vulnerable.
348 # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
349 # and migrated your data accordingly.
351 # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
352 system.stateVersion = "24.05"; # Did you read the comment?