all repos — dotfiles @ 04d6b71a5e7ced19cb1a7dd2f5d4724f2c36d940

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    bluetooth = {
135      enable = true;
136      powerOnBoot = true;
137      disabledPlugins = [ "sap" ];
138    };
139    nvidia.prime = {
140      offload.enable = true;
141      amdgpuBusId = "PCI:8:0:0";
142      nvidiaBusId = "PCI:1:0:0";
143    };
144    logitech.wireless = {
145      enable = true;
146      enableGraphical = true;
147    };
148  };
149
150  services = {
151    asusctl.enable = true;
152    supergfxctl.enable = true;
153    pipewire = {
154      enable = true;
155      alsa.enable = true;
156      alsa.support32Bit = true;
157      pulse.enable = true;
158    };
159    xserver = {
160      enable = true;
161      layout = "us";
162      desktopManager.plasma5.enable = true;
163      displayManager.sddm = {
164        enable = true;
165        enableHidpi = true;
166      };
167      dpi = 192;
168      videoDrivers = [ "nvidia" ];
169      screenSection = ''
170        Option         "metamodes" "nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}"
171        Option         "AllowIndirectGLXProtocol" "off"
172        Option         "TripleBuffer" "on"
173      '';
174      libinput = {
175        enable = true;
176        mouse = {
177          scrollButton = 8;
178          scrollMethod = "button";
179        };
180      };
181    };
182    tailscale.enable = true;
183    auto-cpufreq.enable = true;
184    # 1. chmod for rootless backligh1t
185    # 2. lotus58 bootloader mode for rootless qmk flashing
186    udev = {
187      extraRules = ''
188        ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="amdgpu_bl1", MODE="0666", RUN+="${pkgs.coreutils}/bin/chmod a+w /sys/class/backlight/%k/brightness"
189        ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0036", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1"
190      '';
191      extraHwdb = ''
192        evdev:input:b0003v0B05p19B6*
193          KEYBOARD_KEY_ff31007c=f20 # x11 mic-mute
194      '';
195      path = [
196        pkgs.coreutils
197      ];
198    };
199    logind.extraConfig = ''
200      HandlePowerKey=hibernate
201    '';
202  };
203
204  virtualisation.docker = {
205    enable = true;
206    logDriver = "json-file";
207  };
208
209  security = {
210    doas.enable = true;
211    sudo.enable = true;
212    doas.extraConfig = ''
213      permit nopass :wheel
214    '';
215    doas.extraRules = [{
216      users = [ "icy" ];
217    }];
218    pki.certificateFiles = [ "/home/icy/.local/share/caddy/pki/authorities/local/root.crt" ];
219  };
220
221  powerManagement = {
222    enable = true;
223    powertop.enable = true;
224  };
225
226  users.users.icy = {
227    isNormalUser = true;
228    extraGroups = [ "wheel" "docker" "audio" "video" "dialout" ];
229  };
230
231  programs = {
232    steam.enable = true;
233    gamemode.enable = true;
234  };
235
236  nix = {
237    package = pkgs.nixFlakes;
238    extraOptions = ''
239      experimental-features = nix-command flakes ca-derivations
240      warn-dirty = false
241      keep-outputs = false
242    '';
243    settings = {
244      trusted-users = [
245        "root"
246        "icy"
247      ];
248    };
249  };
250
251
252  # This value determines the NixOS release from which the default
253  # settings for stateful data, like file locations and database versions
254  # on your system were taken. It‘s perfectly fine and recommended to leave
255  # this value at the release version of the first install of this system.
256  # Before changing this value read the documentation for this option
257  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
258  system.stateVersion = "21.11"; # Did you read the comment?
259
260}
261