all repos — dotfiles @ 5674e47702a2c2b46d9df9ed4e363a61522b4cd3

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    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      libinput = {
162        enable = true;
163        mouse = {
164          scrollButton = 8;
165          scrollMethod = "button";
166        };
167      };
168    };
169    ddccontrol.enable = true;
170    tailscale.enable = true;
171    # 1. chmod for rootless backligh1t
172    # 2. lotus58 bootloader mode for rootless qmk flashing
173    udev = {
174      extraRules = ''
175        ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="amdgpu_bl1", MODE="0666", RUN+="${pkgs.coreutils}/bin/chmod a+w /sys/class/backlight/%k/brightness"
176        ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0036", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1"
177        KERNEL=="i2c-[0-9]*", GROUP="i2c", MODE="0660"
178      '';
179      extraHwdb = ''
180        evdev:input:b0003v0B05p19B6*
181          KEYBOARD_KEY_ff31007c=f20 # x11 mic-mute
182      '';
183      path = [
184        pkgs.coreutils
185      ];
186    };
187    logind.extraConfig = ''
188      HandlePowerKey=hibernate
189    '';
190
191    keyd = {
192      enable = true;
193      keyboards.default = {
194        ids = [ "*" ];
195        extraConfig = ''
196          [main]
197          capslock = overload(capslock, esc)
198
199          [capslock:C]
200          h = left
201          j = down
202          k = up
203          l = right
204
205          # Activates when both capslock and shift is pressed
206          [capslock+shift]
207          h = C-left
208          j = C-down
209          k = C-up
210          l = C-right
211        '';
212      };
213    };
214    pcscd.enable = true;
215  };
216
217  virtualisation.docker = {
218    enable = true;
219    logDriver = "json-file";
220    extraOptions = ''
221      --insecure-registry "http://sini:5000"
222    '';
223  };
224
225  security = {
226    doas.enable = true;
227    sudo.enable = true;
228    doas.extraConfig = ''
229      permit nopass :wheel
230    '';
231    doas.extraRules = [{
232      users = [ "icy" ];
233    }];
234  };
235
236  powerManagement = {
237    enable = true;
238    powertop.enable = true;
239  };
240
241  users.users.icy = {
242    isNormalUser = true;
243    extraGroups = [ "wheel" "docker" "audio" "video" "dialout" "i2c" ];
244  };
245
246  programs = {
247    steam.enable = true;
248    gamemode.enable = true;
249  };
250
251  nix = {
252    package = pkgs.nixVersions.stable;
253    extraOptions = ''
254      experimental-features = nix-command flakes ca-derivations
255      warn-dirty = false
256      keep-outputs = false
257    '';
258    settings = {
259      trusted-users = [
260        "root"
261        "icy"
262      ];
263    };
264  };
265
266  # https://github.com/NixOS/nixpkgs/issues/180175
267  systemd.services.systemd-udevd.restartIfChanged = false;
268  systemd.services.NetworkManager-wait-online.enable = lib.mkForce
269    false;
270
271
272  # This value determines the NixOS release from which the default
273  # settings for stateful data, like file locations and database versions
274  # on your system were taken. It‘s perfectly fine and recommended to leave
275  # this value at the release version of the first install of this system.
276  # Before changing this value read the documentation for this option
277  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
278  system.stateVersion = "21.11"; # Did you read the comment?
279
280}
281