nix: new host wyndle
Anirudh Oppiliappan x@icyphox.sh
Sat, 23 Apr 2022 12:56:56 +0530
11 files changed,
260 insertions(+),
13 deletions(-)
M
config/nvim/_init.lua
→
config/nvim/_init.lua
@@ -1,7 +1,7 @@
-- loaded by home-manager; see: nix/programs/neovim.nix -- TODO: ref: https://github.com/neovim/neovim/pull/15436 -require 'impatient' +-- require 'impatient' require 'settings' require 'maps'
M
home/.cwmrc
→
home/.cwmrc
@@ -54,7 +54,7 @@ # other
borderwidth 1 snapdist 10 ignore bar -gap 30 0 0 0 +gap 50 0 0 0 autogroup 0 barito # colors
M
nix/bin/bar.nix
→
nix/bin/bar.nix
@@ -1,10 +1,11 @@
-{ pkgs, theme, ... }: +{ pkgs, theme, host, ... }: let name = "bar"; pamixer = "${pkgs.pamixer}/bin/pamixer"; lemonbar = "${pkgs.lemonbar-xft}/bin/lemonbar"; btctl = "${pkgs.bluezFull}/bin/bluetoothctl"; + barHeight = if host == "wyndle" then "50" else "30"; in pkgs.writeShellScriptBin name ''@@ -32,6 +33,6 @@ while :; do
time="$(date +"%H:%M")" echo "$pad $(dt) $pad $time %{r}bat $(bat) %{O14}$(audio_dev) $(vol)% $pad" sleep 0.5 - done | ${lemonbar} -n bar -f 'Input:style=Regular:size=12:antialias=true' -g x30 \ + done | ${lemonbar} -n bar -f 'Input:style=Regular:size=12:antialias=true' -g x${barHeight} \ -F '${theme.base00}' -B '${theme.base07}' ''
M
nix/bin/default.nix
→
nix/bin/default.nix
@@ -1,4 +1,4 @@
-{ pkgs, theme, ... }: +{ pkgs, theme, host, ... }: let@@ -38,7 +38,7 @@ # screen record with ffmpeg and slop
record = import ./record.nix pkgs; # bar - bar = import ./bar.nix { inherit pkgs theme; }; + bar = import ./bar.nix { inherit pkgs theme host; }; # xurls xurls = import ./xurls.nix pkgs;
M
nix/flake.nix
→
nix/flake.nix
@@ -49,6 +49,28 @@ home-manager.useUserPackages = true;
home-manager.users.icy = { imports = [ ./home.nix ]; _module.args.self = self; + _module.args.host = "lapis"; + _module.args.inputs = inputs; + _module.args.theme = import ./theme.nix; + }; + } + ]; + }; + wyndle = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + { + imports = [ ./hosts/wyndle/configuration.nix ]; + _module.args.self = self; + } + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.icy = { + imports = [ ./home.nix ]; + _module.args.self = self; + _module.args.host = "wyndle"; _module.args.inputs = inputs; _module.args.theme = import ./theme.nix; };
M
nix/home.nix
→
nix/home.nix
@@ -2,6 +2,7 @@ { config
, pkgs , theme , self +, host , ... }:@@ -51,7 +52,7 @@ aerc
calibre pinentry - ] ++ (import ./bin { inherit pkgs theme; }); + ] ++ (import ./bin { inherit pkgs theme host; }); xdg = { userDirs = {@@ -71,7 +72,8 @@ initExtra = ''
${pkgs.xorg.setxkbmap}/bin/setxkbmap us,ru -option grp:ctrls_toggle ${pkgs.xorg.xrdb}/bin/xrdb -load $HOME/.Xresources bar & + st & ''; }; +} -}
A
nix/hosts/wyndle/configuration.nix
@@ -0,0 +1,191 @@
+let + nixpkgs-tar = "https://github.com/NixOS/nixpkgs/archive/"; + asusctl-tar = fetchTarball "${nixpkgs-tar}a4a81b6f6c27e5a964faea25b7b5cbe611f98691.tar.gz"; +in +{ self, config, pkgs, theme, ... }: + +{ + imports = + [ + ./hardware-configuration.nix + "${asusctl-tar}/nixos/modules/services/misc/asusctl.nix" + "${asusctl-tar}/nixos/modules/services/misc/supergfxctl.nix" + ]; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.kernel.sysctl."net.ipv4.ip_forward" = 1; + + networking = { + nameservers = [ "1.1.1.1" "1.0.0.1" ]; + wireless = { + enable = true; + interfaces = [ "wlp6s0" ]; + environmentFile = "/home/icy/secrets/wireless.env"; + networks = { + Sanic.psk = "@PSK_SANI@"; + Gopalan.psk = "@PSK_GOPA@"; + "GoSpaze 2" = { + psk = "@PSK_GOSP@"; + }; + }; + extraConfig = '' + ctrl_interface=/run/wpa_supplicant + ctrl_interface_group=wheel + ''; + }; + # dhcpcd.enable = true; + hostName = "wyndle"; + useDHCP = false; + interfaces.wlp6s0.useDHCP = true; + }; + + i18n.defaultLocale = "en_US.UTF-8"; + time.timeZone = "Asia/Kolkata"; + + nixpkgs.config = { + allowUnfree = true; + st = { + conf = builtins.readFile ../../programs/st/config.h; + extraLibs = with pkgs; [ harfbuzz ]; + patches = [ + ../../patches/st/xres.diff + ../../patches/st/bright.diff + ../../patches/st/ligatures.diff + ]; + }; + }; + + nixpkgs.overlays = with self.overlays; [ + nvim-nightly + prompt + (self: super: { + asusctl = pkgs.callpackage "${asusctl-tar}/pkgs/tools/misc/asusctl/default.nix" { }; + supergfxctl = pkgs.callpackage "${asusctl-tar}/pkgs/tools/misc/supergfxctl/default.nix" { }; + }) + ]; + + environment.systemPackages = with pkgs; [ + cwm + man-pages + git + man-pages-posix + (lib.hiPrio pkgs.bashInteractive_5) + asusctl + ]; + + environment.variables = { + MOZ_USE_XINPUT2 = "1"; + GDK_SCALE = "2"; + GDK_DPI_SCALE = "0.5"; + }; + + documentation = { + dev.enable = true; + man.generateCaches = true; + }; + + users.motd = with config; '' + Host ${networking.hostName} + OS NixOS ${system.nixos.release} (${system.nixos.codeName}) + Version ${system.nixos.version} + Kernel ${boot.kernelPackages.kernel.version} + ''; + + console = { + font = "${pkgs.terminus_font}/share/consolefonts/ter-u28n.psf.gz"; + keyMap = "us"; + }; + + sound.enable = true; + hardware = { + pulseaudio.enable = true; + bluetooth = { + enable = true; + powerOnBoot = true; + }; + nvidia.prime = { + offload.enable = true; + amdgpuBusId = "PCI:8:0:0"; + nvidiaBusId = "PCI:1:0:0"; + }; + }; + + services = { + asusctl.enable = true; + xserver = { + enable = true; + layout = "us"; + displayManager.startx.enable = true; + libinput.enable = true; + dpi = 192; + videoDrivers = [ "nvidia" ]; + screenSection = '' + Option "metamodes" "nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}" + Option "AllowIndirectGLXProtocol" "off" + Option "TripleBuffer" "on" + ''; + }; + tailscale.enable = true; + power-profiles-daemon.enable = true; + # 1. chmod for rootless backligh1t + # 2. lotus58 bootloader mode for rootless qmk flashing + udev = { + extraRules = '' + ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0036", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ''; + path = [ + pkgs.coreutils + ]; + }; + }; + + virtualisation.docker = { + enable = true; + logDriver = "json-file"; + }; + + security = { + doas.enable = true; + sudo.enable = true; + doas.extraConfig = '' + permit nopass :wheel + ''; + doas.extraRules = [{ + users = [ "icy" ]; + }]; + pki.certificateFiles = [ "/home/icy/.local/share/caddy/pki/authorities/local/root.crt" ]; + }; + + + users.users.icy = { + isNormalUser = true; + extraGroups = [ "wheel" "docker" "audio" "video" "dialout" ]; + }; + + nix = { + package = pkgs.nixFlakes; + extraOptions = '' + experimental-features = nix-command flakes ca-derivations + warn-dirty = false + keep-outputs = false + ''; + settings = { + trusted-users = [ + "root" + "icy" + ]; + }; + }; + + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "21.11"; # Did you read the comment? + +} +
A
nix/hosts/wyndle/hardware-configuration.nix
@@ -0,0 +1,33 @@
+# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/f66408c3-50c9-421a-80c1-8163761f3817"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/E85D-EAD8"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.opengl.enable = true; + hardware.nvidia.modesetting.enable = true; + # high-resolution display + hardware.video.hidpi.enable = lib.mkDefault true; +}
M
nix/services/picom.nix
→
nix/services/picom.nix
@@ -7,9 +7,7 @@ {
services.picom = { enable = true; backend = "glx"; - fade = true; - fadeDelta = 5; - fadeSteps = [ "0.04" "0.04" ]; + vSync = true; inactiveDim = "0.0"; shadow = false; shadowOffsets = [ (-60) (-60) ];
M
nix/services/sxhkd.nix
→
nix/services/sxhkd.nix
@@ -10,7 +10,7 @@ enable = true;
keybindings = { "XF86Audio{Lower,Raise}Volume" = "${pkgs.alsaUtils}/bin/amixer sset Master 2%{-,+}"; "XF86AudioMute" = "${pkgs.alsaUtils}/bin/amixer sset Master toggle"; - "XF86MonBrightness{Down,Up}" = "${pkgs.brightnessctl}/bin/brightnessctl s 100{-,+}"; + "XF86MonBrightness{Down,Up}" = "${pkgs.brightnessctl}/bin/brightnessctl s 10{-,+}"; "super + Escape" = "pkill -USR1 -x sxhkd"; }; };
M
nix/x/xft.nix
→
nix/x/xft.nix
@@ -11,6 +11,6 @@ "Xft.lcdfilter" = "lcddefault";
"Xft.hintstyle" = "hintslight"; "Xft.hinting" = true; "Xft.rgba" = "rgb"; - "Xft.dpi" = 100; + "Xft.dpi" = 192; }; }