# Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page, on # https://search.nixos.org/options and in the NixOS manual (`nixos-help`). { config, lib, pkgs, chirp, ... }: { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix ]; # Use the GRUB 2 boot loader. boot.loader.systemd-boot.enable = true; # boot.loader.grub.efiSupport = true; # boot.loader.grub.efiInstallAsRemovable = true; # boot.loader.efi.efiSysMountPoint = "/boot/efi"; # Define on which hard drive you want to install Grub. # boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.package = pkgs.nixVersions.nix_2_28; nix.gc = { automatic = true; options = "--delete-older-than 30d"; }; nix.optimise.automatic = true; system.autoUpgrade = { enable = true; allowReboot = true; }; networking.hostName = "pschdev"; # Define your hostname. # Pick only one of the below networking options. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. networking.firewall = { enable = true; allowedTCPPorts = [ 80 443 9418 ]; }; # Set your time zone. time.timeZone = "Europe/Amsterdam"; # Configure network proxy if necessary # networking.proxy.default = "http://user:password@proxy:port/"; # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; # Select internationalisation properties. i18n.defaultLocale = "de_DE.UTF-8"; console = { font = "Lat2-Terminus16"; keyMap = "de-latin1-nodeadkeys"; # useXkbConfig = true; # use xkb.options in tty. }; # Enable the X11 windowing system. # services.xserver.enable = true; # Configure keymap in X11 # services.xserver.xkb.layout = "us"; # services.xserver.xkb.options = "eurosign:e,caps:escape"; # Enable CUPS to print documents. # services.printing.enable = true; # Enable sound. # hardware.pulseaudio.enable = true; # OR # services.pipewire = { # enable = true; # pulse.enable = true; # }; # Enable touchpad support (enabled default in most desktopManager). # services.libinput.enable = true; # Define a user account. Don't forget to set a password with ‘passwd’. users.users.ps = { isNormalUser = true; extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. packages = with pkgs; [ ]; }; security = { polkit.enable = true; sudo.wheelNeedsPassword = false; }; # nixpkgs.config.allowUnfree = true; # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ vim wget file git fzf bat helix gitui bintools btop htop systemctl-tui tmux pkg-config ]; # git users.users.git = { isSystemUser = true; group = "git"; home = "/srv/git"; createHome = true; homeMode = "750"; shell = "${pkgs.git}/bin/git-shell"; openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICQOPefMnq0qvFjYxlrdlSmUgyCbvV85gkfRykVlTnrn ps@nixos" ]; }; users.groups.git = {}; programs.git = { enable = true; config = { init.defaultBranch = "main"; user.name = "Patrick"; user.email = "patrick.schoenberger@posteo.de"; }; }; # Some programs need SUID wrappers, can be configured further or are # started in user sessions. # programs.mtr.enable = true; # programs.gnupg.agent = { # enable = true; # enableSSHSupport = true; # }; # List services that you want to enable: # Enable the OpenSSH daemon. services.openssh = { enable = true; extraConfig = '' Match user git AllowTcpForwarding no AllowAgentForwarding no PasswordAuthentication no PermitTTY no X11Forwarding no ''; }; services.qemuGuest.enable = true; # virtualisation.qemu.guestAgent.enable = true; services.caddy = { enable = true; virtualHosts."psch.dev".extraConfig = '' respond "hello :D" ''; virtualHosts."chirp.psch.dev".extraConfig = '' reverse_proxy http://localhost:8080 { request_buffers 8192 } tls { protocols tls1.3 tls1.3 } ''; virtualHosts."git.psch.dev".extraConfig = '' redir / /cgit reverse_proxy localhost:8082 ''; }; # services.chirp = { # enable = true; # }; users.users.chirp = { isSystemUser = true; group = "chirp"; home = "/var/lib/chirp"; createHome = true; }; users.groups.chirp = {}; systemd.services.chirp = { description = "Chirp SystemD Service"; wantedBy = ["multi-user.target"]; after = ["network.target"]; serviceConfig = { WorkingDirectory = "/var/lib/chirp"; ExecStart = "${chirp.packages.${pkgs.system}.default}/bin/chirp"; Restart = "always"; Type = "simple"; User = "chirp"; Group = "chirp"; }; }; services.gitDaemon = { enable = true; basePath = "/srv/git"; repositories = [ "/srv/git" ]; exportAll = true; port = 9418; }; services.lighttpd = { enable = true; document-root = "/srv/www"; port = 8082; cgit = { enable = true; subdir = "cgit"; configText = '' scan-path=/srv/git robots=noindex, nofollow ''; }; gitweb.enable = true; }; users.users."lighttpd".extraGroups = [ "git" ]; services.gitweb = { gitwebTheme = false; projectroot = "/srv/git"; }; # Open ports in the firewall. # networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ]; # Or disable the firewall altogether. # networking.firewall.enable = false; # Copy the NixOS configuration file and link it from the resulting system # (/run/current-system/configuration.nix). This is useful in case you # accidentally delete configuration.nix. # system.copySystemConfiguration = true; # This option defines the first version of NixOS you have installed on this particular machine, # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. # # Most users should NEVER change this value after the initial install, for any reason, # even if you've upgraded your system to a new NixOS release. # # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how # to actually do that. # # This value being lower than the current NixOS release does NOT mean your system is # out of date, out of support, or vulnerable. # # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, # and migrated your data accordingly. # # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . system.stateVersion = "24.05"; # Did you read the comment? }