all repos — dotfiles @ 6b1179415128a15ebcc9fe1816df642fa49479b8

my *nix dotfiles

nix/hosts/wyndle/configuration.nix (view raw)

  1let
  2  asusctl-tar = fetchTarball "https://github.com/NixOS/nixpkgs/archive/a4a81b6f6c27e5a964faea25b7b5cbe611f98691.tar.gz";
  3in
  4{ self, config, pkgs, lib, ... }:
  5
  6{
  7  imports =
  8    [
  9      ./hardware-configuration.nix
 10      "${asusctl-tar}/nixos/modules/services/misc/asusctl.nix"
 11      "${asusctl-tar}/nixos/modules/services/misc/supergfxctl.nix"
 12    ];
 13
 14  boot = {
 15    loader.systemd-boot.enable = true;
 16    loader.efi.canTouchEfiVariables = true;
 17    kernel.sysctl."net.ipv4.ip_forward" = 1;
 18    kernelParams = [ "mem_sleep_default=deep" ];
 19    kernelPatches = [{
 20      name = "three-hundred-hertz";
 21      patch = null;
 22      extraConfig = ''
 23        HZ_300 y
 24        HZ 300
 25      '';
 26    }];
 27    resumeDevice = "/dev/nvme0n1p2";
 28    kernelPackages = pkgs.linuxPackages_latest;
 29  };
 30
 31  networking = {
 32    nameservers = [ "1.1.1.1" "1.0.0.1" ];
 33    wireless = {
 34      enable = true;
 35      interfaces = [ "wlp6s0" ];
 36      environmentFile = "/home/icy/secrets/wireless.env";
 37      networks = {
 38        Sanic.psk = "@PSK_SANI@";
 39        Gopalan5G.psk = "@PSK_GOPA@";
 40        denim.psk = "@PSK_DENI@";
 41      };
 42      extraConfig = ''
 43        ctrl_interface=/run/wpa_supplicant
 44        ctrl_interface_group=wheel
 45      '';
 46    };
 47    # dhcpcd.enable = true;
 48    hostName = "wyndle";
 49    useDHCP = false;
 50    interfaces.wlp6s0.useDHCP = true;
 51    firewall.checkReversePath = "loose";
 52  };
 53
 54  i18n.defaultLocale = "en_US.UTF-8";
 55  time.timeZone = "Asia/Kolkata";
 56
 57  nixpkgs.config = {
 58    allowUnfree = true;
 59    allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
 60      "steam"
 61      "steam-original"
 62      "steam-runtime"
 63    ];
 64    st = {
 65      conf = builtins.readFile ../../programs/st/config.h;
 66      extraLibs = with pkgs; [ harfbuzz ];
 67      patches = [
 68        ../../patches/st/xres.diff
 69        ../../patches/st/bright.diff
 70        ../../patches/st/ligatures.diff
 71      ];
 72    };
 73    chromium = {
 74      commandLineArgs = "--ozone-platform=wayland";
 75    };
 76    firefox.enablePlasmaBrowserIntegration = true;
 77  };
 78
 79  nixpkgs.overlays = with self.overlays; [
 80    (self: super: {
 81      asusctl = pkgs.callPackage "${asusctl-tar}/pkgs/tools/misc/asusctl/default.nix" { };
 82      supergfxctl = pkgs.callPackage "${asusctl-tar}/pkgs/tools/misc/supergfxctl/default.nix" { };
 83    })
 84    nvim-nightly
 85    prompt
 86  ];
 87
 88  environment = {
 89    systemPackages = with pkgs; [
 90      asusctl
 91      supergfxctl
 92      cwm
 93      man-pages
 94      git
 95      man-pages-posix
 96      (lib.hiPrio pkgs.bashInteractive_5)
 97    ];
 98    variables = {
 99      MOZ_USE_XINPUT2 = "1";
100      GDK_SCALE = "2";
101      GDK_DPI_SCALE = "0.5";
102    };
103    etc = {
104      "wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = ''
105        bluez_monitor.properties = {
106          ["bluez5.enable-sbc-xq"] = true,
107          ["bluez5.enable-msbc"] = true,
108          ["bluez5.enable-hw-volume"] = true,
109          ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
110        }
111      '';
112    };
113  };
114
115  documentation = {
116    dev.enable = true;
117    man.generateCaches = true;
118  };
119
120  users.motd = with config; ''
121    Host       ${networking.hostName}
122    OS         NixOS ${system.nixos.release} (${system.nixos.codeName})
123    Version    ${system.nixos.version}
124    Kernel     ${boot.kernelPackages.kernel.version}
125  '';
126
127  console = {
128    font = "${pkgs.terminus_font}/share/consolefonts/ter-u28n.psf.gz";
129    keyMap = "us";
130  };
131
132  sound.enable = true;
133  hardware = {
134    opengl.driSupport = true;
135    bluetooth = {
136      enable = true;
137      powerOnBoot = true;
138      disabledPlugins = [ "sap" ];
139    };
140    nvidia.prime = {
141      offload.enable = true;
142      amdgpuBusId = "PCI:8:0:0";
143      nvidiaBusId = "PCI:1:0:0";
144    };
145    logitech.wireless = {
146      enable = true;
147      enableGraphical = true;
148    };
149  };
150
151  services = {
152    asusctl.enable = true;
153    supergfxctl.enable = true;
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