]> gitweb.ps.run Git - flake_server/blob - configuration.nix
Initial configuration
[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, ... }:
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
23   networking.hostName = "nixos"; # Define your hostname.
24   # Pick only one of the below networking options.
25   # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.
26   # networking.networkmanager.enable = true;  # Easiest to use and most distros use this by default.
27
28   networking.firewall = {
29     enable = true;
30     allowedTCPPorts = [ 80 443 ];
31   };
32
33   # Set your time zone.
34   time.timeZone = "Europe/Amsterdam";
35
36   # Configure network proxy if necessary
37   # networking.proxy.default = "http://user:password@proxy:port/";
38   # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
39
40   # Select internationalisation properties.
41   i18n.defaultLocale = "de_DE.UTF-8";
42   console = {
43     font = "Lat2-Terminus16";
44     keyMap = "de-latin1-nodeadkeys";
45     # useXkbConfig = true; # use xkb.options in tty.
46   };
47
48   # Enable the X11 windowing system.
49   # services.xserver.enable = true;
50
51
52   
53
54   # Configure keymap in X11
55   # services.xserver.xkb.layout = "us";
56   # services.xserver.xkb.options = "eurosign:e,caps:escape";
57
58   # Enable CUPS to print documents.
59   # services.printing.enable = true;
60
61   # Enable sound.
62   # hardware.pulseaudio.enable = true;
63   # OR
64   # services.pipewire = {
65   #   enable = true;
66   #   pulse.enable = true;
67   # };
68
69   # Enable touchpad support (enabled default in most desktopManager).
70   # services.libinput.enable = true;
71
72   # Define a user account. Don't forget to set a password with ‘passwd’.
73   users.users.ps = {
74     isNormalUser = true;
75     extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
76     packages = with pkgs; [
77     ];
78   };
79
80   security = {
81     polkit.enable = true;
82     sudo.wheelNeedsPassword = false;
83   };
84
85   # nixpkgs.config.allowUnfree = true;
86
87   # List packages installed in system profile. To search, run:
88   # $ nix search wget
89   environment.systemPackages = with pkgs; [
90     vim neovim wget file git
91     zig fzf bat
92     bintools
93     htop
94     tmux
95
96     forgejo
97     mbedtls
98     pkg-config
99   ];
100
101   # git
102   users.users.git = {
103     isSystemUser = true;
104     group = "git";
105     home = "/srv/git";
106     createHome = true;
107     shell = "${pkgs.git}/bin/git-shell";
108     openssh.authorizedKeys.keys = [
109       "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICQOPefMnq0qvFjYxlrdlSmUgyCbvV85gkfRykVlTnrn ps@nixos"
110     ];
111   };
112   users.groups.git = {};
113
114   programs.git = {
115     enable = true;
116     config = {
117       init.defaultBranch = "main";
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."chirp.psch.dev".extraConfig = ''
149       reverse_proxy http://127.0.0.1:8080
150       tls {
151         protocols tls1.3 tls1.3
152       }
153     '';
154     virtualHosts."git.psch.dev".extraConfig = ''
155       reverse_proxy http://127.0.0.1:3000
156     '';
157   };
158
159   # Open ports in the firewall.
160   # networking.firewall.allowedTCPPorts = [ ... ];
161   # networking.firewall.allowedUDPPorts = [ ... ];
162   # Or disable the firewall altogether.
163   # networking.firewall.enable = false;
164
165   # Copy the NixOS configuration file and link it from the resulting system
166   # (/run/current-system/configuration.nix). This is useful in case you
167   # accidentally delete configuration.nix.
168   # system.copySystemConfiguration = true;
169
170   # This option defines the first version of NixOS you have installed on this particular machine,
171   # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
172   #
173   # Most users should NEVER change this value after the initial install, for any reason,
174   # even if you've upgraded your system to a new NixOS release.
175   #
176   # This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
177   # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
178   # to actually do that.
179   #
180   # This value being lower than the current NixOS release does NOT mean your system is
181   # out of date, out of support, or vulnerable.
182   #
183   # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
184   # and migrated your data accordingly.
185   #
186   # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
187   system.stateVersion = "24.05"; # Did you read the comment?
188
189 }
190