├── .gitignore ├── LICENSE ├── README.md ├── flake.lock ├── flake.nix ├── hardware-configuration.nix ├── home ├── .cargo │ └── config.toml ├── .config │ ├── awesome │ │ ├── .luarc.json │ │ ├── keys.lua │ │ ├── rc.lua │ │ ├── theme.lua │ │ └── widget.lua │ ├── bottom │ │ └── bottom.toml │ ├── fcitx5 │ │ ├── conf │ │ │ ├── classicui.conf │ │ │ ├── clipboard.conf │ │ │ └── quickphrase.conf │ │ └── config │ ├── fd │ │ └── ignore │ ├── gtk-4.0 │ │ └── gtk.css │ ├── mmtc │ │ └── mmtc.ron │ └── mpv │ │ ├── mpv.conf │ │ └── script-opts │ │ └── mpv_thumbnail_script.conf └── .local │ └── share │ └── fcitx5 │ ├── rime │ ├── default.custom.yaml │ └── luna_pinyin.custom.yaml │ └── themes │ └── dark │ └── theme.conf ├── install ├── rebuild ├── src ├── _colors.nix ├── _pkgs │ ├── alacritty.nix │ ├── ghtok.nix │ ├── icon-theme.nix │ ├── lockscreen.nix │ ├── mpv.nix │ ├── nixpkgs-review.nix │ ├── r.nix │ ├── rofi-todo.nix │ └── rust.nix ├── boot.nix ├── default.nix ├── environment │ ├── etc.nix │ ├── flat-dark.rasi │ ├── rofi.rasi │ ├── systemPackages.nix │ └── variables.nix ├── fonts.nix ├── i18n.nix ├── networking.nix ├── nix.nix ├── nixpkgs.nix ├── programs │ ├── default.nix │ ├── fish │ │ ├── default.nix │ │ ├── interactiveShellInit.nix │ │ ├── loginShellInit.nix │ │ ├── shellAbbrs.nix │ │ └── shellAliases.nix │ ├── git │ │ ├── config.nix │ │ └── default.nix │ ├── neovim │ │ ├── configure │ │ │ ├── .luarc.json │ │ │ ├── _colorscheme.nix │ │ │ ├── autopairs.lua │ │ │ ├── before.lua │ │ │ ├── customRC.nix │ │ │ ├── init.lua │ │ │ ├── init.vim │ │ │ ├── packages.nix │ │ │ ├── plugins.lua │ │ │ └── snippets.lua │ │ └── default.nix │ ├── ssh │ │ ├── askPassword.nix │ │ ├── extraConfig.nix │ │ └── knownHosts.nix │ └── starship.nix ├── services │ ├── default.nix │ ├── libinput.nix │ ├── udev.nix │ └── xserver.nix ├── systemd │ ├── services │ │ ├── lockscreen.nix │ │ └── nixos-upgrade.nix │ └── timers.nix ├── users │ └── users │ │ └── figsoda.nix ├── virtualisation │ └── podman.nix └── xdg │ └── mime.nix └── stylua.toml /.gitignore: -------------------------------------------------------------------------------- 1 | /result 2 | /result-* 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # cfg 2 | 3 | NixOS configuration featuring [awesome](https://github.com/awesomewm/awesome) and [neovim](https://github.com/neovim/neovim) 4 | 5 | ![](https://user-images.githubusercontent.com/40620903/232329160-f3b4ff47-185a-4b4b-ad5f-ad1720e2dbc9.png) 6 | 7 | ## Installation 8 | 9 | ```ShellSession 10 | # mount /dev/disk/by-label/nixos /mnt 11 | # mkdir /mnt/boot 12 | # mount /dev/disk/by-label/BOOT /mnt/boot 13 | # swapon /dev/disk/by-label/swap 14 | # nixos-generate-config --root /mnt 15 | # rm /mnt/etc/nixos/configuration.nix 16 | # git clone https://github.com/figsoda/cfg 17 | # cp -r cfg/{src,flake.*} /mnt/etc/nixos 18 | # nixos-install --flake /mnt/etc/nixos#nixos --no-channel-copy 19 | # reboot 20 | 21 | # passwd figsoda 22 | 23 | $ git clone https://github.com/figsoda/cfg 24 | $ cfg/install 25 | $ secret-tool store github git --label github-token 26 | ``` 27 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "fenix": { 4 | "inputs": { 5 | "nixpkgs": [ 6 | "nixpkgs" 7 | ], 8 | "rust-analyzer-src": "rust-analyzer-src" 9 | }, 10 | "locked": { 11 | "lastModified": 1742106676, 12 | "narHash": "sha256-3ehv1oScQfhVi9JcBGbvVkop+m7icKcRUi8MzjIYC5I=", 13 | "owner": "nix-community", 14 | "repo": "fenix", 15 | "rev": "9906c9f9a474f189df09629cf2813e8888d42429", 16 | "type": "github" 17 | }, 18 | "original": { 19 | "owner": "nix-community", 20 | "repo": "fenix", 21 | "type": "github" 22 | } 23 | }, 24 | "figsoda-pkgs": { 25 | "inputs": { 26 | "nixpkgs": [ 27 | "nixpkgs" 28 | ], 29 | "rust-templates": "rust-templates", 30 | "ymdl": "ymdl" 31 | }, 32 | "locked": { 33 | "lastModified": 1741940066, 34 | "narHash": "sha256-fQUW4ySJvk634tBH5fiNUlF5gWkFSVI4vpmrxLO1yFU=", 35 | "owner": "figsoda", 36 | "repo": "pkgs", 37 | "rev": "124822e881849e75841ecc85256e703189b70aad", 38 | "type": "github" 39 | }, 40 | "original": { 41 | "owner": "figsoda", 42 | "repo": "pkgs", 43 | "type": "github" 44 | } 45 | }, 46 | "flake-registry": { 47 | "flake": false, 48 | "locked": { 49 | "lastModified": 1734450202, 50 | "narHash": "sha256-/3gigrEBFORQs6a8LL5twoHs7biu08y/8Xc5aQmk3b0=", 51 | "owner": "nixos", 52 | "repo": "flake-registry", 53 | "rev": "02fe640c9e117dd9d6a34efc7bcb8bd09c08111d", 54 | "type": "github" 55 | }, 56 | "original": { 57 | "owner": "nixos", 58 | "repo": "flake-registry", 59 | "type": "github" 60 | } 61 | }, 62 | "haumea": { 63 | "inputs": { 64 | "nixpkgs": [ 65 | "nixpkgs" 66 | ] 67 | }, 68 | "locked": { 69 | "lastModified": 1, 70 | "narHash": "sha256-FePm/Gi9PBSNwiDFq3N+DWdfxFq0UKsVVTJS3cQPn94=", 71 | "rev": "34dd58385092a23018748b50f9b23de6266dffc2", 72 | "revCount": 53, 73 | "type": "tarball", 74 | "url": "https://api.flakehub.com/f/pinned/nix-community/haumea/0.2.2/0189dfd6-5068-7a4f-9aba-705d0c9c9181/source.tar.gz" 75 | }, 76 | "original": { 77 | "type": "tarball", 78 | "url": "https://flakehub.com/f/nix-community/haumea/0.2.tar.gz" 79 | } 80 | }, 81 | "nix-index-database": { 82 | "inputs": { 83 | "nixpkgs": [ 84 | "nixpkgs" 85 | ] 86 | }, 87 | "locked": { 88 | "lastModified": 1742096597, 89 | "narHash": "sha256-CUy00dj513aIvtN2NGiDKLCVEQSz4xHWSDf229EiJdU=", 90 | "owner": "nix-community", 91 | "repo": "nix-index-database", 92 | "rev": "5c77c6d6f2e8cc6007c2b1a4df1a507834404a67", 93 | "type": "github" 94 | }, 95 | "original": { 96 | "owner": "nix-community", 97 | "repo": "nix-index-database", 98 | "type": "github" 99 | } 100 | }, 101 | "nixos-hardware": { 102 | "locked": { 103 | "lastModified": 1741792691, 104 | "narHash": "sha256-f0BVt1/cvA0DQ/q3rB+HY4g4tKksd03ZkzI4xehC2Ew=", 105 | "owner": "nixos", 106 | "repo": "nixos-hardware", 107 | "rev": "e1f12151258b12c567f456d8248e4694e9390613", 108 | "type": "github" 109 | }, 110 | "original": { 111 | "owner": "nixos", 112 | "repo": "nixos-hardware", 113 | "type": "github" 114 | } 115 | }, 116 | "nixpkgs": { 117 | "locked": { 118 | "lastModified": 1742069588, 119 | "narHash": "sha256-C7jVfohcGzdZRF6DO+ybyG/sqpo1h6bZi9T56sxLy+k=", 120 | "owner": "nixos", 121 | "repo": "nixpkgs", 122 | "rev": "c80f6a7e10b39afcc1894e02ef785b1ad0b0d7e5", 123 | "type": "github" 124 | }, 125 | "original": { 126 | "owner": "nixos", 127 | "ref": "nixos-unstable", 128 | "repo": "nixpkgs", 129 | "type": "github" 130 | } 131 | }, 132 | "root": { 133 | "inputs": { 134 | "fenix": "fenix", 135 | "figsoda-pkgs": "figsoda-pkgs", 136 | "flake-registry": "flake-registry", 137 | "haumea": "haumea", 138 | "nix-index-database": "nix-index-database", 139 | "nixos-hardware": "nixos-hardware", 140 | "nixpkgs": "nixpkgs" 141 | } 142 | }, 143 | "rust-analyzer-src": { 144 | "flake": false, 145 | "locked": { 146 | "lastModified": 1742071726, 147 | "narHash": "sha256-DnmN/Sj9g8b0jDmXI0V2erPqPBSRfAlUdtPbZ2zD3M4=", 148 | "owner": "rust-lang", 149 | "repo": "rust-analyzer", 150 | "rev": "78aee2a4246d5f3df88893752bceb8fe4a315951", 151 | "type": "github" 152 | }, 153 | "original": { 154 | "owner": "rust-lang", 155 | "ref": "nightly", 156 | "repo": "rust-analyzer", 157 | "type": "github" 158 | } 159 | }, 160 | "rust-templates": { 161 | "flake": false, 162 | "locked": { 163 | "lastModified": 1694197244, 164 | "narHash": "sha256-r2BAm47tgddGMHemEFuulbjzO6PvvalcjkVTmNFF7nU=", 165 | "owner": "figsoda", 166 | "repo": "rust-templates", 167 | "rev": "3b51751eeeafb847f12bdf3cfe1d273914c661d0", 168 | "type": "github" 169 | }, 170 | "original": { 171 | "owner": "figsoda", 172 | "repo": "rust-templates", 173 | "type": "github" 174 | } 175 | }, 176 | "ymdl": { 177 | "flake": false, 178 | "locked": { 179 | "lastModified": 1631585381, 180 | "narHash": "sha256-7XVq+xsPx51LtTeF1yHm8+GO3H8LCzSiwzmbEhyJ81w=", 181 | "owner": "figsoda", 182 | "repo": "ymdl", 183 | "rev": "7c587526ab07e791e4aa9bae51e87af861eeaf10", 184 | "type": "github" 185 | }, 186 | "original": { 187 | "owner": "figsoda", 188 | "repo": "ymdl", 189 | "type": "github" 190 | } 191 | } 192 | }, 193 | "root": "root", 194 | "version": 7 195 | } 196 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs = { 3 | fenix = { 4 | url = "github:nix-community/fenix"; 5 | inputs.nixpkgs.follows = "nixpkgs"; 6 | }; 7 | figsoda-pkgs = { 8 | url = "github:figsoda/pkgs"; 9 | inputs.nixpkgs.follows = "nixpkgs"; 10 | }; 11 | flake-registry = { 12 | url = "github:nixos/flake-registry"; 13 | flake = false; 14 | }; 15 | haumea = { 16 | url = "https://flakehub.com/f/nix-community/haumea/0.2.tar.gz"; 17 | inputs.nixpkgs.follows = "nixpkgs"; 18 | }; 19 | nix-index-database = { 20 | url = "github:nix-community/nix-index-database"; 21 | inputs.nixpkgs.follows = "nixpkgs"; 22 | }; 23 | nixos-hardware.url = "github:nixos/nixos-hardware"; 24 | nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; 25 | }; 26 | 27 | outputs = inputs@{ haumea, nixos-hardware, nixpkgs, ... }: 28 | let 29 | inherit (nixpkgs.lib) genAttrs nixosSystem; 30 | 31 | eachSystem = genAttrs [ 32 | "aarch64-darwin" 33 | "aarch64-linux" 34 | "x86_64-darwin" 35 | "x86_64-linux" 36 | ]; 37 | 38 | module = { pkgs, ... }@args: haumea.lib.load { 39 | src = ./src; 40 | inputs = args // { 41 | inherit inputs; 42 | }; 43 | transformer = haumea.lib.transformers.liftDefault; 44 | }; 45 | in 46 | { 47 | formatter = eachSystem (system: 48 | nixpkgs.legacyPackages.${system}.nixpkgs-fmt); 49 | 50 | nixosConfigurations.nixos = nixosSystem { 51 | system = "x86_64-linux"; 52 | modules = [ 53 | module 54 | nixos-hardware.nixosModules.asus-zephyrus-ga402 55 | ./hardware-configuration.nix 56 | ]; 57 | }; 58 | 59 | packages = eachSystem (system: { 60 | neovim = (nixosSystem { 61 | inherit system; 62 | modules = [ module ]; 63 | }).config.programs.neovim.finalPackage; 64 | }); 65 | }; 66 | } 67 | -------------------------------------------------------------------------------- /hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | # dummy hardware-configuration.nix to fix eval 2 | { 3 | fileSystems."/".label = "_"; 4 | } 5 | -------------------------------------------------------------------------------- /home/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | incremental = false 3 | rustc-wrapper = "sccache" 4 | 5 | [profile.dev] 6 | split-debuginfo = "unpacked" 7 | 8 | [target.x86_64-unknown-linux-gnu] 9 | linker = "clang" 10 | rustflags = ["-Clink-arg=-fuse-ld=mold"] 11 | -------------------------------------------------------------------------------- /home/.config/awesome/.luarc.json: -------------------------------------------------------------------------------- 1 | { 2 | "diagnostics.globals": ["awesome", "client", "root", "screen"] 3 | } 4 | -------------------------------------------------------------------------------- /home/.config/awesome/keys.lua: -------------------------------------------------------------------------------- 1 | local awful = require("awful") 2 | local gears = require("gears") 3 | local naughty = require("naughty") 4 | 5 | local c = { "Control" } 6 | local m = { "Mod4" } 7 | local ma = { "Mod4", "Mod1" } 8 | local mc = { "Mod4", "Control" } 9 | local ms = { "Mod4", "Shift" } 10 | 11 | local function exec(cmd) 12 | return function() 13 | awful.spawn(cmd) 14 | end 15 | end 16 | local function exec_sh(cmd) 17 | return function() 18 | awful.spawn.with_shell(cmd) 19 | end 20 | end 21 | 22 | local function focus(idx, dir) 23 | return function(c) 24 | if c.screen.selected_tag.layout.name == "max" then 25 | awful.client.focus.byidx(idx, c) 26 | else 27 | awful.client.focus.bydirection(dir, c) 28 | end 29 | end 30 | end 31 | 32 | local function swap(idx, dir) 33 | return function(c) 34 | if c.screen.selected_tag.layout.name == "max" then 35 | awful.client.swap.byidx(idx, c) 36 | else 37 | awful.client.swap.bydirection(dir, c) 38 | end 39 | end 40 | end 41 | 42 | local function shotgun(flags) 43 | local name = os.date("%Y%m%d%H%M%S") .. ".png" 44 | awful.spawn.easy_async( 45 | { "shotgun", name, unpack(flags) }, 46 | function(_, _, _, exitcode) 47 | if exitcode == 0 then 48 | naughty.notify({ 49 | text = name, 50 | title = "screenshot saved", 51 | icon = os.getenv("HOME") .. "/" .. name, 52 | icon_size = 96, 53 | }) 54 | awful.spawn({ 55 | "xclip", 56 | name, 57 | "-selection", 58 | "clipboard", 59 | "-t", 60 | "image/png", 61 | }) 62 | end 63 | end 64 | ) 65 | end 66 | 67 | local ckbs = { 68 | { 69 | ms, 70 | "f", 71 | function(c) 72 | c.fullscreen = not c.fullscreen 73 | end, 74 | }, 75 | { 76 | ms, 77 | "q", 78 | function(c) 79 | c:kill() 80 | end, 81 | }, 82 | { 83 | ms, 84 | "t", 85 | function(c) 86 | c.ontop = not c.ontop 87 | end, 88 | }, 89 | { m, "h", focus(-1, "left") }, 90 | { m, "j", focus(1, "down") }, 91 | { m, "k", focus(-1, "up") }, 92 | { m, "l", focus(1, "right") }, 93 | { ms, "h", swap(-1, "left") }, 94 | { ms, "j", swap(1, "down") }, 95 | { ms, "k", swap(-1, "up") }, 96 | { ms, "l", swap(1, "right") }, 97 | } 98 | 99 | local kbs = { 100 | { mc, "l", exec("lockscreen") }, 101 | { 102 | mc, 103 | "Return", 104 | function() 105 | awful.spawn.easy_async_with_shell( 106 | "echo '1 ⏻ shutdown | poweroff,2  reboot,3 ⏼ suspend,4 󰖔 hibernate,5 󰌾 lock screen,6  quit | log out,7  reload awesome,8  restart firefox' | rofi -dmenu -sep , -p session -format i -no-custom -select 8", 107 | function(stdout) 108 | ({ 109 | exec("poweroff"), 110 | exec("reboot"), 111 | exec({ "systemctl", "suspend" }), 112 | exec({ "systemctl", "hibernate" }), 113 | exec("lockscreen"), 114 | awesome.quit, 115 | awesome.restart, 116 | exec_sh("killall firefox-bin && firefox"), 117 | })[stdout:byte() - 47]() 118 | end 119 | ) 120 | end, 121 | }, 122 | 123 | { 124 | ms, 125 | "Left", 126 | function() 127 | awful.layout.inc(-1) 128 | end, 129 | }, 130 | { 131 | ms, 132 | "Right", 133 | function() 134 | awful.layout.inc(1) 135 | end, 136 | }, 137 | { 138 | m, 139 | " ", 140 | function() 141 | awful.layout.inc(1) 142 | end, 143 | }, 144 | { 145 | m, 146 | "[", 147 | function() 148 | awful.tag.incmwfact(-0.05) 149 | end, 150 | }, 151 | { 152 | m, 153 | "]", 154 | function() 155 | awful.tag.incmwfact(0.05) 156 | end, 157 | }, 158 | { 159 | m, 160 | "\\", 161 | function() 162 | awful.screen.focused().selected_tag.master_width_factor = 0.5 163 | end, 164 | }, 165 | { 166 | ms, 167 | "[", 168 | function() 169 | awful.tag.incncol(-1) 170 | end, 171 | }, 172 | { 173 | ms, 174 | "]", 175 | function() 176 | awful.tag.incncol(1) 177 | end, 178 | }, 179 | { 180 | ms, 181 | "\\", 182 | function() 183 | awful.screen.focused().selected_tag.column_count = 1 184 | end, 185 | }, 186 | 187 | { m, "Left", awful.tag.viewprev }, 188 | { m, "Right", awful.tag.viewnext }, 189 | { m, "BackSpace", awful.tag.history.restore }, 190 | { m, "Tab", awful.tag.viewnext }, 191 | { ms, "Tab", awful.tag.viewprev }, 192 | { 193 | m, 194 | "n", 195 | function() 196 | local c = client.focus 197 | if c then 198 | c.minimized = true 199 | else 200 | awful.client.restore(awful.screen.focused()) 201 | end 202 | end, 203 | }, 204 | { 205 | ms, 206 | "n", 207 | function() 208 | local c = awful.client.restore(awful.screen.focused()) 209 | if c then 210 | c:emit_signal("request::activate", "mouse_click", { raise = true }) 211 | end 212 | end, 213 | }, 214 | { 215 | m, 216 | "p", 217 | function() 218 | local panel = awful.screen.focused().panel 219 | panel.visible = not panel.visible 220 | end, 221 | }, 222 | 223 | { 224 | {}, 225 | "XF86AudioLowerVolume", 226 | exec({ "wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "5%-" }), 227 | }, 228 | { 229 | {}, 230 | "XF86AudioMicMute", 231 | exec({ "wpctl", "set-mute", "@DEFAULT_AUDIO_SOURCE@", "toggle" }), 232 | }, 233 | { 234 | {}, 235 | "XF86AudioMute", 236 | exec({ "wpctl", "set-mute", "@DEFAULT_AUDIO_SINK@", "toggle" }), 237 | }, 238 | { 239 | {}, 240 | "XF86AudioNext", 241 | function() 242 | awful.screen.focused().mpd.next() 243 | end, 244 | }, 245 | { 246 | {}, 247 | "XF86AudioPlay", 248 | function() 249 | awful.screen.focused().mpd.toggle() 250 | end, 251 | }, 252 | { 253 | {}, 254 | "XF86AudioPrev", 255 | function() 256 | awful.screen.focused().mpd.prev() 257 | end, 258 | }, 259 | { 260 | {}, 261 | "XF86AudioRaiseVolume", 262 | exec({ "wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "5%+" }), 263 | }, 264 | { 265 | {}, 266 | "XF86KbdBrightnessDown", 267 | exec({ "brightnessctl", "s", "1-", "-d", "asus::kbd_backlight" }), 268 | }, 269 | { 270 | {}, 271 | "XF86KbdBrightnessUp", 272 | exec({ "brightnessctl", "s", "1+", "-d", "asus::kbd_backlight" }), 273 | }, 274 | { {}, "XF86MonBrightnessDown", exec({ "brightnessctl", "s", "4-" }) }, 275 | { {}, "XF86MonBrightnessUp", exec({ "brightnessctl", "s", "4+" }) }, 276 | { c, "XF86MonBrightnessDown", exec({ "brightnessctl", "s", "1-" }) }, 277 | { c, "XF86MonBrightnessUp", exec({ "brightnessctl", "s", "1+" }) }, 278 | 279 | { 280 | {}, 281 | "Print", 282 | function() 283 | shotgun({}) 284 | end, 285 | }, 286 | { 287 | c, 288 | "Print", 289 | function() 290 | awful.spawn.easy_async("slop", function(stdout, _, _, exitcode) 291 | if exitcode == 0 then 292 | shotgun({ "-g", stdout:sub(1, -2) }) 293 | end 294 | end) 295 | end, 296 | }, 297 | { m, "Return", exec("alacritty") }, 298 | { m, "a", exec("pwvucontrol") }, 299 | { m, "b", exec("firefox") }, 300 | { m, "c", exec_sh("CM_LAUNCHER=rofi clipmenu -p clipmenu") }, 301 | { ms, "c", exec_sh("xclip -selection clipboard /dev/null; clipdel -d .") }, 302 | { 303 | m, 304 | "e", 305 | exec_sh( 306 | "fd -d 1 -t d --strip-cwd-prefix --path-separator '' | rofi -dmenu -p edit -i | xargs -r alacritty -e nvim" 307 | ), 308 | }, 309 | { m, "f", exec("spacefm") }, 310 | { m, "m", exec({ "alacritty", "-e", "mmtc" }) }, 311 | { 312 | ms, 313 | "m", 314 | function() 315 | awful.screen.focused().mpd.reload() 316 | end, 317 | }, 318 | { 319 | m, 320 | "o", 321 | exec_sh( 322 | "xdg-open (fd -E /nixpkgs/ --strip-cwd-prefix | rofi -dmenu -p open -i -matching fuzzy)" 323 | ), 324 | }, 325 | { m, "q", exec("qalculate-gtk") }, 326 | { 327 | m, 328 | "r", 329 | exec({ 330 | "rofi", 331 | "-modes", 332 | "combi", 333 | "-show", 334 | "combi", 335 | "-combi-modes", 336 | "run,drun", 337 | "-combi-display-format", 338 | "{text}", 339 | }), 340 | }, 341 | { m, "s", exec({ "alacritty", "-e", "btm" }) }, 342 | { m, "t", exec("rofi-todo") }, 343 | { 344 | m, 345 | "u", 346 | function() 347 | root.fake_input("key_release", "u") 348 | root.fake_input("key_release", "Super_L") 349 | root.fake_input("key_press", "Alt_L") 350 | root.fake_input("key_press", "Control_L") 351 | root.fake_input("key_press", "Shift_L") 352 | root.fake_input("key_press", "u") 353 | root.fake_input("key_release", "u") 354 | root.fake_input("key_release", "Alt_L") 355 | root.fake_input("key_release", "Control_L") 356 | root.fake_input("key_release", "Shift_L") 357 | end, 358 | }, 359 | { m, "w", exec({ "rofi", "-show", "window", "-modes", "window" }) }, 360 | { 361 | m, 362 | ",", 363 | function() 364 | awful.screen.focused().mpd.toggle() 365 | end, 366 | }, 367 | { 368 | m, 369 | ".", 370 | function() 371 | awful.screen.focused().mpd.next() 372 | end, 373 | }, 374 | { 375 | m, 376 | ";", 377 | function() 378 | awful.screen.focused().mpd.stop() 379 | end, 380 | }, 381 | } 382 | 383 | for i = 1, 6 do 384 | local key = i == 1 and "`" or i - 1 385 | table.insert(kbs, { 386 | m, 387 | key, 388 | function() 389 | awful.screen.focused().tags[i]:view_only() 390 | end, 391 | }) 392 | table.insert(kbs, { 393 | ma, 394 | key, 395 | function() 396 | awful.tag.viewtoggle(awful.screen.focused().tags[i]) 397 | end, 398 | }) 399 | table.insert(ckbs, { 400 | ms, 401 | key, 402 | function(c) 403 | c:move_to_tag(awful.screen.focused().tags[i]) 404 | end, 405 | }) 406 | table.insert(ckbs, { 407 | mc, 408 | key, 409 | function(c) 410 | c:toggle_tag(awful.screen.focused().tags[i]) 411 | end, 412 | }) 413 | end 414 | 415 | local keys = { client = {}, global = {} } 416 | 417 | for _, kb in pairs(ckbs) do 418 | keys.client = gears.table.join(keys.client, awful.key(kb[1], kb[2], kb[3])) 419 | end 420 | 421 | for _, kb in pairs(kbs) do 422 | keys.global = gears.table.join(keys.global, awful.key(kb[1], kb[2], kb[3])) 423 | end 424 | 425 | return keys 426 | -------------------------------------------------------------------------------- /home/.config/awesome/rc.lua: -------------------------------------------------------------------------------- 1 | local awful = require("awful") 2 | local b = require("beautiful") 3 | local dpi = b.xresources.apply_dpi 4 | local gears = require("gears") 5 | local naughty = require("naughty") 6 | local wibox = require("wibox") 7 | 8 | local keys = require("keys") 9 | local widget = require("widget") 10 | 11 | require("awful.autofocus") 12 | 13 | local m = { "Mod4" } 14 | local ms = { "Mod4", "Shift" } 15 | 16 | local function setwallpaper(s) 17 | if b.wallpaper then 18 | local wallpaper = b.wallpaper 19 | if type(wallpaper) == "function" then 20 | wallpaper = wallpaper(s) 21 | end 22 | gears.wallpaper.tiled(wallpaper, s) 23 | end 24 | end 25 | 26 | local function focusclient(c) 27 | c:emit_signal("request::activate", "mouse_click", { raise = true }) 28 | end 29 | 30 | local l = awful.layout.suit 31 | local p = awful.placement 32 | 33 | b.init(gears.filesystem.get_configuration_dir() .. "theme.lua") 34 | 35 | naughty.config.defaults.position = "bottom_right" 36 | naughty.config.icon_formats = { "png", "svg" } 37 | 38 | screen.connect_signal("property::geometry", setwallpaper) 39 | 40 | screen.connect_signal("arrange", function(s) 41 | local only = #s.tiled_clients == 1 or s.selected_tag.layout.name == "max" 42 | for _, c in pairs(s.clients) do 43 | local max = c.fullscreen or c.maximized or only and not c.floating 44 | c.border_width = max and 0 or b.border_width 45 | end 46 | end) 47 | 48 | awful.layout.layouts = { l.tile, l.max } 49 | 50 | awful.screen.connect_for_each_screen(function(s) 51 | setwallpaper(s) 52 | 53 | awful.tag({ "~", "1", "2", "3", "4", "5" }, s, l.tile) 54 | 55 | s.mpd = widget.mpd() 56 | 57 | local textclock = wibox.widget.textclock( 58 | ' %F %T ', 59 | 1 60 | ) 61 | textclock.font = b.textclock_font 62 | awful.widget.calendar_popup 63 | .month({ font = "monospace 9" }) 64 | :attach(textclock, "tr") 65 | 66 | s.panel = awful.wibar({ screen = s }) 67 | s.panel:setup({ 68 | layout = wibox.layout.align.horizontal, 69 | { 70 | layout = wibox.layout.fixed.horizontal, 71 | awful.widget.layoutbox(s), 72 | widget.padding(3), 73 | awful.widget.taglist({ 74 | screen = s, 75 | filter = awful.widget.taglist.filter.all, 76 | buttons = gears.table.join( 77 | awful.button({}, 1, function(t) 78 | t:view_only() 79 | end), 80 | awful.button({}, 3, awful.tag.viewtoggle), 81 | awful.button({}, 4, function(t) 82 | awful.tag.viewprev(t.screen) 83 | end), 84 | awful.button({}, 5, function(t) 85 | awful.tag.viewnext(t.screen) 86 | end) 87 | ), 88 | widget_template = { 89 | id = "background_role", 90 | widget = wibox.container.background, 91 | { 92 | id = "text_role", 93 | widget = wibox.widget.textbox, 94 | align = "center", 95 | forced_width = b.wibar_height, 96 | }, 97 | }, 98 | }), 99 | widget.padding(3), 100 | }, 101 | awful.widget.tasklist({ 102 | screen = s, 103 | filter = awful.widget.tasklist.filter.currenttags, 104 | buttons = gears.table.join( 105 | awful.button({}, 1, function(c) 106 | client.focus = c 107 | c.minimized = false 108 | c:raise() 109 | end), 110 | awful.button({}, 4, function() 111 | awful.client.focus.byidx(-1) 112 | end), 113 | awful.button({}, 5, function() 114 | awful.client.focus.byidx(1) 115 | end) 116 | ), 117 | widget_template = { 118 | id = "background_role", 119 | widget = wibox.container.background, 120 | { 121 | { 122 | { id = "icon", widget = awful.widget.clienticon }, 123 | widget = wibox.container.margin, 124 | left = 4, 125 | right = 4, 126 | top = 2, 127 | bottom = 2, 128 | }, 129 | { id = "text_role", widget = wibox.widget.textbox }, 130 | layout = wibox.layout.fixed.horizontal, 131 | }, 132 | create_callback = function(self, c) 133 | self:get_children_by_id("icon")[1].client = c 134 | end, 135 | }, 136 | }), 137 | { 138 | layout = wibox.layout.fixed.horizontal, 139 | s.mpd, 140 | widget.padding(3), 141 | (function() 142 | local tray = wibox.widget.systray() 143 | tray:set_base_size(dpi(12)) 144 | return tray 145 | end)(), 146 | widget.battery(), 147 | textclock, 148 | }, 149 | }) 150 | end) 151 | 152 | awful.rules.rules = { 153 | { 154 | rule = {}, 155 | properties = { 156 | border_width = b.border_width, 157 | border_color = b.border_normal, 158 | focus = awful.client.focus.filter, 159 | raise = true, 160 | keys = keys.client, 161 | buttons = gears.table.join( 162 | awful.button({}, 1, focusclient), 163 | awful.button(m, 1, function(c) 164 | focusclient(c) 165 | awful.mouse.client.move(c) 166 | end), 167 | awful.button(m, 3, function(c) 168 | focusclient(c) 169 | awful.mouse.client.resize(c) 170 | end), 171 | awful.button(ms, 1, function(c) 172 | c.floating = not c.floating 173 | end) 174 | ), 175 | screen = awful.screen.preferred, 176 | placement = p.no_overlap + p.no_offscreen, 177 | }, 178 | }, 179 | { 180 | rule = { class = "Qalculate-gtk" }, 181 | properties = { 182 | floating = true, 183 | ontop = true, 184 | placement = p.centered, 185 | }, 186 | }, 187 | } 188 | 189 | client.connect_signal("manage", function(c) 190 | if awesome.startup then 191 | if not c.size_hints.user_position and not c.size_hints.program_position then 192 | p.no_offscreen(c) 193 | end 194 | else 195 | awful.client.setslave(c) 196 | end 197 | end) 198 | 199 | client.connect_signal("property::maximized", function(c) 200 | c.maximized = false 201 | end) 202 | 203 | client.connect_signal("mouse::enter", function(c) 204 | c:emit_signal("request::activate", "mouse_enter", { raise = false }) 205 | end) 206 | 207 | client.connect_signal("focus", function(c) 208 | c.border_color = b.border_focus 209 | end) 210 | 211 | client.connect_signal("unfocus", function(c) 212 | c.border_color = b.border_normal 213 | end) 214 | 215 | root.keys(keys.global) 216 | -------------------------------------------------------------------------------- /home/.config/awesome/theme.lua: -------------------------------------------------------------------------------- 1 | local dpi = require("beautiful").xresources.apply_dpi 2 | local themedir = require("gears.filesystem").get_themes_dir() 3 | 4 | return { 5 | fullscreen_hide_border = true, 6 | maximized_hide_border = true, 7 | 8 | layout_max = themedir .. "zenburn/layouts/max.png", 9 | layout_tile = themedir .. "zenburn/layouts/tile.png", 10 | 11 | notification_max_width = dpi(280), 12 | notification_max_height = dpi(140), 13 | notification_icon_size = dpi(20), 14 | wibar_height = dpi(14), 15 | 16 | font = "sans 8", 17 | battery_font = "monospace 5.5", 18 | taglist_font = "monospace 8", 19 | textclock_font = "monospace 7", 20 | 21 | bg_normal = "#101014", 22 | bg_focus = "#202428", 23 | bg_urgent = "#e5c076", 24 | bg_minimize = "#101014", 25 | taglist_fg_normal = "#b8b8b8", 26 | taglist_fg_empty = "#585858", 27 | tasklist_bg_focus = "#101014", 28 | 29 | fg_normal = "#c8c8c8", 30 | fg_focus = "#d8d8d8", 31 | fg_urgent = "#f0f0f0", 32 | fg_minimize = "#606060", 33 | tasklist_fg_normal = "#a0a0a0", 34 | tasklist_fg_focus = "#c8c8c8", 35 | 36 | border_width = dpi(0.75), 37 | border_normal = "#586068", 38 | border_focus = "#56b6c2", 39 | 40 | calendar_start_sunday = true, 41 | calendar_long_weekdays = true, 42 | calendar_month_bg_color = "#101014", 43 | calendar_month_padding = dpi(4), 44 | calendar_month_border_width = 0, 45 | calendar_header_bg_color = "#101014", 46 | calendar_header_fg_color = "#e5c07b", 47 | calendar_header_padding = dpi(2), 48 | calendar_header_border_width = 0, 49 | calendar_weekday_bg_color = "#101014", 50 | calendar_weekday_fg_color = "#e06c75", 51 | calendar_weekday_border_width = 0, 52 | calendar_normal_bg_color = "#101014", 53 | calendar_normal_fg_color = "#abb2bf", 54 | calendar_normal_border_width = 0, 55 | calendar_focus_fg_color = "#56b6c2", 56 | calendar_focus_bg_color = "#101014", 57 | calendar_focus_border_width = 0, 58 | 59 | wallpaper = os.getenv("HOME") .. "/.config/wallpaper.png", 60 | } 61 | -------------------------------------------------------------------------------- /home/.config/awesome/widget.lua: -------------------------------------------------------------------------------- 1 | local widget = {} 2 | 3 | local awful = require("awful") 4 | local b = require("beautiful") 5 | local dpi = b.xresources.apply_dpi 6 | local gears = require("gears") 7 | local wibox = require("wibox") 8 | 9 | function widget.padding(w) 10 | return wibox.widget({ forced_width = dpi(w) }) 11 | end 12 | 13 | function widget.battery() 14 | local t = gears.timer({ timeout = 1 }) 15 | 16 | local txt = wibox.widget.textbox() 17 | txt.align = "center" 18 | txt.font = b.battery_font 19 | 20 | local bat = wibox.container.arcchart(txt) 21 | bat.min_value = 0 22 | bat.max_value = 100 23 | bat.thickness = 2 24 | bat.start_angle = math.pi * 3 / 2 25 | 26 | t:connect_signal("timeout", function() 27 | t:stop() 28 | 29 | local cap = io.open("/sys/class/power_supply/BAT0/capacity") 30 | local st = io.open("/sys/class/power_supply/BAT0/status") 31 | 32 | if cap and st then 33 | local percent = cap:read("*n") 34 | bat.value = percent 35 | 36 | if percent >= 100 then 37 | bat.visible = false 38 | else 39 | bat.visible = true 40 | txt:set_text(percent) 41 | bat.colors = { 42 | (st:read(8) == "Charging") and "#20a020" 43 | or ((percent <= 30) and "#d01000" or "#a0a0a0"), 44 | } 45 | end 46 | 47 | cap:close() 48 | st:close() 49 | end 50 | 51 | t:again() 52 | end) 53 | t:start() 54 | t:emit_signal("timeout") 55 | 56 | return wibox.container.margin(bat, dpi(2), dpi(2), dpi(1), dpi(1), nil, false) 57 | end 58 | 59 | function widget.mpd() 60 | local status = wibox.widget.textbox() 61 | local txt = wibox.widget.textbox() 62 | local time = wibox.widget.textbox() 63 | time.font = "monospace 7" 64 | 65 | local scr = wibox.container.scroll.horizontal(txt, 60, 120, 24) 66 | scr.forced_width = dpi(140) 67 | scr:pause() 68 | 69 | local template = wibox.widget({ 70 | layout = wibox.layout.fixed.horizontal, 71 | buttons = gears.table.join( 72 | awful.button({}, 1, function() 73 | awful.screen.focused().mpd.toggle() 74 | end), 75 | awful.button({}, 2, function() 76 | awful.spawn({ "alacritty", "-e", "mmtc" }) 77 | end), 78 | awful.button({}, 3, function() 79 | awful.screen.focused().mpd.next() 80 | end) 81 | ), 82 | widget.padding(3), 83 | status, 84 | widget.padding(2), 85 | scr, 86 | widget.padding(4), 87 | time, 88 | }) 89 | template:connect_signal("mouse::enter", function() 90 | scr:set_space_for_scrolling(4096) 91 | scr:continue() 92 | end) 93 | template:connect_signal("mouse::leave", function() 94 | scr:pause() 95 | scr:set_space_for_scrolling(dpi(140)) 96 | scr:reset_scrolling() 97 | end) 98 | 99 | local function update(stdout, exitcode) 100 | if exitcode == 0 then 101 | local name, st, t = 102 | stdout:match("^([^\n]+)\n%[(%a+)%].-(%d:%d%d/%d:%d%d)") 103 | if name and st and t then 104 | if st == "playing" then 105 | status.markup = [[]] 106 | elseif st == "paused" then 107 | status.markup = [[]] 108 | else 109 | status.markup = [[]] 110 | end 111 | txt.markup = string.format( 112 | [[%s]], 113 | gears.string.xml_escape(name) 114 | ) 115 | time.markup = string.format([[%s]], t) 116 | template.visible = true 117 | return 118 | end 119 | end 120 | template.visible = false 121 | end 122 | 123 | local watch = awful.widget.watch( 124 | { "mpc", "-f", "%title% - %artist%" }, 125 | 1, 126 | function(_, stdout, _, _, exitcode) 127 | update(stdout, exitcode) 128 | end, 129 | template 130 | ) 131 | 132 | local function cmd_then_update(cmd) 133 | return function() 134 | awful.spawn.easy_async( 135 | { "mpc", cmd, "-f", "%title% - %artist%" }, 136 | function(stdout, _, _, exitcode) 137 | update(stdout, exitcode) 138 | end 139 | ) 140 | end 141 | end 142 | 143 | return setmetatable({}, { 144 | __index = function(_, k) 145 | if k == "reload" then 146 | return function() 147 | awful.spawn.easy_async( 148 | { "mmtc", "-C", "clear", "update", "add /" }, 149 | function() 150 | template.visible = false 151 | end 152 | ) 153 | end 154 | elseif k == "toggle" then 155 | return cmd_then_update("toggle") 156 | elseif k == "prev" then 157 | return cmd_then_update("prev") 158 | elseif k == "next" then 159 | return cmd_then_update("next") 160 | elseif k == "stop" then 161 | return function() 162 | awful.spawn.easy_async({ "mmtc", "-C", "stop" }, function() 163 | template.visible = false 164 | end) 165 | end 166 | else 167 | return watch[k] 168 | end 169 | end, 170 | __newindex = watch, 171 | }) 172 | end 173 | 174 | return widget 175 | -------------------------------------------------------------------------------- /home/.config/bottom/bottom.toml: -------------------------------------------------------------------------------- 1 | [[row]] 2 | [[row.child]] 3 | ratio = 3 4 | [[row.child.child]] 5 | ratio = 5 6 | type = "battery" 7 | [[row.child.child]] 8 | ratio = 4 9 | type = "disk" 10 | [[row.child]] 11 | ratio = 4 12 | type = "mem" 13 | [[row.child]] 14 | ratio = 4 15 | type = "net" 16 | 17 | [[row]] 18 | [[row.child]] 19 | ratio = 1 20 | type = "temp" 21 | [[row.child]] 22 | ratio = 5 23 | type = "cpu" 24 | 25 | [[row]] 26 | [[row.child]] 27 | ratio = 1 28 | type = "proc" 29 | default = true 30 | -------------------------------------------------------------------------------- /home/.config/fcitx5/conf/classicui.conf: -------------------------------------------------------------------------------- 1 | Font="Sans 10" 2 | MenuFont="Sans 10" 3 | TrayFont="Sans 6" 4 | Theme=dark 5 | -------------------------------------------------------------------------------- /home/.config/fcitx5/conf/clipboard.conf: -------------------------------------------------------------------------------- 1 | TriggerKey= 2 | -------------------------------------------------------------------------------- /home/.config/fcitx5/conf/quickphrase.conf: -------------------------------------------------------------------------------- 1 | TriggerKey= 2 | -------------------------------------------------------------------------------- /home/.config/fcitx5/config: -------------------------------------------------------------------------------- 1 | [Behavior] 2 | ShareInputState=All 3 | 4 | [Hotkey] 5 | ActivateKeys= 6 | AltTriggerKeys= 7 | DeactivateKeys= 8 | EnumerateBackwardKeys= 9 | EnumerateForwardKeys= 10 | EnumerateGroupBackwardKeys= 11 | EnumerateGroupForwardKeys= 12 | 13 | [Hotkey/TriggerKeys] 14 | 0=Super+I 15 | -------------------------------------------------------------------------------- /home/.config/fd/ignore: -------------------------------------------------------------------------------- 1 | .git 2 | -------------------------------------------------------------------------------- /home/.config/gtk-4.0/gtk.css: -------------------------------------------------------------------------------- 1 | @import "/etc/xdg/gtk-4.0/gtk.css"; 2 | -------------------------------------------------------------------------------- /home/.config/mmtc/mmtc.ron: -------------------------------------------------------------------------------- 1 | Config( 2 | clear_query_on_play: true, 3 | cycle: true, 4 | ) 5 | -------------------------------------------------------------------------------- /home/.config/mpv/mpv.conf: -------------------------------------------------------------------------------- 1 | osc=no 2 | -------------------------------------------------------------------------------- /home/.config/mpv/script-opts/mpv_thumbnail_script.conf: -------------------------------------------------------------------------------- 1 | thumbnail_network=yes 2 | -------------------------------------------------------------------------------- /home/.local/share/fcitx5/rime/default.custom.yaml: -------------------------------------------------------------------------------- 1 | patch: 2 | ascii_composer/switch_key: 3 | Caps_Lock: inline_ascii 4 | Control_L: noop 5 | Control_R: noop 6 | Shift_L: inline_ascii 7 | Shift_R: inline_ascii 8 | menu: 9 | page_size: 6 10 | schema_list: 11 | - schema: luna_pinyin 12 | switcher/caption: "选项" 13 | switcher/fold_options: false 14 | -------------------------------------------------------------------------------- /home/.local/share/fcitx5/rime/luna_pinyin.custom.yaml: -------------------------------------------------------------------------------- 1 | patch: 2 | switches: 3 | - name: ascii_mode 4 | reset: 0 5 | states: [ 中文, ascii ] 6 | - name: ascii_punct 7 | reset: 1 8 | states: [ "。", "." ] 9 | - name: full_shape 10 | reset: 0 11 | states: [ 半角, 全角 ] 12 | - name: simplification 13 | reset: 1 14 | states: [ 繁體, 简体 ] 15 | -------------------------------------------------------------------------------- /home/.local/share/fcitx5/themes/dark/theme.conf: -------------------------------------------------------------------------------- 1 | [InputPanel] 2 | HighlightBackgroundColor=#1f2227 3 | HighlightCandidateColor=#e5c07b 4 | HighlightColor=#61afef 5 | NormalColor=#abb2bf 6 | Spacing=2 7 | 8 | [InputPanel/Background] 9 | Color=#1f2227 10 | 11 | [InputPanel/Highlight] 12 | Color=#1f2227 13 | 14 | [InputPanel/TextMargin] 15 | Bottom=8 16 | Left=8 17 | Right=8 18 | Top=8 19 | 20 | [Menu] 21 | HighlightCandidateColor=#e5c07b 22 | NormalColor=#abb2bf 23 | 24 | [Menu/Background] 25 | Color=#1f2227 26 | 27 | [Menu/Highlight] 28 | Color=#1f2227 29 | 30 | [Menu/Separator] 31 | Color=#1f2227 32 | 33 | [Menu/TextMargin] 34 | Bottom=8 35 | Left=8 36 | Right=8 37 | Top=8 38 | -------------------------------------------------------------------------------- /install: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env nix-shell 2 | #!nix-shell -i bash -p curl fd imagemagick ripgrep sd xorg.xrandr 3 | 4 | # shellcheck shell=bash 5 | # vim: ft=sh 6 | 7 | set -euo pipefail 8 | 9 | echo Installing rime packages 10 | curl -LSs https://git.io/rime-install \ 11 | | rime_dir=~/.local/share/fcitx5/rime bash -s -- prelude essay luna-pinyin 12 | rm -rf plum 13 | 14 | echo Creating symlinks 15 | src=$(dirname "$(realpath "$0")")/home 16 | fd --base-directory "$src" -Ht f -x \ 17 | sh -c "mkdir -p '$HOME/{//}' && ln -sf '$src/{}' '$HOME/{}'" 18 | 19 | echo Downloading wallpaper 20 | res=$(xrandr | rg -F \* | sd "\s*(\d+x\d+).*" \$1) 21 | curl -LSs https://raw.githubusercontent.com/NixOS/nixos-artwork/master/wallpapers/nix-wallpaper-nineish-dark-gray.svg \ 22 | | convert svg:- \ 23 | -gamma 1.14,1.16,1.25 \ 24 | -resize "$res^" \ 25 | -gravity center \ 26 | -extent "$res" \ 27 | ~/.config/wallpaper.png 28 | 29 | echo Configuring mpd 30 | mkdir -p ~/.local/share/mpd 31 | touch ~/.local/share/mpd/mpd.db 32 | -------------------------------------------------------------------------------- /rebuild: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | sudo rm -rf /etc/nixos/src 6 | sudo cp -r src flake.lock flake.nix /etc/nixos 7 | sudo nixos-rebuild switch "$@" 8 | -------------------------------------------------------------------------------- /src/_colors.nix: -------------------------------------------------------------------------------- 1 | # modified from https://github.com/joshdick/onedark.vim 2 | { 3 | black = "#1f2227"; 4 | blue = "#61afef"; 5 | cyan = "#56b6c2"; 6 | dimgray = "#282c34"; 7 | gray = "#2c323c"; 8 | green = "#98c379"; 9 | lightgray = "#5c6370"; 10 | lightred = "#fa565c"; 11 | magenta = "#c678dd"; 12 | orange = "#d19a66"; 13 | red = "#e06c75"; 14 | silver = "#4b5263"; 15 | white = "#abb2bf"; 16 | yellow = "#e5c07b"; 17 | } 18 | -------------------------------------------------------------------------------- /src/_pkgs/alacritty.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | let 4 | inherit (pkgs) alacritty writers; 5 | in 6 | 7 | writers.writeDashBin "alacritty" '' 8 | ${alacritty}/bin/alacritty msg create-window "$@" || { 9 | [ $? = 1 ] && ${alacritty}/bin/alacritty "$@" 10 | } 11 | '' 12 | -------------------------------------------------------------------------------- /src/_pkgs/ghtok.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | pkgs.writers.writeDashBin "ghtok" '' 4 | ${pkgs.libsecret}/bin/secret-tool lookup github git 5 | '' 6 | -------------------------------------------------------------------------------- /src/_pkgs/icon-theme.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | pkgs.writeTextDir "/share/icons/default/index.theme" /* ini */ '' 4 | [icon theme] 5 | Inherits=Qogir 6 | '' 7 | -------------------------------------------------------------------------------- /src/_pkgs/lockscreen.nix: -------------------------------------------------------------------------------- 1 | { pkgs, root }: 2 | 3 | let 4 | inherit (pkgs) i3lock-color writers; 5 | inherit (root.colors) blue green lightred orange; 6 | in 7 | 8 | writers.writeBashBin "lockscreen" '' 9 | ${i3lock-color}/bin/i3lock-color \ 10 | -i ~/.config/wallpaper.png -k \ 11 | --{inside{ver,wrong,},ring,line,separator}-color=00000000 \ 12 | --ringver-color=${green} --ringwrong-color=${lightred} \ 13 | --keyhl-color=${blue} --bshl-color=${orange} \ 14 | --verif-color=${green} --wrong-color=${lightred} \ 15 | --ind-pos=x+w/7:y+h-w/8 \ 16 | --{time,date}-font=monospace \ 17 | --{layout,verif,wrong,greeter}-size=14 \ 18 | --time-color=${blue} --time-size=16 \ 19 | --date-pos=ix:iy+16 --date-color=${green} --date-str=%F --date-size=12 \ 20 | --verif-text=Verifying... \ 21 | --wrong-text="Try again!" \ 22 | --noinput-text="No input" \ 23 | --lock-text=Locking... --lockfailed-text="Lock failed!" \ 24 | --radius 48 --ring-width 4 25 | '' 26 | -------------------------------------------------------------------------------- /src/_pkgs/mpv.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | pkgs.mpv.override { 4 | scripts = with pkgs.mpvScripts; [ autoload sponsorblock thumbnail ]; 5 | } 6 | -------------------------------------------------------------------------------- /src/_pkgs/nixpkgs-review.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | let 4 | inherit (pkgs) fish libsecret nixpkgs-review writers; 5 | in 6 | 7 | writers.writeBashBin "nixpkgs-review" '' 8 | if [ "$1" = pr ]; then 9 | export GITHUB_TOKEN=$(${libsecret}/bin/secret-tool lookup github git) 10 | args=(--run ${fish}/bin/fish) 11 | elif [[ "$1" =~ rev|wip ]]; then 12 | args=(--no-shell) 13 | fi 14 | ${nixpkgs-review}/bin/nixpkgs-review "$@" "''${args[@]}" 15 | '' 16 | -------------------------------------------------------------------------------- /src/_pkgs/r.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs }: 2 | 3 | pkgs.writers.writeBashBin "r" '' 4 | if [ "$1" = cargo ] && nix eval --raw "nixpkgs#$1-$2" 2> /dev/null; then 5 | ${config.nix.package}/bin/nix shell "nixpkgs#$1-$2" -c cargo "''${@:2}" 6 | else 7 | ${config.nix.package}/bin/nix run "nixpkgs#$1" -- "''${@:2}" 8 | fi 9 | '' 10 | -------------------------------------------------------------------------------- /src/_pkgs/rofi-todo.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, root }: 2 | 3 | let 4 | inherit (pkgs) coreutils moreutils ripgrep rofi writers; 5 | inherit (root.pkgs) alacritty; 6 | 7 | neovim = config.programs.neovim.finalPackage; 8 | in 9 | 10 | writers.writeBashBin "rofi-todo" '' 11 | ${rofi}/bin/rofi -show todo -modes todo:${ 12 | writers.writeBash "todo-mode" '' 13 | todos=~/.local/share/todos 14 | ${coreutils}/bin/mkdir -p ~/.local/share 15 | ${coreutils}/bin/touch "$todos" 16 | 17 | [ -z "$1" ] && ${coreutils}/bin/cat "$todos" && exit 0 18 | 19 | if [ "$1" = @ ]; then 20 | ${alacritty}/bin/alacritty -e ${neovim}/bin/nvim "$todos" 21 | elif item=$(${ripgrep}/bin/rg '^\+\s*([^\s](.*[^\s])?)\s*$' -r '$1' <<< "$1"); then 22 | ${coreutils}/bin/sort "$todos" - -uo "$todos" <<< "$item" 23 | else 24 | while read -r line; do 25 | [ "$line" = "$1" ] || echo "$line" 26 | done < "$todos" | ${moreutils}/bin/sponge "$todos" 27 | fi 28 | '' 29 | } 30 | '' 31 | -------------------------------------------------------------------------------- /src/_pkgs/rust.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | pkgs.fenix.complete.withComponents [ 4 | "cargo" 5 | "clippy" 6 | "llvm-tools" 7 | "rust-src" 8 | "rustc" 9 | "rustfmt" 10 | ] 11 | -------------------------------------------------------------------------------- /src/boot.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | { 4 | loader = { 5 | efi.canTouchEfiVariables = true; 6 | systemd-boot = { 7 | enable = true; 8 | editor = false; 9 | }; 10 | }; 11 | tmp.cleanOnBoot = true; 12 | } 13 | -------------------------------------------------------------------------------- /src/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | documentation = { 3 | doc.enable = false; 4 | info.enable = false; 5 | nixos.enable = false; 6 | }; 7 | 8 | gtk.iconCache.enable = true; 9 | 10 | hardware.bluetooth.enable = true; 11 | 12 | security.sudo.wheelNeedsPassword = false; 13 | 14 | system = { 15 | autoUpgrade = { 16 | enable = true; 17 | dates = "04:00"; 18 | }; 19 | stateVersion = "22.05"; 20 | }; 21 | 22 | time.timeZone = "America/New_York"; 23 | } 24 | -------------------------------------------------------------------------------- /src/environment/etc.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs, root }: 2 | 3 | let 4 | inherit (lib) concatStrings generators mapAttrsToList; 5 | inherit (pkgs) fish formats libsecret substituteAll; 6 | 7 | gtkSettings = generators.toINI { } { 8 | Settings = { 9 | gtk-application-prefer-dark-theme = true; 10 | gtk-cursor-theme-name = "Qogir"; 11 | gtk-enable-animations = false; 12 | gtk-font-name = "sans 8"; 13 | gtk-icon-theme-name = "Tela-dark"; 14 | gtk-theme-name = "Qogir-Dark"; 15 | gtk-xft-antialias = 1; 16 | gtk-xft-hinting = 1; 17 | gtk-xft-hintstyle = "hintfull"; 18 | gtk-xft-rgba = "rgb"; 19 | }; 20 | }; 21 | in 22 | 23 | { 24 | "xdg/alacritty/alacritty.toml".source = (formats.toml { }).generate "alacritty.toml" { 25 | colors = with root.colors; { 26 | primary = { 27 | foreground = white; 28 | background = black; 29 | }; 30 | 31 | cursor = { 32 | text = lightgray; 33 | cursor = white; 34 | }; 35 | 36 | normal = { 37 | inherit black blue cyan green magenta red white yellow; 38 | }; 39 | 40 | bright = { 41 | inherit black blue cyan green magenta white; 42 | red = lightred; 43 | yellow = orange; 44 | }; 45 | }; 46 | 47 | cursor.style = "Beam"; 48 | font.size = 8; 49 | terminal.shell.program = "${fish}/bin/fish"; 50 | window.padding = { 51 | x = 4; 52 | y = 4; 53 | }; 54 | }; 55 | 56 | "xdg/gtk-3.0/settings.ini".text = gtkSettings; 57 | 58 | "xdg/gtk-4.0/gtk.css".text = concatStrings (mapAttrsToList (k: v: "@define-color ${k} ${v};\n") (with root.colors; { 59 | accent_bg_color = blue; 60 | accent_color = blue; 61 | accent_fg_color = black; 62 | card_bg_color = black; 63 | card_fg_color = white; 64 | destructive_bg_color = red; 65 | destructive_color = red; 66 | destructive_fg_color = black; 67 | dialog_bg_color = black; 68 | dialog_fg_color = white; 69 | error_bg_color = red; 70 | error_color = red; 71 | error_fg_color = black; 72 | headerbar_backdrop_color = black; 73 | headerbar_bg_color = black; 74 | headerbar_border_color = black; 75 | headerbar_darker_shade_color = black; 76 | headerbar_fg_color = white; 77 | headerbar_shade_color = black; 78 | popover_bg_color = black; 79 | popover_fg_color = white; 80 | popover_shade_color = white; 81 | scrollbar_outline_color = black; 82 | secondary_sidebar_backdrop_color = black; 83 | secondary_sidebar_bg_color = black; 84 | secondary_sidebar_fg_color = white; 85 | secondary_sidebar_shade_color = black; 86 | shade_color = black; 87 | sidebar_backdrop_color = black; 88 | sidebar_bg_color = black; 89 | sidebar_fg_color = white; 90 | sidebar_shade_color = black; 91 | success_bg_color = green; 92 | success_color = green; 93 | success_fg_color = black; 94 | thumbnail_bg_color = black; 95 | thumbnail_fg_color = white; 96 | view_bg_color = black; 97 | view_fg_color = white; 98 | warning_bg_color = yellow; 99 | warning_color = yellow; 100 | warning_fg_color = black; 101 | window_bg_color = black; 102 | window_fg_color = white; 103 | })); 104 | 105 | "xdg/gtk-4.0/settings.ini".text = gtkSettings; 106 | 107 | "xdg/nix-init/config.toml".source = (formats.toml { }).generate "config.toml" { 108 | access-tokens = { 109 | "github.com".command = [ 110 | "${libsecret}/bin/secret-tool" 111 | "lookup" 112 | "github" 113 | "git" 114 | ]; 115 | }; 116 | commit = true; 117 | maintainers = [ "figsoda" ]; 118 | }; 119 | 120 | "xdg/rofi.rasi".source = ./rofi.rasi; 121 | "xdg/flat-dark.rasi".source = substituteAll (root.colors // { 122 | src = ./flat-dark.rasi; 123 | }); 124 | 125 | "xdg/sagoin/config.toml".source = (formats.toml { }).generate "config.toml" { 126 | username = "${libsecret}/bin/secret-tool lookup umd username"; 127 | username_type = "command"; 128 | password = "${libsecret}/bin/secret-tool lookup umd password"; 129 | password_type = "command"; 130 | }; 131 | 132 | "xdg/user-dirs.defaults".text = '' 133 | DESKTOP=/dev/null 134 | DOCUMENTS=files 135 | DOWNLOAD=files 136 | MUSIC=music 137 | PICTURES=files 138 | PUBLICSHARE=/dev/null 139 | TEMPLATES=/dev/null 140 | VIDEOS=files 141 | ''; 142 | 143 | "xdg/xsettingsd/xsettingsd.conf".text = '' 144 | Xft/DPI 220160 145 | ''; 146 | } 147 | -------------------------------------------------------------------------------- /src/environment/flat-dark.rasi: -------------------------------------------------------------------------------- 1 | * { 2 | background-color: @black@; 3 | border-color: @lightgray@; 4 | text-color: @white@; 5 | } 6 | 7 | window { 8 | padding: 0.8mm; 9 | } 10 | 11 | inputbar { 12 | padding: 0.8mm; 13 | children: [prompt, entry]; 14 | } 15 | 16 | prompt { 17 | border: 0 0.1mm 0 0; 18 | padding: 0.4mm 2mm 0.8mm 1.2mm; 19 | } 20 | 21 | entry { 22 | padding: 0.4mm 1.2mm 0.8mm 2mm; 23 | } 24 | 25 | listview { 26 | cycle: false; 27 | } 28 | 29 | element { 30 | padding: 0.8mm 2.4mm; 31 | } 32 | 33 | element selected { 34 | background-color: @gray@; 35 | text-color: @blue@; 36 | } 37 | 38 | element-icon { 39 | size: 3.2mm; 40 | background-color: inherit; 41 | } 42 | 43 | element-text { 44 | background-color: inherit; 45 | text-color: inherit; 46 | } 47 | -------------------------------------------------------------------------------- /src/environment/rofi.rasi: -------------------------------------------------------------------------------- 1 | @theme "flat-dark" 2 | 3 | configuration { 4 | disable-history: true; 5 | dpi: 0; 6 | font: "monospace 9"; 7 | show-icons: true; 8 | sort: true; 9 | terminal: "alacritty"; 10 | } 11 | -------------------------------------------------------------------------------- /src/environment/systemPackages.nix: -------------------------------------------------------------------------------- 1 | { config, inputs, pkgs, root }: 2 | 3 | let 4 | nix-index = inputs.nix-index-database.packages.${config.nixpkgs.system}.default; 5 | in 6 | 7 | with pkgs; 8 | 9 | builtins.attrValues root.pkgs ++ [ 10 | bat 11 | binutils 12 | blueberry 13 | bottom 14 | brightnessctl 15 | bubblewrap 16 | cargo-edit 17 | cargo-insta 18 | cargo-nextest 19 | clang 20 | clipmenu 21 | dafny 22 | delta 23 | dune_3 24 | element-desktop 25 | erdtree 26 | fd 27 | firefox-bin # https://github.com/NixOS/nixpkgs/issues/332540 28 | fishPlugins.async-prompt 29 | fishPlugins.autopair 30 | gcc 31 | git-absorb 32 | gnumake 33 | gradescope-submit 34 | haskell-language-server 35 | libreoffice-fresh 36 | libsecret 37 | lutris 38 | mmtc 39 | mold 40 | mpc_cli 41 | namaka 42 | nasm 43 | nix-index 44 | nix-init 45 | nix-melt 46 | nix-update 47 | nixpkgs-fmt 48 | nixpkgs-hammering 49 | nsxiv 50 | nurl 51 | ocaml 52 | ocamlPackages.utop 53 | ocamlformat 54 | ouch 55 | psmisc 56 | pwvucontrol 57 | python3 58 | qalculate-gtk 59 | qogir-icon-theme 60 | qogir-theme 61 | racket 62 | ripgrep 63 | rofi 64 | sagoin 65 | sccache 66 | sd 67 | shotgun 68 | slop 69 | spaceFM 70 | sshfs 71 | stack 72 | statix 73 | stylua 74 | tela-icon-theme 75 | xclip 76 | ymdl 77 | zig 78 | ] 79 | -------------------------------------------------------------------------------- /src/environment/variables.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | let 4 | inherit (pkgs) writeText; 5 | in 6 | 7 | { 8 | BAT_STYLE = "numbers"; 9 | BAT_THEME = "TwoDark"; 10 | CC = "gcc"; 11 | ERDTREE_CONFIG_PATH = writeText "erd-config" '' 12 | --dir-order first 13 | --human 14 | --icons 15 | --sort name 16 | ''; 17 | LESSHISTFILE = "-"; 18 | PATH = "$HOME/.cargo/bin"; 19 | RIPGREP_CONFIG_PATH = writeText "rg-config" '' 20 | -S 21 | -g=!.git 22 | --hidden 23 | ''; 24 | STEAM_FORCE_DESKTOPUI_SCALING = "1.5"; 25 | fish_features = "qmark-noglob"; 26 | } 27 | -------------------------------------------------------------------------------- /src/fonts.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | { 4 | fontconfig = { 5 | defaultFonts = { 6 | emoji = [ "Noto Color Emoji" ]; 7 | monospace = [ "JetBrainsMono Nerd Font" "Cascadia Code" "Sarasa Mono SC" ]; 8 | sansSerif = [ "Arimo Nerd Font" "Sarasa Gothic SC" ]; 9 | serif = [ "Arimo Nerd Font" "Sarasa Gothic SC" ]; 10 | }; 11 | includeUserConf = false; 12 | }; 13 | packages = with pkgs; [ 14 | cascadia-code 15 | nerd-fonts.arimo 16 | nerd-fonts.jetbrains-mono 17 | sarasa-gothic 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /src/i18n.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | { 4 | inputMethod = { 5 | enable = true; 6 | fcitx5.addons = [ pkgs.fcitx5-rime ]; 7 | type = "fcitx5"; 8 | }; 9 | supportedLocales = [ "en_US.UTF-8/UTF-8" ]; 10 | } 11 | -------------------------------------------------------------------------------- /src/networking.nix: -------------------------------------------------------------------------------- 1 | { 2 | dhcpcd.wait = "background"; 3 | interfaces.enp8s0f3u1c2.useDHCP = true; 4 | nameservers = [ 5 | "2620:fe::fe" 6 | "2620:fe::9" 7 | "9.9.9.9" 8 | "149.112.112.122" 9 | ]; 10 | networkmanager = { 11 | enable = true; 12 | dns = "none"; 13 | ethernet.macAddress = "random"; 14 | unmanaged = [ "type:ethernet" ]; 15 | wifi.macAddress = "random"; 16 | }; 17 | useDHCP = false; 18 | } 19 | -------------------------------------------------------------------------------- /src/nix.nix: -------------------------------------------------------------------------------- 1 | { inputs }: 2 | 3 | { 4 | buildMachines = [ 5 | { 6 | hostName = "aarch64.nixos.community"; 7 | maxJobs = 64; 8 | sshKey = "/root/.ssh/aarch64-build-box"; 9 | sshUser = "figsoda"; 10 | system = "aarch64-linux"; 11 | supportedFeatures = [ "big-parallel" ]; 12 | } 13 | { 14 | hostName = "darwin-build-box.nix-community.org"; 15 | maxJobs = 64; 16 | sshKey = "/root/.ssh/darwin-build-box"; 17 | sshUser = "figsoda"; 18 | systems = [ "aarch64-darwin" "x86_64-darwin" ]; 19 | supportedFeatures = [ "big-parallel" ]; 20 | } 21 | ]; 22 | distributedBuilds = true; 23 | gc = { 24 | automatic = true; 25 | dates = "Sat, 04:30"; 26 | options = "--delete-older-than 7d"; 27 | }; 28 | registry.nixpkgs.flake = inputs.nixpkgs; 29 | settings = { 30 | auto-optimise-store = true; 31 | experimental-features = [ "flakes" "nix-command" ]; 32 | flake-registry = "${inputs.flake-registry}/flake-registry.json"; 33 | keep-outputs = true; 34 | log-lines = 50; 35 | nix-path = [ 36 | "nixpkgs=${inputs.nixpkgs}" 37 | ]; 38 | substituters = [ 39 | "https://figsoda.cachix.org" 40 | "https://nix-community.cachix.org" 41 | ]; 42 | trusted-public-keys = [ 43 | "figsoda.cachix.org-1:mJfTEL4qLCqymqynJlaTxxi5APlaM0DfWg+h+CRGa20=" 44 | "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" 45 | ]; 46 | trusted-users = [ "root" "@wheel" ]; 47 | }; 48 | } 49 | -------------------------------------------------------------------------------- /src/nixpkgs.nix: -------------------------------------------------------------------------------- 1 | { inputs }: 2 | 3 | { 4 | config.allowUnfree = true; 5 | overlays = with inputs; [ 6 | fenix.overlays.default 7 | figsoda-pkgs.overlays.default 8 | ]; 9 | } 10 | -------------------------------------------------------------------------------- /src/programs/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | command-not-found.enable = false; 3 | 4 | dconf.enable = true; 5 | 6 | gamemode.enable = true; 7 | 8 | steam.enable = true; 9 | } 10 | -------------------------------------------------------------------------------- /src/programs/fish/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | enable = true; 3 | useBabelfish = true; 4 | } 5 | -------------------------------------------------------------------------------- /src/programs/fish/interactiveShellInit.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, root }: 2 | 3 | let 4 | inherit (builtins) concatStringsSep; 5 | inherit (lib) mapAttrsToList removePrefix; 6 | inherit (pkgs) coreutils fish rust-templates; 7 | 8 | nix = config.nix.package; 9 | in 10 | 11 | /* fish */ '' 12 | ${concatStringsSep "\n" (mapAttrsToList 13 | (k: v: "set -g fish_${k} ${removePrefix "#" v}") 14 | (with root.colors; { 15 | color_autosuggestion = lightgray; 16 | color_cancel = red; 17 | color_command = "${blue} -o"; 18 | color_comment = "${lightgray} -i"; 19 | color_cwd = green; 20 | color_cwd_root = blue; 21 | color_end = white; 22 | color_error = lightred; 23 | color_escape = cyan; 24 | color_history_current = "${yellow} -o"; 25 | color_host = blue; 26 | color_host_remote = blue; 27 | color_match = cyan; 28 | color_normal = white; 29 | color_operator = cyan; 30 | color_param = white; 31 | color_quote = green; 32 | color_redirection = magenta; 33 | color_search_match = yellow; 34 | color_selection = gray; 35 | color_status = red; 36 | color_user = yellow; 37 | color_valid_path = yellow; 38 | greeting = ""; 39 | pager_color_background = ""; 40 | pager_color_completion = white; 41 | pager_color_description = green; 42 | pager_color_prefix = "${white} -o"; 43 | pager_color_progress = yellow; 44 | pager_color_selected_completion = "${blue} -o"; 45 | pager_color_selected_description = yellow; 46 | pager_color_selected_prefix = "${blue} -o -u"; 47 | }))} 48 | 49 | ${concatStringsSep "\n" 50 | (mapAttrsToList (k: v: "set -gx LESS_TERMCAP_${k} ${v}") { 51 | md = ''\e"[1m"\e"[38;2;97;175;239m"''; 52 | ue = ''\e"[0m"''; 53 | us = ''\e"[38;2;209;154;102m"''; 54 | })} 55 | 56 | abbr -ag --position anywhere -- "\ad" "--argstr system aarch64-darwin" 57 | abbr -ag --position anywhere -- "\al" "--argstr system aarch64-linux" 58 | abbr -ag --position anywhere -- "\xd" "--argstr system x86_64-darwin" 59 | 60 | function fish_command_not_found -a cmd 61 | history merge 62 | history delete -Ce -- $history[1] 63 | if [ -d $cmd ] 64 | echo "fish: Entering directory: $cmd" >&2 65 | cd $cmd 66 | else 67 | echo "fish: Unknown command: $cmd" >&2 68 | end 69 | end 70 | 71 | function gen -a tmpl name 72 | ${rust-templates}/bin/generate $tmpl $name $name '["figsoda "]' figsoda/$name 73 | and cd $name 74 | and commandline "git push -u origin main" 75 | end 76 | 77 | function p -a name 78 | ${coreutils}/bin/realpath (command -v $name) 79 | end 80 | 81 | function w 82 | if set -q with_pkgs 83 | set with_pkgs ", $with_pkgs" 84 | end 85 | set -lx with_pkgs "$argv$with_pkgs" 86 | IN_NIX_SHELL=impure name="with: $with_pkgs" \ 87 | ${nix}/bin/nix shell nixpkgs#$argv -c ${fish}/bin/fish 88 | end 89 | '' 90 | -------------------------------------------------------------------------------- /src/programs/fish/loginShellInit.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, root }: 2 | 3 | let 4 | inherit (lib) getExe; 5 | in 6 | 7 | with pkgs; 8 | 9 | /* fish */ '' 10 | if not set -q DISPLAY && [ (${coreutils}/bin/tty) = /dev/tty1 ] 11 | exec ${ 12 | sx.override { 13 | xorg = xorg // { 14 | xorgserver = writers.writeDashBin "Xorg" '' 15 | exec ${xorg.xorgserver}/bin/Xorg -ardelay 320 -arinterval 32 "$@" 16 | ''; 17 | }; 18 | } 19 | }/bin/sx ${ 20 | writers.writeDash "sxrc" '' 21 | ${config.services.asusd.package}/bin/asusctl profile -P performance & 22 | ${config.services.asusd.package}/bin/asusctl fan-curve -m performance -e true & 23 | CM_MAX_CLIPS=100 CM_SELECTIONS=clipboard ${clipmenu}/bin/clipmenud & 24 | ${getExe element-desktop} --hidden & 25 | ${getExe config.i18n.inputMethod.package} & 26 | ${getExe mpd} ${writeText "mpd.conf" '' 27 | music_directory "~/music" 28 | db_file "~/.local/share/mpd/mpd.db" 29 | pid_file "~/.local/share/mpd/mpd.pid" 30 | state_file "~/.local/share/mpd/mpdstate" 31 | bind_to_address "127.0.0.1" 32 | restore_paused "yes" 33 | audio_output { 34 | type "pipewire" 35 | name "mpd" 36 | } 37 | ''} & 38 | ${getExe networkmanagerapplet} & 39 | ${getExe picom} --backend glx & 40 | ${spaceFM}/bin/spacefm -d & 41 | ${getExe unclutter-xfixes} --timeout 3 & 42 | ${getExe volctl} & 43 | ${getExe xdg-user-dirs} & 44 | ${getExe xsettingsd} & 45 | ${getExe xss-lock} --ignore-sleep ${root.pkgs.lockscreen}/bin/lockscreen & 46 | exec ${config.services.xserver.windowManager.awesome.package}/bin/awesome 47 | '' 48 | } 49 | end 50 | '' 51 | -------------------------------------------------------------------------------- /src/programs/fish/shellAbbrs.nix: -------------------------------------------------------------------------------- 1 | { 2 | c = "cargo"; 3 | cb = "cargo build"; 4 | cbr = "cargo build --release"; 5 | cir = "cargo insta review"; 6 | cit = "cargo insta test"; 7 | cl = "cargo clippy"; 8 | cn = "cargo nextest run"; 9 | cr = "cargo run"; 10 | crr = "cargo run --release"; 11 | ct = "cargo test"; 12 | g = "git"; 13 | ga = "git add"; 14 | gab = "git absorb -r"; 15 | gb = " git branch"; 16 | gbb = "git bisect bad"; 17 | gbg = "git bisect good"; 18 | gbr = "git bisect reset"; 19 | gbrun = " git bisect run"; 20 | gbs = "git bisect start"; 21 | gc = "git commit"; 22 | gca = "git commit --amend"; 23 | gcan = "git commit --amend --no-edit"; 24 | gcl = " git clone"; 25 | gcp = " git cherry-pick"; 26 | gd = "git diff"; 27 | gdc = "git diff --cached"; 28 | gdh = "git diff HEAD"; 29 | gf = "git fetch"; 30 | gff = "git pull --ff-only"; 31 | gffu = "git pull --ff-only upstream (git branch --show-current)"; 32 | gfu = "git fetch upstream"; 33 | gl = "git log"; 34 | gm = "git merge"; 35 | gp = "git push"; 36 | gpf = "git push -f"; 37 | gpm = "git pull"; 38 | gpr = "git pull --rebase"; 39 | gpu = "git push -u origin (git branch --show-current)"; 40 | gr = "git reset"; 41 | grb = "git rebase"; 42 | gre = "git restore"; 43 | gro = "git reabse --onto"; 44 | gs = "git status"; 45 | gs- = "git switch -"; 46 | gsC = " git switch -C"; 47 | gsc = " git switch -c"; 48 | gsd = " git switch -d"; 49 | gsp = "git stash pop"; 50 | gst = "git stash"; 51 | gsw = " git switch"; 52 | gt = " git tag"; 53 | n = "nix"; 54 | nb = "nix build"; 55 | nbf = "nix build -f ."; 56 | nd = "nix develop -c fish"; 57 | nf = "nix flake"; 58 | nfc = "nix flake check"; 59 | nfs = "nix flake show"; 60 | nfu = "nix flake update"; 61 | nfuc = "nix flake update --commit-lock-file"; 62 | nh = "nixpkgs-hammer"; 63 | ni = "nix-init"; 64 | nl = " nix-locate"; 65 | nmc = "namaka check"; 66 | nmr = "namaka review"; 67 | nr = "nix run"; 68 | nra = "nixpkgs-review approve"; 69 | nram = "nixpkgs-review approve && nixpkgs-review merge"; 70 | nrh = "nixpkgs-review rev HEAD"; 71 | nrm = "nixpkgs-review merge"; 72 | nrp = " nixpkgs-review pr --sandbox"; 73 | nrpam = "nixpkgs-review post-result && nixpkgs-review approve && nixpkgs-review merge"; 74 | nrpr = "nixpkgs-review post-result"; 75 | nrw = "nixpkgs-rev wip"; 76 | nsip = "nix-shell -I nixpkgs=. --run fish -p"; 77 | nsp = "nix-shell --run fish -p"; 78 | nu = "nix-update"; 79 | nuc = "nix-update --commit"; 80 | nucb = "nix-update --commit --build"; 81 | p = " p"; 82 | r = " r"; 83 | vpu = " nix run -f . vimPluginsUpdater -- -t (ghtok | psub)"; 84 | w = " w"; 85 | z = "zig"; 86 | zb = "zig build"; 87 | zf = "zig fmt"; 88 | zr = "zig build run"; 89 | zt = "zig build test"; 90 | } 91 | -------------------------------------------------------------------------------- /src/programs/fish/shellAliases.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | let 4 | inherit (pkgs) coreutils eza; 5 | in 6 | 7 | { 8 | cp = "${coreutils}/bin/cp -ir"; 9 | ls = "${eza}/bin/eza -bl --git --icons --time-style long-iso --group-directories-first"; 10 | mv = "${coreutils}/bin/mv -i"; 11 | rm = "${coreutils}/bin/rm -I"; 12 | } 13 | -------------------------------------------------------------------------------- /src/programs/git/config.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | let 4 | inherit (pkgs) delta libsecret writers; 5 | in 6 | 7 | { 8 | core = { 9 | fsmonitor = true; 10 | pager = "${delta}/bin/delta"; 11 | }; 12 | credential."https://github.com" = { 13 | username = "figsoda"; 14 | helper = writers.writeBash "credential-helper-github" '' 15 | if [ "$1" = get ]; then 16 | echo -n password= 17 | ${libsecret}/bin/secret-tool lookup github git 18 | fi 19 | ''; 20 | }; 21 | delta = { 22 | hunk-header-decoration-style = "blue"; 23 | line-number = true; 24 | syntax-theme = "OneHalfDark"; 25 | }; 26 | features.manyFiles = true; 27 | http.postBuffer = 32 * 1024 * 1024; 28 | init.defaultBranch = "main"; 29 | interactive.diffFilter = "${delta}/bin/delta --color-only"; 30 | url = { 31 | "https://gitlab.com/".insteadOf = [ "gl:" "gitlab:" ]; 32 | "https://github.com/".insteadOf = [ "gh:" "github:" ]; 33 | "https://github.com/figsoda/".insteadOf = [ "me:" ]; 34 | "https://github.com/nix-community/".insteadOf = [ "nc:" ]; 35 | }; 36 | user = { 37 | name = "figsoda"; 38 | email = "figsoda@pm.me"; 39 | }; 40 | } 41 | -------------------------------------------------------------------------------- /src/programs/git/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | enable = true; 3 | } 4 | -------------------------------------------------------------------------------- /src/programs/neovim/configure/.luarc.json: -------------------------------------------------------------------------------- 1 | { 2 | "diagnostics.globals": ["vim"] 3 | } 4 | -------------------------------------------------------------------------------- /src/programs/neovim/configure/_colorscheme.nix: -------------------------------------------------------------------------------- 1 | { lib, root }: 2 | 3 | with root.colors; 4 | 5 | let 6 | inherit (builtins) concatStringsSep; 7 | inherit (lib) flip imap0 mapAttrsToList; 8 | 9 | highlights = { 10 | # group-name 11 | Comment = { 12 | fg = lightgray; 13 | attrs = "italic"; 14 | }; 15 | Constant.fg = blue; 16 | String.fg = green; 17 | Character.fg = green; 18 | Number.fg = orange; 19 | Boolean.fg = orange; 20 | Float.fg = orange; 21 | Identifier.fg = white; 22 | Function.fg = blue; 23 | Statement.fg = magenta; 24 | Conditional.fg = magenta; 25 | Repeat.fg = magenta; 26 | Label.fg = red; 27 | Operator.fg = magenta; 28 | Keyword.fg = magenta; 29 | Exception.fg = magenta; 30 | PreProc.fg = blue; 31 | Include.fg = magenta; 32 | Define.fg = magenta; 33 | Macro.fg = magenta; 34 | PreCondit.fg = yellow; 35 | Type.fg = yellow; 36 | StorageClass.fg = yellow; 37 | Structure.fg = yellow; 38 | Typedef.fg = yellow; 39 | Special.fg = blue; 40 | SpecialChar.fg = orange; 41 | Tag = { }; 42 | Delimiter = { }; 43 | SpecialComment = { 44 | fg = lightgray; 45 | attrs = "italic"; 46 | }; 47 | Debug = { }; 48 | Underlined.attrs = "underline"; 49 | Ignore = { }; 50 | Error.fg = red; 51 | Todo.fg = magenta; 52 | 53 | # highlight-groups 54 | ColorColumn.bg = dimgray; 55 | Conceal = { }; 56 | Cursor = { 57 | fg = black; 58 | bg = blue; 59 | }; 60 | lCursor = { 61 | fg = black; 62 | bg = cyan; 63 | }; 64 | CursorIM.fg = white; 65 | CursorColumn.bg = dimgray; 66 | CursorLine.bg = dimgray; 67 | Directory.fg = blue; 68 | DiffAdd.fg = green; 69 | DiffChange.fg = yellow; 70 | DiffDelete.fg = red; 71 | DiffText.fg = white; 72 | EndOfBuffer.fg = black; 73 | TermCursor.bg = white; 74 | TermCursorNC.fg = white; 75 | ErrorMsg.fg = red; 76 | WinSeparator.fg = black; 77 | Folded.fg = lightgray; 78 | FoldColumn.fg = white; 79 | SignColumn.fg = white; 80 | IncSearch = { 81 | fg = yellow; 82 | bg = lightgray; 83 | }; 84 | Substitute = { 85 | fg = black; 86 | bg = yellow; 87 | }; 88 | LineNr.fg = silver; 89 | CursorLineNr.fg = white; 90 | MatchParen = { 91 | fg = blue; 92 | attrs = "underline"; 93 | }; 94 | ModeMsg.fg = white; 95 | MsgArea.fg = white; 96 | MsgSeparator.fg = dimgray; 97 | MoreMsg.fg = white; 98 | NonText.fg = silver; 99 | Normal = { 100 | fg = white; 101 | bg = black; 102 | }; 103 | NormalFloat = { 104 | fg = white; 105 | bg = dimgray; 106 | }; 107 | NormalNC = { 108 | fg = white; 109 | bg = black; 110 | }; 111 | Pmenu = { 112 | fg = white; 113 | bg = dimgray; 114 | }; 115 | PmenuSel = { 116 | fg = black; 117 | bg = blue; 118 | }; 119 | PmenuSbar.bg = dimgray; 120 | PmenuThumb.bg = lightgray; 121 | Question.fg = magenta; 122 | QuickFixLine = { 123 | fg = black; 124 | bg = yellow; 125 | }; 126 | Search = { 127 | fg = black; 128 | bg = yellow; 129 | }; 130 | SpecialKey.fg = silver; 131 | SpellBad = { 132 | fg = red; 133 | attrs = "underline"; 134 | }; 135 | SpellCap.fg = orange; 136 | SpellLocal.fg = orange; 137 | SpellRare.fg = orange; 138 | StatusLine = { }; 139 | StatusLineNC = { }; 140 | TabLine.fg = lightgray; 141 | TabLineFill = { }; 142 | TabLineSel.fg = white; 143 | Title = { 144 | fg = blue; 145 | attrs = "bold"; 146 | }; 147 | Visual.bg = gray; 148 | VisualNOS.bg = gray; 149 | WarningMsg.fg = yellow; 150 | Whitespace.fg = silver; 151 | WildMenu = { 152 | fg = black; 153 | bg = blue; 154 | }; 155 | 156 | # nvim_open_win 157 | FloatBorder = { 158 | fg = white; 159 | bg = dimgray; 160 | }; 161 | 162 | # diagnostic 163 | DiagnosticError.fg = red; 164 | DiagnosticWarn.fg = yellow; 165 | DiagnosticInfo.fg = blue; 166 | DiagnosticHint.fg = white; 167 | DiagnosticUnderlineError = { 168 | sp = red; 169 | attrs = "underline"; 170 | }; 171 | DiagnosticUnderlineWarn = { 172 | sp = yellow; 173 | attrs = "underline"; 174 | }; 175 | DiagnosticUnderlineInfo = { 176 | sp = blue; 177 | attrs = "underline"; 178 | }; 179 | DiagnosticUnderlineHint = { 180 | sp = white; 181 | attrs = "underline"; 182 | }; 183 | 184 | # diff 185 | diffRemoved.fg = red; 186 | diffAdded.fg = green; 187 | diffChanged.fg = yellow; 188 | diffSubname.fg = orange; 189 | diffLine.fg = magenta; 190 | diffFile.fg = yellow; 191 | diffOldFile.fg = red; 192 | diffNewFile.fg = green; 193 | diffIndexLine.fg = magenta; 194 | 195 | # gitsigns.nvim 196 | GitSignsAdd.fg = green; 197 | GitSignsChange.fg = yellow; 198 | GitSignsDelete.fg = red; 199 | 200 | # indent-blankline.nvim 201 | IblIndent.fg = gray; 202 | 203 | # leap.nvim 204 | LeapMatch = { 205 | fg = green; 206 | attrs = "bold"; 207 | }; 208 | LeapLabelPrimary = { 209 | fg = black; 210 | bg = blue; 211 | attrs = "bold"; 212 | }; 213 | LeapLabelSecondary = { 214 | fg = white; 215 | bg = yellow; 216 | attrs = "bold"; 217 | }; 218 | LeapLabelSelected = { 219 | fg = magenta; 220 | attrs = "bold"; 221 | }; 222 | LeapBackdrop = { 223 | fg = lightgray; 224 | bg = black; 225 | attrs = "NONE"; 226 | }; 227 | 228 | # lsp-semantic-highlight 229 | "@lsp.type.attributeBracket".fg = cyan; 230 | "@lsp.type.builtinAttribute".fg = cyan; 231 | "@lsp.type.class".fg = yellow; 232 | "@lsp.type.comment" = { 233 | fg = lightgray; 234 | attrs = "italic"; 235 | }; 236 | "@lsp.type.decorator".fg = cyan; 237 | "@lsp.type.deriveHelper".fg = cyan; 238 | "@lsp.type.enum".fg = yellow; 239 | "@lsp.type.enumMember".fg = orange; 240 | "@lsp.type.event".fg = orange; 241 | "@lsp.type.function".fg = blue; 242 | "@lsp.type.interface".fg = yellow; 243 | "@lsp.type.keyword".fg = magenta; 244 | "@lsp.type.macro".fg = blue; 245 | "@lsp.type.method".fg = blue; 246 | "@lsp.type.modifier".fg = magenta; 247 | "@lsp.type.namespace".fg = white; 248 | "@lsp.type.number".fg = orange; 249 | "@lsp.type.operator".fg = magenta; 250 | "@lsp.type.parameter".fg = red; 251 | "@lsp.type.property".fg = blue; 252 | "@lsp.type.regexp".fg = orange; 253 | "@lsp.type.string".fg = green; 254 | "@lsp.type.struct".fg = yellow; 255 | "@lsp.type.type".fg = yellow; 256 | "@lsp.type.typeParameter".fg = red; 257 | "@lsp.type.variable".fg = white; 258 | "@lsp.typemod.function.builtin".fg = cyan; 259 | "@lsp.typemod.struct.builtin".fg = orange; 260 | 261 | # neo-tree.nvim 262 | NeoTreeDimText.fg = lightgray; 263 | NeoTreeDirectoryIcon.fg = white; 264 | NeoTreeDotfile.fg = lightgray; 265 | NeoTreeFloatBorder = { 266 | fg = white; 267 | bg = black; 268 | }; 269 | NeoTreeFloatNormal = { 270 | fg = white; 271 | bg = black; 272 | }; 273 | NeoTreeGitConflict.fg = lightred; 274 | NeoTreeGitUnstaged.fg = orange; 275 | NeoTreeGitUntracked.fg = orange; 276 | 277 | # noice.nvim 278 | NoiceFormatProgressDone = { 279 | fg = white; 280 | bg = silver; 281 | }; 282 | NoiceFormatProgressTodo = { 283 | fg = white; 284 | bg = black; 285 | }; 286 | NoiceLspProgressTitle.fg = white; 287 | 288 | # nvim-cmp 289 | CmpItemAbbr.fg = white; 290 | CmpItemAbbrDeprecated.fg = lightgray; 291 | CmpItemAbbrMatch.fg = blue; 292 | CmpItemAbbrMatchFuzzy.fg = blue; 293 | CmpItemKind.fg = orange; 294 | CmpItemMenu.fg = white; 295 | 296 | # nvim-notify 297 | NotifyERRORBorder.fg = red; 298 | NotifyERRORIcon.fg = red; 299 | NotifyERRORTitle.fg = red; 300 | NotifyWARNBorder.fg = yellow; 301 | NotifyWARNIcon.fg = yellow; 302 | NotifyWARNTitle.fg = yellow; 303 | NotifyINFOBorder.fg = blue; 304 | NotifyINFOIcon.fg = blue; 305 | NotifyINFOTitle.fg = blue; 306 | NotifyDEBUGBorder.fg = white; 307 | NotifyDEBUGIcon.fg = white; 308 | NotifyDEBUGTitle.fg = white; 309 | NotifyTRACEBorder.fg = white; 310 | NotifyTRACEIcon.fg = white; 311 | NotifyTRACETitle.fg = white; 312 | 313 | # telescope.nvim 314 | TelescopeResultsIdentifier.fg = blue; 315 | 316 | # treesitter 317 | "@attribute".fg = cyan; 318 | "@constant.builtin".fg = orange; 319 | "@constant.macro".fg = orange; 320 | "@constructor".fg = yellow; 321 | "@error".fg = red; 322 | "@field".fg = blue; 323 | "@function.builtin".fg = cyan; 324 | "@function.macro".fg = blue; 325 | "@namespace".fg = white; 326 | "@none".fg = white; 327 | "@parameter".fg = red; 328 | "@property".fg = blue; 329 | "@punctuation.delimiter".fg = white; 330 | "@punctuation.special".fg = blue; 331 | "@string.escape".fg = orange; 332 | "@string.regex".fg = orange; 333 | "@string.special".fg = orange; 334 | "@symbol".fg = cyan; 335 | "@tag".fg = blue; 336 | "@tag.attribute".fg = red; 337 | "@tag.delimiter".fg = blue; 338 | "@text.danger".fg = red; 339 | "@text.emphasis".attrs = "italic"; 340 | "@text.literal".fg = green; 341 | "@text.note".fg = blue; 342 | "@text.reference".fg = red; 343 | "@text.strong".attrs = "bold"; 344 | "@text.title" = { 345 | fg = blue; 346 | attrs = "bold"; 347 | }; 348 | "@text.uri".fg = orange; 349 | "@text.warning".fg = yellow; 350 | "@type".fg = yellow; 351 | "@type.qualifier".fg = magenta; 352 | "@variable".fg = white; 353 | "@variable.builtin".fg = orange; 354 | 355 | # vim-loves-dafny 356 | dafnyLogic.fg = blue; 357 | 358 | # custom 359 | StatusLineGitAdded = { 360 | fg = green; 361 | bg = dimgray; 362 | }; 363 | StatusLineGitChanged = { 364 | fg = yellow; 365 | bg = dimgray; 366 | }; 367 | StatusLineGitRemoved = { 368 | fg = red; 369 | bg = dimgray; 370 | }; 371 | }; 372 | in 373 | 374 | concatStringsSep "\n" 375 | (flip mapAttrsToList highlights 376 | (group: highlight: 377 | let 378 | get = k: highlight.${k} or "NONE"; 379 | in 380 | "hi ${group} guifg=${get "fg"} guibg=${get "bg"} guisp=${highlight.sp or (get "fg")} gui=${get "attrs"}") 381 | ++ imap0 (i: color: "let terminal_color_${toString i} = '${color}'") [ 382 | black 383 | red 384 | green 385 | yellow 386 | blue 387 | magenta 388 | cyan 389 | white 390 | silver 391 | lightred 392 | green 393 | orange 394 | blue 395 | magenta 396 | cyan 397 | ]) 398 | -------------------------------------------------------------------------------- /src/programs/neovim/configure/autopairs.lua: -------------------------------------------------------------------------------- 1 | local api = vim.api 2 | local fn = vim.fn 3 | local map = vim.keymap.set 4 | local treesitter = vim.treesitter 5 | 6 | local function get(s, i) 7 | return s:sub(i, i) 8 | end 9 | 10 | local function indent_pair(r) 11 | local indent = string.rep(" ", fn.indent(".")) 12 | return string.format(" %s%s%s", indent, r, indent) 13 | end 14 | 15 | local function ts_string(buf, x, y) 16 | for _, capture in pairs(treesitter.get_captures_at_pos(buf, y - 1, x)) do 17 | if capture.capture:match("^string") then 18 | return true 19 | end 20 | end 21 | return false 22 | end 23 | 24 | local function syn_string(x, y) 25 | local ids = fn.synstack(y, x + 1) 26 | local len = #ids 27 | if len == 0 then 28 | return false 29 | else 30 | local syn = fn.synIDattr(ids[len], "name") 31 | return syn:find("String") or syn:find("InterpolationDelimiter") 32 | end 33 | end 34 | 35 | local function in_string(x, y) 36 | local last_x, last_y 37 | if x == 0 then 38 | last_y = y - 1 39 | last_x = math.max(#fn.getline(last_y), 1) 40 | else 41 | last_x = x - 1 42 | last_y = y 43 | end 44 | 45 | local buf = api.nvim_get_current_buf() 46 | if treesitter.highlighter.active[buf] then 47 | return ts_string(buf, x, y) and ts_string(buf, last_x, last_y) 48 | else 49 | return syn_string(x, y) and syn_string(last_x, last_y) 50 | end 51 | end 52 | 53 | local autopairs = { 54 | ["("] = ")", 55 | ["["] = "]", 56 | ["{"] = "}", 57 | ['"'] = '"', 58 | } 59 | 60 | local function in_pair() 61 | local line = api.nvim_get_current_line() 62 | local x = fn.col(".") 63 | local r = get(line, x) 64 | return r ~= "" and r == autopairs[get(line, x - 1)] 65 | end 66 | 67 | map("i", "", function() 68 | return in_pair() and "" or "" 69 | end, { expr = true }) 70 | 71 | map("i", "", function() 72 | return in_pair() and indent_pair("") or "" 73 | end, { expr = true }) 74 | 75 | api.nvim_create_autocmd("FileType", { 76 | pattern = "nix", 77 | callback = function(ctx) 78 | map("i", "", function() 79 | local line = api.nvim_get_current_line() 80 | local x = fn.col(".") 81 | local r = get(line, x) 82 | if r ~= "" and r == autopairs[get(line, x - 1)] then 83 | return indent_pair("") 84 | elseif line:sub(x - 2, x - 1) == "''" and get(line, x - 3) ~= "'" then 85 | return indent_pair("''") 86 | else 87 | return "" 88 | end 89 | end, { buffer = ctx.buf, expr = true }) 90 | end, 91 | }) 92 | 93 | for l, r in pairs(autopairs) do 94 | if l == r then 95 | map("i", l, function() 96 | local y, x = unpack(api.nvim_win_get_cursor(0)) 97 | if in_string(x, y) then 98 | return get(api.nvim_get_current_line(), x + 1) == l and "" or l 99 | else 100 | return l .. l .. "" 101 | end 102 | end, { expr = true }) 103 | else 104 | map("i", l, function() 105 | local line = api.nvim_get_current_line() 106 | local pos = fn.col(".") 107 | return pos ~= #line and (get(line, pos) or ""):match("%w") and l 108 | or l .. r .. "" 109 | end, { expr = true }) 110 | map("i", r, function() 111 | return get(api.nvim_get_current_line(), fn.col(".")) == r and "" 112 | or r 113 | end, { expr = true }) 114 | end 115 | end 116 | -------------------------------------------------------------------------------- /src/programs/neovim/configure/before.lua: -------------------------------------------------------------------------------- 1 | local no_top_text = { 2 | opts = { 3 | border = { 4 | text = { top = "" }, 5 | }, 6 | }, 7 | } 8 | 9 | require("notify").setup({ 10 | max_width = 80, 11 | minimum_width = 20, 12 | on_open = function(win) 13 | vim.api.nvim_win_set_config(win, { border = "single" }) 14 | end, 15 | stages = "static", 16 | render = "minimal", 17 | }) 18 | 19 | require("noice").setup({ 20 | cmdline = { 21 | format = { 22 | cmdline = no_top_text, 23 | filter = no_top_text, 24 | lua = no_top_text, 25 | search_down = no_top_text, 26 | search_up = no_top_text, 27 | }, 28 | }, 29 | 30 | lsp = { 31 | override = { 32 | ["cmp.entry.get_documentation"] = true, 33 | ["vim.lsp.util.convert_input_to_markdown_lines"] = true, 34 | ["vim.lsp.util.stylize_markdown"] = true, 35 | }, 36 | progress = { 37 | enabled = false, 38 | }, 39 | }, 40 | 41 | popupmenu = { 42 | backend = "cmp", 43 | }, 44 | 45 | routes = { 46 | { 47 | filter = { 48 | event = "msg_show", 49 | kind = "search_count", 50 | }, 51 | opts = { skip = true }, 52 | }, 53 | }, 54 | 55 | views = { 56 | cmdline_popup = { 57 | border = { 58 | style = "single", 59 | }, 60 | }, 61 | confirm = { 62 | border = { 63 | style = "single", 64 | text = { top = "" }, 65 | }, 66 | }, 67 | }, 68 | }) 69 | -------------------------------------------------------------------------------- /src/programs/neovim/configure/customRC.nix: -------------------------------------------------------------------------------- 1 | { inputs, lib, config, pkgs, root, super }: 2 | 3 | let 4 | inherit (lib) mapAttrs' nameValuePair; 5 | 6 | nix = config.nix.package; 7 | 8 | substitutePackages = src: substitutions: 9 | pkgs.substituteAll ({ inherit src; } // mapAttrs' 10 | (k: nameValuePair (builtins.replaceStrings [ "-" ] [ "_" ] k)) 11 | substitutions); 12 | 13 | codeExt = pub: ext: 14 | "${pkgs.vscode-extensions.${pub}.${ext}}/share/vscode/extensions/${pub}.${ext}"; 15 | in 16 | 17 | /* vim */ '' 18 | ${super.colorscheme} 19 | 20 | luafile ${./before.lua} 21 | 22 | source ${ 23 | substitutePackages ./init.vim { 24 | inherit (root.pkgs) rust; 25 | inherit (pkgs) fd fish nixpkgs-fmt stylua util-linux; 26 | } 27 | } 28 | 29 | luafile ${./autopairs.lua} 30 | 31 | luafile ${ 32 | substitutePackages ./init.lua { 33 | inherit nix; 34 | inherit (inputs) nixpkgs; 35 | inherit (pkgs) cargo-edit dafny stack; 36 | inherit (root.pkgs) rust; 37 | } 38 | } 39 | 40 | luafile ${ 41 | substitutePackages ./plugins.lua (root.colors // { 42 | inherit (pkgs) 43 | clang-tools 44 | dafny 45 | emmet-ls 46 | isort 47 | lua-language-server 48 | nil 49 | nixpkgs-fmt 50 | pyright 51 | shellcheck 52 | statix 53 | stylua 54 | taplo 55 | tinymist 56 | vscode-langservers-extracted 57 | xdg-utils 58 | yaml-language-server 59 | zls 60 | ; 61 | inherit (pkgs.nodePackages) 62 | prettier 63 | typescript-language-server 64 | vim-language-server 65 | ; 66 | inherit (pkgs.ocamlPackages) ocaml-lsp; 67 | 68 | black-py = pkgs.black; 69 | 70 | lua-paths = 71 | let 72 | inherit (config.programs.neovim) configure package; 73 | in 74 | lib.concatMapStringsSep ''", "'' (path: "${path}/lua") 75 | ([ "${package}/share/nvim/runtime" ] ++ configure.packages.all.start); 76 | 77 | rust-analyzer = pkgs.rust-analyzer-nightly; 78 | 79 | vscode-lldb = codeExt "vadimcn" "vscode-lldb"; 80 | }) 81 | } 82 | 83 | luafile ${ 84 | substitutePackages ./snippets.lua { 85 | inherit nix; 86 | } 87 | } 88 | '' 89 | -------------------------------------------------------------------------------- /src/programs/neovim/configure/init.lua: -------------------------------------------------------------------------------- 1 | local dap = require("dap") 2 | local dapui = require("dapui") 3 | local gitsigns = require("gitsigns") 4 | local luasnip = require("luasnip") 5 | 6 | local api = vim.api 7 | local b = vim.b 8 | local g = vim.g 9 | local map = vim.keymap.set 10 | local o = vim.o 11 | 12 | local function mapt(buf, lhs, cmd, no_auto_quit) 13 | map("n", lhs, function() 14 | api.nvim_command("T " .. cmd) 15 | b.no_auto_quit = no_auto_quit 16 | api.nvim_command("startinsert") 17 | end, { buffer = buf }) 18 | end 19 | 20 | local function map_cargo(ctx) 21 | mapt(ctx.buf, " B", "@rust@/bin/cargo run", true) 22 | map("n", " D", ":!@rust@/bin/cargo doc --open", { buffer = ctx.buf }) 23 | mapt(ctx.buf, " U", "@cargo_edit@/bin/cargo-upgrade upgrade") 24 | map("n", " a", function() 25 | vim.ui.input({ prompt = "Add dependencies: " }, function(flags) 26 | if flags then 27 | api.nvim_command("T @rust@/bin/cargo add " .. flags) 28 | api.nvim_command("startinsert") 29 | end 30 | end) 31 | end, { buffer = ctx.buf }) 32 | mapt(ctx.buf, " b", "@rust@/bin/cargo build") 33 | mapt(ctx.buf, " c", "@rust@/bin/cargo test") 34 | mapt(ctx.buf, " u", "@rust@/bin/cargo update") 35 | end 36 | 37 | local function map_nix(ctx) 38 | mapt(ctx.buf, " B", "@nix@/bin/nix run", true) 39 | mapt(ctx.buf, " U", "@nix@/bin/nix flake update --commit-lock-file") 40 | mapt(ctx.buf, " b", "@nix@/bin/nix build") 41 | mapt(ctx.buf, " c", "@nix@/bin/nix flake check") 42 | mapt(ctx.buf, " i", "@nix@/bin/nix repl -f @nixpkgs@") 43 | mapt(ctx.buf, " u", "@nix@/bin/nix flake update") 44 | end 45 | 46 | g.loaded_netrw = true 47 | g.loaded_netrwFileHandlers = true 48 | g.loaded_netrwPlugin = true 49 | g.loaded_netrwSettings = true 50 | g.mapleader = " " 51 | g.zig_fmt_autosave = false 52 | g.zig_fmt_parse_errors = false 53 | 54 | o.clipboard = "unnamedplus" 55 | o.completeopt = "menuone,noinsert,noselect" 56 | o.cursorline = true 57 | o.expandtab = true 58 | o.ignorecase = true 59 | o.list = true 60 | o.listchars = "tab:-->,trail:+,extends:>,precedes:<,nbsp:·" 61 | o.mouse = "a" 62 | o.foldenable = false 63 | o.showmode = false 64 | o.swapfile = false 65 | o.number = true 66 | o.relativenumber = true 67 | o.scrolloff = 2 68 | o.shiftwidth = 4 69 | o.shortmess = "aoOtTIcF" 70 | o.showtabline = 2 71 | o.signcolumn = "yes" 72 | o.smartcase = true 73 | o.smartindent = true 74 | o.splitbelow = true 75 | o.splitright = true 76 | o.termguicolors = true 77 | o.timeoutlen = 400 78 | o.title = true 79 | o.updatetime = 300 80 | 81 | api.nvim_create_autocmd("BufRead", { 82 | pattern = "all-packages.nix", 83 | callback = function() 84 | require("cmp").setup.buffer({ 85 | sources = { 86 | { name = "nvim_lsp" }, 87 | { name = "path" }, 88 | }, 89 | }) 90 | end, 91 | }) 92 | 93 | api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { 94 | pattern = { "Cargo.toml", "Cargo.lock" }, 95 | callback = map_cargo, 96 | }) 97 | 98 | api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { 99 | pattern = "flake.lock", 100 | callback = map_nix, 101 | }) 102 | 103 | api.nvim_create_autocmd("FileType", { 104 | pattern = "dafny", 105 | callback = function(ctx) 106 | mapt(ctx.buf, " B", "@dafny@/bin/dafny run " .. ctx.file, true) 107 | mapt(ctx.buf, " b", "@dafny@/bin/dafny build " .. ctx.file) 108 | mapt(ctx.buf, " c", "@dafny@/bin/dafny test " .. ctx.file) 109 | end, 110 | }) 111 | 112 | api.nvim_create_autocmd("FileType", { 113 | pattern = "haskell", 114 | callback = function(ctx) 115 | mapt(ctx.buf, " B", "@stack@/bin/stack run", true) 116 | mapt(ctx.buf, " b", "@stack@/bin/stack build") 117 | mapt(ctx.buf, " c", "@stack@/bin/stack test") 118 | mapt(ctx.buf, " i", "@stack@/bin/stack ghci") 119 | end, 120 | }) 121 | 122 | api.nvim_create_autocmd("FileType", { 123 | pattern = "nix", 124 | callback = map_nix, 125 | }) 126 | 127 | api.nvim_create_autocmd("FileType", { 128 | pattern = "rust", 129 | callback = function(ctx) 130 | if string.sub(ctx.file, 1, 5) == "/tmp/" then 131 | mapt(ctx.buf, " B", "@rust@/bin/cargo -Zscript " .. ctx.file, true) 132 | else 133 | map_cargo(ctx) 134 | end 135 | end, 136 | }) 137 | 138 | api.nvim_create_autocmd("TermClose", { 139 | callback = function() 140 | if not b.no_auto_quit then 141 | vim.defer_fn(function() 142 | if api.nvim_get_current_line() == "[Process exited 0]" then 143 | api.nvim_buf_delete(0, { force = true }) 144 | end 145 | end, 50) 146 | end 147 | end, 148 | }) 149 | 150 | api.nvim_create_autocmd("TextYankPost", { 151 | callback = function() 152 | vim.highlight.on_yank() 153 | end, 154 | }) 155 | 156 | api.nvim_create_user_command("P", function(input) 157 | local ext = input.fargs[1] 158 | local file = vim.fn.tempname() 159 | if ext and ext ~= "" then 160 | file = file .. "." .. ext 161 | end 162 | api.nvim_command("edit " .. file) 163 | 164 | if ext == "rs" then 165 | api.nvim_put({ 166 | "//!```cargo", 167 | "//! [package]", 168 | [[//! edition = "2021"]], 169 | "//!", 170 | "//! [dependencies]", 171 | "//! ```", 172 | "", 173 | "fn main() {}", 174 | }, "c", false, false) 175 | end 176 | end, { nargs = "?" }) 177 | 178 | map("n", " dB", dap.clear_breakpoints) 179 | map("n", " dC", dap.reverse_continue) 180 | map("n", " db", dap.toggle_breakpoint) 181 | map("n", " dc", dap.continue) 182 | map("n", " dd", function() 183 | dapui.toggle({ reset = true }) 184 | end) 185 | map("n", " dh", dap.step_out) 186 | map("n", " dj", dap.step_over) 187 | map("n", " dk", dap.step_back) 188 | map("n", " dl", dap.step_into) 189 | map("n", " dt", dap.terminate) 190 | map("n", " gR", gitsigns.reset_buffer) 191 | map("n", " gb", gitsigns.blame_line) 192 | map("n", " gh", gitsigns.preview_hunk) 193 | map("n", " gr", gitsigns.reset_hunk) 194 | map("n", " gs", gitsigns.stage_hunk) 195 | map("n", " gu", gitsigns.undo_stage_hunk) 196 | map("n", " nd", function() 197 | require("nix-develop").nix_develop({}) 198 | end) 199 | map("n", " q", require("trouble").toggle) 200 | map("n", "[h", gitsigns.prev_hunk) 201 | map("n", "]h", gitsigns.next_hunk) 202 | 203 | map("s", "", function() 204 | luasnip.jump(-1) 205 | end) 206 | map("s", "", function() 207 | luasnip.jump(1) 208 | end) 209 | 210 | map({ "i", "s" }, "", function() 211 | luasnip.change_choice(1) 212 | end) 213 | 214 | map({ "n", "v", "s" }, " de", dapui.eval) 215 | map({ "n", "v", "s" }, "", function() 216 | if vim.bo.buftype == "terminal" then 217 | api.nvim_buf_delete(0, { force = true }) 218 | else 219 | api.nvim_command("confirm bdelete") 220 | end 221 | end) 222 | 223 | vim.diagnostic.config({ 224 | severity_sort = true, 225 | virtual_text = { 226 | format = function(diagnostic) 227 | return table.concat( 228 | vim.tbl_filter(function(line) 229 | return line ~= "" 230 | end, vim.tbl_map(vim.trim, vim.split(diagnostic.message, "\n"))), 231 | ", " 232 | ) 233 | end, 234 | }, 235 | }) 236 | -------------------------------------------------------------------------------- /src/programs/neovim/configure/init.vim: -------------------------------------------------------------------------------- 1 | no ; : 2 | no let @/ = "" 3 | no confirm quitall 4 | no write 5 | 6 | nn 7 | nn 8 | nn h 9 | nn j 10 | nn k 11 | nn l 12 | nn move +1 13 | nn vertical resize -2 14 | nn resize -2 15 | nn resize +2 16 | nn vertical resize +2 17 | nn BufferLinePick 18 | nn move -2 19 | nn BufferLineCyclePrev 20 | nn / Telescope live_grep 21 | nn fc !@rust@/bin/cargo fmt 22 | nn fl !@fd@/bin/fd -H '.lua$' -x @stylua@/bin/stylua 23 | nn fn !@fd@/bin/fd -H '.nix$' -x @nixpkgs_fmt@/bin/nixpkgs-fmt 24 | nn g :Git 25 | nn gB Telescope git_bcommits 26 | nn gN Git absorb -r 27 | nn gS Telescope git_stash 28 | nn ga Git add -p 29 | nn gc Git commit 30 | nn gi exec "Git rebase -i HEAD~" . (v:count ? v:count : 2) 31 | nn gl Telescope git_commits 32 | nn gn Git commit --amend --no-edit 33 | nn go Telescope git_branches 34 | nn gp Git push 35 | nn j move +1 36 | nn k move -2 37 | nn m Telescope man_pages 38 | nn o Telescope find_files 39 | nn t T @fish@/bin/fishi 40 | nn BufferLineCycleNext 41 | nn N Nzz 42 | nn R "_di"hp 43 | nn T Neotree reveal 44 | nn X "_X 45 | nn n nzz 46 | nn t Neotree toggle focus 47 | nn x "_x 48 | 49 | vn < 51 | vn 52 | vn :move '>+1gv 53 | vn :move -2gv 54 | vn j :move '>+1gv 55 | vn k :move -2gv 56 | vn > >gv 57 | 58 | ino I 59 | ino 60 | ino o 61 | ino O 62 | ino confirm quitall 63 | ino write 64 | ino call setline(".", getline(".") . ",") 65 | ino call setline(".", getline(".") . ";") 66 | ino move +1 67 | ino 68 | ino a 69 | ino a 70 | ino ea 71 | ino move -2 72 | 73 | tno 74 | 75 | autocmd BufRead,BufNewFile *.rasi setfiletype css 76 | 77 | autocmd BufRead,BufNewFile flake.lock setfiletype json 78 | 79 | autocmd BufRead,BufNewFile Cargo.lock setfiletype toml 80 | 81 | autocmd FileType lua setlocal shiftwidth=2 82 | 83 | autocmd FileType markdown setlocal shiftwidth=2 84 | 85 | autocmd FileType nix setlocal shiftwidth=2 86 | 87 | autocmd FileType vim setlocal shiftwidth=2 88 | 89 | autocmd FileType yaml setlocal shiftwidth=2 90 | 91 | autocmd User TelescopePreviewerLoaded setlocal number 92 | 93 | command -nargs=+ T botright 12split term:// 94 | -------------------------------------------------------------------------------- /src/programs/neovim/configure/packages.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | { 4 | all.start = with pkgs.vimPlugins; [ 5 | bufferline-nvim 6 | cmp-buffer 7 | cmp-cmdline 8 | cmp-dap 9 | cmp-nvim-lsp 10 | cmp-nvim-lsp-document-symbol 11 | cmp-path 12 | cmp_luasnip 13 | comment-nvim 14 | crates-nvim 15 | dressing-nvim 16 | gitsigns-nvim 17 | indent-blankline-nvim 18 | leap-nvim 19 | lspkind-nvim 20 | lualine-nvim 21 | luasnip 22 | neo-tree-nvim 23 | nix-develop-nvim 24 | noice-nvim 25 | null-ls-nvim 26 | numb-nvim 27 | nvim-cmp 28 | nvim-colorizer-lua 29 | nvim-dap 30 | nvim-dap-ui 31 | nvim-lspconfig 32 | nvim-navic 33 | nvim-notify 34 | nvim-treesitter-textobjects 35 | nvim-treesitter.withAllGrammars 36 | nvim-web-devicons 37 | nvim_context_vt 38 | playground 39 | refactoring-nvim 40 | ron-vim 41 | rust-tools-nvim 42 | telescope-fzf-native-nvim 43 | telescope-nvim 44 | trouble-nvim 45 | vim-fugitive 46 | vim-lastplace 47 | vim-loves-dafny 48 | vim-visual-multi 49 | ]; 50 | } 51 | -------------------------------------------------------------------------------- /src/programs/neovim/configure/plugins.lua: -------------------------------------------------------------------------------- 1 | local cmp = require("cmp") 2 | local leap = require("leap") 3 | local lspconfig = require("lspconfig") 4 | local luasnip = require("luasnip") 5 | local navic = require("nvim-navic") 6 | local neo_tree = require("neo-tree") 7 | local null_ls = require("null-ls") 8 | local nb = null_ls.builtins 9 | local rust_tools = require("rust-tools") 10 | local telescope = require("telescope") 11 | local trouble = require("trouble") 12 | 13 | local api = vim.api 14 | local diagnostic = vim.diagnostic 15 | local lsp = vim.lsp 16 | local treesitter = vim.treesitter 17 | 18 | local border = { "", "", "", " ", "", "", "", " " } 19 | local capabilities = require("cmp_nvim_lsp").default_capabilities() 20 | 21 | local function on_attach(c, buf) 22 | local function mapb(mode, lhs, rhs) 23 | vim.keymap.set(mode, lhs, rhs, { buffer = buf }) 24 | end 25 | 26 | mapb("n", " e", function() 27 | trouble.open("workspace_diagnostics") 28 | end) 29 | mapb("n", " r", function() 30 | trouble.open("lsp_references") 31 | end) 32 | mapb("n", "K", lsp.buf.hover) 33 | mapb("n", "[d", diagnostic.goto_prev) 34 | mapb("n", "]d", diagnostic.goto_next) 35 | mapb("n", "gd", function() 36 | trouble.open("lsp_definitions") 37 | end) 38 | mapb("n", "ge", function() 39 | diagnostic.open_float(0, { scope = "cursor" }) 40 | end) 41 | mapb("n", "gr", lsp.buf.rename) 42 | mapb("n", "gt", function() 43 | trouble.open("lsp_type_definitions") 44 | end) 45 | mapb({ "n", "v" }, "ff", function() 46 | lsp.buf.format({ async = true, bufnr = buf }) 47 | end) 48 | mapb({ "n", "v" }, "ga", lsp.buf.code_action) 49 | 50 | if c.server_capabilities.documentSymbolProvider then 51 | navic.attach(c, buf) 52 | end 53 | end 54 | 55 | require("bufferline").setup({ 56 | highlights = { 57 | background = { bg = "@black@" }, 58 | buffer_visible = { bg = "@black@" }, 59 | close_button = { bg = "@black@" }, 60 | duplicate = { bg = "@black@" }, 61 | duplicate_visible = { bg = "@black@" }, 62 | error = { bg = "@black@" }, 63 | error_visible = { bg = "@black@" }, 64 | fill = { bg = "@black@" }, 65 | indicator_selected = { fg = "@blue@" }, 66 | modified = { bg = "@black@" }, 67 | modified_visible = { bg = "@black@" }, 68 | pick = { bg = "@black@" }, 69 | pick_visible = { bg = "@black@" }, 70 | separator = { 71 | fg = "@black@", 72 | bg = "@black@", 73 | }, 74 | separator_visible = { 75 | fg = "@black@", 76 | bg = "@black@", 77 | }, 78 | tab = { bg = "@black@" }, 79 | tab_close = { bg = "@black@" }, 80 | warning = { bg = "@black@" }, 81 | warning_selected = { fg = "@yellow@" }, 82 | warning_visible = { bg = "@black@" }, 83 | }, 84 | options = { 85 | custom_filter = function(n) 86 | return api.nvim_buf_get_name(n) ~= "" 87 | and api.nvim_buf_get_option(n, "buftype") ~= "terminal" 88 | end, 89 | diagnostics = "nvim_lsp", 90 | show_close_icon = false, 91 | }, 92 | }) 93 | 94 | cmp.setup({ 95 | confirmation = { default_behavior = cmp.ConfirmBehavior.Replace }, 96 | formatting = { 97 | format = require("lspkind").cmp_format({ with_text = false }), 98 | }, 99 | mapping = { 100 | [""] = function(fallback) 101 | cmp.close() 102 | fallback() 103 | end, 104 | [""] = cmp.mapping.confirm(), 105 | [""] = cmp.mapping.confirm({ select = true }), 106 | [""] = cmp.mapping({ 107 | i = function(fallback) 108 | if not cmp.select_prev_item() and not luasnip.jump(-1) then 109 | fallback() 110 | end 111 | end, 112 | c = cmp.mapping.select_prev_item(), 113 | }), 114 | [""] = cmp.mapping({ 115 | i = function(fallback) 116 | if not cmp.select_next_item() and not luasnip.jump(1) then 117 | fallback() 118 | end 119 | end, 120 | c = cmp.mapping.select_next_item(), 121 | }), 122 | }, 123 | snippet = { 124 | expand = function(args) 125 | luasnip.lsp_expand(args.body) 126 | end, 127 | }, 128 | sources = { 129 | { name = "nvim_lsp" }, 130 | { name = "crates" }, 131 | { name = "path" }, 132 | { name = "luasnip" }, 133 | { name = "buffer", keyword_length = 3 }, 134 | }, 135 | }) 136 | 137 | cmp.setup.cmdline("/", { 138 | sources = { 139 | { name = "nvim_lsp_document_symbol" }, 140 | { name = "buffer" }, 141 | }, 142 | }) 143 | 144 | cmp.setup.cmdline(":", { 145 | sources = { 146 | { name = "cmdline" }, 147 | { name = "path" }, 148 | }, 149 | }) 150 | 151 | cmp.setup.filetype({ "dap-repl", "dapui_watches" }, { 152 | enabled = true, 153 | sources = { 154 | { name = "dap" }, 155 | }, 156 | }) 157 | 158 | require("colorizer").setup({ 159 | user_default_options = { 160 | css = true, 161 | }, 162 | }) 163 | 164 | require("Comment").setup({ ignore = "^$" }) 165 | 166 | require("crates").setup() 167 | 168 | require("dapui").setup() 169 | 170 | require("dressing").setup({ 171 | input = { 172 | border = "single", 173 | override = function(cfg) 174 | cfg.anchor = "NW" 175 | return cfg 176 | end, 177 | win_options = { 178 | winblend = 0, 179 | winhighlight = "FloatBorder:DiagnosticInfo,NormalFloat:Normal", 180 | }, 181 | }, 182 | select = { 183 | backend = { "builtin" }, 184 | builtin = { 185 | border = "single", 186 | min_height = { 0, 0 }, 187 | min_width = { 0, 0 }, 188 | relative = "cursor", 189 | win_options = { 190 | winblend = 0, 191 | winhighlight = "FloatBorder:DiagnosticInfo,NormalFloat:Normal", 192 | }, 193 | }, 194 | }, 195 | }) 196 | 197 | require("gitsigns").setup({ 198 | preview_config = { border = border }, 199 | status_formatter = function(status) 200 | return "  " 201 | .. (status.head == "" and "detached HEAD" or status.head) 202 | .. (status.added and status.added > 0 and " %#StatusLineGitAdded# " .. status.added or "") 203 | .. (status.changed and status.changed > 0 and " %#StatusLineGitChanged# " .. status.changed or "") 204 | .. ( 205 | status.removed 206 | and status.removed > 0 207 | and " %#StatusLineGitRemoved# " .. status.removed 208 | or "" 209 | ) 210 | end, 211 | }) 212 | 213 | require("ibl").setup({ 214 | indent = { 215 | char = "▏", 216 | }, 217 | }) 218 | 219 | leap.opts.special_keys = { 220 | next_phase_one_target = "]", 221 | next_target = "]", 222 | prev_target = "[", 223 | next_group = "]", 224 | prev_group = "[", 225 | } 226 | leap.add_default_mappings() 227 | 228 | require("lualine").setup({ 229 | options = { 230 | component_separators = "", 231 | section_separators = "", 232 | disabled_filetypes = { "neo-tree" }, 233 | theme = { 234 | normal = { 235 | a = { fg = "@black@", bg = "@green@", bold = true }, 236 | b = { fg = "@white@", bg = "@dimgray@" }, 237 | c = { fg = "@white@", bg = "@black@" }, 238 | }, 239 | insert = { a = { fg = "@black@", bg = "@blue@", bold = true } }, 240 | visual = { a = { fg = "@black@", bg = "@magenta@", bold = true } }, 241 | replace = { a = { fg = "@black@", bg = "@red@", bold = true } }, 242 | inactive = { 243 | a = { fg = "@lightgray@", bg = "@black@", bold = true }, 244 | b = { fg = "@lightgray@", bg = "@black@" }, 245 | c = { fg = "@lightgray@", bg = "@black@" }, 246 | }, 247 | }, 248 | }, 249 | sections = { 250 | lualine_b = { 251 | function() 252 | return vim.b.gitsigns_status or "" 253 | end, 254 | }, 255 | lualine_c = { 256 | "filename", 257 | { "diagnostics", sources = { "nvim_diagnostic" } }, 258 | { navic.get_location, cond = navic.is_available }, 259 | }, 260 | }, 261 | }) 262 | 263 | lspconfig.clangd.setup({ 264 | capabilities = capabilities, 265 | cmd = { "@clang_tools@/bin/clangd" }, 266 | on_attach = on_attach, 267 | }) 268 | 269 | lspconfig.dafny.setup({ 270 | capabilities = capabilities, 271 | cmd = { "@dafny@/bin/dafny", "server" }, 272 | on_attach = on_attach, 273 | }) 274 | 275 | lspconfig.emmet_ls.setup({ 276 | capabilities = capabilities, 277 | cmd = { "@emmet_ls@/bin/emmet-ls", "--stdio" }, 278 | on_attach = on_attach, 279 | }) 280 | 281 | lspconfig.cssls.setup({ 282 | capabilities = capabilities, 283 | cmd = { 284 | "@vscode_langservers_extracted@/bin/vscode-css-language-server", 285 | "--stdio", 286 | }, 287 | on_attach = on_attach, 288 | }) 289 | 290 | lspconfig.eslint.setup({ 291 | capabilities = capabilities, 292 | cmd = { 293 | "@vscode_langservers_extracted@/bin/vscode-eslint-language-server", 294 | "--stdio", 295 | }, 296 | on_attach = on_attach, 297 | }) 298 | 299 | lspconfig.jsonls.setup({ 300 | capabilities = capabilities, 301 | cmd = { 302 | "@vscode_langservers_extracted@/bin/vscode-json-language-server", 303 | "--stdio", 304 | }, 305 | on_attach = on_attach, 306 | }) 307 | 308 | lspconfig.hls.setup({ 309 | capabilities = capabilities, 310 | on_attach = on_attach, 311 | }) 312 | 313 | lspconfig.html.setup({ 314 | capabilities = capabilities, 315 | cmd = { 316 | "@vscode_langservers_extracted@/bin/vscode-html-language-server", 317 | "--stdio", 318 | }, 319 | on_attach = on_attach, 320 | }) 321 | 322 | lspconfig.lua_ls.setup({ 323 | capabilities = capabilities, 324 | cmd = { "@lua_language_server@/bin/lua-language-server" }, 325 | on_new_config = function(config, root_dir) 326 | local function load_lua_paths() 327 | config.settings.Lua.workspace.library = { "@lua_paths@" } 328 | end 329 | 330 | local function load_luarc(path) 331 | local file = io.open(root_dir .. "/" .. path) 332 | if not file then 333 | return false 334 | end 335 | 336 | local luarc = vim.json.decode(file:read("*a")) 337 | local lua = luarc.Lua or luarc 338 | local diagnostics = lua and lua.diagnostics or luarc["Lua.diagnostics"] 339 | local globals = diagnostics and diagnostics.globals 340 | or lua and lua["diagnostics.globals"] 341 | or luarc["Lua.diagnostics.globals"] 342 | 343 | if globals and vim.tbl_contains(globals, "vim") then 344 | load_lua_paths() 345 | end 346 | return true 347 | end 348 | 349 | config.settings.Lua.workspace.library = {} 350 | config.settings.Lua.diagnostics.globals = {} 351 | 352 | if load_luarc(".luarc.json") or load_luarc(".luarc.jsonc") then 353 | return 354 | end 355 | 356 | local lcrc = loadfile(root_dir .. "/.luacheckrc", "t", {}) 357 | if lcrc then 358 | local found_vim = false 359 | 360 | local function read_config(cfg) 361 | local function add_globals(globals) 362 | if globals then 363 | for _, global in pairs(globals) do 364 | table.insert(config.settings.Lua.diagnostics.globals, global) 365 | if global == "vim" then 366 | found_vim = true 367 | end 368 | end 369 | end 370 | end 371 | 372 | add_globals(cfg.globals) 373 | add_globals(cfg.new_globals) 374 | add_globals(cfg.new_read_globals) 375 | add_globals(cfg.read_globals) 376 | end 377 | 378 | local lc = {} 379 | setfenv(lcrc, lc) 380 | lcrc() 381 | 382 | read_config(lc) 383 | if lc.std then 384 | read_config(lc.std) 385 | end 386 | 387 | if lc.files then 388 | for _, cfg in lc.files do 389 | if cfg then 390 | read_config(cfg) 391 | if cfg.std then 392 | read_config(cfg.std) 393 | end 394 | end 395 | end 396 | end 397 | 398 | if found_vim then 399 | load_lua_paths() 400 | end 401 | end 402 | end, 403 | 404 | on_attach = on_attach, 405 | 406 | settings = { 407 | Lua = { 408 | completion = { 409 | callSnippet = "Replace", 410 | postfix = ".", 411 | }, 412 | diagnostics = { 413 | disable = { "lowercase-global", "redefined-local" }, 414 | groupSeverity = { 415 | unused = "Warning", 416 | }, 417 | libraryFiles = "Disable", 418 | }, 419 | format = { 420 | enable = false, 421 | }, 422 | runtime = { 423 | pathStrict = true, 424 | version = "LuaJIT", 425 | }, 426 | workspace = { 427 | checkThirdParty = false, 428 | }, 429 | }, 430 | }, 431 | }) 432 | 433 | lspconfig.nil_ls.setup({ 434 | capabilities = capabilities, 435 | cmd = { "@nil@/bin/nil" }, 436 | on_attach = on_attach, 437 | settings = { 438 | ["nil"] = { 439 | formatting = { 440 | command = { "@nixpkgs_fmt@/bin/nixpkgs-fmt" }, 441 | }, 442 | nix = { 443 | flake = { 444 | autoArchive = true, 445 | autoEvalImports = true, 446 | }, 447 | }, 448 | }, 449 | }, 450 | }) 451 | 452 | lspconfig.ocamllsp.setup({ 453 | capabilities = capabilities, 454 | cmd = { "@ocaml_lsp@/bin/ocamllsp" }, 455 | on_attach = on_attach, 456 | }) 457 | 458 | lspconfig.pyright.setup({ 459 | capabilities = capabilities, 460 | cmd = { "@pyright@/bin/pyright-langserver", "--stdio" }, 461 | on_attach = on_attach, 462 | settings = { 463 | python = { 464 | analysis = { 465 | diagnosticSeverityOverrides = { 466 | reportMissingModuleSource = "none", 467 | }, 468 | useLibraryCodeForTypes = true, 469 | }, 470 | }, 471 | }, 472 | }) 473 | 474 | lspconfig.racket_langserver.setup({ 475 | capabilities = capabilities, 476 | on_attach = on_attach, 477 | }) 478 | 479 | lspconfig.taplo.setup({ 480 | capabilities = capabilities, 481 | cmd = { "@taplo@/bin/taplo", "lsp", "stdio" }, 482 | on_attach = on_attach, 483 | }) 484 | 485 | lspconfig.ts_ls.setup({ 486 | capabilities = capabilities, 487 | cmd = { 488 | "@typescript_language_server@/bin/typescript-language-server", 489 | "--stdio", 490 | }, 491 | on_attach = function(c, buf) 492 | on_attach(c, buf) 493 | c.server_capabilities.documentFormattingProvider = false 494 | c.server_capabilities.documentRangeFormattingProvider = false 495 | end, 496 | }) 497 | 498 | lspconfig.tinymist.setup({ 499 | capabilities = capabilities, 500 | cmd = { "@tinymist@/bin/tinymist" }, 501 | on_attach = on_attach, 502 | }) 503 | 504 | lspconfig.vimls.setup({ 505 | capabilities = capabilities, 506 | cmd = { "@vim_language_server@/bin/vim-language-server", "--stdio" }, 507 | on_attach = on_attach, 508 | }) 509 | 510 | lspconfig.yamlls.setup({ 511 | capabilities = capabilities, 512 | cmd = { "@yaml_language_server@/bin/yaml-language-server", "--stdio" }, 513 | on_attach = on_attach, 514 | }) 515 | 516 | lspconfig.zls.setup({ 517 | capabilities = capabilities, 518 | cmd = { "@zls@/bin/zls" }, 519 | on_attach = on_attach, 520 | settings = { 521 | enable_autofix = false, 522 | }, 523 | }) 524 | 525 | luasnip.config.setup({ 526 | region_check_events = "InsertEnter", 527 | }) 528 | 529 | neo_tree.setup({ 530 | default_component_configs = { 531 | icon = { 532 | default = "", 533 | }, 534 | }, 535 | event_handlers = { 536 | { 537 | event = "file_opened", 538 | handler = function() 539 | require("neo-tree.command").execute({ action = "close" }) 540 | end, 541 | }, 542 | }, 543 | filesystem = { 544 | commands = { 545 | system_open = function(state) 546 | local path = state.tree:get_node():get_id() 547 | vim.loop.spawn( 548 | "@xdg_utils@/bin/xdg-open", 549 | { args = { path } }, 550 | function(code) 551 | if code ~= 0 then 552 | vim.notify( 553 | "xdg-open " .. path .. " exited with code " .. code, 554 | vim.log.levels.WARN 555 | ) 556 | end 557 | end 558 | ) 559 | end, 560 | }, 561 | filtered_items = { 562 | hide_by_name = { ".git" }, 563 | hide_dotfiles = false, 564 | show_hidden_count = false, 565 | use_libuv_file_watcher = true, 566 | }, 567 | find_by_full_path_words = true, 568 | window = { 569 | mappings = { 570 | [""] = "clear_filter", 571 | }, 572 | }, 573 | }, 574 | popup_border_style = "single", 575 | use_popups_for_input = false, 576 | window = { 577 | width = 32, 578 | mappings = { 579 | S = "noop", 580 | [""] = "open_vsplit", 581 | [""] = "open_split", 582 | [""] = "open_drop", 583 | o = "system_open", 584 | s = "noop", 585 | t = "noop", 586 | }, 587 | }, 588 | }) 589 | 590 | null_ls.setup({ 591 | on_attach = on_attach, 592 | sources = { 593 | nb.code_actions.refactoring, 594 | nb.code_actions.statix.with({ command = "@statix@/bin/statix" }), 595 | nb.diagnostics.shellcheck.with({ command = "@shellcheck@/bin/shellcheck" }), 596 | nb.diagnostics.statix.with({ command = "@statix@/bin/statix" }), 597 | nb.formatting.black.with({ command = "@black_py@/bin/black" }), 598 | nb.formatting.isort.with({ command = "@isort@/bin/isort" }), 599 | nb.formatting.prettier.with({ 600 | command = "@prettier@/bin/prettier", 601 | disabled_filetypes = { "html" }, 602 | }), 603 | nb.formatting.stylua.with({ command = "@stylua@/bin/stylua" }), 604 | }, 605 | }) 606 | 607 | require("numb").setup() 608 | 609 | require("nvim-treesitter.configs").setup({ 610 | highlight = { 611 | enable = true, 612 | }, 613 | indent = { 614 | enable = true, 615 | }, 616 | playground = { 617 | enable = true, 618 | }, 619 | query_linter = { 620 | enable = true, 621 | }, 622 | textobjects = { 623 | lsp_interop = { 624 | enable = true, 625 | border = border, 626 | peek_definition_code = { 627 | gp = "@function.outer", 628 | }, 629 | }, 630 | move = { 631 | enable = true, 632 | goto_next_start = { 633 | ["]]"] = "@class.outer", 634 | ["]m"] = "@function.outer", 635 | }, 636 | goto_next_end = { 637 | ["]["] = "@class.outer", 638 | ["]M"] = "@function.outer", 639 | }, 640 | goto_previous_start = { 641 | ["[["] = "@class.outer", 642 | ["[m"] = "@function.outer", 643 | }, 644 | goto_previous_end = { 645 | ["[]"] = "@class.outer", 646 | ["[M"] = "@function.outer", 647 | }, 648 | }, 649 | select = { 650 | enable = true, 651 | lookahead = true, 652 | keymaps = { 653 | ab = "@block.outer", 654 | ib = "@block.inner", 655 | ac = "@class.outer", 656 | ic = "@class.inner", 657 | af = "@function.outer", 658 | ["if"] = "@function.inner", 659 | ai = "@conditional.outer", 660 | ii = "@conditional.inner", 661 | al = "@loop.outer", 662 | il = "@loop.inner", 663 | }, 664 | }, 665 | swap = { 666 | enable = true, 667 | swap_next = { 668 | glc = "@class.outer", 669 | glf = "@function.outer", 670 | glp = "@parameter.inner", 671 | }, 672 | swap_previous = { 673 | ghc = "@class.outer", 674 | ghf = "@function.outer", 675 | ghp = "@parameter.inner", 676 | }, 677 | }, 678 | }, 679 | }) 680 | 681 | require("nvim_context_vt").setup({ 682 | custom_parser = function(node) 683 | local text = treesitter.get_node_text(node, 0, { concat = false })[1] 684 | if text and #text > 3 then 685 | local start_row, _, end_row, _ = treesitter.get_node_range(node) 686 | return end_row - start_row > 6 and "<- " .. text or nil 687 | end 688 | end, 689 | }) 690 | 691 | rust_tools.setup({ 692 | dap = { 693 | adapter = require("rust-tools.dap").get_codelldb_adapter( 694 | "@vscode_lldb@/adapter/codelldb", 695 | "@vscode_lldb@/lldb/lib/liblldb.so" 696 | ), 697 | }, 698 | server = { 699 | capabilities = capabilities, 700 | cmd = { "@rust_analyzer@/bin/rust-analyzer" }, 701 | on_attach = function(c, buf) 702 | on_attach(c, buf) 703 | vim.keymap.set( 704 | "n", 705 | "K", 706 | rust_tools.hover_actions.hover_actions, 707 | { buffer = buf } 708 | ) 709 | end, 710 | settings = { 711 | ["rust-analyzer"] = { 712 | assist = { importPrefix = "by_crate" }, 713 | checkOnSave = { command = "clippy" }, 714 | }, 715 | }, 716 | }, 717 | tools = { 718 | hover_actions = { border = border }, 719 | inlay_hints = { 720 | other_hints_prefix = "", 721 | show_parameter_hints = false, 722 | }, 723 | }, 724 | }) 725 | 726 | telescope.setup({ 727 | defaults = { 728 | borderchars = { "─", "│", "─", "│", "┌", "┐", "┘", "└" }, 729 | layout_config = { 730 | height = 0.9, 731 | preview_width = 80, 732 | width = 0.9, 733 | }, 734 | mappings = { 735 | i = { 736 | [""] = require("trouble.sources.telescope").open, 737 | [""] = require("telescope.actions").close, 738 | }, 739 | }, 740 | prompt_prefix = " ", 741 | selection_caret = "❯ ", 742 | }, 743 | pickers = { 744 | find_files = { hidden = true }, 745 | }, 746 | }) 747 | telescope.load_extension("fzf") 748 | 749 | trouble.setup({ 750 | auto_jump = { 751 | "lsp_definitions", 752 | "lsp_type_definitions", 753 | }, 754 | }) 755 | -------------------------------------------------------------------------------- /src/programs/neovim/configure/snippets.lua: -------------------------------------------------------------------------------- 1 | local luasnip = require("luasnip") 2 | local i = luasnip.insert_node 3 | local s = luasnip.snippet 4 | local t = luasnip.text_node 5 | 6 | local fn = vim.fn 7 | luasnip.add_snippets("nix", { 8 | s("flake", { 9 | t({ 10 | "{", 11 | " inputs = {", 12 | " flake-parts = {", 13 | ' url = "github:hercules-ci/flake-parts";', 14 | ' inputs.nixpkgs-lib.follows = "nixpkgs";', 15 | " };", 16 | ' nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";', 17 | " };", 18 | "", 19 | " outputs = inputs@{ flake-parts, ... }:", 20 | " flake-parts.lib.mkFlake { inherit inputs; } {", 21 | " systems = [", 22 | ' "aarch64-darwin"', 23 | ' "aarch64-linux"', 24 | ' "x86_64-darwin"', 25 | ' "x86_64-linux"', 26 | " ];", 27 | "", 28 | " perSystem = { pkgs, ... }:", 29 | " let", 30 | " inherit (pkgs)", 31 | " mkShell", 32 | " ;", 33 | " in", 34 | " {", 35 | " devShells.default = mkShell {", 36 | " packages = [ ", 37 | }), 38 | i(0), 39 | t({ 40 | " ];", 41 | " };", 42 | " };", 43 | " };", 44 | "}", 45 | }), 46 | }, { 47 | show_condition = function() 48 | return fn.expand("%:t") == "flake.nix" and fn.line(".") == 1 49 | end, 50 | }), 51 | }) 52 | -------------------------------------------------------------------------------- /src/programs/neovim/default.nix: -------------------------------------------------------------------------------- 1 | { super }: 2 | 3 | { 4 | enable = true; 5 | defaultEditor = true; 6 | viAlias = true; 7 | vimAlias = true; 8 | withNodeJs = false; 9 | withPython3 = false; 10 | withRuby = false; 11 | } 12 | -------------------------------------------------------------------------------- /src/programs/ssh/askPassword.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | let 4 | inherit (pkgs) writers yad; 5 | in 6 | 7 | toString (writers.writeDash "password-prompt" '' 8 | ${yad}/bin/yad --title "Password prompt" \ 9 | --fixed --on-top --center \ 10 | --entry --hide-text 11 | '') 12 | -------------------------------------------------------------------------------- /src/programs/ssh/extraConfig.nix: -------------------------------------------------------------------------------- 1 | '' 2 | SetEnv TERM=xterm-256color 3 | '' 4 | -------------------------------------------------------------------------------- /src/programs/ssh/knownHosts.nix: -------------------------------------------------------------------------------- 1 | { 2 | "aarch64.nixos.community".publicKey = 3 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMUTz5i9u5H2FHNAmZJyoJfIGyUm/HfGhfwnc142L3ds"; 4 | "darwin-build-box.nix-community.org".publicKey = 5 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFz8FXSVEdf8FvDMfboxhB5VjSe7y2WgSa09q1L4t099"; 6 | } 7 | -------------------------------------------------------------------------------- /src/programs/starship.nix: -------------------------------------------------------------------------------- 1 | { 2 | enable = true; 3 | interactiveOnly = false; 4 | settings = { 5 | cmd_duration.min_time = 1000; 6 | command_timeout = 1000; 7 | directory = { 8 | fish_style_pwd_dir_length = 1; 9 | read_only = " "; 10 | truncate_to_repo = false; 11 | }; 12 | format = '' 13 | $username$directory$git_branch$git_commit$git_state$git_status$nix_shell$cmd_duration 14 | $jobs$battery$status$character 15 | ''; 16 | nix_shell.symbol = " "; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /src/services/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | auto-cpufreq.enable = true; 3 | 4 | earlyoom.enable = true; 5 | 6 | gnome = { 7 | at-spi2-core.enable = true; 8 | gnome-keyring.enable = true; 9 | }; 10 | 11 | pipewire = { 12 | enable = true; 13 | alsa.enable = true; 14 | pulse.enable = true; 15 | }; 16 | 17 | ratbagd.enable = true; 18 | } 19 | -------------------------------------------------------------------------------- /src/services/libinput.nix: -------------------------------------------------------------------------------- 1 | { 2 | enable = true; 3 | mouse = { 4 | accelProfile = "flat"; 5 | accelSpeed = "0"; 6 | middleEmulation = false; 7 | }; 8 | touchpad = { 9 | accelProfile = "flat"; 10 | accelSpeed = "0"; 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /src/services/udev.nix: -------------------------------------------------------------------------------- 1 | { 2 | extraRules = '' 3 | KERNEL=="rfkill", SUBSYSTEM=="misc", TAG+="uaccess" 4 | ''; 5 | } 6 | -------------------------------------------------------------------------------- /src/services/xserver.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | let 4 | inherit (pkgs) awesome luajit; 5 | in 6 | 7 | { 8 | enable = true; 9 | displayManager.sx.enable = true; 10 | windowManager.awesome = { 11 | enable = true; 12 | noArgb = true; 13 | package = awesome.override { 14 | lua = luajit; 15 | }; 16 | }; 17 | xkb.options = "ctrl:nocaps"; 18 | xrandrHeads = [ 19 | { 20 | output = "eDP-2"; 21 | monitorConfig = '' 22 | DisplaySize 302 189 23 | ''; 24 | } 25 | ]; 26 | } 27 | -------------------------------------------------------------------------------- /src/systemd/services/lockscreen.nix: -------------------------------------------------------------------------------- 1 | { root }: 2 | 3 | { 4 | wantedBy = [ "sleep.target" ]; 5 | before = [ "sleep.target" ]; 6 | environment = { 7 | DISPLAY = ":1"; 8 | XAUTHORITY = "/home/figsoda/.local/share/sx/xauthority"; 9 | }; 10 | serviceConfig = { 11 | Type = "forking"; 12 | User = "figsoda"; 13 | ExecStart = "${root.pkgs.lockscreen}/bin/lockscreen"; 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /src/systemd/services/nixos-upgrade.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs }: 2 | 3 | { 4 | serviceConfig.WorkingDirectory = "/home/figsoda/cfg"; 5 | script = lib.mkForce /* bash */ '' 6 | ${pkgs.coreutils}/bin/sleep 5 7 | /run/wrappers/bin/sudo -u figsoda \ 8 | ${config.nix.package}/bin/nix flake update --commit-lock-file 9 | ${pkgs.coreutils}/bin/cp flake.lock /etc/nixos 10 | ${config.system.build.nixos-rebuild}/bin/nixos-rebuild switch 11 | ''; 12 | } 13 | -------------------------------------------------------------------------------- /src/systemd/timers.nix: -------------------------------------------------------------------------------- 1 | { 2 | nix-gc.timerConfig.WakeSystem = true; 3 | nixos-upgrade.timerConfig.WakeSystem = true; 4 | } 5 | -------------------------------------------------------------------------------- /src/users/users/figsoda.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | { 4 | extraGroups = [ "audio" "networkmanager" "podman" "video" "wheel" ]; 5 | isNormalUser = true; 6 | shell = pkgs.fish; 7 | } 8 | -------------------------------------------------------------------------------- /src/virtualisation/podman.nix: -------------------------------------------------------------------------------- 1 | { 2 | enable = true; 3 | dockerCompat = true; 4 | dockerSocket.enable = true; 5 | } 6 | -------------------------------------------------------------------------------- /src/xdg/mime.nix: -------------------------------------------------------------------------------- 1 | { 2 | defaultApplications = { 3 | "application/pdf" = "firefox.desktop"; 4 | "image/avif" = "nsxiv.desktop"; 5 | "image/bmp" = "nsxiv.desktop"; 6 | "image/gif" = "nsxiv.desktop"; 7 | "image/heic" = "nsxiv.desktop"; 8 | "image/heif" = "nsxiv.desktop"; 9 | "image/jp2" = "nsxiv.desktop"; 10 | "image/jpeg" = "nsxiv.desktop"; 11 | "image/jpg" = "nsxiv.desktop"; 12 | "image/jxl" = "nsxiv.desktop"; 13 | "image/png" = "nsxiv.desktop"; 14 | "image/svg+xml" = "nsxiv.desktop"; 15 | "image/tiff" = "nsxiv.desktop"; 16 | "image/webp" = "nsxiv.desktop"; 17 | "image/x-bmp" = "nsxiv.desktop"; 18 | "image/x-portable-anymap" = "nsxiv.desktop"; 19 | "image/x-portable-bitmap" = "nsxiv.desktop"; 20 | "image/x-portable-graymap" = "nsxiv.desktop"; 21 | "image/x-tga" = "nsxiv.desktop"; 22 | "image/x-xpixmap" = "nsxiv.desktop"; 23 | "inode/directory" = "spacefm.desktop"; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /stylua.toml: -------------------------------------------------------------------------------- 1 | column_width = 80 2 | indent_type = "Spaces" 3 | indent_width = 2 4 | 5 | [sort_requires] 6 | enabled = true 7 | --------------------------------------------------------------------------------