all repos — dotfiles @ 76e9ebb6b063115b359d538a0c4d53bfe387f00a

my *nix dotfiles

hosts/wyndle/configuration.nix (view raw)

  1{ self, config, pkgs, lib, ... }:
  2
  3{
  4  imports =
  5    [
  6      ./hardware-configuration.nix
  7    ];
  8
  9  boot = {
 10    loader.systemd-boot.enable = true;
 11    loader.systemd-boot.consoleMode = "max";
 12    loader.efi.canTouchEfiVariables = true;
 13    kernel.sysctl."net.ipv4.ip_forward" = 1;
 14    resumeDevice = "/dev/nvme0n1p2";
 15    kernelPackages = pkgs.linuxPackages_latest;
 16    kernelModules = [ "i2c-dev" ];
 17  };
 18
 19  networking = {
 20    nameservers = [ "8.8.8.8" "8.8.4.4" ];
 21    networkmanager.enable = true;
 22    hostName = "wyndle";
 23    useDHCP = false;
 24    interfaces.wlp6s0.useDHCP = true;
 25    firewall.checkReversePath = "loose";
 26  };
 27
 28  i18n.defaultLocale = "en_US.UTF-8";
 29  i18n.inputMethod = {
 30    enabled = "ibus";
 31  };
 32  time.timeZone = "Europe/Helsinki";
 33
 34  nixpkgs.config = {
 35    allowUnfree = true;
 36    allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
 37      "steam"
 38      "steam-original"
 39      "steam-runtime"
 40    ];
 41    st = {
 42      conf = builtins.readFile ../../programs/st/config.h;
 43      extraLibs = with pkgs; [ harfbuzz ];
 44      patches = [
 45        ../../patches/st/xres.diff
 46        ../../patches/st/bright.diff
 47        ../../patches/st/ligatures.diff
 48      ];
 49    };
 50    chromium = {
 51      commandLineArgs = "--ozone-platform=wayland";
 52    };
 53    firefox.enablePlasmaBrowserIntegration = true;
 54  };
 55
 56  nixpkgs.overlays = with self.overlays; [
 57    prompt
 58    customPkgs
 59  ];
 60
 61  environment = {
 62    etc = {
 63      "supergfxd.conf" = {
 64        mode = "0644";
 65        source = (pkgs.formats.json { }).generate "supergfxd.conf" {
 66          mode = "hybrid";
 67          vfio_enable = false;
 68          vfio_save = false;
 69          always_reboot = false;
 70          no_logind = false;
 71          logout_timeout_s = 180;
 72        };
 73      };
 74    };
 75    sessionVariables = rec {
 76      NIXOS_OZONE_WL = "1";
 77    };
 78    variables = {
 79      MOZ_USE_XINPUT2 = "1";
 80      GDK_SCALE = "2";
 81      GDK_DPI_SCALE = "1";
 82    };
 83    systemPackages = with pkgs; [
 84      man-pages
 85      git
 86      man-pages-posix
 87      (lib.hiPrio pkgs.bashInteractive_5)
 88    ];
 89    gnome.excludePackages = (with pkgs; [
 90      gnome-photos
 91      gnome-tour
 92    ]) ++ (with pkgs.gnome; [
 93      cheese
 94      epiphany
 95      geary
 96      totem
 97    ]);
 98  };
 99
100  documentation = {
101    dev.enable = true;
102    man.generateCaches = true;
103  };
104
105  users.motd = with config; ''
106    Host       ${networking.hostName}
107    OS         NixOS ${system.nixos.release} (${system.nixos.codeName})
108    Version    ${system.nixos.version}
109    Kernel     ${boot.kernelPackages.kernel.version}
110  '';
111
112  console = {
113    font = "${pkgs.terminus_font}/share/consolefonts/ter-u28n.psf.gz";
114    keyMap = "us";
115  };
116
117  hardware = {
118    bluetooth = {
119      enable = true;
120      powerOnBoot = true;
121      disabledPlugins = [ "sap" ];
122    };
123    nvidia.prime = {
124      offload.enable = true;
125      amdgpuBusId = "PCI:8:0:0";
126      nvidiaBusId = "PCI:1:0:0";
127    };
128    logitech.wireless = {
129      enable = true;
130      enableGraphical = true;
131    };
132  };
133
134  services = {
135    asusd = {
136      enable = true;
137      enableUserService = true;
138    };
139    supergfxd = {
140      enable = true;
141    };
142    pipewire = {
143      enable = true;
144      wireplumber.enable = true;
145      alsa.enable = true;
146      alsa.support32Bit = true;
147      pulse.enable = true;
148    };
149    xserver = {
150      enable = true;
151      xkb.layout = "us";
152      desktopManager.gnome.enable = true;
153      displayManager.gdm.enable = true;
154      dpi = 192;
155      videoDrivers = [ "nvidia" ];
156      screenSection = ''
157        Option         "metamodes" "nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}"
158        Option         "AllowIndirectGLXProtocol" "off"
159        Option         "TripleBuffer" "on"
160      '';
161    };
162
163    libinput = {
164      enable = true;
165      mouse = {
166        scrollButton = 8;
167        scrollMethod = "button";
168      };
169    };
170
171    ddccontrol.enable = true;
172    tailscale.enable = true;
173    # 1. chmod for rootless backligh1t
174    # 2. lotus58 bootloader mode for rootless qmk flashing
175    udev = {
176      extraRules = ''
177        ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="amdgpu_bl1", MODE="0666", RUN+="${pkgs.coreutils}/bin/chmod a+w /sys/class/backlight/%k/brightness"
178        ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0036", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1"
179        KERNEL=="i2c-[0-9]*", GROUP="i2c", MODE="0660"
180      '';
181      extraHwdb = ''
182        evdev:input:b0003v0B05p19B6*
183          KEYBOARD_KEY_ff31007c=f20 # x11 mic-mute
184      '';
185      path = [
186        pkgs.coreutils
187      ];
188    };
189    logind.extraConfig = ''
190      HandlePowerKey=hibernate
191    '';
192
193    keyd = {
194      enable = true;
195      keyboards.default = {
196        ids = [ "*" ];
197        extraConfig = ''
198          [main]
199          capslock = overload(capslock, rightalt)
200          leftmeta = layer(meta_mac)
201          rightmeta = layer(meta_mac)
202          leftalt = layer(option_mac)
203          rightalt = layer(option_mac)
204
205          [capslock]
206          h = left
207          j = down
208          k = up
209          l = right
210
211          # Activates when both capslock and shift is pressed
212          [capslock+shift]
213          h = C-left
214          j = C-down
215          k = C-up
216          l = C-right
217
218          # macOS style bindings
219          [meta_mac:M]
220          l = C-l
221          a = C-a
222          t = C-t
223          w = C-w
224          f = C-f
225          c = C-c
226          v = C-v
227          backspace = C-backspace
228
229          [option_mac:A]
230          backspace = C-backspace
231        '';
232      };
233    };
234    pcscd.enable = true;
235  };
236
237  virtualisation.docker = {
238    enable = true;
239    logDriver = "json-file";
240    extraOptions = ''
241      --insecure-registry "http://sini:5000"
242    '';
243  };
244
245  security = {
246    doas.enable = true;
247    sudo.enable = true;
248    doas.extraConfig = ''
249      permit nopass :wheel
250    '';
251    doas.extraRules = [{
252      users = [ "icy" ];
253    }];
254  };
255
256  powerManagement = {
257    enable = true;
258    powertop.enable = true;
259  };
260
261  users.users.icy = {
262    isNormalUser = true;
263    extraGroups = [ "wheel" "docker" "audio" "video" "dialout" "i2c" ];
264  };
265
266  programs = {
267    steam.enable = true;
268    gamemode.enable = true;
269  };
270
271  nix = {
272    package = pkgs.nixVersions.stable;
273    extraOptions = ''
274      experimental-features = nix-command flakes ca-derivations
275      warn-dirty = false
276      keep-outputs = false
277    '';
278    settings = {
279      trusted-users = [
280        "root"
281        "icy"
282      ];
283    };
284  };
285
286  # https://github.com/NixOS/nixpkgs/issues/180175
287  systemd.services.systemd-udevd.restartIfChanged = false;
288  systemd.services.NetworkManager-wait-online.enable = lib.mkForce
289    false;
290
291
292  # This value determines the NixOS release from which the default
293  # settings for stateful data, like file locations and database versions
294  # on your system were taken. It‘s perfectly fine and recommended to leave
295  # this value at the release version of the first install of this system.
296  # Before changing this value read the documentation for this option
297  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
298  system.stateVersion = "21.11"; # Did you read the comment?
299
300}
301