]> 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       inputs.extra-container.nixosModules.default
24       inputs.microvm.nixosModules.host
25       inputs.fakwin.nixosModules.default
26     ];
27
28   # Bootloader.
29   boot.loader.systemd-boot.enable = true;
30   boot.loader.efi.canTouchEfiVariables = true;
31   boot.plymouth.enable = true;
32   boot.plymouth.theme = "bgrt";
33   boot.initrd.verbose = false;
34   boot.initrd.systemd.enable = true;
35   boot.initrd.kernelModules = [ "amdgpu" ];
36   boot.consoleLogLevel = 0;
37   boot.kernelPackages = pkgs.linuxPackages_latest;
38   boot.kernelParams = [ "quiet" "udev.log_level=0" "amdgpu.runpm=0" ];
39
40   # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.
41
42   # Configure network proxy if necessary
43   # networking.proxy.default = "http://user:password@proxy:port/";
44   # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
45
46
47   programs.dconf.enable = true;
48   programs.steam.enable = true;
49
50
51   # Services
52   services = {
53     displayManager = {
54       sddm.enable = true;
55       sddm.autoLogin.relogin = true;
56       defaultSession = "xfce+i3";
57     };
58     desktopManager = {
59       plasma6.enable = true;
60     };
61     xserver = {
62       enable = true;
63       
64       displayManager = {
65         session = [
66           {
67             manage = "desktop";
68             name = "plasma-i3wm";
69             start = "KDEWM=${pkgs.i3}/bin/i3 /run/current-system/sw/bin/startplasma-x11";
70           }
71         ];
72       };
73
74       desktopManager = {
75         xterm.enable = false;
76         wallpaper.mode = "center";
77         xfce = {
78           enable = true;
79           noDesktop = true;
80           enableXfwm = false;
81         };
82       };
83       windowManager.i3.enable = true;
84       # windowManager.awesome.enable = true;
85       # windowManager.herbstluftwm.enable = true;
86
87       xkb = {
88         layout = "de";
89         variant = "nodeadkeys";
90         options = "caps:ctrl_modifier";
91       };
92       excludePackages = [ pkgs.xterm ];
93       videoDrivers = ["amdgpu"];
94       # libinput.enable = true;
95     };
96   };
97
98   systemd.user.services.plasma-kwin_x11.enable = false;
99   services.fakwin.enable = true;
100
101   services.autorandr = {
102     enable = true;
103     matchEdid = true;
104     hooks = {
105       postswitch = {
106         "set-wallpaper" = "set-wallpaper";
107       };
108     };
109   };
110   
111   # services.auto-cpufreq.enable = true;
112   services.auto-cpufreq.settings = {
113     battery = {
114        governor = "powersave";
115        turbo = "never";
116     };
117     charger = {
118        governor = "performance";
119        turbo = "auto";
120     };
121   };
122
123   # services.tlp = {
124   #   enable = true;
125   #   settings = {
126   #     CPU_SCALING_GOVERNOR_ON_AC = "performance";
127   #     CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
128   #
129   #     CPU_ENERGY_PERF_POLICY_ON_AC = "balance_performance";
130   #     CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
131   #
132   #     PLATFORM_PROFILE_ON_AC = "balanced";
133   #     PLATFORM_PROFILE_ON_BAT = "low-power";
134   #
135   #     CPU_BOOST_ON_AC = "1";
136   #     CPU_BOOST_ON_BAT = "0";
137   #
138   #     AMDGPU_ABM_LEVEL_ON_AC = "0";
139   #     AMDGPU_ABM_LEVEL_ON_BAT = "3";
140   #
141   #     CPU_MIN_PERF_ON_AC = 0;
142   #     CPU_MAX_PERF_ON_AC = 100;
143   #     CPU_MIN_PERF_ON_BAT = 0;
144   #     CPU_MAX_PERF_ON_BAT = 20;
145   #
146   #     # START_CHARGE_THRESH_BAT0 = 40; # 40 and below it starts to charge
147   #     STOP_CHARGE_THRESH_BAT0 = 90; # 85 and above it stops charging
148   #   };
149   # };
150
151   services.udev.extraRules = ''
152     KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{serial}=="*vial:f64c2b3c*", MODE="0660", GROUP="users", TAG+="uaccess", TAG+="udev-acl"
153   '';
154
155   # OpenGL
156   hardware = {
157     graphics = {
158         enable = true;
159         enable32Bit = true;
160         extraPackages = with pkgs; [
161           rocmPackages.clr.icd
162           mesa.opencl
163           amf
164         ];
165     };
166
167     amdgpu.amdvlk = {
168         enable = true;
169         support32Bit.enable = true;
170     };
171   };
172
173   # services.logind = {
174   #   extraConfig = "HandlePowerKey=suspend";
175   #   lidSwitch = "suspend";
176   # }; 
177
178   # Enable Bluetooth
179   hardware.bluetooth.enable = true;
180   hardware.bluetooth.powerOnBoot = false;
181   # services.blueman.enable = true;
182
183   # Enable sound with pipewire.
184   services.pulseaudio.enable = false;
185   security.rtkit.enable = true;
186   services.pipewire = {
187     enable = true;
188     alsa.enable = true;
189     alsa.support32Bit = true;
190     pulse.enable = true;
191     # If you want to use JACK applications, uncomment this
192     #jack.enable = true;
193
194     # use the example session manager (no others are packaged yet so this is enabled by default,
195     # no need to redefine it in your config for now)
196     #media-session.enable = true;
197   };
198   services.jack = {
199     jackd.enable = true;
200   };
201
202   # Enable touchpad support (enabled default in most desktopManager).
203   # services.libinput.touchpad = {
204   #   naturalScrolling = false;
205   # };
206
207   # Workaround for GNOME autologin: https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229
208   # systemd.services."getty@tty1".enable = false;
209   # systemd.services."autovt@tty1".enable = false;
210
211   # Allow unfree packages
212
213
214   environment.variables = {
215     RUSTICL_ENABLE = "radeonsi";
216   };
217
218   # Open ports in the firewall.
219   # Or disable the firewall altogether.
220   # networking.firewall.enable = false;
221
222
223 }