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