all repos — dotfiles @ dcd495a6a7f358f1f0d1f4dcd961e3cf6d9b7b63

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;
 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  ];
 59
 60  environment = {
 61    etc = {
 62      "supergfxd.conf" = {
 63        mode = "0644";
 64        source = (pkgs.formats.json { }).generate "supergfxd.conf" {
 65          mode = "hybrid";
 66          vfio_enable = false;
 67          vfio_save = false;
 68          always_reboot = false;
 69          no_logind = false;
 70          logout_timeout_s = 180;
 71        };
 72      };
 73    };
 74    sessionVariables = rec {
 75      NIXOS_OZONE_WL = "1";
 76    };
 77    variables = {
 78      MOZ_USE_XINPUT2 = "1";
 79      GDK_SCALE = "2";
 80      GDK_DPI_SCALE = "1";
 81    };
 82    systemPackages = with pkgs; [
 83      man-pages
 84      git
 85      man-pages-posix
 86      (lib.hiPrio pkgs.bashInteractive_5)
 87    ];
 88    gnome.excludePackages = (with pkgs; [
 89      gnome-photos
 90      gnome-tour
 91    ]) ++ (with pkgs.gnome; [
 92      cheese
 93      epiphany
 94      geary
 95      totem
 96    ]);
 97  };
 98
 99  documentation = {
100    dev.enable = true;
101    man.generateCaches = true;
102  };
103
104  users.motd = with config; ''
105    Host       ${networking.hostName}
106    OS         NixOS ${system.nixos.release} (${system.nixos.codeName})
107    Version    ${system.nixos.version}
108    Kernel     ${boot.kernelPackages.kernel.version}
109  '';
110
111  console = {
112    font = "${pkgs.terminus_font}/share/consolefonts/ter-u28n.psf.gz";
113    keyMap = "us";
114  };
115
116  sound.enable = true;
117  hardware = {
118    opengl.driSupport = true;
119    bluetooth = {
120      enable = true;
121      powerOnBoot = true;
122      disabledPlugins = [ "sap" ];
123    };
124    nvidia.prime = {
125      offload.enable = true;
126      amdgpuBusId = "PCI:8:0:0";
127      nvidiaBusId = "PCI:1:0:0";
128    };
129    logitech.wireless = {
130      enable = true;
131      enableGraphical = true;
132    };
133  };
134
135  services = {
136    asusd = {
137      enable = true;
138      enableUserService = true;
139    };
140    supergfxd = {
141      enable = true;
142    };
143    pipewire = {
144      enable = true;
145      wireplumber.enable = true;
146      alsa.enable = true;
147      alsa.support32Bit = true;
148      pulse.enable = true;
149    };
150    xserver = {
151      enable = true;
152      xkb.layout = "us";
153      desktopManager.gnome.enable = true;
154      displayManager.gdm.enable = true;
155      dpi = 192;
156      videoDrivers = [ "nvidia" ];
157      screenSection = ''
158        Option         "metamodes" "nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}"
159        Option         "AllowIndirectGLXProtocol" "off"
160        Option         "TripleBuffer" "on"
161      '';
162      libinput = {
163        enable = true;
164        mouse = {
165          scrollButton = 8;
166          scrollMethod = "button";
167        };
168      };
169    };
170    ddccontrol.enable = true;
171    tailscale.enable = true;
172    auto-cpufreq.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, esc)
200
201          [capslock:C]
202          h = left
203          j = down
204          k = up
205          l = right
206
207          # Activates when both capslock and shift is pressed
208          [capslock+shift]
209          h = C-left
210          j = C-down
211          k = C-up
212          l = C-right
213        '';
214      };
215    };
216    pcscd.enable = true;
217  };
218
219  virtualisation.docker = {
220    enable = true;
221    logDriver = "json-file";
222  };
223
224  security = {
225    doas.enable = true;
226    sudo.enable = true;
227    doas.extraConfig = ''
228      permit nopass :wheel
229    '';
230    doas.extraRules = [{
231      users = [ "icy" ];
232    }];
233  };
234
235  powerManagement = {
236    enable = true;
237    powertop.enable = true;
238  };
239
240  users.users.icy = {
241    isNormalUser = true;
242    extraGroups = [ "wheel" "docker" "audio" "video" "dialout" "i2c" ];
243  };
244
245  programs = {
246    steam.enable = true;
247    gamemode.enable = true;
248  };
249
250  nix = {
251    package = pkgs.nixVersions.stable;
252    extraOptions = ''
253      experimental-features = nix-command flakes ca-derivations
254      warn-dirty = false
255      keep-outputs = false
256    '';
257    settings = {
258      trusted-users = [
259        "root"
260        "icy"
261      ];
262    };
263  };
264
265  # https://github.com/NixOS/nixpkgs/issues/180175
266  systemd.services.systemd-udevd.restartIfChanged = false;
267  systemd.services.NetworkManager-wait-online.enable = lib.mkForce
268    false;
269
270
271  # This value determines the NixOS release from which the default
272  # settings for stateful data, like file locations and database versions
273  # on your system were taken. It‘s perfectly fine and recommended to leave
274  # this value at the release version of the first install of this system.
275  # Before changing this value read the documentation for this option
276  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
277  system.stateVersion = "21.11"; # Did you read the comment?
278
279}
280