all repos — dotfiles @ 9f2aa547dae45c6183baab3dbe54bae3bed6050b

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    wireless = {
 20      enable = true;
 21      interfaces = [ "wlp6s0" ];
 22      environmentFile = "/home/icy/secrets/wireless.env";
 23      networks = {
 24        Sanic.psk = "@PSK_SANI@";
 25        Gopalan5G.psk = "@PSK_GOPA@";
 26        denim.psk = "@PSK_DENI@";
 27      };
 28      extraConfig = ''
 29        ctrl_interface=/run/wpa_supplicant
 30        ctrl_interface_group=wheel
 31      '';
 32    };
 33    # dhcpcd.enable = true;
 34    hostName = "wyndle";
 35    useDHCP = false;
 36    interfaces.wlp6s0.useDHCP = true;
 37    firewall.checkReversePath = "loose";
 38  };
 39
 40  i18n.defaultLocale = "en_US.UTF-8";
 41  time.timeZone = "Asia/Kolkata";
 42
 43  nixpkgs.config = {
 44    allowUnfree = true;
 45    allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
 46      "steam"
 47      "steam-original"
 48      "steam-runtime"
 49    ];
 50    st = {
 51      conf = builtins.readFile ../../programs/st/config.h;
 52      extraLibs = with pkgs; [ harfbuzz ];
 53      patches = [
 54        ../../patches/st/xres.diff
 55        ../../patches/st/bright.diff
 56        ../../patches/st/ligatures.diff
 57      ];
 58    };
 59    chromium = {
 60      commandLineArgs = "--ozone-platform=wayland";
 61    };
 62    firefox.enablePlasmaBrowserIntegration = true;
 63  };
 64
 65  nixpkgs.overlays = with self.overlays; [
 66    nvim-nightly
 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
253  # This value determines the NixOS release from which the default
254  # settings for stateful data, like file locations and database versions
255  # on your system were taken. It‘s perfectly fine and recommended to leave
256  # this value at the release version of the first install of this system.
257  # Before changing this value read the documentation for this option
258  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
259  system.stateVersion = "21.11"; # Did you read the comment?
260
261}
262