From b39e453d49e7cbbe1dd69c70871492df83d9134a Mon Sep 17 00:00:00 2001 From: Ray Andrew Date: Mon, 3 Mar 2025 22:54:32 -0600 Subject: [PATCH] stable --- flake.lock | 249 +++++++++++++++++++++++++++++++ flake.nix | 65 +++++++++ home/default.nix | 35 +++++ home/ghostty.nix | 64 ++++++++ home/git.nix | 49 +++++++ home/gui.nix | 90 ++++++++++++ home/i3/config | 163 +++++++++++++++++++++ home/i3/default.nix | 206 ++++++++++++++++++++++++++ home/i3/i3status.config | 52 +++++++ home/kitty.nix | 264 +++++++++++++++++++++++++++++++++ home/ssh/config | 282 ++++++++++++++++++++++++++++++++++++ home/ssh/default.nix | 17 +++ hosts/default.nix | 63 ++++++++ hosts/pickwick/default.nix | 50 +++++++ hosts/pickwick/disko.nix | 66 +++++++++ hosts/pickwick/hardware.nix | 34 +++++ hosts/pickwick/home.nix | 15 ++ nixos/1password.nix | 34 +++++ nixos/default.nix | 127 ++++++++++++++++ nixos/displaymanager.nix | 55 +++++++ nixos/keyd.nix | 71 +++++++++ 21 files changed, 2051 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 home/default.nix create mode 100644 home/ghostty.nix create mode 100644 home/git.nix create mode 100644 home/gui.nix create mode 100644 home/i3/config create mode 100644 home/i3/default.nix create mode 100644 home/i3/i3status.config create mode 100644 home/kitty.nix create mode 100644 home/ssh/config create mode 100644 home/ssh/default.nix create mode 100644 hosts/default.nix create mode 100644 hosts/pickwick/default.nix create mode 100644 hosts/pickwick/disko.nix create mode 100644 hosts/pickwick/hardware.nix create mode 100644 hosts/pickwick/home.nix create mode 100644 nixos/1password.nix create mode 100644 nixos/default.nix create mode 100644 nixos/displaymanager.nix create mode 100644 nixos/keyd.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..0261408 --- /dev/null +++ b/flake.lock @@ -0,0 +1,249 @@ +{ + "nodes": { + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1739791827, + "narHash": "sha256-l6ooDEtfzet9qRQxlb5A+H6eY7VPpdiGMwqX0nqD1xM=", + "owner": "nix-community", + "repo": "disko", + "rev": "af4a580628e98302bb922c01e1169ce08d7bee57", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "ghostty": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "nixpkgs-stable": "nixpkgs-stable", + "nixpkgs-unstable": "nixpkgs-unstable", + "zig": "zig", + "zig2nix": "zig2nix" + }, + "locked": { + "lastModified": 1739813871, + "narHash": "sha256-1UAvBHL6haAa8PysB01t83+FBvMgkE4k8BAtOx56yQE=", + "owner": "ghostty-org", + "repo": "ghostty", + "rev": "da32534e8a63423d34d46caa9f60f342ed27235f", + "type": "github" + }, + "original": { + "owner": "ghostty-org", + "repo": "ghostty", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1739823458, + "narHash": "sha256-uHjpcdlWKrZEJxsGdlMRTe4jlMYAnNsjRxPSTrNMFvo=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "6c93eea85daddd0dc8d4a3a687473461f3122961", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1739736696, + "narHash": "sha256-zON2GNBkzsIyALlOCFiEBcIjI4w38GYOb+P+R4S8Jsw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d74a2335ac9c133d6bbec9fc98d91a77f1604c1f", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1738255539, + "narHash": "sha256-hP2eOqhIO/OILW+3moNWO4GtdJFYCqAe9yJZgvlCoDQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c3511a3b53b482aa7547c9d1626fd7310c1de1c5", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "release-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1738136902, + "narHash": "sha256-pUvLijVGARw4u793APze3j6mU1Zwdtz7hGkGGkD87qw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9a5db3142ce450045840cc8d832b13b8a2018e0c", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "disko": "disko", + "ghostty": "ghostty", + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "zen-browser": "zen-browser" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "zen-browser": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1739667343, + "narHash": "sha256-fNEz+Yd0t9jXz27qKRMAEBradTwYBeBLOECx+ydG25s=", + "owner": "0xc000022070", + "repo": "zen-browser-flake", + "rev": "8c7f6ca49f87b4e114f775a4dad956ceb6df4220", + "type": "github" + }, + "original": { + "owner": "0xc000022070", + "repo": "zen-browser-flake", + "type": "github" + } + }, + "zig": { + "inputs": { + "flake-compat": [ + "ghostty" + ], + "flake-utils": [ + "ghostty", + "flake-utils" + ], + "nixpkgs": [ + "ghostty", + "nixpkgs-stable" + ] + }, + "locked": { + "lastModified": 1738239110, + "narHash": "sha256-Y5i9mQ++dyIQr+zEPNy+KIbc5wjPmfllBrag3cHZgcE=", + "owner": "mitchellh", + "repo": "zig-overlay", + "rev": "1a8fb6f3a04724519436355564b95fce5e272504", + "type": "github" + }, + "original": { + "owner": "mitchellh", + "repo": "zig-overlay", + "type": "github" + } + }, + "zig2nix": { + "inputs": { + "flake-utils": [ + "ghostty", + "flake-utils" + ], + "nixpkgs": [ + "ghostty", + "nixpkgs-stable" + ] + }, + "locked": { + "lastModified": 1738263917, + "narHash": "sha256-j/3fwe2pEOquHabP/puljOKwAZFjIE9gXZqA91sC48M=", + "owner": "jcollie", + "repo": "zig2nix", + "rev": "c311d8e77a6ee0d995f40a6e10a89a3a4ab04f9a", + "type": "github" + }, + "original": { + "owner": "jcollie", + "ref": "c311d8e77a6ee0d995f40a6e10a89a3a4ab04f9a", + "repo": "zig2nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..9c86e65 --- /dev/null +++ b/flake.nix @@ -0,0 +1,65 @@ +{ + description = "Ray's Nix Config"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + disko.url = "github:nix-community/disko"; + disko.inputs.nixpkgs.follows = "nixpkgs"; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + zen-browser.url = "github:0xc000022070/zen-browser-flake"; + zen-browser.inputs.nixpkgs.follows = "nixpkgs"; + ghostty.url = "github:ghostty-org/ghostty"; + }; + + outputs = { + self, + nixpkgs, + home-manager, + ... + } @ inputs: let + inherit (self) outputs; + system = "x86_64-linux"; + dots = "/home/rayandrew/dotfiles"; + user = "rayandrew"; + pkgs = import inputs.nixpkgs { + inherit system; + config.allowUnfree = true; + }; + lib = nixpkgs.lib; + createCommonArgs = system: { + inherit + self + inputs + nixpkgs + lib + pkgs + system + dots + ; + specialArgs = { + inherit self inputs; + }; + }; + commonArgs = createCommonArgs system; + in { + nixosConfigurations = import ./hosts commonArgs; + # nixosConfigurations = { + # pickwick = nixpkgs.lib.nixosSystem { + # specialArgs = {inherit inputs outputs system dots user;}; + # modules = [ + # ./nixos + # # ./nixos/configuration.nix + # ./hosts/pickwick + # inputs.disko.nixosModules.default + # inputs.home-manager.nixosModules.home-manager + # (nixpkgs.lib.mkAliasOptionModule [ "hm" ] [ + # "home-manager" + # "users" + # user + # ]) + # ]; + # }; + # }; + }; +} diff --git a/home/default.nix b/home/default.nix new file mode 100644 index 0000000..3f2c656 --- /dev/null +++ b/home/default.nix @@ -0,0 +1,35 @@ +{ + inputs, + lib, + config, + pkgs, + system, + ... +}: { + imports = [ + ./ssh + ./git.nix + ./gui.nix + ]; + + programs.neovim.enable = true; + home.packages = with pkgs; [ + gpclient + openconnect + emacs + fd + ripgrep + yazi + tree + gnumake + texinfo + texlive.combined.scheme-full + ]; + + fonts.fontconfig.enable = true; + + programs.home-manager.enable = true; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + home.stateVersion = "25.05"; +} diff --git a/home/ghostty.nix b/home/ghostty.nix new file mode 100644 index 0000000..6723aab --- /dev/null +++ b/home/ghostty.nix @@ -0,0 +1,64 @@ +{ + config, + pkgs, + inputs, + lib, + ... +}: +{ + options.custom.gui = with lib; { + ghostty = { + enable = mkEnableOption "Enable ghostty"; + }; + }; + + config = lib.mkIf config.custom.gui.ghostty.enable { + home.packages = with pkgs; [ + inputs.ghostty.packages."${system}".default + ]; + xdg.configFile."ghostty/config".text = '' +gtk-single-instance = false +gtk-titlebar = false +window-decoration = server +# gtk-adwaita = false +font-family = Consolas +font-size = 11 +app-notifications = no-clipboard-copy +# theme = gruber-darker +# font-family = Iosevka Nerd Font Mono +# font-size = 13 + +# background = #062329 +background = #072626 +# foreground = #d1b897 +foreground = #d3b58d +cursor-color = #ffffff +# cursor-text = #d1b897 +cursor-text = #d3b58d +# selection-background = #0000ff +# selection-foreground = #d1b897 +selection-background = #0000ff +selection-foreground = #d3b58d +# palette = 0=#062329 +palette = 0=#072626 +# palette = 1=#0b3335 +# palette = 2=#0000ff +palette = 3=#44b340 +palette = 4=#8cde94 +# palette = 5=#d1b897 +palette = 5=#d3b58d +palette = 6=#c1d1e3 +palette = 7=#ffffff +palette = 8=#626880 +palette = 9=#e67172 +palette = 10=#8ec772 +palette = 11=#d9ba73 +palette = 12=#7b9ef0 +palette = 13=#f2a4db +palette = 14=#5abfb5 +palette = 15=#b5bfe2 + +keybind = all:ctrl+shift+period=text:\x1b\x1f\x4c\x23\x1f +''; + }; +} diff --git a/home/git.nix b/home/git.nix new file mode 100644 index 0000000..109423e --- /dev/null +++ b/home/git.nix @@ -0,0 +1,49 @@ +{ + lib, + pkgs, + config, + ... +}: +let + home = config.home.homeDirectory; +in +{ + home.packages = with pkgs; [ + gh + ]; + + programs.git = { + enable = true; + lfs = { + enable = true; + }; + userEmail = "rs@rs.ht"; + userName = "Ray Andrew"; + signing = { + key = "${home}/.ssh/id_ed25519.pub"; + signByDefault = true; + signer = ""; + }; + ignores = [ + ".DS_Store" + "*~" + "*.swp" + ]; + extraConfig = { + gpg.format = "ssh"; + core.editor = "emacs"; + credential.helper = "store --file ${home}/.git-credentials"; + pull.rebase = true; + }; + }; + + # programs.gh = { + # enable = true; + # settings = { + # git_protocol = "ssh"; + # }; + # extensions = with pkgs; [ + # gh-copilot + # ]; + # }; +} diff --git a/home/gui.nix b/home/gui.nix new file mode 100644 index 0000000..e1159a5 --- /dev/null +++ b/home/gui.nix @@ -0,0 +1,90 @@ +{ + lib, + pkgs, + config, + inputs, + hm, + user, + ... +}: + +{ + imports = [ + ./i3 + ./kitty.nix + ./ghostty.nix + ]; + + options.custom.gui.default = with lib; { + enable = mkEnableOption "Enable Default GUI"; + }; + + config = lib.mkIf config.custom.gui.default.enable { + dconf.settings = { + "org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + show-battery-percentage = true; + clock-format = "12h"; + }; + }; + + home.packages = with pkgs; [ + inputs.zen-browser.packages."${system}".twilight + # globalprotect-openconnect + firefox + chromium + zoom-us + slack + teams-for-linux + skypeforlinux + zotero + spotify + arandr + webex + kitty + seahorse # gnome keyring + xfce.thunar + xfce.thunar-volman + xclip + # fonts + vista-fonts + nerd-fonts.ubuntu-mono + nerd-fonts.iosevka + nerd-fonts.fira-code + nerd-fonts.sauce-code-pro + nerd-fonts.inconsolata + nerd-fonts.inconsolata-go + nerd-fonts.droid-sans-mono + nerd-fonts.space-mono + nerd-fonts.dejavu-sans-mono + ]; + + gtk = { + enable = true; + theme = { + name = "Adwaita-dark"; + package = pkgs.gnome-themes-extra; + }; + }; + + qt = { + enable = true; + platformTheme.name = "adwaita"; + style.name = "adwaita-dark"; + }; + + systemd.user.sessionVariables = config.home.sessionVariables; + + services.redshift = { + enable = true; + # provider = "geoclue2"; + provider = "manual"; + # madison + latitude = "43.07305000"; + longitude = "-89.40123000"; + # chicago + # latitude = "41.85003000"; + # longitude = "-87.65005000"; + }; + }; +} diff --git a/home/i3/config b/home/i3/config new file mode 100644 index 0000000..9539f0e --- /dev/null +++ b/home/i3/config @@ -0,0 +1,163 @@ +set $mod Mod4 +# font pango:monospace 8 + +# This font is widely installed, provides lots of unicode glyphs, right-to-left +# text rendering and scalability on retina/hidpi displays (thanks to pango). +font pango:DejaVu Sans Mono 8 + +@startup@ + +bindsym XF86AudioRaiseVolume exec --no-startup-id @raise_vol@ +bindsym XF86AudioLowerVolume exec --no-startup-id @lower_vol@ +bindsym XF86AudioMute exec --no-startup-id @mute_vol@ +bindsym XF86AudioMicMute exec --no-startup-id @mute_mic@ +bindsym XF86AudioPlay exec --no-startup-id @media_play@ +bindsym XF86AudioPause exec --no-startup-id @media_pause@ +bindsym XF86AudioNext exec --no-startup-id @media_next@ +bindsym XF86AudioPrev exec --no-startup-id @media_prev@ + +floating_modifier $mod +tiling_drag modifier titlebar +bindsym $mod+Shift+q kill + +bindsym $mod+space exec --no-startup-id dmenu_run + +bindsym $mod+Return exec @term@ +bindsym $mod+Shift+Return exec @second_term@ + +# file manager +bindsym $mod+b exec --no-startup-id @fm@ + +# screenshot +bindsym $mod+o exec --no-startup-id @screenshot@ +bindsym $mod+Shift+o exec --no-startup-id @screenshot_clipboard@ + +# change focus +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right + +# alternatively, you can use the cursor keys: +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# move focused window +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right + +# alternatively, you can use the cursor keys: +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# split in horizontal orientation +bindsym $mod+v split h + +# split in vertical orientation +bindsym $mod+Shift+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+t layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+p floating toggle + +# change focus between tiling / floating windows +bindsym $mod+Shift+p focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +#bindsym $mod+d focus child + +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws10 "10" + +# switch to workspace +bindsym $mod+1 workspace number $ws1 +bindsym $mod+2 workspace number $ws2 +bindsym $mod+3 workspace number $ws3 +bindsym $mod+4 workspace number $ws4 +bindsym $mod+5 workspace number $ws5 +bindsym $mod+6 workspace number $ws6 +bindsym $mod+7 workspace number $ws7 +bindsym $mod+8 workspace number $ws8 +bindsym $mod+9 workspace number $ws9 +bindsym $mod+0 workspace number $ws10 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace number $ws1 +bindsym $mod+Shift+2 move container to workspace number $ws2 +bindsym $mod+Shift+3 move container to workspace number $ws3 +bindsym $mod+Shift+4 move container to workspace number $ws4 +bindsym $mod+Shift+5 move container to workspace number $ws5 +bindsym $mod+Shift+6 move container to workspace number $ws6 +bindsym $mod+Shift+7 move container to workspace number $ws7 +bindsym $mod+Shift+8 move container to workspace number $ws8 +bindsym $mod+Shift+9 move container to workspace number $ws9 +bindsym $mod+Shift+0 move container to workspace number $ws10 + +# reload the configuration file +bindsym $mod+Shift+c reload +bindsym $mod+Shift+r restart +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" + +# resize window +set $resize " : [h]  , [j]  , [k]  , [l] " +mode $resize { + bindsym h resize shrink width 10 px or 10 ppt + bindsym j resize grow height 10 px or 10 ppt + bindsym k resize shrink height 10 px or 10 ppt + bindsym l resize grow width 10 px or 10 ppt + + # same bindings, but for the arrow keys + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + + bindsym Return mode "default" + bindsym Escape mode "default" +} + +bindsym $mod+r mode $resize + +# power +set $power " : Screen [l]ock, [e]xit, [s]uspend, [h]ibernate, [R]eboot, [S]hutdown" +mode $power { + bindsym l mode "default", exec loginctl lock-session + bindsym e mode "default", exec loginctl terminate-session $XDG_SESSION_ID + bindsym s mode "default", exec systemctl suspend + bindsym h mode "default", exec systemctl hibernate + bindsym Shift+r mode "default", exec systemctl reboot + bindsym Shift+s mode "default", exec systemctl poweroff + + bindsym Return mode "default" + bindsym Escape mode "default" +} + +bindsym $mod+Escape mode $power + +bar { + status_command i3status +} \ No newline at end of file diff --git a/home/i3/default.nix b/home/i3/default.nix new file mode 100644 index 0000000..80198d9 --- /dev/null +++ b/home/i3/default.nix @@ -0,0 +1,206 @@ +{ + config, + lib, + pkgs, + inputs, + system, + ... +}: +{ + options.custom.gui = with lib; { + i3 = { + enable = mkEnableOption "Enable i3"; + }; + }; + config = lib.mkIf config.custom.gui.i3.enable { + xdg.configFile."i3status/config".source = pkgs.substituteAll { + src = ./i3status.config; + }; + services.picom = { + enable = true; + }; + services.dunst = { + enable = true; + }; + home.pointerCursor = { + package = pkgs.adwaita-icon-theme; + name = "Adwaita"; + size = 32; + x11.enable = true; + }; + xsession = { + enable = true; + scriptPath = ".xsession-hm"; + initExtra = '' + # export GDK_SCALE=2 + # export GDK_DPI_SCALE=0.5 + export _JAVA_OPTIONS="-Dsun.java2d.uiScale=2" + export QT_AUTO_SCREEN_SCALE_FACTOR=1 + export QT_DEVICE_PIXEL_RATIO=2 + # export XCURSOR_SIZE=128 + # ${pkgs.xorg.xsetroot}/bin/xsetroot -cursor_name ${pkgs.vanilla-dmz}/share/icons/Vanilla-DMZ/cursors/left_ptr 128 &disown + if test -e $HOME/.Xresources; then + ${pkgs.xorg.xrdb}/bin/xrdb -merge $HOME/.Xresources &disown + fi + echo "Xft.dpi: 192" | ${pkgs.xorg.xrdb}/bin/xrdb -merge + ''; + windowManager.i3 = + let + modifier = "Mod4"; + powerManagementMode = " : Screen [l]ock, [e]xit, [s]uspend, [h]ibernate, [R]eboot, [S]hutdown"; + miscellaneousMode = "D [p]ause, D [c]ontinue"; + resizeMode = " : [h]  , [j]  , [k]  , [l] "; + light = lib.getExe' pkgs.brightnessctl "brightnessctl"; + pactl = lib.getExe' pkgs.pulseaudio "pactl"; + maim = lib.getExe' pkgs.maim "maim"; + clipboard = lib.getExe' pkgs.xclip "xclip"; + yazi = lib.getExe' pkgs.yazi "yazi"; + terminal = lib.getExe' inputs.ghostty.packages."${system}".default "ghostty"; + # terminal = lib.getExe' pkgs.kitty "kitty"; + # second_terminal = lib.getExe' pkgs.wezterm "wezterm"; + playerctl = lib.getExe' pkgs.playerctl "playerctl"; + dmenu = lib.getExe' pkgs.dmenu "dmenu_run"; + refresh_i3status = "killall -SIGUSR1 i3status"; + # config = pkgs.substituteAll { + # inherit term second_term; + # src = ./config; + # raise_vol = "${pactl} set-sink-volume @DEFAULT_SINK@ +1% && $refresh_i3status"; + # lower_vol = "${pactl} set-sink-volume @DEFAULT_SINK@ -1% && $refresh_i3status"; + # mute_vol = "${pactl} set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status"; + # mute_mic = "${pactl} set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status"; + # screenshot = "${maim} -s ~/Pictures/screenshots/$(date +%Y-%m-%d-%H-%M-%S).png"; + # screenshot_clipboard = "${maim} -s | ${clipboard} -selection clipboard -t image/png"; + # media_play = "${playerctl} play-pause"; + # media_pause = "${playerctl} play-pause"; + # media_next = "${playerctl} next"; + # media_prev = "${playerctl} previous"; + # fm = "${term} -e ${fm}"; + # startup = '' + # exec --no-startup-id ${pkgs.dex}/bin/dex --autostart --environment i3 + # exec --no-startup-id ${pkgs.networkmanagerapplet}/bin/nm-applet + # exec --no-startup-id ${pkgs.pasystray}/bin/pasystray + # exec --no-startup-id ${pkgs.xss-lock}/bin/xss-lock --transfer-sleep-lock -- i3lock --nofork + # ''; + # }; + in + { + enable = true; + config = { + inherit modifier terminal; + keybindings = lib.mkOptionDefault { + "${modifier}+h" = "focus left"; + "${modifier}+j" = "focus down"; + "${modifier}+k" = "focus up"; + "${modifier}+l" = "focus right"; + "${modifier}+Shift+h" = "move left"; + "${modifier}+Shift+j" = "move down"; + "${modifier}+Shift+k" = "move up"; + "${modifier}+Shift+l" = "move right"; + "${modifier}+v" = "split h"; + "${modifier}+Shift+v" = "split v"; + "${modifier}+s" = "layout stacking"; + "${modifier}+t" = "layout tabbed"; + "${modifier}+e" = "layout toggle split"; + "${modifier}+p" = "floating toggle"; + "${modifier}+Shift+p" = "focus mode_toggle"; + "${modifier}+Shift+c" = "reload"; + "${modifier}+Shift+r" = "restart"; + # mode + "${modifier}+r" = ''mode "${resizeMode}"''; + "${modifier}+Escape" = ''mode "${powerManagementMode}"''; + "${modifier}+Shift+Escape" = ''mode "${miscellaneousMode}"''; + # workspace + # "${modifier}+Shift+minus" = "move scratchpad"; + # "${modifier}+minus" = "scratchpad show"; + # media + "XF86AudioRaiseVolume" = "exec --no-startup-id ${pactl} set-sink-volume @DEFAULT_SINK@ +1% && ${refresh_i3status}"; + "XF86AudioLowerVolume" = "exec --no-startup-id ${pactl} set-sink-volume @DEFAULT_SINK@ -1% && ${refresh_i3status}"; + "XF86AudioMute" = "exec --no-startup-id ${pactl} set-sink-mute @DEFAULT_SINK@ toggle && ${refresh_i3status}"; + "XF86AudioMicMute" = "exec --no-startup-id ${pactl} set-source-mute @DEFAULT_SOURCE@ toggle && ${refresh_i3status}"; + "XF86AudioPlay" = "exec --no-startup-id ${playerctl} play-pause"; + "XF86AudioPause" = "exec --no-startup-id ${playerctl} play-pause"; + "XF86AudioNext" = "exec --no-startup-id ${playerctl} next"; + "XF86AudioPrev" = "exec --no-startup-id ${playerctl} previous"; + # brightness + "XF86MonBrightnessUp" = "exec --no-startup-id ${light} s +10%"; + "XF86MonBrightnessDown" = "exec --no-startup-id ${light} s 10%-"; + # screenshot + "${modifier}+o" = "exec --no-startup-id ${maim} -s ~/Pictures/screenshots/$(date +%Y-%m-%d-%H-%M-%S).png"; + "${modifier}+Shift+o" = "exec --no-startup-id ${maim} -s | ${clipboard} -selection clipboard -t image/png"; + # others + "${modifier}+space" = "exec --no-startup-id ${dmenu}"; + "${modifier}+b" = "exec --no-startup-id ${yazi}"; + # "${modifier}+Shift+Return" = "exec ${second_terminal}"; + # reset + "${modifier}+Shift+e" = null; + "${modifier}+w" = null; + "${modifier}+d" = null; + }; + modes = let + exitMode = { + "Escape" = "mode default"; + "Return" = "mode default"; + }; + in + { + "${resizeMode}" = { + "Left" = "resize shrink width 10 px or 10 ppt"; + "Down" = "resize grow height 10 px or 10 ppt"; + "Up" = "resize shrink height 10 px or 10 ppt"; + "Right" = "resize grow width 10 px or 10 ppt"; + "Escape" = "mode default"; + "Return" = "mode default"; + } // exitMode; + "${powerManagementMode}" = { + l = "mode default, exec loginctl lock-session"; + e = "mode default, exec loginctl terminate-session $XDG_SESSION_ID"; + s = "mode default, exec systemctl suspend"; + h = "mode default, exec systemctl hibernate"; + "Shift+r" = "mode default, exec systemctl reboot"; + "Shift+s" = "mode default, exec systemctl poweroff"; + } // exitMode; + "${miscellaneousMode}" = { + p = "mode default, exec kill -SIGUSR1 $(pidof dunst)"; + c = "mode default, exec kill -SIGUSR2 $(pidof dunst"; + } // exitMode; + }; + startup = [ + { + command = "${pkgs.hsetroot}/bin/hsetroot -solid \"#062329\""; + notification = false; + } + { + command = "${pkgs.dex}/bin/dex --autostart --environment i3"; + notification = false; + } + { + command = "${pkgs.networkmanagerapplet}/bin/nm-applet"; + notification = false; + } + { + command = "${pkgs.pasystray}/bin/pasystray"; + notification = false; + } + { + command = "${pkgs.xss-lock}/bin/xss-lock --transfer-sleep-lock -- i3lock --nofork"; + notification = false; + } + { + command = "${pkgs.autorandr}/bin/autorandr -c"; + always = false; # Important, run only on first start (will loop otherwise)! + notification = false; + } + { + command = "${pkgs.xfce.xfce4-volumed-pulse}/bin/xfce4-volumed-pulse &"; + always = false; + notification = false; + } + { + command = "${light} s 25%"; + } + ]; + }; + }; + }; + }; +} diff --git a/home/i3/i3status.config b/home/i3/i3status.config new file mode 100644 index 0000000..58b9133 --- /dev/null +++ b/home/i3/i3status.config @@ -0,0 +1,52 @@ +general { + colors = true + interval = 5 +} + +# order += "ipv6" +order += "wireless _first_" +# order += "ethernet _first_" +order += "volume master" +order += "battery all" +order += "disk /" +order += "load" +order += "memory" +order += "tztime local" + +wireless _first_ { + format_up = "W: (%quality at %essid) %ip" + format_down = "W: down" +} + +ethernet _first_ { + format_up = "E: %ip (%speed)" + format_down = "E: down" +} + +battery all { + format = "%status %percentage %remaining" +} + +disk "/" { + format = "%avail" +} + +load { + format = "%1min" +} + +memory { + format = "%used | %available" + threshold_degraded = "1G" + format_degraded = "MEMORY < %available" +} + +tztime local { + format = "%Y-%m-%d %I:%M %p" +} + +volume master { + format = "V: %volume" + format_muted = "V: muted (%volume)" + device = "default" +} \ No newline at end of file diff --git a/home/kitty.nix b/home/kitty.nix new file mode 100644 index 0000000..77e65e2 --- /dev/null +++ b/home/kitty.nix @@ -0,0 +1,264 @@ +{ + config, + pkgs, + lib, + ... +}: +{ + options.custom.gui = with lib; { + kitty = { + enable = mkEnableOption "Enable kitty"; + }; + }; + + config = lib.mkIf config.custom.gui.kitty.enable { + programs.kitty = { + enable = true; + font = { + package = pkgs.vista-fonts; + name = "Consolas"; + size = 12.0; + }; + shellIntegration = { + enableBashIntegration = true; + }; + extraConfig = '' +modify_font cell_height 1.1 +# modify_font cell_width 95% +text_composition_strategy legacy + +background #062329 +foreground #d1b897 +cursor-color #ffffff +cursor-text #d1b897 +selection_background #0000ff +selection_foreground #d1b897 +color0 #062329 +# color1 #0b3335 +# color2 #0000ff +color3 #44b340 +color4 #8cde94 +color5 #d1b897 +color6 #c1d1e3 +color7 #ffffff +color8 #626880 +color9 #e67172 +color10 #8ec772 +color11 #d9ba73 +color12 #7b9ef0 +color13 #f2a4db +color14 #5abfb5 +color15 #b5bfe2 +''; + keybindings = { + # "CTRL+GRAVE_ACCENT" = "send_text all \x1b\x1f\x2a\x62\x1f"; + # "SHIFT+CTRL+GRAVE_ACCENT" = "send_text all \x1b\x1f\x2a\x63\x1f"; + # "CTRL+ALT+GRAVE_ACCENT" = "send_text all \x1b\x1f\x2a\x66\x1f"; + # "SHIFT+CTRL+ALT+GRAVE_ACCENT" = "send_text all \x1b\x1f\x2a\x67\x1f"; + # "CTRL+1" = "send_text all \x1b\x1f\x2b\x42\x1f"; + # "SHIFT+CTRL+1" = "send_text all \x1b\x1f\x2b\x43\x1f"; + # "CTRL+ALT+1" = "send_text all \x1b\x1f\x2b\x46\x1f"; + # "SHIFT+CTRL+ALT+1" = "send_text all \x1b\x1f\x2b\x47\x1f"; + # "CTRL+2" = "send_text all \x1b\x1f\x2c\x22\x1f"; + # "SHIFT+CTRL+2" = "send_text all \x1b\x1f\x2c\x23\x1f"; + # "CTRL+ALT+2" = "send_text all \x1b\x1f\x2c\x26\x1f"; + # "SHIFT+CTRL+ALT+2" = "send_text all \x1b\x1f\x2c\x27\x1f"; + # "CTRL+3" = "send_text all \x1b\x1f\x2c\x62\x1f"; + # "SHIFT+CTRL+3" = "send_text all \x1b\x1f\x2c\x63\x1f"; + # "CTRL+ALT+3" = "send_text all \x1b\x1f\x2c\x66\x1f"; + # "SHIFT+CTRL+ALT+3" = "send_text all \x1b\x1f\x2c\x67\x1f"; + # "CTRL+4" = "send_text all \x1b\x1f\x2d\x42\x1f"; + # "SHIFT+CTRL+4" = "send_text all \x1b\x1f\x2d\x43\x1f"; + # "CTRL+ALT+4" = "send_text all \x1b\x1f\x2d\x46\x1f"; + # "SHIFT+CTRL+ALT+4" = "send_text all \x1b\x1f\x2d\x47\x1f"; + # "CTRL+5" = "send_text all \x1b\x1f\x2e\x22\x1f"; + # "SHIFT+CTRL+5" = "send_text all \x1b\x1f\x2e\x23\x1f"; + # "CTRL+ALT+5" = "send_text all \x1b\x1f\x2e\x26\x1f"; + # "SHIFT+CTRL+ALT+5" = "send_text all \x1b\x1f\x2e\x27\x1f"; + # "CTRL+6" = "send_text all \x1b\x1f\x2e\x62\x1f"; + # "SHIFT+CTRL+6" = "send_text all \x1b\x1f\x2e\x63\x1f"; + # "CTRL+ALT+6" = "send_text all \x1b\x1f\x2e\x66\x1f"; + # "SHIFT+CTRL+ALT+6" = "send_text all \x1b\x1f\x2e\x67\x1f"; + # "CTRL+7" = "send_text all \x1b\x1f\x2f\x42\x1f"; + # "SHIFT+CTRL+7" = "send_text all \x1b\x1f\x2f\x43\x1f"; + # "CTRL+ALT+7" = "send_text all \x1b\x1f\x2f\x46\x1f"; + # "SHIFT+CTRL+ALT+7" = "send_text all \x1b\x1f\x2f\x47\x1f"; + # "CTRL+8" = "send_text all \x1b\x1f\x30\x22\x1f"; + # "SHIFT+CTRL+8" = "send_text all \x1b\x1f\x30\x23\x1f"; + # "CTRL+ALT+8" = "send_text all \x1b\x1f\x30\x26\x1f"; + # "SHIFT+CTRL+ALT+8" = "send_text all \x1b\x1f\x30\x27\x1f"; + # "CTRL+9" = "send_text all \x1b\x1f\x30\x62\x1f"; + # "SHIFT+CTRL+9" = "send_text all \x1b\x1f\x30\x63\x1f"; + # "CTRL+ALT+9" = "send_text all \x1b\x1f\x30\x66\x1f"; + # "SHIFT+CTRL+ALT+9" = "send_text all \x1b\x1f\x30\x67\x1f"; + # "CTRL+0" = "send_text all \x1b\x1f\x31\x42\x1f"; + # "SHIFT+CTRL+0" = "send_text all \x1b\x1f\x31\x43\x1f"; + # "CTRL+ALT+0" = "send_text all \x1b\x1f\x31\x46\x1f"; + # "SHIFT+CTRL+ALT+0" = "send_text all \x1b\x1f\x31\x47\x1f"; + # "CTRL+MINUS" = "send_text all \x1b\x1f\x32\x22\x1f"; + # "SHIFT+CTRL+MINUS" = "send_text all \x1b\x1f\x32\x23\x1f"; + # "CTRL+ALT+MINUS" = "send_text all \x1b\x1f\x32\x26\x1f"; + # "SHIFT+CTRL+ALT+MINUS" = "send_text all \x1b\x1f\x32\x27\x1f"; + # "CTRL+EQUAL" = "send_text all \x1b\x1f\x32\x62\x1f"; + # "SHIFT+CTRL+EQUAL" = "send_text all \x1b\x1f\x32\x63\x1f"; + # "CTRL+ALT+EQUAL" = "send_text all \x1b\x1f\x32\x66\x1f"; + # "SHIFT+CTRL+ALT+EQUAL" = "send_text all \x1b\x1f\x32\x67\x1f"; + # "SHIFT+BACKSPACE" = "send_text all \x1b\x1f\x33\x41\x1f"; + # "CTRL+BACKSPACE" = "send_text all \x1b\x1f\x33\x42\x1f"; + # "SHIFT+CTRL+BACKSPACE" = "send_text all \x1b\x1f\x33\x43\x1f"; + # "SHIFT+ALT+BACKSPACE" = "send_text all \x1b\x1f\x33\x45\x1f"; + # "CTRL+ALT+BACKSPACE" = "send_text all \x1b\x1f\x33\x46\x1f"; + # "SHIFT+CTRL+ALT+BACKSPACE" = "send_text all \x1b\x1f\x33\x47\x1f"; + # "CTRL+TAB" = "send_text all \x1b\x1f\x34\x22\x1f"; + # "SHIFT+CTRL+TAB" = "send_text all \x1b\x1f\x34\x23\x1f"; + # "CTRL+ALT+TAB" = "send_text all \x1b\x1f\x34\x26\x1f"; + # "SHIFT+CTRL+ALT+TAB" = "send_text all \x1b\x1f\x34\x27\x1f"; + # "SHIFT+CTRL+Q" = "send_text all \x1b\x1f\x34\x63\x1f"; + # "SHIFT+CTRL+ALT+Q" = "send_text all \x1b\x1f\x34\x67\x1f"; + # "SHIFT+CTRL+W" = "send_text all \x1b\x1f\x35\x43\x1f"; + # "SHIFT+CTRL+ALT+W" = "send_text all \x1b\x1f\x35\x47\x1f"; + # "SHIFT+CTRL+E" = "send_text all \x1b\x1f\x36\x23\x1f"; + # "SHIFT+CTRL+ALT+E" = "send_text all \x1b\x1f\x36\x27\x1f"; + # "SHIFT+CTRL+R" = "send_text all \x1b\x1f\x36\x63\x1f"; + # "SHIFT+CTRL+ALT+R" = "send_text all \x1b\x1f\x36\x67\x1f"; + # "SHIFT+CTRL+T" = "send_text all \x1b\x1f\x37\x43\x1f"; + # "SHIFT+CTRL+ALT+T" = "send_text all \x1b\x1f\x37\x47\x1f"; + # "SHIFT+CTRL+Y" = "send_text all \x1b\x1f\x38\x23\x1f"; + # "SHIFT+CTRL+ALT+Y" = "send_text all \x1b\x1f\x38\x27\x1f"; + # "SHIFT+CTRL+U" = "send_text all \x1b\x1f\x38\x63\x1f"; + # "SHIFT+CTRL+ALT+U" = "send_text all \x1b\x1f\x38\x67\x1f"; + # "SHIFT+CTRL+I" = "send_text all \x1b\x1f\x39\x43\x1f"; + # "SHIFT+CTRL+ALT+I" = "send_text all \x1b\x1f\x39\x47\x1f"; + # "SHIFT+CTRL+O" = "send_text all \x1b\x1f\x3a\x23\x1f"; + # "SHIFT+CTRL+ALT+O" = "send_text all \x1b\x1f\x3a\x27\x1f"; + # "SHIFT+CTRL+P" = "send_text all \x1b\x1f\x3a\x63\x1f"; + # "SHIFT+CTRL+ALT+P" = "send_text all \x1b\x1f\x3a\x67\x1f"; + # "CTRL+LEFT_BRACKET" = "send_text all \x1b\x1f\x3b\x42\x1f"; + # "SHIFT+CTRL+LEFT_BRACKET" = "send_text all \x1b\x1f\x3b\x43\x1f"; + # "CTRL+ALT+LEFT_BRACKET" = "send_text all \x1b\x1f\x3b\x46\x1f"; + # "SHIFT+CTRL+ALT+LEFT_BRACKET" = "send_text all \x1b\x1f\x3b\x47\x1f"; + # "CTRL+RIGHT_BRACKET" = "send_text all \x1b\x1f\x3c\x22\x1f"; + # "SHIFT+CTRL+RIGHT_BRACKET" = "send_text all \x1b\x1f\x3c\x23\x1f"; + # "CTRL+ALT+RIGHT_BRACKET" = "send_text all \x1b\x1f\x3c\x26\x1f"; + # "SHIFT+CTRL+ALT+RIGHT_BRACKET" = "send_text all \x1b\x1f\x3c\x27\x1f"; + # "SHIFT+ENTER" = "send_text all \x1b\x1f\x3c\x61\x1f"; + # "CTRL+ENTER" = "send_text all \x1b\x1f\x3c\x62\x1f"; + # "SHIFT+CTRL+ENTER" = "send_text all \x1b\x1f\x3c\x63\x1f"; + # "SHIFT+ALT+ENTER" = "send_text all \x1b\x1f\x3c\x65\x1f"; + # "CTRL+ALT+ENTER" = "send_text all \x1b\x1f\x3c\x66\x1f"; + # "SHIFT+CTRL+ALT+ENTER" = "send_text all \x1b\x1f\x3c\x67\x1f"; + # "SHIFT+CTRL+A" = "send_text all \x1b\x1f\x3e\x23\x1f"; + # "SHIFT+CTRL+ALT+A" = "send_text all \x1b\x1f\x3e\x27\x1f"; + # "SHIFT+CTRL+S" = "send_text all \x1b\x1f\x3e\x63\x1f"; + # "SHIFT+CTRL+ALT+S" = "send_text all \x1b\x1f\x3e\x67\x1f"; + # "SHIFT+CTRL+D" = "send_text all \x1b\x1f\x3f\x43\x1f"; + # "SHIFT+CTRL+ALT+D" = "send_text all \x1b\x1f\x3f\x47\x1f"; + # "SHIFT+CTRL+F" = "send_text all \x1b\x1f\x40\x23\x1f"; + # "SHIFT+CTRL+ALT+F" = "send_text all \x1b\x1f\x40\x27\x1f"; + # "SHIFT+CTRL+G" = "send_text all \x1b\x1f\x40\x63\x1f"; + # "CTRL+ALT+G" = "send_text all \x1b\x1f\x40\x66\x1f"; + # "SHIFT+CTRL+ALT+G" = "send_text all \x1b\x1f\x40\x67\x1f"; + # "SHIFT+CTRL+H" = "send_text all \x1b\x1f\x41\x43\x1f"; + # "SHIFT+CTRL+ALT+H" = "send_text all \x1b\x1f\x41\x47\x1f"; + # "SHIFT+CTRL+J" = "send_text all \x1b\x1f\x42\x23\x1f"; + # "SHIFT+CTRL+ALT+J" = "send_text all \x1b\x1f\x42\x27\x1f"; + # "SHIFT+CTRL+K" = "send_text all \x1b\x1f\x42\x63\x1f"; + # "SHIFT+CTRL+ALT+K" = "send_text all \x1b\x1f\x42\x67\x1f"; + # "SHIFT+CTRL+L" = "send_text all \x1b\x1f\x43\x43\x1f"; + # "SHIFT+CTRL+ALT+L" = "send_text all \x1b\x1f\x43\x47\x1f"; + # "CTRL+SEMICOLON" = "send_text all \x1b\x1f\x44\x22\x1f"; + # "SHIFT+CTRL+SEMICOLON" = "send_text all \x1b\x1f\x44\x23\x1f"; + # "CTRL+ALT+SEMICOLON" = "send_text all \x1b\x1f\x44\x26\x1f"; + # "SHIFT+CTRL+ALT+SEMICOLON" = "send_text all \x1b\x1f\x44\x27\x1f"; + # "CTRL+APOSTROPHE" = "send_text all \x1b\x1f\x44\x62\x1f"; + # "SHIFT+CTRL+APOSTROPHE" = "send_text all \x1b\x1f\x44\x63\x1f"; + # "CTRL+ALT+APOSTROPHE" = "send_text all \x1b\x1f\x44\x66\x1f"; + # "SHIFT+CTRL+ALT+APOSTROPHE" = "send_text all \x1b\x1f\x44\x67\x1f"; + # "CTRL+BACKSLASH" = "send_text all \x1b\x1f\x46\x22\x1f"; + # "SHIFT+CTRL+BACKSLASH" = "send_text all \x1b\x1f\x46\x23\x1f"; + # "CTRL+ALT+BACKSLASH" = "send_text all \x1b\x1f\x46\x26\x1f"; + # "SHIFT+CTRL+ALT+BACKSLASH" = "send_text all \x1b\x1f\x46\x27\x1f"; + # "SHIFT+CTRL+Z" = "send_text all \x1b\x1f\x46\x63\x1f"; + # "SHIFT+CTRL+ALT+Z" = "send_text all \x1b\x1f\x46\x67\x1f"; + # "SHIFT+CTRL+X" = "send_text all \x1b\x1f\x47\x43\x1f"; + # "SHIFT+CTRL+ALT+X" = "send_text all \x1b\x1f\x47\x47\x1f"; + # "SHIFT+CTRL+C" = "send_text all \x1b\x1f\x48\x23\x1f"; + # "SHIFT+CTRL+ALT+C" = "send_text all \x1b\x1f\x48\x27\x1f"; + # "SHIFT+CTRL+V" = "send_text all \x1b\x1f\x48\x63\x1f"; + # "SHIFT+CTRL+ALT+V" = "send_text all \x1b\x1f\x48\x67\x1f"; + # "SHIFT+CTRL+B" = "send_text all \x1b\x1f\x49\x43\x1f"; + # "SHIFT+CTRL+ALT+B" = "send_text all \x1b\x1f\x49\x47\x1f"; + # "SHIFT+CTRL+N" = "send_text all \x1b\x1f\x4a\x23\x1f"; + # "SHIFT+CTRL+ALT+N" = "send_text all \x1b\x1f\x4a\x27\x1f"; + # "SHIFT+CTRL+M" = "send_text all \x1b\x1f\x4a\x63\x1f"; + # "SHIFT+CTRL+ALT+M" = "send_text all \x1b\x1f\x4a\x67\x1f"; + # "CTRL+COMMA" = "send_text all \x1b\x1f\x4b\x42\x1f"; + # "SHIFT+CTRL+COMMA" = "send_text all \x1b\x1f\x4b\x43\x1f"; + # "CTRL+ALT+COMMA" = "send_text all \x1b\x1f\x4b\x46\x1f"; + # "SHIFT+CTRL+ALT+COMMA" = "send_text all \x1b\x1f\x4b\x47\x1f"; + # "CTRL+PERIOD" = "send_text all \x1b\x1f\x4c\x22\x1f"; # d + # "SHIFT+CTRL+PERIOD" = "send_text all \x1b\x1f\x4c\x23\x1f"; # d + # "CTRL+ALT+PERIOD" = "send_text all \x1b\x1f\x4c\x26\x1f"; # d + # "SHIFT+CTRL+ALT+PERIOD" = "send_text all \x1b\x1f\x4c\x27\x1f"; # d + # "CTRL+SLASH" = "send_text all \x1b\x1f\x4c\x62\x1f"; + # "SHIFT+CTRL+SLASH" = "send_text all \x1b\x1f\x4c\x63\x1f"; + # "CTRL+ALT+SLASH" = "send_text all \x1b\x1f\x4c\x66\x1f"; + # "SHIFT+CTRL+ALT+SLASH" = "send_text all \x1b\x1f\x4c\x67\x1f"; + # "CTRL+SPACE" = "send_text all \x1b\x1f\x50\x22\x1f"; + # "SHIFT+CTRL+SPACE" = "send_text all \x1b\x1f\x50\x23\x1f"; + # "CTRL+ALT+SPACE" = "send_text all \x1b\x1f\x50\x26\x1f"; + # "SHIFT+CTRL+ALT+SPACE" = "send_text all \x1b\x1f\x50\x27\x1f"; + # "MENU" = "send_text all \x1b\x1f\x52\x20\x1f"; + # "SHIFT+MENU" = "send_text all \x1b\x1f\x52\x21\x1f"; + # "CTRL+MENU" = "send_text all \x1b\x1f\x52\x22\x1f"; + # "SHIFT+CTRL+MENU" = "send_text all \x1b\x1f\x52\x23\x1f"; + # "ALT+MENU" = "send_text all \x1b\x1f\x52\x24\x1f"; + # "SHIFT+ALT+MENU" = "send_text all \x1b\x1f\x52\x25\x1f"; + # "CTRL+ALT+MENU" = "send_text all \x1b\x1f\x52\x26\x1f"; + # "SHIFT+CTRL+ALT+MENU" = "send_text all \x1b\x1f\x52\x27\x1f"; + # "SHIFT+CTRL+UP" = "send_text all \x1b\x1f\x53\x43\x1f"; + # "ALT+UP" = "send_text all \x1b\x1f\x53\x44\x1f"; + # "SHIFT+ALT+UP" = "send_text all \x1b\x1f\x53\x45\x1f"; + # "CTRL+ALT+UP" = "send_text all \x1b\x1f\x53\x46\x1f"; + # "SHIFT+CTRL+ALT+UP" = "send_text all \x1b\x1f\x53\x47\x1f"; + # "SHIFT+CTRL+DOWN" = "send_text all \x1b\x1f\x54\x23\x1f"; + # "ALT+DOWN" = "send_text all \x1b\x1f\x54\x24\x1f"; + # "SHIFT+ALT+DOWN" = "send_text all \x1b\x1f\x54\x25\x1f"; + # "CTRL+ALT+DOWN" = "send_text all \x1b\x1f\x54\x26\x1f"; + # "SHIFT+CTRL+ALT+DOWN" = "send_text all \x1b\x1f\x54\x27\x1f"; + # "SHIFT+CTRL+LEFT" = "send_text all \x1b\x1f\x54\x63\x1f"; + # "ALT+LEFT" = "send_text all \x1b\x1f\x54\x64\x1f"; + # "SHIFT+ALT+LEFT" = "send_text all \x1b\x1f\x54\x65\x1f"; + # "CTRL+ALT+LEFT" = "send_text all \x1b\x1f\x54\x66\x1f"; + # "SHIFT+CTRL+ALT+LEFT" = "send_text all \x1b\x1f\x54\x67\x1f"; + # "SHIFT+CTRL+RIGHT" = "send_text all \x1b\x1f\x55\x43\x1f"; + # "ALT+RIGHT" = "send_text all \x1b\x1f\x55\x44\x1f"; + # "SHIFT+ALT+RIGHT" = "send_text all \x1b\x1f\x55\x45\x1f"; + # "CTRL+ALT+RIGHT" = "send_text all \x1b\x1f\x55\x46\x1f"; + # "SHIFT+CTRL+ALT+RIGHT" = "send_text all \x1b\x1f\x55\x47\x1f"; + # "SHIFT+CTRL+HOME" = "send_text all \x1b\x1f\x57\x43\x1f"; + # "ALT+HOME" = "send_text all \x1b\x1f\x57\x44\x1f"; + # "SHIFT+ALT+HOME" = "send_text all \x1b\x1f\x57\x45\x1f"; + # "CTRL+ALT+HOME" = "send_text all \x1b\x1f\x57\x46\x1f"; + # "SHIFT+CTRL+ALT+HOME" = "send_text all \x1b\x1f\x57\x47\x1f"; + # "SHIFT+CTRL+END" = "send_text all \x1b\x1f\x58\x23\x1f"; + # "ALT+END" = "send_text all \x1b\x1f\x58\x24\x1f"; + # "SHIFT+ALT+END" = "send_text all \x1b\x1f\x58\x25\x1f"; + # "CTRL+ALT+END" = "send_text all \x1b\x1f\x58\x26\x1f"; + # "SHIFT+CTRL+ALT+END" = "send_text all \x1b\x1f\x58\x27\x1f"; + # "SHIFT+PAGE_UP" = "send_text all \x1b\x1f\x58\x61\x1f"; + # "SHIFT+CTRL+PAGE_UP" = "send_text all \x1b\x1f\x58\x63\x1f"; + # "ALT+PAGE_UP" = "send_text all \x1b\x1f\x58\x64\x1f"; + # "SHIFT+ALT+PAGE_UP" = "send_text all \x1b\x1f\x58\x65\x1f"; + # "CTRL+ALT+PAGE_UP" = "send_text all \x1b\x1f\x58\x66\x1f"; + # "SHIFT+CTRL+ALT+PAGE_UP" = "send_text all \x1b\x1f\x58\x67\x1f"; + # "SHIFT+PAGE_DOWN" = "send_text all \x1b\x1f\x59\x41\x1f"; + # "SHIFT+CTRL+PAGE_DOWN" = "send_text all \x1b\x1f\x59\x43\x1f"; + # "ALT+PAGE_DOWN" = "send_text all \x1b\x1f\x59\x44\x1f"; + # "SHIFT+ALT+PAGE_DOWN" = "send_text all \x1b\x1f\x59\x45\x1f"; + # "CTRL+ALT+PAGE_DOWN" = "send_text all \x1b\x1f\x59\x46\x1f"; + # "SHIFT+CTRL+ALT+PAGE_DOWN" = "send_text all \x1b\x1f\x59\x47\x1f"; + }; + }; + }; +} diff --git a/home/ssh/config b/home/ssh/config new file mode 100644 index 0000000..ba3c26d --- /dev/null +++ b/home/ssh/config @@ -0,0 +1,282 @@ +# Argonne + +Host login-gce + User rayandrew + HostName logins.cels.anl.gov + ControlMaster auto + ControlPersist yes + LogLevel FATAL + +Host *.cels.anl.gov !logins.cels.anl.gov + ForwardX11Trusted yes + User rayandrew + ProxyJump login-gce + +Host bebop + ForwardX11Trusted yes + User rayandrew + HostName bebop.lcrc.anl.gov + ControlMaster auto + ControlPersist yes + LogLevel FATAL + +Host swing + ForwardX11Trusted yes + User rayandrew + HostName swing.lcrc.anl.gov + ControlMaster auto + ControlPersist yes + LogLevel FATAL + +Host *.lcrc.anl.gov + ForwardX11Trusted yes + User rayandrew + ControlMaster auto + ControlPersist yes + LogLevel FATAL + +Host homes-gce + ForwardX11Trusted yes + User rayandrew + HostName homes.cels.anl.gov + ProxyJump login-gce + +Host theta + ForwardX11Trusted yes + User rayandrew + HostName thetalogin5.alcf.anl.gov + ControlMaster auto + ControlPersist yes + LogLevel FATAL + +Host polaris + ForwardX11Trusted yes + User rayandrew + HostName polaris.alcf.anl.gov + ControlMaster auto + ControlPersist yes + LogLevel FATAL + +Host sophia + ForwardX11Trusted yes + User rayandrew + HostName sophia.alcf.anl.gov + ControlMaster auto + ControlPersist yes + LogLevel FATAL + +# LLNL + +Host lassen + ForwardX11Trusted yes + User sinurat1 + HostName lassen.llnl.gov + ControlMaster auto + ControlPersist yes + LogLevel FATAL + +Host corona + ForwardX11Trusted yes + User sinurat1 + HostName corona.llnl.gov + ControlMaster auto + ControlPersist yes + LogLevel FATAL + +Host czgitlab + HostName czgitlab.llnl.gov + ProxyCommand ssh oslic -W %h:7999 + ControlMaster no + User sinurat1 + +Host oslic + ForwardX11Trusted yes + Hostname oslic.llnl.gov + PreferredAuthentications password + User sinurat1 + ControlMaster auto + ControlPersist yes + LogLevel FATAL + +# Box + +Host box + Port 23 + ForwardAgent yes + ForwardX11 yes + User u369179 + HostName box.rs.ht + ControlMaster auto + ControlPersist yes + LogLevel FATAL + RequestTTY yes + +Host personal-box + Port 23 + ForwardAgent yes + ForwardX11 yes + User u369179-sub2 + HostName box.rs.ht + ControlMaster auto + ControlPersist yes + LogLevel FATAL + RequestTTY yes + +Host clio-box + Port 23 + ForwardAgent yes + ForwardX11 yes + User u369179-sub3 + HostName box.rs.ht + ControlMaster auto + ControlPersist yes + LogLevel FATAL + RequestTTY yes + +Host cl-data + ForwardAgent yes + ForwardX11 yes + User rayandrew + HostName 192.5.87.68 + RequestTTY yes + +Host clperf-box + Port 23 + ForwardAgent yes + ForwardX11 yes + User u369179-sub1 + HostName box.rs.ht + ControlMaster auto + ControlPersist yes + LogLevel FATAL + RequestTTY yes + +Host flashnet-box + Port 23 + ForwardAgent yes + ForwardX11 yes + User u369179-sub4 + HostName box.rs.ht + ControlMaster auto + ControlPersist yes + LogLevel FATAL + RequestTTY yes + +# UChicago + +Host cs-uc + User rayandrew + HostName linux.cs.uchicago.edu + # ControlMaster auto + # ControlPersist yes + LogLevel FATAL + ForwardAgent yes + ForwardX11 yes + +Host cs-uc-06 + User rayandrew + HostName linux6.cs.uchicago.edu + # ControlMaster auto + # ControlPersist yes + LogLevel FATAL + ForwardAgent yes + ForwardX11 yes + +Host cs-uc-07 + User rayandrew + HostName linux7.cs.uchicago.edu + # ControlMaster auto + # ControlPersist yes + LogLevel FATAL + ForwardAgent yes + ForwardX11 yes + +Host ucare-gpu-1.cs.uchicago.edu + ForwardAgent yes + ForwardX11 yes + ForwardX11Trusted yes + User rayandrew + HostName ucare-gpu-1.cs.uchicago.edu + ProxyJump cs-uc-06 + # ControlMaster auto + # ControlPersist yes + LogLevel FATAL + RequestTTY yes + +Host ucare-gpu-1 + ForwardAgent yes + ForwardX11 yes + ForwardX11Trusted yes + User rayandrew + HostName ucare-gpu-1.cs.uchicago.edu + ProxyJump cs-uc-06 + # ControlMaster auto + # ControlPersist yes + LogLevel FATAL + RequestTTY yes + +Host ucare-07 + ForwardAgent yes + ForwardX11 yes + User rayandrew + HostName ucare-07.cs.uchicago.edu + RequestTTY yes + ProxyJump cs-uc + +Host ucare-10 + ForwardAgent yes + ForwardX11 yes + ForwardX11Trusted yes + User rayandrew + HostName ucare-10.cs.uchicago.edu + RequestTTY yes + ProxyJump cs-uc + LogLevel FATAL + +Host ucare-mini + ForwardAgent yes + ForwardX11 yes + User ucare + HostName ucare-mini.cs.uchicago.edu + RequestTTY yes + +# General + +Host *.amazonaws.com + ControlMaster no + ControlPath none + LogLevel FATAL + RequestTTY yes + +Host *.github.com + AddKeysToAgent yes + +# CC + +Host ray-stor + HostName 192.5.87.101 + User cc + ForwardAgent yes + ForwardX11 yes + RequestTTY yes + LogLevel FATAL + +Host ray-st + HostName 192.5.87.59 + User cc + ForwardAgent yes + ForwardX11 yes + RequestTTY yes + LogLevel FATAL + +Host * + ForwardAgent no + AddKeysToAgent no + Compression no + ServerAliveInterval 10 + ServerAliveCountMax 120 + HashKnownHosts no + UserKnownHostsFile ~/.ssh/known_hosts + ControlMaster no + ControlPath ~/.ssh/.control-channels/%h:%p:%r + ControlPersist no diff --git a/home/ssh/default.nix b/home/ssh/default.nix new file mode 100644 index 0000000..d49ae04 --- /dev/null +++ b/home/ssh/default.nix @@ -0,0 +1,17 @@ +{ + config, + pkgs, + dots, + ... +}: +{ + programs.ssh = { + enable = false; + }; + + home.packages = with pkgs; [ + openssh + ]; + + home.file.".ssh/config".source = config.lib.file.mkOutOfStoreSymlink "${dots}/home/ssh/config"; +} diff --git a/hosts/default.nix b/hosts/default.nix new file mode 100644 index 0000000..9b3cb3b --- /dev/null +++ b/hosts/default.nix @@ -0,0 +1,63 @@ +{ + inputs, + lib, + system, + specialArgs, + dots, + user ? "rayandrew", + ... +}: +let + mkNixosConfiguration = + host: + { + pkgs ? ( + import inputs.nixpkgs { + inherit system; + config.allowUnfree = true; + } + ), + }: + lib.nixosSystem { + inherit pkgs; + + specialArgs = specialArgs // { + inherit host user dots; + }; + + modules = [ + inputs.disko.nixosModules.default + ./${host} + ./${host}/hardware.nix + ../nixos + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + + extraSpecialArgs = specialArgs // { + inherit host user system dots; + }; + + users.${user} = { + imports = [ + # inputs.nix-index-database.hmModules.nix-index + ./${host}/home.nix + ../home + ]; + }; + }; + } + # alias for home-manager + (lib.mkAliasOptionModule [ "hm" ] [ + "home-manager" + "users" + user + ]) + inputs.home-manager.nixosModules.home-manager + ]; + }; +in +{ + pickwick = mkNixosConfiguration "pickwick" { }; +} diff --git a/hosts/pickwick/default.nix b/hosts/pickwick/default.nix new file mode 100644 index 0000000..7e6fd9f --- /dev/null +++ b/hosts/pickwick/default.nix @@ -0,0 +1,50 @@ +# This is your system's configuration file. +# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) +{ + inputs, + lib, + config, + pkgs, + system, + dots, + user, + hm, + ... +}: { + # You can import other NixOS modules here + imports = [ + ./hardware.nix + ]; + + custom = { + keyd.enable = true; + displaymanager.enable = true; + _1password.enable = true; + }; + + networking.hostName = "pickwick"; + time.timeZone = "America/Chicago"; + + users.users = { + rayandrew = { + initialPassword = "abc123"; + isNormalUser = true; + openssh.authorizedKeys.keys = []; + extraGroups = ["wheel" "video" "audio" "networkmanager"]; + }; + }; + + # home-manager = { + # useGlobalPkgs = true; + # useUserPackages = true; + # extraSpecialArgs = { inherit inputs system dots user hm; }; + # users.rayandrew = { + # imports = [ + # ./home; + # ]; + # }; + # }; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + system.stateVersion = "25.05"; +} diff --git a/hosts/pickwick/disko.nix b/hosts/pickwick/disko.nix new file mode 100644 index 0000000..2ffdb6e --- /dev/null +++ b/hosts/pickwick/disko.nix @@ -0,0 +1,66 @@ +{ + device ? throw "select device" +, ... +}: +{ + disko.devices = { + disk = { + main = { + inherit device; + type = "disk"; + content = { + type = "gpt"; + partitions = { + boot = { + name = "boot"; + size = "1M"; + type = "EF02"; + }; + ESP = { + priority = 1; + size = "1G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ + "defaults" + "umask=0077" + ]; + extraArgs = [ + "-n" + "BOOT" + ]; + }; + }; + swap = { + size = "108G"; + content = { + type = "swap"; + discardPolicy = "both"; + resumeDevice = true; + extraArgs = [ + "--label" + "SWAP" + ]; + }; + }; + root = { + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + extraArgs = [ + "-L" + "ROOT" + ]; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/hosts/pickwick/hardware.nix b/hosts/pickwick/hardware.nix new file mode 100644 index 0000000..f6b6b02 --- /dev/null +++ b/hosts/pickwick/hardware.nix @@ -0,0 +1,34 @@ +{ config, lib, pkgs, modulesPath, ... }: +{ + boot.loader.systemd-boot.enable = true; + + + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + (import ./disko.nix { device = "/dev/nvme0n1"; }) + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.eth0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + + swapDevices = [ + { + device = "/dev/disk/by-label/SWAP"; + } + ]; + zramSwap.enable = true; +} diff --git a/hosts/pickwick/home.nix b/hosts/pickwick/home.nix new file mode 100644 index 0000000..d657c95 --- /dev/null +++ b/hosts/pickwick/home.nix @@ -0,0 +1,15 @@ +{ + config, + lib, + pkgs, + ... +}: +{ + custom = { + gui = { + default.enable = true; + i3.enable = true; + ghostty.enable = true; + }; + }; +} diff --git a/nixos/1password.nix b/nixos/1password.nix new file mode 100644 index 0000000..b80890d --- /dev/null +++ b/nixos/1password.nix @@ -0,0 +1,34 @@ +{ + config, + lib, + pkgs, + ... +}: +{ + options.custom = with lib; { + _1password = { + enable = mkEnableOption "Enable 1password"; + }; + }; + + config = lib.mkIf config.custom._1password.enable { + programs._1password.enable = true; + programs._1password-gui = { + enable = true; + polkitPolicyOwners = [ "rayandrew" ]; + }; + + environment.etc = { + "1password/custom_allowed_browsers" = { + text = '' +zen +zen-twilight +.zen-wrapped +.firefox-wrapped +firefox + ''; + mode = "0755"; + }; + }; + }; +} diff --git a/nixos/default.nix b/nixos/default.nix new file mode 100644 index 0000000..56b4ae9 --- /dev/null +++ b/nixos/default.nix @@ -0,0 +1,127 @@ +{ + inputs, + lib, + config, + pkgs, + system, + ... +}: { + imports = [ + ./1password.nix + ./displaymanager.nix + ./keyd.nix + ]; + + # nixpkgs = { + # # You can add overlays here + # overlays = [ + # # If you want to use overlays exported from other flakes: + # # neovim-nightly-overlay.overlays.default + # + # # Or define it inline, for example: + # # (final: prev: { + # # hi = final.hello.overrideAttrs (oldAttrs: { + # # patches = [ ./change-hello-to-hi.patch ]; + # # }); + # # }) + # ]; + # # Configure your nixpkgs instance + # config = { + # # Disable if you don't want unfree packages + # allowUnfree = true; + # }; + # }; + + nix = let + flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs; + in { + settings = { + # Enable flakes and new 'nix' command + experimental-features = "nix-command flakes"; + # Opinionated: disable global registry + flake-registry = ""; + # Workaround for https://github.com/NixOS/nix/issues/9574 + nix-path = config.nix.nixPath; + }; + # Opinionated: disable channels + channel.enable = false; + + # Opinionated: make flake registry and nix path match flake inputs + registry = lib.mapAttrs (_: flake: {inherit flake;}) flakeInputs; + nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs; + }; + + # networking + networking.hostId = builtins.substring 0 8 (builtins.hashString "md5" config.networking.hostName); + networking.networkmanager.enable = true; + + programs.dconf.enable = true; + services.pulseaudio.enable = false; + services.libinput = { + enable = true; + touchpad = { + disableWhileTyping = true; + naturalScrolling = true; + }; + }; + + # bluetooth + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + }; + services.blueman.enable = true; + + # pipewire + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + + # disable camera to save battery + # https://reddit.com/r/linux/comments/1em8biv/psa_pipewire_has_been_halving_your_battery_life/ + wireplumber = { + enable = true; + extraConfig = { + "10-disable-camera" = { + "wireplumber.profiles" = { + main."monitor.libcamera" = "disabled"; + }; + }; + "10-bluez" = { + "monitor.bluez.properties" = { + "bluez5.enable-sbc-xq" = true; + "bluez5.enable-msbc" = true; + "bluez5.enable-hw-volume" = true; + "bluez5.roles" = [ + "hsp_hs" + "hsp_ag" + "hfp_hf" + "hfp_ag" + ]; + }; + }; + }; + }; + }; + + services.openssh = { + enable = true; + settings = { + # Opinionated: forbid root login through SSH. + PermitRootLogin = "no"; + # Opinionated: use keys only. + # Remove if you want to SSH using passwords + PasswordAuthentication = false; + }; + }; + + environment.systemPackages = with pkgs; [ + vim + htop + pwvucontrol + ]; +} diff --git a/nixos/displaymanager.nix b/nixos/displaymanager.nix new file mode 100644 index 0000000..764a263 --- /dev/null +++ b/nixos/displaymanager.nix @@ -0,0 +1,55 @@ +{ + config, + pkgs, + lib, + ... +}: +{ + options.custom = with lib; { + displaymanager = { + enable = mkEnableOption "Enable displaymanager"; + }; + }; + + config = lib.mkIf config.custom.displaymanager.enable { + services = { + xserver = { + enable = true; + desktopManager = { + xterm.enable = false; + }; + displayManager = { + lightdm = { + enable = true; + greeters.enso = { + enable = true; + }; + }; + session = [ + { + manage = "window"; + name = "hm"; + start = '' + export CURRENT_XSESSION="hm" + ${pkgs.stdenv.shell} $HOME/.xsession-hm & + waitPID=$! + ''; + } + ]; + }; + windowManager.i3 = { + enable = true; + extraPackages = with pkgs; [ + dmenu + i3status + i3lock + ]; + }; + }; + xserver.xkb.layout = "us"; + gnome.gnome-keyring.enable = true; + }; + + security.polkit.enable = true; + }; +} diff --git a/nixos/keyd.nix b/nixos/keyd.nix new file mode 100644 index 0000000..331ec7c --- /dev/null +++ b/nixos/keyd.nix @@ -0,0 +1,71 @@ +{ + config, + lib, + pkgs, + ... +}: +let + commonSettings = { + main = { + capslock = "layer(capslock)"; + insert = "S-insert"; + }; + meta = { + w = "macro(C-w)"; + a = "macro(C-a)"; + }; + "capslock:C" = { }; + }; +in +{ + options.custom = with lib; { + keyd = { + enable = mkEnableOption "Enable keyd"; + }; + }; + + + config = lib.mkIf config.custom.keyd.enable { + environment.systemPackages = with pkgs; [ + keyd + ]; + + users.groups.keyd = { }; + services.keyd = { + enable = true; + keyboards = { + default = { + ids = [ "*" ]; + settings = commonSettings; + }; + workstation = { + ids = [ + "0001:0001:70533846" # framework + "3434:06a0:d7dfbeabt" # keychron q10 + "046d:c339:9f276ca6" # Logitech Pro + ]; + settings = lib.mkMerge [ + commonSettings + { + main = { + leftalt = "layer(meta)"; + leftmeta = "layer(alt)"; + }; + } + ]; + }; + }; + }; + + systemd.services.keyd.serviceConfig.CapabilityBoundingSet = [ + "CAP_SETGID" + ]; + + environment.etc."libinput/local-overrides.quirks".text = '' + [Serial Keyboards] + MatchUdevType=keyboard + MatchName=keyd virtual keyboard + AttrKeyboardIntegration=internal + ''; + }; +}