]> gitweb.ps.run Git - flake_server/blob - configuration.nix
update config
[flake_server] / configuration.nix
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`).
4
5 { config, lib, pkgs, chirp, ... }:
6
7 {
8   imports =
9     [ # Include the results of the hardware scan.
10       ./hardware-configuration.nix
11     ];
12
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
20
21   nix.settings.experimental-features = [ "nix-command" "flakes" ];
22   nix.package = pkgs.nixVersions.nix_2_28;
23
24   networking.hostName = "nixos"; # Define your hostname.
25   # Pick only one of the below networking options.
26   # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.
27   # networking.networkmanager.enable = true;  # Easiest to use and most distros use this by default.
28
29   networking.firewall = {
30     enable = true;
31     allowedTCPPorts = [ 80 443 9418 ];
32   };
33
34   # Set your time zone.
35   time.timeZone = "Europe/Amsterdam";
36
37   # Configure network proxy if necessary
38   # networking.proxy.default = "http://user:password@proxy:port/";
39   # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
40
41   # Select internationalisation properties.
42   i18n.defaultLocale = "de_DE.UTF-8";
43   console = {
44     font = "Lat2-Terminus16";
45     keyMap = "de-latin1-nodeadkeys";
46     # useXkbConfig = true; # use xkb.options in tty.
47   };
48
49   # Enable the X11 windowing system.
50   # services.xserver.enable = true;
51
52   # Configure keymap in X11
53   # services.xserver.xkb.layout = "us";
54   # services.xserver.xkb.options = "eurosign:e,caps:escape";
55
56   # Enable CUPS to print documents.
57   # services.printing.enable = true;
58
59   # Enable sound.
60   # hardware.pulseaudio.enable = true;
61   # OR
62   # services.pipewire = {
63   #   enable = true;
64   #   pulse.enable = true;
65   # };
66
67   # Enable touchpad support (enabled default in most desktopManager).
68   # services.libinput.enable = true;
69
70   # Define a user account. Don't forget to set a password with ‘passwd’.
71   users.users.ps = {
72     isNormalUser = true;
73     extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
74     packages = with pkgs; [
75     ];
76   };
77
78   security = {
79     polkit.enable = true;
80     sudo.wheelNeedsPassword = false;
81   };
82
83   # nixpkgs.config.allowUnfree = true;
84
85   # List packages installed in system profile. To search, run:
86   # $ nix search wget
87   environment.systemPackages = with pkgs; [
88     vim neovim wget file git
89     zig fzf bat
90     bintools
91     htop
92     tmux
93
94     forgejo
95     mbedtls
96     pkg-config
97   ];
98
99   # git
100   users.users.git = {
101     isSystemUser = true;
102     group = "git";
103     home = "/srv/git";
104     createHome = true;
105     shell = "${pkgs.git}/bin/git-shell";
106     openssh.authorizedKeys.keys = [
107       "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICQOPefMnq0qvFjYxlrdlSmUgyCbvV85gkfRykVlTnrn ps@nixos"
108     ];
109   };
110   users.groups.git = {};
111
112   programs.git = {
113     enable = true;
114     config = {
115       init.defaultBranch = "main";
116       user.name = "Patrick";
117       user.email = "patrick.schoenberger@posteo.de";
118     };
119   };
120
121   # Some programs need SUID wrappers, can be configured further or are
122   # started in user sessions.
123   # programs.mtr.enable = true;
124   # programs.gnupg.agent = {
125   #   enable = true;
126   #   enableSSHSupport = true;
127   # };
128
129   # List services that you want to enable:
130
131   # Enable the OpenSSH daemon.
132   services.openssh = {
133     enable = true;
134     extraConfig = ''
135       Match user git
136         AllowTcpForwarding no
137         AllowAgentForwarding no
138         PasswordAuthentication no
139         PermitTTY no
140         X11Forwarding no
141     '';
142   };
143   services.qemuGuest.enable = true;
144   # virtualisation.qemu.guestAgent.enable = true;
145
146   services.caddy = {
147     enable = true;
148     virtualHosts."psch.dev".extraConfig = ''
149       respond "hello :D"
150     '';
151     virtualHosts."chirp.psch.dev".extraConfig = ''
152       reverse_proxy http://localhost:8080 {
153         request_buffers 8192
154       }
155       tls {
156         protocols tls1.3 tls1.3
157       }
158     '';
159     virtualHosts."git.psch.dev".extraConfig = ''
160     '';
161   };
162
163   # services.chirp = {
164   #   enable = true;
165   # };
166   users.users.chirp = {
167     isSystemUser = true;
168     group = "chirp";
169     home = "/var/lib/chirp";
170     createHome = true;
171   };
172   users.groups.chirp = {};
173   
174   systemd.services.chirp = {
175     description = "Chirp SystemD Service";
176     wantedBy = ["multi-user.target"];
177     after = ["network.target"];
178     serviceConfig = {
179       WorkingDirectory = "/var/lib/chirp";
180       ExecStart = "${chirp.packages.${pkgs.system}.default}/bin/chirp";
181       Restart = "always";
182       Type = "simple";
183       User = "chirp";
184       Group = "chirp";
185     };
186   };
187
188   services.gitDaemon = {
189     enable = true;
190     basePath = "/srv/git";
191     repositories = [ "/srv/git" ];
192     exportAll = true;
193     port = 9418;
194   };
195
196   # Open ports in the firewall.
197   # networking.firewall.allowedTCPPorts = [ ... ];
198   # networking.firewall.allowedUDPPorts = [ ... ];
199   # Or disable the firewall altogether.
200   # networking.firewall.enable = false;
201
202   # Copy the NixOS configuration file and link it from the resulting system
203   # (/run/current-system/configuration.nix). This is useful in case you
204   # accidentally delete configuration.nix.
205   # system.copySystemConfiguration = true;
206
207   # This option defines the first version of NixOS you have installed on this particular machine,
208   # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
209   #
210   # Most users should NEVER change this value after the initial install, for any reason,
211   # even if you've upgraded your system to a new NixOS release.
212   #
213   # This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
214   # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
215   # to actually do that.
216   #
217   # This value being lower than the current NixOS release does NOT mean your system is
218   # out of date, out of support, or vulnerable.
219   #
220   # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
221   # and migrated your data accordingly.
222   #
223   # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
224   system.stateVersion = "24.05"; # Did you read the comment?
225
226 }
227