]> gitweb.ps.run Git - flake_thinkpad/blob - configuration.nix
set download buffer size to 500mb
[flake_thinkpad] / 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
3 # and in the NixOS manual (accessible by running ‘nixos-help’).
4
5 { config, pkgs, inputs, lib, ... } @ args:
6
7
8 let
9   # tuigreet = "${pkgs.greetd.tuigreet}/bin/tuigreet";
10   # session = "${pkgs.sway}/bin/sway";
11   # username = "ps";
12   wallpaper = pkgs.fetchurl {
13     url = "https://w.wallhaven.cc/full/ex/wallhaven-exrqrr.jpg";
14     sha256 = "sha256-RYN8KwJPDMfxrcosbpmjON0Y+I58IhB1Ke36LdohsxA=";
15   };
16 in
17
18 {
19   imports =
20     [ # Include the results of the hardware scan.
21       ./hardware-configuration.nix
22       inputs.home-manager.nixosModules.default
23     ];
24
25   # Bootloader.
26   boot.tmp.cleanOnBoot = true;
27   boot.loader.systemd-boot.enable = true;
28   boot.loader.efi.canTouchEfiVariables = true;
29   boot.plymouth.enable = true;
30   boot.plymouth.theme = "bgrt";
31   boot.initrd.verbose = false;
32   boot.initrd.systemd.enable = true;
33   boot.initrd.kernelModules = [ "amdgpu" ];
34   boot.consoleLogLevel = 0;
35   boot.kernelPackages = pkgs.linuxPackages_latest;
36   boot.kernelParams = [ "quiet" "udev.log_level=0" "amdgpu.runpm=0" ]; 
37
38   networking.hostName = "nixos"; # Define your hostname.
39   # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.
40
41   nix.settings.experimental-features = [ "nix-command" "flakes" ];
42   nix.settings.download-buffer-size = 500000000;
43   nix.package = pkgs.nixVersions.nix_2_28;
44
45   # Configure network proxy if necessary
46   # networking.proxy.default = "http://user:password@proxy:port/";
47   # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
48
49   # Enable networking
50   networking.networkmanager.enable = true;
51
52   # Set your time zone.
53   time.timeZone = "Europe/Berlin";
54
55   # Select internationalisation properties.
56   i18n.defaultLocale = "de_DE.UTF-8";
57
58   i18n.extraLocaleSettings = {
59     LC_ADDRESS = "de_DE.UTF-8";
60     LC_IDENTIFICATION = "de_DE.UTF-8";
61     LC_MEASUREMENT = "de_DE.UTF-8";
62     LC_MONETARY = "de_DE.UTF-8";
63     LC_NAME = "de_DE.UTF-8";
64     LC_NUMERIC = "de_DE.UTF-8";
65     LC_PAPER = "de_DE.UTF-8";
66     LC_TELEPHONE = "de_DE.UTF-8";
67     LC_TIME = "de_DE.UTF-8";
68   };
69
70   programs.dconf.enable = true;
71   programs.steam.enable = true;
72
73   # Services
74   services = {
75
76     xserver = {
77       enable = true;
78       
79       # Enable the GNOME Desktop Environment.
80       # displayManager.gdm.enable = true;
81       # desktopManager.gnome.enable = true;
82       
83       # displayManager.sddm.enable = true;
84       # desktopManager.budgie.enable = true;
85
86       # desktopManager.deepin.enable = true;
87       # displayManager.lightdm.enable = true;
88
89       # displayManager.gdm.enable = true;
90       # desktopManager.plasma5.enable = true;
91
92       displayManager = {
93         defaultSession = "xfce+i3";
94         lightdm = {
95           enable = true;
96           greeters.gtk = {
97             theme = {
98               name = "Qogir-Dark";
99               package = pkgs.qogir-theme;
100             };
101             iconTheme = {
102               name = "Qogir-dark";
103               package = pkgs.qogir-icon-theme;
104             };
105             cursorTheme = {
106               name = "volantes_light_cursors";
107               package = pkgs.volantes-cursors;
108             };
109           };
110           background = "${wallpaper}";
111         };
112       };
113
114       desktopManager = {
115         xterm.enable = false;
116         xfce = {
117           enable = true;
118           # noDesktop = true;
119           enableXfwm = false;
120         };
121       };
122       windowManager.i3.enable = true;
123       windowManager.awesome.enable = true;
124
125       xkb = {
126         layout = "de";
127         variant = "nodeadkeys";
128         options = "caps:ctrl_modifier";
129       };
130       excludePackages = [ pkgs.xterm ];
131       videoDrivers = ["amdgpu"];
132       # libinput.enable = true;
133     };
134   };
135
136   services.autorandr = {
137     enable = true;
138     matchEdid = true;
139     hooks = {
140       postswitch = {
141         "set-wallpaper" = "set-wallpaper";
142       };
143     };
144   };
145   
146   services.syncthing = {
147     enable = true;
148     user = "ps";
149     dataDir = "/home/ps/sync";
150     configDir = "/home/ps/.config/syncthing";
151   };
152
153   services.udev.extraRules = ''
154     KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{serial}=="*vial:f64c2b3c*", MODE="0660", GROUP="users", TAG+="uaccess", TAG+="udev-acl"
155   '';
156
157   # OpenGL
158   # hardware.graphics.enable = true;
159   hardware = {
160     graphics = {
161         enable = true;
162         enable32Bit = true;
163     };
164
165     amdgpu.amdvlk = {
166         enable = true;
167         support32Bit.enable = true;
168     };
169 };
170
171   # services.logind = {
172   #   extraConfig = "HandlePowerKey=suspend";
173   #   lidSwitch = "suspend";
174   # }; 
175
176   # Configure console keymap
177   console.keyMap = "de-latin1-nodeadkeys";
178
179   # Enable CUPS to print documents.
180   services.printing.enable = true;
181   services.printing.drivers = [ pkgs.gutenprint ];
182
183   # Enable Bluetooth
184   hardware.bluetooth.enable = true;
185   hardware.bluetooth.powerOnBoot = false;
186   services.blueman.enable = true;
187
188   # Enable sound with pipewire.
189   hardware.pulseaudio.enable = false;
190   security.rtkit.enable = true;
191   services.pipewire = {
192     enable = true;
193     alsa.enable = true;
194     alsa.support32Bit = true;
195     pulse.enable = true;
196     # If you want to use JACK applications, uncomment this
197     #jack.enable = true;
198
199     # use the example session manager (no others are packaged yet so this is enabled by default,
200     # no need to redefine it in your config for now)
201     #media-session.enable = true;
202   };
203   services.jack = {
204     jackd.enable = true;
205   };
206
207   # Enable touchpad support (enabled default in most desktopManager).
208   # services.libinput.touchpad = {
209   #   naturalScrolling = false;
210   # };
211
212   # Define a user account. Don't forget to set a password with ‘passwd’.
213   users.groups.ssh = {};
214   users.users = {
215     ps = {
216       isNormalUser = true;
217       description = "Patrick";
218       shell = pkgs.bash;
219       extraGroups = [ "networkmanager" "wheel" "dialout" "jackaudio" ];
220     };
221     sshd = {
222       isSystemUser = true;
223       packages = [
224         pkgs.python3
225       ];
226       group = "ssh";
227     };
228     chirp = {
229       isSystemUser = true;
230       packages = [
231         pkgs.python3
232       ];
233       group = "ssh";
234       shell = pkgs.bash;
235       initialPassword = "chirp";
236     };
237   };
238   
239   security.polkit.enable = true;
240   security.sudo.wheelNeedsPassword = false;
241
242   home-manager = {
243     backupFileExtension = "backup";
244     extraSpecialArgs = {
245       inherit inputs;
246       inherit wallpaper;
247     };
248     # users = {
249     #   "ps" = import ./home.nix;
250     # };
251     users.ps.imports = [ ./home.nix ];
252   };
253
254   # Enable automatic login for the user.
255   # services.displayManager.autoLogin.enable = true;
256   # services.displayManager.autoLogin.user = "ps";
257   # services.getty.autologinUser = "ps";
258
259   # Workaround for GNOME autologin: https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229
260   # systemd.services."getty@tty1".enable = false;
261   # systemd.services."autovt@tty1".enable = false;
262
263   # Allow unfree packages
264   nixpkgs.config.allowUnfree = true;
265
266   # List packages installed in system profile. To search, run:
267   # $ nix search wget
268   environment.systemPackages = with pkgs; [
269     args.inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.zig
270     args.inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.zls
271     args.inputs.psch-flakes.packages.${pkgs.system}.resetmsmice
272     vim wget file git kitty i3 gdb
273     mosh
274     cmake
275
276     scrcpy
277
278     xsel
279
280     pavucontrol
281     syncthingtray
282     # xfce plugins
283     xfce.xfce4-pulseaudio-plugin
284       # xfce.xfce4-verve-plugin
285     xfce.xfce4-notes-plugin
286     # xfce.xfce4-timer-plugin
287     # xfce.xfce4-windowck-plugin
288     xfce.thunar-archive-plugin
289     # xfce.xfce4-i3-workspaces-plugin
290     # xfce.xfce4-xkb-plugin
291     xfce.xfce4-whiskermenu-plugin
292
293   ];
294
295   programs.xfconf.enable = true;
296   programs.nix-ld.enable = true;
297
298   services.fwupd.enable = true;
299
300   # Some programs need SUID wrappers, can be configured further or are
301   # started in user sessions.
302   # programs.mtr.enable = true;
303   # programs.gnupg.agent = {
304   #   enable = true;
305   #   enableSSHSupport = true;
306   # };
307
308   # List services that you want to enable:
309
310   # Enable the OpenSSH daemon.
311   services.openssh = {
312     enable = false;
313     ports = [ 22 ];
314     settings = {
315       PasswordAuthentication = false;
316       PermitRootLogin = "no";
317     };
318     authorizedKeysCommand =
319       let keys = pkgs.writers.writePython3Bin "keys" {} ''
320           import sys
321
322           args = sys.argv
323
324           print(args)
325         '';
326       in
327         "${keys}/bin/keys";
328     authorizedKeysCommandUser = "ps";
329   };
330
331   # Open ports in the firewall.
332   networking.firewall.allowedTCPPorts = [ 22 1234 5900 6011 6021 6022 8080 53317 ];
333   networking.firewall.allowedUDPPorts = [ 5901 53317 ];
334   # Or disable the firewall altogether.
335   # networking.firewall.enable = false;
336
337   # This value determines the NixOS release from which the default
338   # settings for stateful data, like file locations and database versions
339   # on your system were taken. It‘s perfectly fine and recommended to leave
340   # this value at the release version of the first install of this system.
341   # Before changing this value read the documentation for this option
342   # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
343   system.stateVersion = "24.05"; # Did you read the comment?
344
345 }