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