all repos — dotfiles @ 242877a4483e053762fb546c780bbb84f7943155

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, ... }:
  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.loader.systemd-boot.enable = true;
 15  boot.loader.efi.canTouchEfiVariables = true;
 16  boot.kernel.sysctl."net.ipv4.ip_forward" = 1;
 17
 18  networking = {
 19    nameservers = [ "1.1.1.1" "1.0.0.1" ];
 20    wireless = {
 21      enable = true;
 22      interfaces = [ "wlp6s0" ];
 23      environmentFile = "/home/icy/secrets/wireless.env";
 24      networks = {
 25        Sanic.psk = "@PSK_SANI@";
 26        Gopalan.psk = "@PSK_GOPA@";
 27        "GoSpaze 2" = {
 28          psk = "@PSK_GOSP@";
 29        };
 30      };
 31      extraConfig = ''
 32        ctrl_interface=/run/wpa_supplicant
 33        ctrl_interface_group=wheel
 34      '';
 35    };
 36    # dhcpcd.enable = true;
 37    hostName = "wyndle";
 38    useDHCP = false;
 39    interfaces.wlp6s0.useDHCP = true;
 40  };
 41
 42  i18n.defaultLocale = "en_US.UTF-8";
 43  time.timeZone = "Asia/Kolkata";
 44
 45  nixpkgs.config = {
 46    allowUnfree = true;
 47    st = {
 48      conf = builtins.readFile ../../programs/st/config.h;
 49      extraLibs = with pkgs; [ harfbuzz ];
 50      patches = [
 51        ../../patches/st/xres.diff
 52        ../../patches/st/bright.diff
 53        ../../patches/st/ligatures.diff
 54      ];
 55    };
 56  };
 57
 58  nixpkgs.overlays = with self.overlays; [
 59    (self: super: {
 60      asusctl = pkgs.callPackage "${asusctl-tar}/pkgs/tools/misc/asusctl/default.nix" { };
 61      supergfxctl = pkgs.callPackage "${asusctl-tar}/pkgs/tools/misc/supergfxctl/default.nix" { };
 62    })
 63    nvim-nightly
 64    prompt
 65  ];
 66
 67  environment = {
 68    systemPackages = with pkgs; [
 69      asusctl
 70      supergfxctl
 71      cwm
 72      man-pages
 73      git
 74      man-pages-posix
 75      (lib.hiPrio pkgs.bashInteractive_5)
 76    ];
 77    variables = {
 78      MOZ_USE_XINPUT2 = "1";
 79      GDK_SCALE = "2";
 80      GDK_DPI_SCALE = "0.5";
 81    };
 82    etc = {
 83      "wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = ''
 84        bluez_monitor.properties = {
 85          ["bluez5.enable-sbc-xq"] = true,
 86          ["bluez5.enable-msbc"] = true,
 87          ["bluez5.enable-hw-volume"] = true,
 88          ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
 89        }
 90      '';
 91    };
 92  };
 93
 94  documentation = {
 95    dev.enable = true;
 96    man.generateCaches = true;
 97  };
 98
 99  users.motd = with config; ''
100    Host       ${networking.hostName}
101    OS         NixOS ${system.nixos.release} (${system.nixos.codeName})
102    Version    ${system.nixos.version}
103    Kernel     ${boot.kernelPackages.kernel.version}
104  '';
105
106  console = {
107    font = "${pkgs.terminus_font}/share/consolefonts/ter-u28n.psf.gz";
108    keyMap = "us";
109  };
110
111  sound.enable = true;
112  hardware = {
113    bluetooth = {
114      enable = true;
115      powerOnBoot = true;
116      disabledPlugins = [ "sap" ];
117    };
118    nvidia.prime = {
119      offload.enable = true;
120      amdgpuBusId = "PCI:8:0:0";
121      nvidiaBusId = "PCI:1:0:0";
122    };
123  };
124
125  services = {
126    asusctl.enable = true;
127    supergfxctl.enable = true;
128    pipewire = {
129      enable = true;
130      alsa.enable = true;
131      alsa.support32Bit = true;
132      pulse.enable = true;
133    };
134    xserver = {
135      enable = true;
136      layout = "us";
137      displayManager.startx.enable = true;
138      libinput.enable = true;
139      dpi = 192;
140      videoDrivers = [ "nvidia" ];
141      screenSection = ''
142        Option         "metamodes" "nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}"
143        Option         "AllowIndirectGLXProtocol" "off"
144        Option         "TripleBuffer" "on"
145      '';
146    };
147    tailscale.enable = true;
148    power-profiles-daemon.enable = true;
149    # 1. chmod for rootless backligh1t
150    # 2. lotus58 bootloader mode for rootless qmk flashing
151    udev = {
152      extraRules = ''
153        ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0036", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1"
154      '';
155      extraHwdb = ''
156        evdev:input:b0003v0B05p19B6*
157          KEYBOARD_KEY_ff31007c=f20 # x11 mic-mute
158      '';
159      path = [
160        pkgs.coreutils
161      ];
162    };
163  };
164
165  virtualisation.docker = {
166    enable = true;
167    logDriver = "json-file";
168  };
169
170  security = {
171    doas.enable = true;
172    sudo.enable = true;
173    doas.extraConfig = ''
174      permit nopass :wheel
175    '';
176    doas.extraRules = [{
177      users = [ "icy" ];
178    }];
179    pki.certificateFiles = [ "/home/icy/.local/share/caddy/pki/authorities/local/root.crt" ];
180  };
181
182  powerManagement = {
183    enable = true;
184    powertop.enable = true;
185  };
186
187  users.users.icy = {
188    isNormalUser = true;
189    extraGroups = [ "wheel" "docker" "audio" "video" "dialout" ];
190  };
191
192  nix = {
193    package = pkgs.nixFlakes;
194    extraOptions = ''
195      experimental-features = nix-command flakes ca-derivations
196      warn-dirty = false
197      keep-outputs = false
198    '';
199    settings = {
200      trusted-users = [
201        "root"
202        "icy"
203      ];
204    };
205  };
206
207
208  # This value determines the NixOS release from which the default
209  # settings for stateful data, like file locations and database versions
210  # on your system were taken. It‘s perfectly fine and recommended to leave
211  # this value at the release version of the first install of this system.
212  # Before changing this value read the documentation for this option
213  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
214  system.stateVersion = "21.11"; # Did you read the comment?
215
216}
217