all repos — dotfiles @ 5351d6833635d341b38c1e322e03b3c18c77d39b

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, theme, 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  };
 52
 53  i18n.defaultLocale = "en_US.UTF-8";
 54  time.timeZone = "Asia/Kolkata";
 55
 56  nixpkgs.config = {
 57    allowUnfree = true;
 58    allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
 59      "steam"
 60      "steam-original"
 61      "steam-runtime"
 62    ];
 63    st = {
 64      conf = builtins.readFile ../../programs/st/config.h;
 65      extraLibs = with pkgs; [ harfbuzz ];
 66      patches = [
 67        ../../patches/st/xres.diff
 68        ../../patches/st/bright.diff
 69        ../../patches/st/ligatures.diff
 70      ];
 71    };
 72    chromium = {
 73      commandLineArgs = "--ozone-platform=wayland";
 74    };
 75  };
 76
 77  nixpkgs.overlays = with self.overlays; [
 78    (self: super: {
 79      asusctl = pkgs.callPackage "${asusctl-tar}/pkgs/tools/misc/asusctl/default.nix" { };
 80      supergfxctl = pkgs.callPackage "${asusctl-tar}/pkgs/tools/misc/supergfxctl/default.nix" { };
 81    })
 82    nvim-nightly
 83    prompt
 84  ];
 85
 86  environment = {
 87    systemPackages = with pkgs; [
 88      asusctl
 89      supergfxctl
 90      cwm
 91      man-pages
 92      git
 93      man-pages-posix
 94      (lib.hiPrio pkgs.bashInteractive_5)
 95    ];
 96    variables = {
 97      MOZ_USE_XINPUT2 = "1";
 98      GDK_SCALE = "2";
 99      GDK_DPI_SCALE = "0.5";
100    };
101    etc = {
102      "wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = ''
103        bluez_monitor.properties = {
104          ["bluez5.enable-sbc-xq"] = true,
105          ["bluez5.enable-msbc"] = true,
106          ["bluez5.enable-hw-volume"] = true,
107          ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
108        }
109      '';
110    };
111  };
112
113  documentation = {
114    dev.enable = true;
115    man.generateCaches = true;
116  };
117
118  users.motd = with config; ''
119    Host       ${networking.hostName}
120    OS         NixOS ${system.nixos.release} (${system.nixos.codeName})
121    Version    ${system.nixos.version}
122    Kernel     ${boot.kernelPackages.kernel.version}
123  '';
124
125  console = {
126    font = "${pkgs.terminus_font}/share/consolefonts/ter-u28n.psf.gz";
127    keyMap = "us";
128  };
129
130  sound.enable = true;
131  hardware = {
132    bluetooth = {
133      enable = true;
134      powerOnBoot = true;
135      disabledPlugins = [ "sap" ];
136    };
137    nvidia.prime = {
138      offload.enable = true;
139      amdgpuBusId = "PCI:8:0:0";
140      nvidiaBusId = "PCI:1:0:0";
141    };
142    logitech.wireless = {
143      enable = true;
144      enableGraphical = true;
145    };
146  };
147
148  services = {
149    asusctl.enable = true;
150    supergfxctl.enable = true;
151    pipewire = {
152      enable = true;
153      alsa.enable = true;
154      alsa.support32Bit = true;
155      pulse.enable = true;
156    };
157    xserver = {
158      enable = true;
159      layout = "us";
160      desktopManager.plasma5.enable = true;
161      displayManager.sddm = {
162        enable = true;
163        enableHidpi = true;
164      };
165      dpi = 192;
166      videoDrivers = [ "nvidia" ];
167      screenSection = ''
168        Option         "metamodes" "nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}"
169        Option         "AllowIndirectGLXProtocol" "off"
170        Option         "TripleBuffer" "on"
171      '';
172      libinput = {
173        enable = true;
174        mouse = {
175          scrollButton = 8;
176          scrollMethod = "button";
177        };
178      };
179    };
180    tailscale.enable = true;
181    auto-cpufreq.enable = true;
182    # 1. chmod for rootless backligh1t
183    # 2. lotus58 bootloader mode for rootless qmk flashing
184    udev = {
185      extraRules = ''
186        ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="amdgpu_bl1", MODE="0666", RUN+="${pkgs.coreutils}/bin/chmod a+w /sys/class/backlight/%k/brightness"
187        ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0036", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1"
188      '';
189      extraHwdb = ''
190        evdev:input:b0003v0B05p19B6*
191          KEYBOARD_KEY_ff31007c=f20 # x11 mic-mute
192      '';
193      path = [
194        pkgs.coreutils
195      ];
196    };
197    logind.extraConfig = ''
198      HandlePowerKey=hibernate
199    '';
200  };
201
202  virtualisation.docker = {
203    enable = true;
204    logDriver = "json-file";
205  };
206
207  security = {
208    doas.enable = true;
209    sudo.enable = true;
210    doas.extraConfig = ''
211      permit nopass :wheel
212    '';
213    doas.extraRules = [{
214      users = [ "icy" ];
215    }];
216    pki.certificateFiles = [ "/home/icy/.local/share/caddy/pki/authorities/local/root.crt" ];
217  };
218
219  powerManagement = {
220    enable = true;
221    powertop.enable = true;
222  };
223
224  users.users.icy = {
225    isNormalUser = true;
226    extraGroups = [ "wheel" "docker" "audio" "video" "dialout" ];
227  };
228
229  programs = {
230    steam.enable = true;
231  };
232
233  nix = {
234    package = pkgs.nixFlakes;
235    extraOptions = ''
236      experimental-features = nix-command flakes ca-derivations
237      warn-dirty = false
238      keep-outputs = false
239    '';
240    settings = {
241      trusted-users = [
242        "root"
243        "icy"
244      ];
245    };
246  };
247
248
249  # This value determines the NixOS release from which the default
250  # settings for stateful data, like file locations and database versions
251  # on your system were taken. It‘s perfectly fine and recommended to leave
252  # this value at the release version of the first install of this system.
253  # Before changing this value read the documentation for this option
254  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
255  system.stateVersion = "21.11"; # Did you read the comment?
256
257}
258