all repos — dotfiles @ 10f6b79ac4722972488cb9c809da579e8d258a5f

my *nix dotfiles

nix/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.efi.canTouchEfiVariables = true;
 12    kernel.sysctl."net.ipv4.ip_forward" = 1;
 13    resumeDevice = "/dev/nvme0n1p2";
 14    kernelPackages = pkgs.linuxPackages;
 15  };
 16
 17  networking = {
 18    nameservers = [ "8.8.8.8" "8.8.4.4" ];
 19    networkmanager.enable = true;
 20    # wireless = {
 21    #   enable = true;
 22    #   interfaces = [ "wlp6s0" ];
 23    #   environmentFile = "/home/icy/secrets/wireless.env";
 24    #   networks = {
 25    #     Sanic.psk = "@PSK_SANI@";
 26    #     Gopalan5G.psk = "@PSK_GOPA@";
 27    #     denim.psk = "@PSK_DENI@";
 28    #   };
 29    #   extraConfig = ''
 30    #     ctrl_interface=/run/wpa_supplicant
 31    #     ctrl_interface_group=wheel
 32    #   '';
 33    # };
 34    # dhcpcd.enable = true;
 35    hostName = "wyndle";
 36    useDHCP = false;
 37    interfaces.wlp6s0.useDHCP = true;
 38    firewall.checkReversePath = "loose";
 39  };
 40
 41  i18n.defaultLocale = "en_US.UTF-8";
 42  time.timeZone = "Europe/Helsinki";
 43
 44  nixpkgs.config = {
 45    allowUnfree = true;
 46    allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
 47      "steam"
 48      "steam-original"
 49      "steam-runtime"
 50    ];
 51    st = {
 52      conf = builtins.readFile ../../programs/st/config.h;
 53      extraLibs = with pkgs; [ harfbuzz ];
 54      patches = [
 55        ../../patches/st/xres.diff
 56        ../../patches/st/bright.diff
 57        ../../patches/st/ligatures.diff
 58      ];
 59    };
 60    chromium = {
 61      commandLineArgs = "--ozone-platform=wayland";
 62    };
 63    firefox.enablePlasmaBrowserIntegration = true;
 64  };
 65
 66  nixpkgs.overlays = with self.overlays; [
 67    prompt
 68  ];
 69
 70  environment = {
 71    etc = {
 72      "supergfxd.conf" = {
 73        mode = "0644";
 74        source = (pkgs.formats.json { }).generate "supergfxd.conf" {
 75          mode = "hybrid";
 76          vfio_enable = false;
 77          vfio_save = false;
 78          always_reboot = false;
 79          no_logind = false;
 80          logout_timeout_s = 180;
 81        };
 82      };
 83    };
 84    sessionVariables = rec {
 85      NIXOS_OZONE_WL = "1";
 86    };
 87    variables = {
 88      MOZ_USE_XINPUT2 = "1";
 89      GDK_SCALE = "2";
 90      GDK_DPI_SCALE = "0.5";
 91    };
 92    systemPackages = with pkgs; [
 93      man-pages
 94      git
 95      man-pages-posix
 96      (lib.hiPrio pkgs.bashInteractive_5)
 97    ];
 98    etc = {
 99      "wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = ''
100        bluez_monitor.properties = {
101          ["bluez5.enable-sbc-xq"] = true,
102          ["bluez5.enable-msbc"] = true,
103          ["bluez5.enable-hw-volume"] = true,
104          ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
105        }
106      '';
107    };
108  };
109
110  documentation = {
111    dev.enable = true;
112    man.generateCaches = true;
113  };
114
115  users.motd = with config; ''
116    Host       ${networking.hostName}
117    OS         NixOS ${system.nixos.release} (${system.nixos.codeName})
118    Version    ${system.nixos.version}
119    Kernel     ${boot.kernelPackages.kernel.version}
120  '';
121
122  console = {
123    font = "${pkgs.terminus_font}/share/consolefonts/ter-u28n.psf.gz";
124    keyMap = "us";
125  };
126
127  sound.enable = true;
128  hardware = {
129    opengl.driSupport = true;
130    bluetooth = {
131      enable = true;
132      powerOnBoot = true;
133      disabledPlugins = [ "sap" ];
134    };
135    nvidia.prime = {
136      offload.enable = true;
137      amdgpuBusId = "PCI:8:0:0";
138      nvidiaBusId = "PCI:1:0:0";
139    };
140    logitech.wireless = {
141      enable = true;
142      enableGraphical = true;
143    };
144  };
145
146  services = {
147    asusd = {
148      enable = true;
149      enableUserService = true;
150    };
151    supergfxd = {
152      enable = true;
153    };
154    pipewire = {
155      enable = true;
156      alsa.enable = true;
157      alsa.support32Bit = true;
158      pulse.enable = true;
159    };
160    xserver = {
161      enable = true;
162      layout = "us";
163      desktopManager.plasma5.enable = true;
164      displayManager.sddm = {
165        enable = true;
166        enableHidpi = true;
167      };
168      dpi = 192;
169      videoDrivers = [ "nvidia" ];
170      screenSection = ''
171        Option         "metamodes" "nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}"
172        Option         "AllowIndirectGLXProtocol" "off"
173        Option         "TripleBuffer" "on"
174      '';
175      libinput = {
176        enable = true;
177        mouse = {
178          scrollButton = 8;
179          scrollMethod = "button";
180        };
181      };
182    };
183    tailscale.enable = true;
184    auto-cpufreq.enable = true;
185    # 1. chmod for rootless backligh1t
186    # 2. lotus58 bootloader mode for rootless qmk flashing
187    udev = {
188      extraRules = ''
189        ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="amdgpu_bl1", MODE="0666", RUN+="${pkgs.coreutils}/bin/chmod a+w /sys/class/backlight/%k/brightness"
190        ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0036", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1"
191      '';
192      extraHwdb = ''
193        evdev:input:b0003v0B05p19B6*
194          KEYBOARD_KEY_ff31007c=f20 # x11 mic-mute
195      '';
196      path = [
197        pkgs.coreutils
198      ];
199    };
200    logind.extraConfig = ''
201      HandlePowerKey=hibernate
202    '';
203  };
204
205  virtualisation.docker = {
206    enable = true;
207    logDriver = "json-file";
208  };
209
210  security = {
211    doas.enable = true;
212    sudo.enable = true;
213    doas.extraConfig = ''
214      permit nopass :wheel
215    '';
216    doas.extraRules = [{
217      users = [ "icy" ];
218    }];
219    pki.certificateFiles = [ "/home/icy/.local/share/caddy/pki/authorities/local/root.crt" ];
220  };
221
222  powerManagement = {
223    enable = true;
224    powertop.enable = true;
225  };
226
227  users.users.icy = {
228    isNormalUser = true;
229    extraGroups = [ "wheel" "docker" "audio" "video" "dialout" ];
230  };
231
232  programs = {
233    steam.enable = true;
234    gamemode.enable = true;
235  };
236
237  nix = {
238    package = pkgs.nixVersions.stable;
239    extraOptions = ''
240      experimental-features = nix-command flakes ca-derivations
241      warn-dirty = false
242      keep-outputs = false
243    '';
244    settings = {
245      trusted-users = [
246        "root"
247        "icy"
248      ];
249    };
250  };
251
252  # https://github.com/NixOS/nixpkgs/issues/180175
253  systemd.services.systemd-udevd.restartIfChanged = false;
254  systemd.services.NetworkManager-wait-online.enable = lib.mkForce false;
255
256
257  # This value determines the NixOS release from which the default
258  # settings for stateful data, like file locations and database versions
259  # on your system were taken. It‘s perfectly fine and recommended to leave
260  # this value at the release version of the first install of this system.
261  # Before changing this value read the documentation for this option
262  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
263  system.stateVersion = "21.11"; # Did you read the comment?
264
265}
266