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, ... } @ 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.package = pkgs.nixVersions.nix_2_28;
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;
80 # List packages installed in system profile. To search, run:
82 environment.systemPackages = with pkgs; [
83 vim wget file git fzf bat
92 python312Packages.pygments
97 environment.shellAliases = {
98 snrs = "sudo nixos-rebuild switch --flake /etc/nixos#default";
99 snrt = "sudo nixos-rebuild test --flake /etc/nixos#default";
100 snrb = "sudo nixos-rebuild boot --flake /etc/nixos#default";
101 senc = "sudo ${pkgs.helix}/bin/hx /etc/nixos/configuration.nix";
111 shell = "${pkgs.git}/bin/git-shell";
112 packages = with pkgs; [
113 python3 # for blog git-hook
116 users.groups.git = {};
121 init.defaultBranch = "main";
122 user.name = "Patrick";
123 user.email = "patrick.schoenberger@posteo.de";
127 services.gitDaemon = {
129 basePath = "/srv/git";
130 repositories = [ "/srv/git" ];
135 # Enable the OpenSSH daemon.
140 AllowTcpForwarding no
141 AllowAgentForwarding no
142 PasswordAuthentication no
147 services.qemuGuest.enable = true;
148 # virtualisation.qemu.guestAgent.enable = true;
149 programs.mosh.enable = true;
154 virtualHosts."psch.dev".extraConfig = ''
155 basic_auth /julius_cam/* { test $2a$14$iKv0GlwavCunG0zQbaf2fOl4r4/8k8gDKUVUouu9Q3o.MfSDkp6Te }
159 virtualHosts."chirp.psch.dev".extraConfig = ''
160 reverse_proxy http://localhost:8080 {
165 services.caddy.virtualHosts."git.psch.dev".extraConfig = ''
168 @assets path /cgit.css /cgit.png /favicon.ico /robots.txt
176 root ${pkgs.cgit}/cgit
180 reverse_proxy unix//run/fcgiwrap-git.sock {
182 env CGIT_CONFIG ${pkgs.writeText "cgitrc" ''
183 snapshots=tar tar.gz zip
188 module-link=/%s/commit/?id=%s
189 clone-url=https://git.psch.dev/$CGIT_REPO_URL git://psch.dev/$CGIT_REPO_URL ssh://git@psch.dev:$CGIT_REPO_URL
192 about-filter=${pkgs.writeShellScript "markdown-filter" ''
193 echo '<div class="markdown-body">'
194 ${pkgs.md4c}/bin/md2html --github --ftables
197 # source-filter=${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py
198 head-include=/srv/cgithub/head-include.html
199 footer=/srv/cgithub/footer.html
206 env SCRIPT_FILENAME ${pkgs.cgit}/cgit/cgit.cgi
211 # virtualHosts."git.psch.dev".extraConfig = ''
212 # reverse_proxy unix//run/anubis/anubis-cgit.sock
214 services.caddy.virtualHosts."gitweb.psch.dev".extraConfig = ''
221 reverse_proxy unix//run/fcgiwrap-git.sock {
223 env GITWEB_CONFIG ${pkgs.writeText "gitweb.conf" ''
224 $projectroot = "/srv/git";
226 $feature{'pathinfo'}{'default'} = [1];
227 $default_projects_order = "age";
229 $site_html_head_string = "<meta xmlns=\"http://www.w3.org/1999/xhtml\" name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />";
231 env SCRIPT_FILENAME ${pkgs.gitweb}/gitweb.cgi
236 # virtualHosts."gitweb.psch.dev".extraConfig = ''
237 # reverse_proxy unix//run/anubis/anubis-gitweb.sock
246 # instances.cgit.settings.TARGET = "http://localhost:8082/cgit";
247 # instances.gitweb.settings.TARGET = "http://localhost:8082";
250 services.fcgiwrap.instances."git" = {
251 process.user = "git";
252 process.group = "git";
253 socket.user = "caddy";
254 socket.group = "caddy";
257 users.users.chirp = {
260 home = "/var/lib/chirp";
263 users.groups.chirp = {};
265 systemd.services.chirp = {
266 description = "Chirp SystemD Service";
267 wantedBy = ["multi-user.target"];
268 after = ["network.target"];
270 WorkingDirectory = "/var/lib/chirp";
271 ExecStart = "${args.inputs.chirp.packages.${pkgs.system}.default}/bin/chirp";
279 # Copy the NixOS configuration file and link it from the resulting system
280 # (/run/current-system/configuration.nix). This is useful in case you
281 # accidentally delete configuration.nix.
282 # system.copySystemConfiguration = true;
284 # This option defines the first version of NixOS you have installed on this particular machine,
285 # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
287 # Most users should NEVER change this value after the initial install, for any reason,
288 # even if you've upgraded your system to a new NixOS release.
290 # This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
291 # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
292 # to actually do that.
294 # This value being lower than the current NixOS release does NOT mean your system is
295 # out of date, out of support, or vulnerable.
297 # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
298 # and migrated your data accordingly.
300 # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
301 system.stateVersion = "24.05"; # Did you read the comment?