├── zshrc.d ├── asdf └── tool-versions ├── bin ├── discoverable ├── path │ ├── default │ │ ├── weather │ │ ├── downcase │ │ ├── upcase │ │ ├── dquote │ │ ├── squote │ │ ├── emacs-ls-eln │ │ ├── battery-status │ │ ├── editor-in-nvim │ │ ├── wrapped-fpp │ │ ├── wttr │ │ ├── doom │ │ ├── preview │ │ ├── doomscript │ │ ├── preview-legacy │ │ ├── add-zsh-to-shells │ │ ├── battery │ │ ├── update-terminfo-alacritty │ │ ├── mirror-args │ │ ├── debug-nix │ │ ├── current-base16 │ │ ├── chzh │ │ ├── update-terminfo-tmux │ │ ├── tmux-zoom │ │ ├── async-with-delay │ │ ├── async-with-wait4path │ │ ├── mux-zoom │ │ ├── pbpaste │ │ ├── battery-icon │ │ ├── nix-outpath │ │ ├── base16-shell-auto-reload-on-tmux │ │ ├── git-remote-url │ │ ├── pbcopy │ │ ├── debug-network │ │ ├── home-manager │ │ ├── debug-resolve │ │ └── teebug │ ├── lspx │ │ ├── nixd │ │ ├── astro-ls │ │ ├── svelteserver │ │ └── README.md │ ├── ssh │ │ ├── open │ │ └── unlock-sessions │ ├── wsl │ │ ├── open │ │ ├── pbpaste │ │ ├── pbcopy │ │ ├── xsel │ │ └── xdg-open │ ├── tea │ │ ├── ls.sh │ │ ├── bin │ │ │ └── .gitignore │ │ └── README.md │ ├── README.md │ ├── linux │ │ ├── open │ │ ├── wifi │ │ └── bluetooth │ ├── darwin │ │ ├── battery │ │ ├── battery-status │ │ ├── react-to-appearance-changes │ │ ├── emacs-opff │ │ └── open-gui-emacs │ └── nixos │ │ ├── nixos-option │ │ └── search ├── darwin │ ├── iterm │ │ └── run.sh │ └── terminfo-eterm-color.sh ├── README.md ├── wsl │ ├── gen-wsl-conf.sh │ └── create-reload-ahk.sh ├── zellij-attach-or-new.sh └── tmux-attach-or-new.sh ├── editorconfig ├── nvim ├── .gitignore ├── init.lua ├── snippets │ ├── README.md │ ├── make.json │ ├── bash.json │ ├── direnv.json │ ├── nix.json │ ├── lua.json │ ├── hcl.json │ ├── all.json │ └── package.json ├── lua │ ├── plugins │ │ └── config │ │ │ ├── README.md │ │ │ ├── efmls-configs │ │ │ └── deno-fmt.lua │ │ │ └── profile.lua │ ├── boot │ │ ├── init.lua │ │ ├── integration │ │ │ └── init.lua │ │ └── filetype.lua │ └── utils │ │ ├── shell.lua │ │ ├── keymap-layer-info.lua │ │ └── table.lua ├── README.md ├── shell │ ├── build-via-nix-shell.sh │ ├── shell.nix │ └── source.zsh ├── stylua.toml ├── ftdetect │ ├── README.md │ └── all.lua └── remote-container.md ├── karabiner-uk ├── .link.sh ├── .gitignore └── assets │ └── complex_modifications │ ├── 1542075990.json │ ├── 1542076094.json │ ├── 1620405151.json │ └── 1542075239.json ├── karabiner ├── .gitignore ├── README.md ├── .link.sh └── assets │ └── complex_modifications │ ├── 1542075990.json │ ├── 1542076094.json │ ├── 1750277837.json │ └── 1542075239.json ├── nix ├── pkgs │ ├── extra │ │ ├── .gitignore │ │ ├── README.md │ │ ├── gen-local-only.sh │ │ └── rusty-fam.nix │ ├── custom │ │ ├── nix-index-database │ │ │ ├── .gitignore │ │ │ ├── Makefile │ │ │ ├── default.nix │ │ │ ├── README.md │ │ │ └── flake.nix │ │ ├── via-niv │ │ │ ├── default.nix │ │ │ ├── Makefile │ │ │ └── README.md │ │ ├── README.md │ │ ├── devenv-beta.nix │ │ ├── ghostty.nix │ │ ├── termimagenator.nix │ │ ├── hexto256.nix │ │ ├── nix-flatpak.nix │ │ ├── bat-riffle │ │ │ ├── update-cargo-toml.patch │ │ │ └── default.nix │ │ ├── alacritty-nightly.nix │ │ ├── grace.nix │ │ ├── nur.nix │ │ ├── tag │ │ │ ├── default.nix │ │ │ └── deps.nix │ │ ├── opener.nix │ │ ├── alt-nid │ │ │ └── default.nix │ │ ├── tf-helper.nix │ │ ├── gitwatch.nix │ │ ├── urlview.nix │ │ ├── pkgs.nix │ │ ├── hired.nix │ │ ├── gemini.nix │ │ ├── alt-nix-index-database │ │ │ └── default.nix │ │ ├── rsop.nix │ │ └── emacs.nix │ ├── lang │ │ ├── wasm.nix │ │ ├── shells.nix │ │ ├── janet.nix │ │ ├── swift.nix │ │ ├── ruby.nix │ │ ├── nim.nix │ │ ├── lua.nix │ │ ├── go.nix │ │ ├── erlang.nix │ │ ├── rust.nix │ │ ├── nix.nix │ │ ├── sql.nix │ │ ├── java.nix │ │ ├── javascript.nix │ │ ├── graalvm.nix │ │ └── support.nix │ ├── overlays │ │ ├── neovim-nightly.nix │ │ ├── default.nix │ │ └── darwin.nix │ └── fonts │ │ └── default.nix ├── nixos │ ├── .gitignore │ ├── recipes │ │ ├── rosetta.nix │ │ ├── firmware.nix │ │ ├── syncthing.nix │ │ ├── dropbox.nix │ │ ├── 1password.nix │ │ ├── wsl.nix │ │ ├── libvirt.nix │ │ ├── keyd-guest.nix │ │ ├── keyd-host-windows.nix │ │ ├── vm-guest-qemu.nix │ │ ├── droidcam.nix │ │ ├── surface-pro-9-intel.nix │ │ ├── chrony-step.nix │ │ ├── steam.nix │ │ ├── meta │ │ │ ├── tpm.nix │ │ │ ├── caddy-over-tailscale.nix │ │ │ ├── README.md │ │ │ └── zerotier.nix │ │ ├── documentation.nix │ │ ├── quickemu.nix │ │ ├── surface-pro-intel.nix │ │ ├── auto-timezone.nix │ │ ├── no-sleep.nix │ │ ├── openssh.nix │ │ ├── mdns.nix │ │ ├── docker-rootful.nix │ │ ├── no-tty-tickets.nix │ │ ├── podman-rootful-docker.nix │ │ ├── desktop-cosmic.nix │ │ ├── escape-hatch.nix │ │ ├── compat.nix │ │ ├── tailscale.nix │ │ ├── rdp-server.nix │ │ ├── resolved.nix │ │ ├── vm-guest-utm.nix │ │ ├── pam-sshagent.nix │ │ ├── airplay.nix │ │ ├── podman.nix │ │ ├── desktop-kde.nix │ │ ├── displaylink.nix │ │ └── incus.nix │ ├── mix-and-match-empty.nix │ ├── gen-local-only.sh │ ├── README.md │ └── keyd │ │ ├── README.md │ │ └── settings-min.nix ├── darwin │ ├── .gitignore │ ├── Makefile │ ├── gen-configuration.sh │ ├── flake.nix │ ├── flake.lock │ └── README.md ├── bin │ ├── install │ │ ├── single-user.sh │ │ ├── multi-user.sh │ │ └── darwin.sh │ ├── hm.sh │ ├── install-hm.sh │ ├── nix-shell.sh │ ├── source │ │ ├── config.sh │ │ └── nix.sh │ └── init-hm.sh ├── niv-shim │ ├── bin │ │ ├── nix-path.nix │ │ ├── alt-src-to-channel.nix │ │ ├── nix-path-for.nix │ │ ├── print-nix-path-for.sh │ │ ├── nix-path-for-paths.nix │ │ ├── get-path-for.sh │ │ └── nix-path-via-niv.sh │ └── README.md ├── utils │ ├── checkEnv.nix │ └── viaDeno.nix ├── home │ ├── services │ │ ├── emacs.nix │ │ ├── syncthing.nix │ │ ├── default.nix │ │ └── opener.nix │ ├── programs │ │ ├── home-manager.nix │ │ ├── direnv.nix │ │ ├── navi.nix │ │ └── default.nix │ └── shims.nix └── shell.nix ├── viddy.toml ├── .gitpod.yml ├── emacs.d ├── README.md ├── doom.d │ ├── .gitignore │ ├── modules │ │ ├── my-custom │ │ │ ├── lab │ │ │ │ ├── packages.el │ │ │ │ └── config.el │ │ │ ├── morevil │ │ │ │ ├── packages.el │ │ │ │ └── readme.org │ │ │ ├── soom │ │ │ │ ├── readme.org │ │ │ │ └── packages.el │ │ │ ├── vterm-enhance │ │ │ │ └── packages.el │ │ │ └── org │ │ │ │ └── packages.el │ │ ├── compat │ │ │ └── neovim │ │ │ │ ├── packages.el │ │ │ │ └── config.el │ │ ├── ext-lang │ │ │ ├── nix │ │ │ │ ├── packages.el │ │ │ │ └── config.el │ │ │ ├── typescript │ │ │ │ └── config.el │ │ │ └── lua │ │ │ │ └── config.el │ │ ├── readme.org │ │ ├── lang │ │ │ ├── svelte │ │ │ │ ├── packages.el │ │ │ │ └── config.el │ │ │ └── astro │ │ │ │ ├── readme.org │ │ │ │ └── packages.el │ │ └── tools │ │ │ ├── treesit-support │ │ │ ├── packages.el │ │ │ ├── config.el │ │ │ └── readme.org │ │ │ └── lsp-support │ │ │ └── packages.el │ └── snippets │ │ └── readme.org ├── emacs-profiles.el └── shell │ └── source.zsh ├── .dockerignore ├── bootstrap └── foundation │ ├── nixos │ ├── .gitignore │ ├── switch.sh │ └── gen-configuration.sh │ ├── optional │ └── ubuntu-prerequisite.sh │ ├── linux.sh │ └── wsl.sh ├── zsh ├── my_addons │ └── options ├── path │ ├── set │ └── tea ├── integration │ ├── 1p │ ├── editors │ └── fzf ├── fn │ ├── linux │ ├── system │ ├── zsh │ └── theme ├── env ├── modules │ └── history ├── zlogin └── aliases ├── espanso ├── match │ ├── extra-emojis.yml │ ├── packages │ │ └── .gitignore │ └── base.yml ├── config │ └── default.yml └── bin │ └── install-pkgs.sh ├── lf ├── pv+pager.sh ├── less.sh ├── glow.sh ├── pv.sh └── lfrc ├── gemini ├── README.md ├── settings.json └── AGENTS.md ├── .gitignore ├── nushell ├── modules │ └── fixtures │ │ ├── linux │ │ ├── adp │ │ │ ├── off.txt │ │ │ └── on.txt │ │ ├── files.nu │ │ └── bat │ │ │ ├── charging.txt │ │ │ ├── unknown.txt │ │ │ ├── discharging.txt │ │ │ ├── not-charging.txt │ │ │ └── full.txt │ │ └── linux.nu └── config.nu ├── brew └── dep.Brewfile ├── lein └── profiles.clj ├── sublime ├── settings ├── keymap └── .link.sh ├── SpaceVim.d └── mimvimrc ├── .theia └── settings.json ├── notable.json ├── zellij └── themes │ └── solarized.kdl ├── gitmux.conf ├── .editorconfig ├── setup.sh ├── aliases └── README.md ├── gh └── config.yml ├── starship.toml └── alacritty └── unix.toml /zshrc.d: -------------------------------------------------------------------------------- 1 | zsh -------------------------------------------------------------------------------- /asdf/tool-versions: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bin/discoverable: -------------------------------------------------------------------------------- 1 | path/default -------------------------------------------------------------------------------- /bin/path/default/weather: -------------------------------------------------------------------------------- 1 | wttr -------------------------------------------------------------------------------- /bin/path/lspx/nixd: -------------------------------------------------------------------------------- 1 | .dummy -------------------------------------------------------------------------------- /bin/path/ssh/open: -------------------------------------------------------------------------------- 1 | xdg-open -------------------------------------------------------------------------------- /bin/path/wsl/open: -------------------------------------------------------------------------------- 1 | xdg-open -------------------------------------------------------------------------------- /editorconfig: -------------------------------------------------------------------------------- 1 | .editorconfig -------------------------------------------------------------------------------- /nvim/.gitignore: -------------------------------------------------------------------------------- 1 | .luarc.json 2 | -------------------------------------------------------------------------------- /bin/path/lspx/astro-ls: -------------------------------------------------------------------------------- 1 | .html-template -------------------------------------------------------------------------------- /bin/path/lspx/svelteserver: -------------------------------------------------------------------------------- 1 | .html-template -------------------------------------------------------------------------------- /karabiner-uk/.link.sh: -------------------------------------------------------------------------------- 1 | ../karabiner/.link.sh -------------------------------------------------------------------------------- /karabiner/.gitignore: -------------------------------------------------------------------------------- 1 | automatic_backups 2 | -------------------------------------------------------------------------------- /karabiner-uk/.gitignore: -------------------------------------------------------------------------------- 1 | automatic_backups 2 | -------------------------------------------------------------------------------- /nix/pkgs/extra/.gitignore: -------------------------------------------------------------------------------- 1 | local-only.nix 2 | -------------------------------------------------------------------------------- /viddy.toml: -------------------------------------------------------------------------------- 1 | [general] 2 | differences = true 3 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | image: ghcr.io/ryuheechul/dotfiles:gitpod 2 | -------------------------------------------------------------------------------- /emacs.d/README.md: -------------------------------------------------------------------------------- 1 | # emacs.d 2 | This is not `.emacs.d` 3 | -------------------------------------------------------------------------------- /nix/pkgs/custom/nix-index-database/.gitignore: -------------------------------------------------------------------------------- 1 | result 2 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .theia 3 | .gitpod 4 | .gitpod.yml 5 | -------------------------------------------------------------------------------- /nix/nixos/.gitignore: -------------------------------------------------------------------------------- 1 | system-pkgs-local.nix 2 | mix-and-match.nix 3 | -------------------------------------------------------------------------------- /nvim/init.lua: -------------------------------------------------------------------------------- 1 | require 'boot' 2 | 3 | -- vim: ts=2 sts=2 sw=2 et 4 | -------------------------------------------------------------------------------- /bootstrap/foundation/nixos/.gitignore: -------------------------------------------------------------------------------- 1 | configuration.nix 2 | result 3 | -------------------------------------------------------------------------------- /zsh/my_addons/options: -------------------------------------------------------------------------------- 1 | # -*- mode: sh; -*- vim: set ft=zsh: 2 | 3 | setopt correct 4 | -------------------------------------------------------------------------------- /espanso/match/extra-emojis.yml: -------------------------------------------------------------------------------- 1 | matches: 2 | - trigger: ":wave" 3 | replace: 👋🏼 4 | -------------------------------------------------------------------------------- /lf/pv+pager.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | LF_PV_WITH_PAGER=1 ~/.config/lf/pv.sh "$@" 4 | -------------------------------------------------------------------------------- /nix/darwin/.gitignore: -------------------------------------------------------------------------------- 1 | result 2 | # since this will be generated 3 | configuration.nix 4 | -------------------------------------------------------------------------------- /bin/path/default/downcase: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | tr '[:upper:]' '[:lower:]' 0 8 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/compat/neovim/packages.el: -------------------------------------------------------------------------------- 1 | ;; -*- no-byte-compile: t; -*- 2 | ;;; compat/neovim/packages.el 3 | 4 | (package! hotfuzz) 5 | -------------------------------------------------------------------------------- /espanso/bin/install-pkgs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | for pkg in basic-emojis gitmojis 4 | do 5 | espanso install "$pkg" || true 6 | done 7 | -------------------------------------------------------------------------------- /nix/niv-shim/bin/alt-src-to-channel.nix: -------------------------------------------------------------------------------- 1 | src: 2 | 3 | let 4 | sources = (import ../nix/sources.nix { }); 5 | in 6 | sources.${src}.outPath 7 | -------------------------------------------------------------------------------- /nushell/modules/fixtures/linux/adp/off.txt: -------------------------------------------------------------------------------- 1 | DEVTYPE=power_supply 2 | POWER_SUPPLY_NAME=ADP1 3 | POWER_SUPPLY_TYPE=Mains 4 | POWER_SUPPLY_ONLINE=0 5 | -------------------------------------------------------------------------------- /nushell/modules/fixtures/linux/adp/on.txt: -------------------------------------------------------------------------------- 1 | DEVTYPE=power_supply 2 | POWER_SUPPLY_NAME=ADP1 3 | POWER_SUPPLY_TYPE=Mains 4 | POWER_SUPPLY_ONLINE=1 5 | -------------------------------------------------------------------------------- /nvim/lua/plugins/config/README.md: -------------------------------------------------------------------------------- 1 | # config 2 | 3 | sometimes `config` function becomes too big to be in [../](../), so it splits into here. 4 | -------------------------------------------------------------------------------- /nix/pkgs/extra/README.md: -------------------------------------------------------------------------------- 1 | # extra 2 | 3 | This is where packages that are only enabled with environment variable flags such as `MY_NIX_EXTRA_AWS`. 4 | -------------------------------------------------------------------------------- /nix/pkgs/lang/shells.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | with pkgs; 4 | [ 5 | shellcheck # Shell script analysis tool 6 | shfmt # Shell parser and formatter 7 | ] 8 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/my-custom/morevil/packages.el: -------------------------------------------------------------------------------- 1 | ;; -*- no-byte-compile: t; -*- 2 | ;;; my-custom/morevil/packages.el 3 | 4 | (package! evil-textobj-line) 5 | -------------------------------------------------------------------------------- /nix/pkgs/custom/nix-index-database/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: switch 2 | switch: update 3 | home-manager switch 4 | 5 | .PHONY: update 6 | update: 7 | nix flake update 8 | -------------------------------------------------------------------------------- /bin/path/default/wrapped-fpp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # To avoid an error similar to https://github.com/saulpw/visidata/issues/1227 4 | TERM=xterm-256color fpp "$@" 5 | -------------------------------------------------------------------------------- /nix/nixos/recipes/firmware.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | # https://nixos.wiki/wiki/Fwupd 4 | # https://fwupd.org/lvfs/docs/users 5 | { 6 | services.fwupd.enable = true; 7 | } 8 | -------------------------------------------------------------------------------- /nvim/lua/boot/init.lua: -------------------------------------------------------------------------------- 1 | require 'boot.lazy' 2 | require 'boot.filetype' 3 | require 'boot.misc' 4 | require 'boot.integration.init' 5 | 6 | -- vim: ts=2 sts=2 sw=2 et 7 | -------------------------------------------------------------------------------- /brew/dep.Brewfile: -------------------------------------------------------------------------------- 1 | brew "patchelf" 2 | brew "gmp" 3 | brew "isl@0.18" 4 | brew "libmpc" 5 | brew "linux-headers" 6 | brew "mpfr" 7 | brew "zlib" 8 | brew "gcc" 9 | brew "glibc" -------------------------------------------------------------------------------- /lf/less.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # `+k`: it means press `k` (scroll one line up) to to make sure the content shows up at the top 4 | less +k --RAW-CONTROL-CHARS -I <&0 5 | -------------------------------------------------------------------------------- /nvim/lua/boot/integration/init.lua: -------------------------------------------------------------------------------- 1 | if vim.env.ZELLIJ_SESSION_NAME ~= nil then 2 | require 'boot.integration.zellij.search-dump' 3 | end 4 | 5 | -- vim: ts=2 sts=2 sw=2 et 6 | -------------------------------------------------------------------------------- /nix/nixos/recipes/syncthing.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | # I actually prefer syncthing via ../../home/services/syncthing.nix instead 4 | { 5 | services.syncthing.enable = true; 6 | } 7 | -------------------------------------------------------------------------------- /nix/pkgs/lang/janet.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | with pkgs; 4 | [ 5 | janet # Janet programming language 6 | jpm # Janet Project Manager for the Janet programming language 7 | ] 8 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/my-custom/soom/readme.org: -------------------------------------------------------------------------------- 1 | #+title: Readme - soom 2 | 3 | Soon on doom? 4 | Shim for doom? 5 | 6 | Anyhow some modifications to workaround what "lacks" at doomemacs 7 | -------------------------------------------------------------------------------- /nix/niv-shim/bin/nix-path-for.nix: -------------------------------------------------------------------------------- 1 | paths: 2 | let 3 | nix-path = import ./nix-path.nix; 4 | results = builtins.map (p: nix-path p) paths; 5 | in 6 | builtins.concatStringsSep ":" results 7 | -------------------------------------------------------------------------------- /nix/pkgs/custom/README.md: -------------------------------------------------------------------------------- 1 | # custom 2 | 3 | This is where handwritten packages will be defined. 4 | 5 | These can be imported directly from `../default.nix` or optionally from `../extra`. 6 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/ext-lang/nix/packages.el: -------------------------------------------------------------------------------- 1 | ;; -*- no-byte-compile: t; -*- 2 | ;;; ext-lang/nix/packages.el 3 | 4 | ;; https://github.com/nix-community/nix-ts-mode 5 | (package! nix-ts-mode) 6 | -------------------------------------------------------------------------------- /espanso/match/packages/.gitignore: -------------------------------------------------------------------------------- 1 | # this directory is where the packages actually gets installed so ignore everything in here 2 | * 3 | # manage and run ../../bin/install-pkgs.sh to install packages 4 | -------------------------------------------------------------------------------- /nix/bin/install/multi-user.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # to automate the answer just like using `yes` but with some "no"s 4 | echo "nyy" | sh <(curl -L https://nixos.org/nix/install) --daemon 5 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/readme.org: -------------------------------------------------------------------------------- 1 | #+title: Readme - modules 2 | 3 | * =ext-*= convention to define modules that are not upstream but developed as my private modules 4 | - e.g. [[./ext-lang][./ext-lang]] 5 | -------------------------------------------------------------------------------- /nix/home/services/emacs.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | services.emacs = { 5 | enable = pkgs.stdenv.isLinux; 6 | package = import ../../pkgs/custom/emacs.nix { pkgs = pkgs; }; 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /nix/nixos/recipes/dropbox.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | # https://nixos.wiki/wiki/Dropbox 4 | { 5 | environment.systemPackages = with pkgs;[ 6 | maestral 7 | maestral-gui 8 | ]; 9 | } 10 | -------------------------------------------------------------------------------- /nix/pkgs/lang/swift.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | with pkgs; 4 | [ 5 | swift # Swift Programming Language 6 | sourcekit-lsp # Language Server Protocol implementation for Swift and C-based languages 7 | ] 8 | -------------------------------------------------------------------------------- /nvim/README.md: -------------------------------------------------------------------------------- 1 | # nvim 2 | 3 | I started using Neovim with [../SpaceVim.d/](../SpaceVim.d) and now I replaced it with my own configuration for greater flexibility and faster performance which is at here. 4 | -------------------------------------------------------------------------------- /zsh/path/set: -------------------------------------------------------------------------------- 1 | # -*- mode: sh; -*- vim: set ft=zsh: 2 | 3 | # for the better PATH! 4 | source "${my_zsh_d}/path/set-basic" 5 | source "${my_zsh_d}/path/set-special" 6 | 7 | export PATH_SET_FROM_MY_ZSH=1 8 | -------------------------------------------------------------------------------- /bin/path/wsl/pbpaste: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # pbpaste for WSL - thanks to https://www.techtronic.us/pbcopy-pbpaste-for-wsl/ 3 | powershell.exe Get-Clipboard | sed 's/\r$//' | sed -z '$ s/\n$//' 4 | exit 0 5 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/lang/svelte/packages.el: -------------------------------------------------------------------------------- 1 | ;; -*- no-byte-compile: t; -*- 2 | ;;; lang/svelte/packages.el 3 | 4 | (package! svelte-ts-mode 5 | :recipe (:host github :repo "leafOfTree/svelte-ts-mode")) 6 | -------------------------------------------------------------------------------- /nix/pkgs/extra/gen-local-only.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | script_d="$(dirname "$0")" 4 | 5 | cat <> "${script_d}/local-only.nix" 6 | { pkgs }: 7 | 8 | with pkgs; 9 | [ 10 | ] 11 | EOF 12 | -------------------------------------------------------------------------------- /nix/pkgs/lang/ruby.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | with pkgs; 4 | [ 5 | # `schasse/tmux-jump` plugin requires ruby at ../../../tmux.conf 6 | ruby # An object-oriented language for quick and easy programming 7 | ] 8 | -------------------------------------------------------------------------------- /bin/path/default/wttr: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | curl "wttr.in/${WTTR_LOC}${WTTR_PARAMS}" 4 | 5 | # examples of arguments 6 | # WTTR_LOC=NewYork 7 | # WTTR_LOC="{NewYork,London}" 8 | # WTTR_PARAMS="?format=2" 9 | -------------------------------------------------------------------------------- /bootstrap/foundation/optional/ubuntu-prerequisite.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | set -e 4 | set -x 5 | 6 | # since ubuntu may not come with these 7 | sudo apt update && \ 8 | sudo apt install git curl openssh-server 9 | -------------------------------------------------------------------------------- /bin/path/default/doom: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | doom=~/.doom-emacs.d/bin/doom 4 | 5 | if test -f "${doom}"; then 6 | "${doom}" "$@" 7 | else 8 | echo "make sure to have doom at ${doom}" 9 | exit 1 10 | fi 11 | -------------------------------------------------------------------------------- /nix/pkgs/lang/nim.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | with pkgs; 4 | [ 5 | nim # Statically typed, imperative programming language (x86_64-unknown-linux-gnu wrapper) 6 | nimlsp # Language Server Protocol implementation for Nim 7 | ] 8 | -------------------------------------------------------------------------------- /bin/path/darwin/battery: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env nu 2 | 3 | # adaptation of ../default/battery for darwin 4 | 5 | use ../../../nushell/modules/parse-battery-darwin.nu battery-status 6 | 7 | battery-status | get capacity | $in * 100 8 | 9 | -------------------------------------------------------------------------------- /bin/path/default/preview: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-${HOME}/.config}" 4 | my_dot_d="${XDG_CONFIG_HOME}/dfs-rhc" 5 | lf_d="${my_dot_d}/lf" 6 | 7 | echo "${@}" | squote | xargs "${lf_d}/pv.sh" 8 | -------------------------------------------------------------------------------- /nix/pkgs/overlays/neovim-nightly.nix: -------------------------------------------------------------------------------- 1 | let 2 | rev = "master"; 3 | url = "https://github.com/nix-community/neovim-nightly-overlay/archive/${rev}.tar.gz"; 4 | overlay = (import (builtins.fetchTarball url)); 5 | in 6 | overlay 7 | -------------------------------------------------------------------------------- /nix/shell.nix: -------------------------------------------------------------------------------- 1 | # for now it's only a testing purpose with `nix-shell` 2 | { pkgs ? import { } }: 3 | 4 | pkgs.mkShell { 5 | nativeBuildInputs = import ./pkgs {pkgs=pkgs;} ++ import ./build-deps.nix {pkgs=pkgs;}; 6 | } 7 | -------------------------------------------------------------------------------- /nvim/snippets/make.json: -------------------------------------------------------------------------------- 1 | { 2 | "PHONY": { 3 | "prefix": "ph", 4 | "body": [ 5 | ".PHONY: ${1:name}", 6 | "${1}:", 7 | "\t" 8 | ], 9 | "description": "ergonomic .PHONY" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /bin/path/tea/bin/.gitignore: -------------------------------------------------------------------------------- 1 | # this directory is where the symlinks actually gets created which I don't want to track in git 2 | # to favor ../link.sh to maintain as a single source of truth 3 | # so ignore everything in here 4 | * 5 | -------------------------------------------------------------------------------- /nix/bin/hm.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # this is to be used regardless of the bootstrapping happened or not 4 | 5 | curr_d="$(dirname "$0")" 6 | hm_wrapper="${curr_d}/../../bin/path/default/home-manager" 7 | "${hm_wrapper}" "$@" 8 | -------------------------------------------------------------------------------- /nix/bin/install/darwin.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # install nix - https://nixos.org/manual/nix/stable/#sect-macos-installation 4 | sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume --daemon 5 | -------------------------------------------------------------------------------- /nix/pkgs/custom/devenv-beta.nix: -------------------------------------------------------------------------------- 1 | # https://devenv.sh/getting-started/#__tabbed_3_3 2 | let 3 | version = "0.6.3"; 4 | url = "https://github.com/cachix/devenv/archive/v${version}.tar.gz"; 5 | in 6 | (import (fetchTarball url)).default 7 | -------------------------------------------------------------------------------- /lein/profiles.clj: -------------------------------------------------------------------------------- 1 | {:repl {:plugins [[cider/cider-nrepl "0.16.0-SNAPSHOT"] 2 | [refactor-nrepl "2.0.0-SNAPSHOT"]] 3 | :dependencies [[alembic "0.3.2"] 4 | [org.clojure/tools.nrepl "0.2.12"]]}} 5 | -------------------------------------------------------------------------------- /sublime/settings: -------------------------------------------------------------------------------- 1 | // Settings in here override those in "Default/Preferences.sublime-settings", 2 | // and are overridden in turn by syntax-specific settings. 3 | { 4 | "ignored_packages": [], 5 | "vintage_start_in_command_mode": true, 6 | } 7 | -------------------------------------------------------------------------------- /lf/glow.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | theme=$(current-base16 | sed 's/solarized-//') 4 | 5 | # assume no piping 6 | if test -n "${1}"; then 7 | glow -s "$theme" "$@" 8 | else # assume piping 9 | glow -s "$theme" /dev/stdin 10 | fi 11 | -------------------------------------------------------------------------------- /bin/path/wsl/pbcopy: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # pbcopy for WSL - thanks to https://www.techtronic.us/pbcopy-pbpaste-for-wsl/ 3 | tee <&0 | nohup bash -c 'clip.exe' >/dev/null 2>&1 & # use nohup to return quickly since `clip.exe` is very slow 4 | exit 0 5 | -------------------------------------------------------------------------------- /nix/nixos/recipes/1password.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | # https://wiki.nixos.org/wiki/1Password 4 | # https://support.1password.com/connect-1password-browser-app/ 5 | { 6 | programs._1password.enable = true; 7 | programs._1password-gui.enable = true; 8 | } 9 | -------------------------------------------------------------------------------- /nix/pkgs/custom/ghostty.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | # inspired by ./alt-nid 4 | let 5 | sources = import ./via-niv; 6 | flake = sources.ghostty.url; 7 | result = builtins.getFlake flake; 8 | in 9 | result.packages.${pkgs.system}.ghostty 10 | -------------------------------------------------------------------------------- /nix/pkgs/lang/lua.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | with pkgs; 4 | [ 5 | # sumneko-lua-language-server # Lua Language Server coded by Lua # now relies on mason via ../../../nvim/lua/plugins/lsp.lua 6 | luajitPackages.fennel # A lisp that compiles to Lua 7 | ] 8 | -------------------------------------------------------------------------------- /nix/home/programs/home-manager.nix: -------------------------------------------------------------------------------- 1 | { 2 | # Let Home Manager install and manage itself. 3 | programs.home-manager = { 4 | # https://nix-community.github.io/home-manager/options.html#opt-programs.home-manager.enable 5 | enable = true; 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /nix/nixos/mix-and-match-empty.nix: -------------------------------------------------------------------------------- 1 | # - to accept the username from ../../bootstrap/foundation/nixos/configuration.nix 2 | username: 3 | 4 | # - from here on it's just like any other NixOS module 5 | { ... }: 6 | 7 | { 8 | imports = [ 9 | ]; 10 | } 11 | -------------------------------------------------------------------------------- /bin/path/default/doomscript: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | doomscript=~/.doom-emacs.d/bin/doomscript 4 | 5 | if test -f "${doomscript}"; then 6 | "${doomscript}" "$@" 7 | else 8 | echo "make sure to have doomscript at ${doomscript}" 9 | exit 1 10 | fi 11 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/my-custom/soom/packages.el: -------------------------------------------------------------------------------- 1 | ;; -*- no-byte-compile: t; -*- 2 | ;;; my-custom/soom/packages.el 3 | 4 | ;; manually enabling at ./config.el until this issue is resolved - https://github.com/doomemacs/doomemacs/issues/8277 5 | (package! diff-hl) 6 | -------------------------------------------------------------------------------- /nix/niv-shim/bin/print-nix-path-for.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | src="${1:-nixpkgs}" 4 | 5 | pushd "$(dirname "$0")" > /dev/null 6 | 7 | source ../../bin/source/config.sh 8 | 9 | nix eval --impure --expr "import ./nix-path.nix {src=\"${src}\";}" | xargs 10 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/my-custom/morevil/readme.org: -------------------------------------------------------------------------------- 1 | #+title: Readme - morevil 2 | 3 | * Like leaning to evil more 4 | This is where I heavily customize things to reduce the gap regarding muscle memory and visual consistency with [[../../../../../nvim/][my nvim config]]. 5 | -------------------------------------------------------------------------------- /nix/nixos/recipes/wsl.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | # https://github.com/nix-community/NixOS-WSL/issues/241 5 | systemd.services.systemd-udevd.enable = pkgs.lib.mkForce true; 6 | services.udev.enable = pkgs.lib.mkForce true; 7 | security.polkit.enable = true; 8 | } 9 | -------------------------------------------------------------------------------- /sublime/keymap: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "keys": ["j", "k"], 4 | "command": "exit_insert_mode", 5 | "context": 6 | [ 7 | { "key": "setting.command_mode", "operand": false }, 8 | { "key": "setting.is_widget", "operand": false } 9 | ] 10 | } 11 | ] 12 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/lang/astro/readme.org: -------------------------------------------------------------------------------- 1 | #+title: Readme - lang/astro module 2 | 3 | It started from https://github.com/edmundmiller/.doom.d/tree/3f53f48071035fdc498a5cf36fff31e51b537367/modules/lang/astro 4 | . 5 | 6 | Discovered by https://edmundmiller.dev/posts/emacs-astro/. 7 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/ext-lang/typescript/config.el: -------------------------------------------------------------------------------- 1 | ;;; ext-lang/typescript/config.el -*- lexical-binding: t; -*- 2 | 3 | ;; typescript-ts-mode is a builtin mode 4 | (after! typescript-ts-mode 5 | (when (modulep! :tools lsp) 6 | (add-hook 'typescript-ts-mode-hook #'lsp! 'append))) 7 | -------------------------------------------------------------------------------- /nix/pkgs/lang/go.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | with pkgs; 4 | [ 5 | go # golang 6 | gopls # go language server 7 | gocode # auto completion for go 8 | gotools # updates your Go import lines, adding missing ones and removing unreferenced ones 9 | delve # go debugger 10 | ] 11 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/my-custom/vterm-enhance/packages.el: -------------------------------------------------------------------------------- 1 | ;; -*- no-byte-compile: t; -*- 2 | ;;; $DOOMDIR/modules/my-custom/vterm-theme/packages.el 3 | 4 | ;; not sure what above really does or working properly 5 | ;; but leave it as is for now 6 | 7 | ;; install required package 8 | (package! base16-theme) 9 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/tools/treesit-support/packages.el: -------------------------------------------------------------------------------- 1 | ;; -*- no-byte-compile: t; -*- 2 | ;;; tools/treesit-support/packages.el 3 | 4 | (package! treesit-langs 5 | :recipe (:host github :repo "emacs-tree-sitter/treesit-langs")) 6 | 7 | ;;;; this is a next TODO for this module 8 | ;; (package! treesit-auto) 9 | -------------------------------------------------------------------------------- /bin/darwin/iterm/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # use this script if the command takes a bit of time like ssh 4 | 5 | cmd="${1}" 6 | 7 | echo "running ${cmd}..." 8 | ${cmd} 9 | 10 | # Example Usage 11 | # put this line to Command on an iTerm's profile 12 | # ~/dotfiles/bin/mac/iterm/run.sh 'ssh xxx' 13 | -------------------------------------------------------------------------------- /bin/path/default/preview-legacy: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # expected to be called from ../../../rsop/config.toml 4 | 5 | XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-${HOME}/.config}" 6 | my_dot_d="${XDG_CONFIG_HOME}/dfs-rhc" 7 | lf_d="${my_dot_d}/lf" 8 | 9 | echo "${@}" | squote | xargs "${lf_d}/pv-legacy.sh" 10 | -------------------------------------------------------------------------------- /nix/nixos/recipes/libvirt.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | # https://nixos.wiki/wiki/Virt-manager 4 | { 5 | virtualisation.libvirtd.enable = true; 6 | 7 | users.groups.libvirtd.members = [ "root" ]; 8 | users.groups.qemu-libvirtd.members = [ "qemu-libvirtd" ]; 9 | 10 | programs.virt-manager.enable = true; 11 | } 12 | -------------------------------------------------------------------------------- /nix/pkgs/custom/termimagenator.nix: -------------------------------------------------------------------------------- 1 | let 2 | rev = "v0.1.2"; 3 | url = "https://github.com/ryuheechul/termimagenator/archive/${rev}.tar.gz"; 4 | sha256 = "sha256:0pcxfrrm6aqwb1gwj7cancah7qk4w66v9617s4w3zg9dxxbvpqpq"; 5 | in 6 | (import (fetchTarball { 7 | url = url; 8 | sha256 = sha256; 9 | })).default 10 | -------------------------------------------------------------------------------- /nix/nixos/recipes/keyd-guest.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | # appropriate when nixos is a guest vm and most of key mapping are done in host side 4 | # probably via something like ../../../karabiner 5 | 6 | { 7 | services.keyd.enable = true; 8 | services.keyd.keyboards.vm.settings = import ../keyd/settings-min.nix; 9 | } 10 | -------------------------------------------------------------------------------- /SpaceVim.d/mimvimrc: -------------------------------------------------------------------------------- 1 | "This vimrc exist when minimal configuration is needed. 2 | "you can run this by `$ vi[m] -u [path/to/]mimvimrc` 3 | "Let's keep this close to vanila vim settings as much as possible 4 | "show line numbers 5 | set nu 6 | "syntax highlight 7 | set syntax 8 | "jk to enter normal mode 9 | inoremap jk 10 | -------------------------------------------------------------------------------- /emacs.d/doom.d/snippets/readme.org: -------------------------------------------------------------------------------- 1 | #+title: Readme 2 | 3 | keep this directory to prevent the error below 4 | 5 | #+begin_quote 6 | [yas] Check your `yas-snippet-dirs': /home/heechul/.config/doom/snippets/ is not a directory 7 | [yas] Prepared just-in-time loading of snippets with some errors. Check *Messages*. 8 | #+end_quote 9 | -------------------------------------------------------------------------------- /nix/bin/install-hm.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # install home-manager (and upgrade if the installed one is falling behind of ../niv-shim/nix/sources.json) 4 | 5 | curr_dir="$(dirname "$0")" 6 | repo_root="${curr_dir}/../.." 7 | nix_d="${repo_root}/nix" 8 | 9 | "${nix_d}/bin/nix-shell.sh" '' -A install 10 | -------------------------------------------------------------------------------- /.theia/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.fontLigatures": true, 3 | "editor.fontFamily": "Jetbrains Mono, FuraCode Nerd Font Mono, Menlo, Monaco, 'Courier New', monospace", 4 | "terminal.integrated.fontFamily": "Jetbrains Mono, FuraCode Nerd Font Mono, Menlo, Monaco, 'Courier New', monospace", 5 | "workbench.colorTheme": "Monokai" 6 | } 7 | -------------------------------------------------------------------------------- /karabiner/README.md: -------------------------------------------------------------------------------- 1 | # karabiner 2 | - https://karabiner-elements.pqrs.org/ 3 | - https://ke-complex-modifications.pqrs.org/ 4 | 5 | ## Open Json File to Add as Complex Modifications 6 | `karabiner://karabiner/assets/complex_modifications/import?url=[url]` 7 | 8 | url examples: 9 | - `file://[path]` 10 | - `https://[path]` 11 | -------------------------------------------------------------------------------- /nix/nixos/recipes/keyd-host-windows.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | # appropriate when nixos is the host OS on a machine and no key mappings are done already 4 | # like the case of ./keyd-guest.nix 5 | 6 | { 7 | services.keyd.enable = true; 8 | services.keyd.keyboards.default.settings = import ../keyd/settings-full-windows.nix; 9 | } 10 | -------------------------------------------------------------------------------- /nix/nixos/recipes/vm-guest-qemu.nix: -------------------------------------------------------------------------------- 1 | # this is to support the case when it's running as a VM via QEMU 2 | # see also at ./vm-guest-utm.nix 3 | { ... }: 4 | 5 | { 6 | imports = [ 7 | ./chrony-step.nix 8 | ]; 9 | 10 | # https://docs.getutm.app/guest-support/linux/#qemu-agent 11 | services.qemuGuest.enable = true; 12 | } 13 | -------------------------------------------------------------------------------- /nix/pkgs/custom/hexto256.nix: -------------------------------------------------------------------------------- 1 | let 2 | rev = "6acca36e1c8c313b59d26aff61f79bef3e8a4c4c"; 3 | url = "https://github.com/ryuheechul/hexto256/archive/${rev}.tar.gz"; 4 | sha256 = "sha256:1by5l50r6zjkx7mj6gd2bc1nij8nyw5y9mp9bh08qcj5wr3xlg0c"; 5 | in 6 | (import (fetchTarball { 7 | url = url; 8 | sha256 = sha256; 9 | })).default 10 | -------------------------------------------------------------------------------- /bin/path/default/add-zsh-to-shells: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # see here for context - https://github.com/fish-shell/fish-shell/issues/989 4 | 5 | should_be_latest_zsh="${1:-$(which zsh)}" 6 | 7 | # only add if not already exist 8 | grep "${should_be_latest_zsh}" /etc/shells || { 9 | echo "${should_be_latest_zsh}" >>/etc/shells 10 | } 11 | -------------------------------------------------------------------------------- /bin/path/default/battery: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # thanks to https://askubuntu.com/a/1317728/1666783 4 | cat /sys/class/power_supply/BAT?/capacity 5 | 6 | # examine battery information with `cat /sys/class/power_supply/BAT?/uevent` 7 | # and decode numbers with https://docs.kernel.org/power/power_supply_class.html#attributes-properties-detailed 8 | -------------------------------------------------------------------------------- /nix/home/programs/direnv.nix: -------------------------------------------------------------------------------- 1 | { 2 | # use nix-direnv to speed up `use nix` in .envrc files 3 | programs.direnv = { 4 | # https://nix-community.github.io/home-manager/options.html#opt-programs.direnv.enable 5 | enable = true; 6 | enableZshIntegration = false; # since I do this manually 7 | nix-direnv.enable = true; 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /nix/home/programs/navi.nix: -------------------------------------------------------------------------------- 1 | { 2 | programs.navi = { 3 | enable = true; 4 | enableZshIntegration = false; # since I do this manually 5 | # https://nix-community.github.io/home-manager/options.html#opt-programs.navi.settings 6 | settings = { 7 | shell = { 8 | command = "zsh"; 9 | }; 10 | }; 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /nix/pkgs/custom/nix-flatpak.nix: -------------------------------------------------------------------------------- 1 | # https://github.com/gmodena/nix-flatpak/tree/main 2 | # see a usage at ../../nixos/recipes/flatpak.nix 3 | 4 | # inspired by ./alt-nid/default.nix 5 | let 6 | sources = import ./via-niv; 7 | flake = sources.nix-flatpak.url; 8 | result = builtins.getFlake flake; 9 | in 10 | result.nixosModules.nix-flatpak 11 | -------------------------------------------------------------------------------- /nix/nixos/recipes/droidcam.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | # https://wiki.nixos.org/wiki/Droidcam 4 | # https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/programs/droidcam.nix 5 | { 6 | # requires a reboot after due to loading "v4l2loopback" kernel module; 7 | # and it may rebuild a whole linux kernel 8 | programs.droidcam.enable = true; 9 | } 10 | -------------------------------------------------------------------------------- /nix/pkgs/custom/bat-riffle/update-cargo-toml.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Cargo.toml b/Cargo.toml 2 | index 50de31a..0f87826 100644 3 | --- a/Cargo.toml 4 | +++ b/Cargo.toml 5 | @@ -17,5 +17,5 @@ crossterm = "0.22" 6 | bat = "0.19" 7 | 8 | [[bin]] 9 | -name = "riffle" 10 | -path = "src/app/main.rs" 11 | +name = "bat-riffle" 12 | +path = "examples/bat-riffle.rs" 13 | -------------------------------------------------------------------------------- /bin/path/default/update-terminfo-alacritty: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | tempdir="$(mktemp -d)" 4 | pushd "${tempdir}" || exit 5 | wget https://raw.githubusercontent.com/alacritty/alacritty/master/extra/alacritty.info 6 | cat ./alacritty.info 7 | tic -xe alacritty,alacritty-direct ./alacritty.info 8 | infocmp alacritty 9 | popd || exit 10 | rm -r "${tempdir}" 11 | -------------------------------------------------------------------------------- /bin/path/default/mirror-args: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | # this simple script is to intended for double checking segmentation of args when debugging shell scripting 4 | 5 | # usage example: 6 | # $ mirror-args single 'to'k'en' with 'multiple tokens' with "different quotes" 7 | # 'single' 'token' 'with' 'multiple tokens' 'with' 'different quotes' 8 | 9 | echo "${(qq)@}" 10 | -------------------------------------------------------------------------------- /bin/path/ssh/unlock-sessions: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # INFO: [Usage] call from a client with something like `[SSH_AUTH_SOCK=...] ssh target-host zsh -c unlock-sessions` 4 | 5 | # do this instead of `loginctl unlock-sessions` since it doesn't seem to respect $SSH_AUTH_SOCK 6 | loginctl --json=short | jq '.[] | select(.idle==true) | .session' | xargs loginctl unlock-session 7 | -------------------------------------------------------------------------------- /nix/nixos/gen-local-only.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | script_d="$(dirname "$0")" 4 | 5 | test -f "${script_d}/system-pkgs-local.nix" || cat <> "${script_d}/system-pkgs-local.nix" 6 | { pkgs }: 7 | 8 | with pkgs; 9 | [ 10 | ] 11 | EOF 12 | 13 | test -f "${script_d}/mix-and-match.nix" || cp "${script_d}/mix-and-match-template.nix" "${script_d}/mix-and-match.nix" 14 | -------------------------------------------------------------------------------- /bin/path/default/debug-nix: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # use this to debug the evaluation of $NIX_CONFIG or files mentioned in `man nix.conf` 4 | # optionally you can run this command with `sudo` as well to see it from a root perspective 5 | 6 | { 7 | nix --extra-experimental-features nix-command config show 8 | echo "run \`man nix.conf\` to debug further" 9 | } | less 10 | -------------------------------------------------------------------------------- /nix/pkgs/custom/alacritty-nightly.nix: -------------------------------------------------------------------------------- 1 | let 2 | rev = "b86511724b9c61f86f9aa36ff9d654b6ea2e182a"; 3 | url = "https://github.com/ryuheechul/alacritty-nightly/archive/${rev}.tar.gz"; 4 | overlay = (import (fetchTarball url)); 5 | pkgs-for-alacritty-nightly = import { 6 | overlays = [ overlay ]; 7 | }; 8 | in 9 | pkgs-for-alacritty-nightly.alacritty-nightly 10 | -------------------------------------------------------------------------------- /nvim/shell/build-via-nix-shell.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # basically simplify this a bit of the snippet from "nix-shell --command 'command that build' ~/.config/dfs-rhc/nvim/shell/shell.nix" to below 4 | # "np-build-via-nix-shell 'command that build'" also thanks to ../../zsh/aliases 5 | 6 | script_d="$(dirname "$0")" 7 | 8 | nix-shell --command "${@}" "${script_d}/shell.nix" 9 | -------------------------------------------------------------------------------- /bin/path/default/current-base16: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # fallback to default when no file is discovered 4 | test ! -f ~/.base16_theme && { 5 | # or an equivalent expression would be below 6 | # test -f ~/.base16_theme || { 7 | echo -n 'solarized-dark' 8 | exit 0 9 | } 10 | 11 | readlink -f ~/.base16_theme | xargs -I _ basename _ .sh | sed s/^base16-// | tr -d '\n' 12 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/ext-lang/lua/config.el: -------------------------------------------------------------------------------- 1 | ;;; ext-lang/lua/config.el -*- lexical-binding: t; -*- 2 | 3 | ;; it's working but syntax is not highlighted, maybe it will be fixed by emacs one day 4 | (use-package! lua-ts-mode 5 | :defer 6 | :init 7 | (when (modulep! +lsp) 8 | ;; without this lsp doesn't kick off 9 | (add-hook 'lua-ts-mode-hook #'lsp! 'append))) 10 | 11 | -------------------------------------------------------------------------------- /nix/nixos/recipes/surface-pro-9-intel.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | # Dealing with gotchas with surface 9 - inspired mostly by https://github.com/iwanders/nixos-surface 4 | { 5 | imports = [ 6 | ./surface-pro-intel.nix 7 | ]; 8 | 9 | # until https://github.com/linux-surface/linux-surface/issues/1183 10 | boot.blacklistedKernelModules = [ 11 | "surface_gpe" 12 | ]; 13 | } 14 | -------------------------------------------------------------------------------- /emacs.d/emacs-profiles.el: -------------------------------------------------------------------------------- 1 | ;; this file will be used by chemacs2 to be able to switch emacs configurations 2 | ;; it is meant to be symlinked to ~/.emacs-profiles.el 3 | (("default" . ((user-emacs-directory . "~/.doom-emacs.d"))) 4 | ("spacemacs" . ((user-emacs-directory . "~/.spacemacs.d")))) 5 | 6 | ;; a quick way to change profile to spacemacs: 7 | ;; echo 'spacemacs' > ~/.emacs-profile 8 | -------------------------------------------------------------------------------- /nix/pkgs/custom/via-niv/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: default 2 | default: show help update-indivisual 3 | 4 | .PHONY: help 5 | help: 6 | niv --help 7 | 8 | .PHONY: show 9 | show: 10 | niv show 11 | 12 | .PHONY: update-indivisual 13 | update-indivisual: 14 | @echo; echo 'run `niv update [repo]` to update individual repo'; echo 15 | 16 | .PHONY: update-all 17 | update-all: 18 | niv update 19 | -------------------------------------------------------------------------------- /bin/path/wsl/xsel: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # mimicking xsel using ../wsl/pbcopy and ../wsl/pbpaste 4 | # also inspired from https://github.com/Konfekt/win-bash-xclip-xsel/tree/0257c08664ce91bcbb8e11f33775ab22c7278c6d 5 | for i in "$@"; do 6 | case "$i" in 7 | (-o|--output|-out) 8 | pbpaste 9 | ;; 10 | (-i|--input|-in) 11 | pbcopy 12 | ;; 13 | esac 14 | done 15 | -------------------------------------------------------------------------------- /karabiner/.link.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # run this script with nix-shell -p coreutils especially on macOS 4 | 5 | set -x 6 | 7 | # to be able to be call from anywhere 8 | cd "$(dirname "$0")" || exit 9 | 10 | echo $(dirname $0) 11 | # symlink to be read by zshrc 12 | this_dir_path="$(readlink -f .)" 13 | 14 | rm -rf ~/.config/karabiner 15 | ln -sf "${this_dir_path}" ~/.config/karabiner 16 | 17 | -------------------------------------------------------------------------------- /nix/pkgs/custom/grace.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | with pkgs; 4 | buildGoModule rec { 5 | pname = "grace"; 6 | version = "0.0.1"; 7 | 8 | src = fetchFromGitHub { 9 | owner = "liamg"; 10 | repo = "grace"; 11 | rev = "v${version}"; 12 | sha256 = "sha256-ZNQORv17O8FuT33TM59IotiTG8thw3Gy9UyiC6mX5qI="; 13 | }; 14 | vendorHash = "sha256-jFwf2npUfQae4naufIMymQa0izlKOTrXskkk+zLS5Lw="; 15 | } 16 | -------------------------------------------------------------------------------- /notable.json: -------------------------------------------------------------------------------- 1 | { 2 | "cwd": "~/icd/notable", 3 | "monaco": { 4 | "editorOptions": { 5 | "minimap": { 6 | "enabled": false 7 | }, 8 | "wordWrap": "bounded" 9 | } 10 | }, 11 | "sorting": { 12 | "by": "title", 13 | "type": "ascending" 14 | }, 15 | "theme": "dark", 16 | "tutorial": true, 17 | "codemirror": { 18 | "options": { 19 | "lineWrapping": true 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /bin/README.md: -------------------------------------------------------------------------------- 1 | # bin 2 | Where scripts are 3 | 4 | ```bash 5 | bin/ # scripts for any platform 6 | ├── path/ # things that is supposed to be added to $PATH 7 | │ ├── default/ # for every system 8 | │ ├── wsl/ # only for WSL 9 | │ └── darwin/ # only for Darwin 10 | ├── darwin/ # masOS specific scripts 11 | └── wsl/ # WSL specific scripts 12 | ``` 13 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/lang/astro/packages.el: -------------------------------------------------------------------------------- 1 | ;; -*- no-byte-compile: t; -*- 2 | ;;; lang/astro/packages.el 3 | 4 | ;; https://github.com/Sorixelle/astro-ts-mode 5 | (package! astro-ts-mode) 6 | 7 | (when (and (modulep! :tools lsp -eglot)(modulep! +lsp)) 8 | ;; https://github.com/merrickluo/lsp-tailwindcss 9 | (package! lsp-tailwindcss 10 | :recipe (:host github :repo "merrickluo/lsp-tailwindcss"))) 11 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/lang/svelte/config.el: -------------------------------------------------------------------------------- 1 | ;;; lang/svelte/config.el -*- lexical-binding: t; -*- 2 | 3 | (use-package! svelte-ts-mode 4 | :after treesit-langs 5 | :init 6 | (when (and (modulep! :tools lsp)(modulep! +lsp)) 7 | (with-eval-after-load 'eglot 8 | (add-to-list 'eglot-server-programs '(svelte-ts-mode . ("svelteserver" "--stdio")))) 9 | (add-hook 'svelte-ts-mode-hook #'lsp! 'append))) 10 | -------------------------------------------------------------------------------- /nix/niv-shim/README.md: -------------------------------------------------------------------------------- 1 | # niv-shim 2 | 3 | to be used in place of using nix-channel via 4 | [../../../bin/path/default/home-manager](../../../bin/path/default/home-manager) 5 | 6 | [nix](./nix) is generated and managed via [niv](https://github.com/nmattia/niv). 7 | 8 | # difference between via-niv and this one 9 | There is [../pkgs/custom/via-niv](../pkgs/custom/via-niv) that explains the difference between two 10 | -------------------------------------------------------------------------------- /nvim/snippets/bash.json: -------------------------------------------------------------------------------- 1 | { 2 | "reference var": { 3 | "prefix": "ref", 4 | "body": [ 5 | "\"\\${${1:var}\\}\"" 6 | ], 7 | "description": "refer var without typing with shifts" 8 | }, 9 | "reference cmd": { 10 | "prefix": "cmd", 11 | "body": [ 12 | "\"\\$(${1:cmd})\"" 13 | ], 14 | "description": "refer the command execution without typing with shifts" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /nix/pkgs/custom/nur.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | # see a usage example at ../../nixos/recipes/waydroid.nix 3 | let 4 | # to support NUR https://github.com/nix-community/NUR; 5 | # manage pinning with https://github.com/nmattia/niv instead of a manual way from https://github.com/nix-community/NUR?tab=readme-ov-file#pinning; 6 | sources = import ./via-niv; 7 | nur = import sources.nur { inherit pkgs; }; 8 | in 9 | nur 10 | -------------------------------------------------------------------------------- /nix/pkgs/lang/erlang.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | with pkgs; 4 | [ 5 | erlang # Programming language used for massively scalable soft real-time systems 6 | rebar3 # Erlang build tool that makes it easy to compile and test Erlang applications, port drivers and releases 7 | elixir # A functional, meta-programming aware language built on top of the Erlang VM 8 | gleam # A statically typed language for the Erlang VM 9 | ] 10 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/ext-lang/nix/config.el: -------------------------------------------------------------------------------- 1 | ;;; ext-lang/nix/config.el -*- lexical-binding: t; -*- 2 | 3 | (use-package! nix-ts-mode 4 | :defer 5 | :mode "\\.nix\\'" 6 | :init 7 | (when (and (modulep! :tools lsp)(modulep! +lsp)) 8 | ;; without this lsp doesn't kick off 9 | (add-hook 'nix-ts-mode-hook #'lsp! 'append))) 10 | 11 | (after! lsp-mode 12 | (setq lsp-nix-nixd-formatting-command [ "nixfmt" ])) 13 | -------------------------------------------------------------------------------- /nix/niv-shim/bin/nix-path-for-paths.nix: -------------------------------------------------------------------------------- 1 | # look at ./nix-path-via-niv.sh for a usage 2 | paths: 3 | # e.g.: 4 | # ```nix 5 | # paths = [ 6 | # { src = "nixos"; name = "nixpkgs"; } 7 | # { src = "nixos-hardware"; } 8 | # ]; 9 | # ``` 10 | let 11 | nix-path-for = import ./nix-path-for.nix; 12 | in 13 | nix-path-for paths 14 | # e.g.: 15 | # nixpkgs=/nix/store/...-nixos-src:nixos-hardware=/nix/store/...-nixos-hardware-src 16 | -------------------------------------------------------------------------------- /nix/nixos/recipes/chrony-step.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | # Use this to deal with unstable rtc: 4 | # e.g. 1 SP8: https://github.com/linux-surface/linux-surface/issues/1497 5 | # e.g. 2 VM: https://chrony-project.org/faq.html#_is_chronyd_allowed_to_step_the_system_clock 6 | { 7 | services.chrony.extraConfig = '' 8 | makestep 1 -1 9 | ''; 10 | # `makestep 1 -1`: continuously step even when there is drift of 1 sec 11 | } 12 | -------------------------------------------------------------------------------- /nix/pkgs/custom/tag/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | with pkgs; 4 | buildGoPackage rec { 5 | pname = "tag"; 6 | version = "1.4.0"; 7 | 8 | goPackagePath = "github.com/aykamko/tag"; 9 | 10 | src = fetchFromGitHub { 11 | owner = "aykamko"; 12 | repo = "tag"; 13 | rev = "v${version}"; 14 | sha256 = "1zy78621wgncbhiyahjbn7jvihcjy8ajbiqv9j5jg7pmnfrmkn9n"; 15 | }; 16 | 17 | goDeps = ./deps.nix; 18 | } 19 | -------------------------------------------------------------------------------- /bin/path/tea/README.md: -------------------------------------------------------------------------------- 1 | # Brewfile-ish for Tea 2 | 3 | `./bin` use symlinks to download and run things via `tea` 4 | > https://github.com/teaxyz/cli#i-need-a-tool-in-path-aka-brew-install 5 | 6 | 1. Use `./link.sh` to quickly "install" things. It's a self contained script also manage what to install. 7 | 2. `./ls.sh` to list what's there. 8 | 9 | _Currently this is being used by [shell_ext](../../../zsh/my_addons/shell_ext)_ 10 | -------------------------------------------------------------------------------- /nix/pkgs/custom/nix-index-database/default.nix: -------------------------------------------------------------------------------- 1 | (import ( 2 | let 3 | lock = builtins.fromJSON (builtins.readFile ./flake.lock); 4 | in 5 | fetchTarball { 6 | url = 7 | lock.nodes.flake-compat.locked.url 8 | or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; 9 | sha256 = lock.nodes.flake-compat.locked.narHash; 10 | } 11 | ) { src = ./.; }).defaultNix 12 | -------------------------------------------------------------------------------- /nvim/stylua.toml: -------------------------------------------------------------------------------- 1 | # --search-parent-directories is a default arg for null_ls.builtins.formatting.stylua 2 | # so that formatting lua file will look for this file 3 | # according to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/15d3aabc2b440293ecf6c85f25ca9fa645a468ae/lua/null-ls/builtins/formatting/stylua.lua#L14 4 | 5 | indent_type = "Spaces" 6 | indent_width = 2 7 | quote_style = "AutoPreferSingle" 8 | call_parentheses = "None" 9 | -------------------------------------------------------------------------------- /nix/bin/nix-shell.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # using this script ensures that `nix-shell` wrapper is used 4 | # in case `nix-shell` path is not exported yet 5 | 6 | curr_d="$(dirname "$0")" 7 | 8 | # to make sure `export NIX_CONFIG='extra-experimental-features = nix-command flakes'` 9 | source "${curr_d}/../../nix/bin/source/config.sh" 10 | 11 | ns_wrapper="${curr_d}/../../bin/path/default/nix-shell" 12 | "${ns_wrapper}" "$@" 13 | -------------------------------------------------------------------------------- /nvim/snippets/direnv.json: -------------------------------------------------------------------------------- 1 | { 2 | "minimal-nix": { 3 | "prefix": "nix", 4 | "body": [ 5 | "# vim: ft=bash", 6 | "source_up", 7 | "use nix" 8 | ], 9 | "description": "configure nix-shell via direnv" 10 | }, 11 | "source_env": { 12 | "prefix": ".env", 13 | "body": [ 14 | "test -f .env && source_env .env" 15 | ], 16 | "description": "source .env if .env exist" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /nix/niv-shim/bin/get-path-for.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | src="${1:-nixpkgs}" 4 | # consider using nix to make sure this script works in any environment if necessary 5 | # e.g. https://ertt.ca/nix/shell-scripts/ 6 | 7 | pushd "$(dirname "$0")" >/dev/null 8 | 9 | source ../../bin/source/config.sh 10 | 11 | # https://stackoverflow.com/a/51242645/1570165 12 | nix eval --impure --expr "import ./alt-src-to-channel.nix \"${src}\"" | xargs 13 | -------------------------------------------------------------------------------- /nix/pkgs/custom/nix-index-database/README.md: -------------------------------------------------------------------------------- 1 | # nix-index-database 2 | 3 | This is packaging https://github.com/nix-community/nix-index-database for my non flake configurations 4 | 5 | _See usage at [../../../home/programs/shells.nix](../../../home/programs/shells.nix)_ 6 | 7 | Run `nix flake update` and `home-manager switch` or just run `make` to renew database. 8 | 9 | ## More About Flakes 10 | https://jade.fyi/blog/flakes-arent-real/ 11 | -------------------------------------------------------------------------------- /nix/pkgs/overlays/default.nix: -------------------------------------------------------------------------------- 1 | let 2 | unstable = import { }; 3 | stdenv = unstable.stdenv; 4 | lib = unstable.lib; 5 | checkEnv = import ../../utils/checkEnv.nix; 6 | shouldNeovimNightly = checkEnv "MY_NIX_OVERLAY_NEOVIM_NIGHTLY"; 7 | in 8 | { 9 | overlays = [ ] 10 | ++ lib.optionals stdenv.isDarwin [ (import ./darwin.nix) ] 11 | ++ lib.optionals shouldNeovimNightly [ (import ./neovim-nightly.nix) ]; 12 | } 13 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/my-custom/org/packages.el: -------------------------------------------------------------------------------- 1 | ;; -*- no-byte-compile: t; -*- 2 | ;;; my-custom/org/packages.el 3 | 4 | ;; install required package 5 | 6 | ;; when https://www.emacswiki.org/emacs/AutoSave is not enough 7 | (package! real-auto-save) 8 | 9 | ;; enables =org-gfm-export-to-markdown= 10 | (package! ox-gfm) 11 | ;; open a scratch that match the mode to current buffer - https://github.com/ieure/scratch-el 12 | (package! scratch) 13 | -------------------------------------------------------------------------------- /nix/nixos/recipes/steam.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | { 4 | # https://nixos.wiki/wiki/Steam 5 | programs.steam = { 6 | enable = true; 7 | remotePlay.openFirewall = true; 8 | }; 9 | # when the game seem to struggle make sure the performance mode is set 10 | # https://github.com/linux-surface/linux-surface/issues/1020#issuecomment-1365528473 11 | # and see if there is a way to automate toggling depends on which app is being used 12 | } 13 | -------------------------------------------------------------------------------- /nix/nixos/README.md: -------------------------------------------------------------------------------- 1 | # nix/nixos 2 | 3 | This is where the real ingredients for that ends up constructing 4 | "configuration.nix". The bootstrap/glue code can be found at 5 | `../../bootstrap/foundation/nixos/` 6 | 7 | ## Resources 8 | 9 | - https://nixos.wiki/wiki/NixOS_as_a_desktop 10 | - https://github.com/mikeroyal/NixOS-Guide 11 | - https://nixos.wiki/wiki/Extend_NixOS 12 | - https://github.com/ryuheechul/reflect/blob/main/org/lang/nix.org 13 | -------------------------------------------------------------------------------- /nvim/ftdetect/README.md: -------------------------------------------------------------------------------- 1 | # ftdetect 2 | ## about [./all.lua](./all.lua) 3 | - this used to be `../ftdetect/detect.vim`, however [that stopped working after sometime](https://github.com/neovim/neovim/issues/23522) 4 | - hence it will piggy back on `../plugin/ftdetect.lua` directory for the time being 5 | - reverting back to `../ftdetect/all.lua` after discovered what caused the break 6 | - https://github.com/neovim/neovim/issues/23522#issuecomment-1960832668 7 | -------------------------------------------------------------------------------- /zellij/themes/solarized.kdl: -------------------------------------------------------------------------------- 1 | // modified from https://github.com/zellij-org/zellij/blob/main/zellij-utils/assets/themes/solarized-dark.kdl 2 | themes { 3 | solarized { 4 | fg 253 246 227 5 | bg 100 43 54 6 | black 7 54 66 7 | red 220 50 47 8 | green 133 153 0 9 | yellow 181 137 0 10 | blue 38 139 210 11 | magenta 211 54 130 12 | cyan 42 161 152 13 | white 177 177 177 14 | orange 203 75 22 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /bin/path/darwin/battery-status: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env nu 2 | 3 | # adaptation of ../default/battery-status for darwin 4 | 5 | use ../../../nushell/modules/parse-battery-darwin.nu battery-status 6 | 7 | let is_charging = battery-status | get charging 8 | let percent = battery-status | get capacity | $in * 100 9 | 10 | if $is_charging { 11 | "Charging" 12 | } else { 13 | if $percent == 100 { 14 | "Full" 15 | } else { 16 | "Not charging" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /nix/home/shims.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | # also see these files: 4 | # - ../../nvim/lua/boot/lazy.lua 5 | # - ../../nvim/lua/utils/nixos-shim.lua 6 | { 7 | # -- REVERTED THE SPECIAL TREATMENT FOR NIXOS 8 | # -- may need to re-run `TSInstall all` if the path ever changed 9 | # home.file."./.local/share/nvim/my-local-lazy/nvim-treesitter/" = { 10 | # recursive = true; 11 | # source = pkgs.vimPlugins.nvim-treesitter.withAllGrammars; 12 | # }; 13 | } 14 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/tools/treesit-support/config.el: -------------------------------------------------------------------------------- 1 | ;;; tools/treesit-support/config.el -*- lexical-binding: t; -*- 2 | 3 | (use-package! treesit-langs) 4 | 5 | (after! treesit-langs 6 | (treesit-langs-major-mode-setup)) 7 | 8 | ;;;; this is a next TODO for this module 9 | ;; (use-package! treesit-auto 10 | ;; :custom 11 | ;; (treesit-auto-install 'prompt) 12 | ;; :config 13 | ;; (treesit-auto-add-to-auto-mode-alist 'all) 14 | ;; (global-treesit-auto-mode)) 15 | -------------------------------------------------------------------------------- /nix/home/services/syncthing.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | # may require to run this `systemctl --user start syncthing.service` 5 | services.syncthing.enable = pkgs.lib.mkIf pkgs.stdenv.isLinux true; 6 | # may require to run this `systemctl --user start syncthingtray.service` 7 | # but currently having an error "Failed to start syncthingtray.service: Unit tray.target not found." 8 | services.syncthing.tray.enable = pkgs.lib.mkIf pkgs.stdenv.isLinux true; 9 | } 10 | -------------------------------------------------------------------------------- /nix/pkgs/custom/opener.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | # see `../../home/services/opener.nix` for usage 4 | 5 | with pkgs; 6 | buildGoModule rec { 7 | pname = "opener"; 8 | version = "0.1.4"; 9 | 10 | src = fetchFromGitHub { 11 | owner = "superbrothers"; 12 | repo = "opener"; 13 | rev = "v${version}"; 14 | sha256 = "sha256-SU7Yn9PwZ6MtNRI8mZ6sHlW/sCvxR8yLjvXIK3aB1gk="; 15 | }; 16 | vendorHash = "sha256-Ey1j7CRkKGtgTw962BKS6j1EawcEr8H9B92JIIv45iM="; 17 | } 18 | -------------------------------------------------------------------------------- /nvim/shell/shell.nix: -------------------------------------------------------------------------------- 1 | # to assist building things on the fly when installing plugins 2 | # search `nix-shell` at ../lua/plugins to see usages 3 | 4 | { pkgs ? import { } }: 5 | 6 | with pkgs; 7 | mkShell { 8 | nativeBuildInputs = import ../../nix/build-deps.nix { } ++ [ 9 | rustc 10 | cargo 11 | ]; 12 | 13 | # thanks to https://github.com/bvaisvil/zenith/issues/19#issuecomment-635515703 14 | CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER = "gcc"; 15 | } 16 | -------------------------------------------------------------------------------- /nix/pkgs/lang/rust.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | with pkgs; 4 | [ 5 | evcxr # An evaluation context for Rust 6 | ## - I found that using devenv is the most smooth experience with Rust via https://nixos.wiki/wiki/Rust on Nix 7 | ## - An alternative to uncomment packages below would be 8 | ## 1. use `export MY_NIX_EXTRA_DEVENV=1` instead and configure per project via `devenv init` 9 | ## 2. or read ../../../bin/path/tea/README.md to use tea 10 | # cargo 11 | # rustc 12 | ] 13 | -------------------------------------------------------------------------------- /zsh/integration/1p: -------------------------------------------------------------------------------- 1 | # -*- mode: sh; -*- vim: set ft=zsh: 2 | 3 | # this file is expected to be sourced via bash or zsh 4 | # this is different from `./agent-bridge-via-1p` which is meant for WSL environment to communicate with Windows host 5 | # an example of 1password being setup are followings: 6 | # - `../../nix/nixos/recipes/1password.nix` 7 | # - `../../nix/nixos/recipes/pam-sshagent.nix` 8 | 9 | test -S ~/.1password/agent.sock && export SSH_AUTH_SOCK=~/.1password/agent.sock 10 | -------------------------------------------------------------------------------- /emacs.d/shell/source.zsh: -------------------------------------------------------------------------------- 1 | # detect the absence of eterm-color on darwin and install it 2 | if uname | xargs test "Darwin" =; then 3 | /usr/bin/infocmp eterm-color &> /dev/null \ 4 | || ~/.config/dfs-rhc/bin/darwin/terminfo-eterm-color.sh 5 | fi 6 | 7 | # fail fast 8 | test -z "${INSIDE_DOOM_EMACS}" && 9 | test -z "${INSIDE_EMACS_RUN_CMD_ON_START_UP}" && 10 | return 11 | 12 | # continue after the condition is met above 13 | 14 | source "${my_dot_d}/emacs.d/doom.d/shell/source.zsh" 15 | -------------------------------------------------------------------------------- /nix/nixos/recipes/meta/tpm.nix: -------------------------------------------------------------------------------- 1 | username: 2 | 3 | { pkgs, ... }: 4 | 5 | # https://nixos.wiki/wiki/TPM 6 | { 7 | environment.systemPackages = [ pkgs.tpm2-tools ]; 8 | security.tpm2.enable = true; 9 | security.tpm2.pkcs11.enable = true; # expose /run/current-system/sw/lib/libtpm2_pkcs11.so 10 | security.tpm2.tctiEnvironment.enable = true; # TPM2TOOLS_TCTI and TPM2_PKCS11_TCTI env variables 11 | users.users.${username}.extraGroups = [ "tss" ]; # tss group has access to TPM devices 12 | } 13 | -------------------------------------------------------------------------------- /zsh/path/tea: -------------------------------------------------------------------------------- 1 | # -*- mode: sh; -*- vim: set ft=zsh: 2 | 3 | # using function add-to-path which should be coming from ./set-basic 4 | 5 | if test -d "${HOME}/.tea"; then 6 | export TEA_MAGIC=0 7 | fastcommandcheck tea || source <("${HOME}/.tea/tea.xyz/v*/bin/tea" --magic=zsh --silent) 8 | 9 | # drawing the power of tea to magically install things with symlinks 10 | # read ../../bin/path/tea/README.md for detail 11 | fastcommandcheck tea && add-to-path "${my_dot_d}/bin/path/tea/bin" 12 | fi 13 | -------------------------------------------------------------------------------- /zsh/fn/linux: -------------------------------------------------------------------------------- 1 | # -*- mode: sh; -*- vim: set ft=zsh: 2 | 3 | fastcommandcheck systemctl || return 0 4 | 5 | function printsystemuserenv() { 6 | # inspired by: 7 | # - https://unix.stackexchange.com/a/176874/396504 8 | # - https://unix.stackexchange.com/a/429106/396504 9 | # - https://stackoverflow.com/a/77651039/1570165 10 | bash -c 'source <(systemctl --user show-environment | grep '$1'); echo $'$1 11 | } 12 | 13 | function sourcesystemuserenv() { 14 | export $1="$(printsystemuserenv $1)" 15 | } 16 | -------------------------------------------------------------------------------- /nix/nixos/recipes/documentation.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | # WARN: is 'man-pages' via `../system-pkgs.nix` not sufficient? 4 | 5 | # https://nixos.wiki/wiki/Man_pages 6 | # https://discourse.nixos.org/t/some-manpage-related-stuff-you-might-want-to-turn-on/38835 7 | { 8 | environment.systemPackages = with pkgs; [ 9 | man-pages 10 | man-pages-posix 11 | ]; 12 | 13 | documentation = { 14 | dev.enable = true; 15 | man.generateCaches = true; 16 | nixos.includeAllModules = true; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /nix/nixos/recipes/quickemu.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | # some tools that are helpful for quicker ways to spin virtual machines to complement ./libvirt.nix 4 | { 5 | environment.systemPackages = with pkgs; [ 6 | quickemu # Quickly create and run optimised Windows, macOS and Linux virtual machines 7 | quickgui # Elegant virtual machine manager for the desktop 8 | vagrant # Tool for building complete development environments 9 | lima # Linux virtual machines (on macOS, in most cases) 10 | ]; 11 | } 12 | -------------------------------------------------------------------------------- /nix/nixos/recipes/surface-pro-intel.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | imports = [ 5 | 6 | ./chrony-step.nix 7 | ./laptop.nix 8 | ]; 9 | 10 | # works only for intel 11 | services.thermald.enable = true; 12 | 13 | # improve pen experience 14 | services.iptsd.config.Touchscreen = { 15 | DisableOnPalm = true; 16 | DisableOnStylus = true; 17 | }; 18 | 19 | environment.systemPackages = [ 20 | pkgs.nvtopPackages.intel 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /bin/path/default/chzh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # this is a chsh helper to make zsh to be the default shell 4 | 5 | echo 'with current zsh information below;' 6 | zsh -c 'version' 7 | 8 | should_be_latest_zsh="${1:-$(which zsh)}" 9 | 10 | echo 11 | echo "trying to set \`${should_be_latest_zsh}\` as the default shell for user \`${USER}\`" 12 | 13 | # make sure to have shell path added to /etc/shell via ./add-zsh-to-shells 14 | sudo add-zsh-to-shells "${should_be_latest_zsh}" 15 | 16 | chsh -s "${should_be_latest_zsh}" 17 | -------------------------------------------------------------------------------- /bin/darwin/terminfo-eterm-color.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | emacs_path="$(nix-outpath emacs)" 4 | # https://stackoverflow.com/a/3162500/1570165 5 | emacs_ver="${emacs_path##*-}" 6 | 7 | # might want to run this in case one from ncurses is not satisfying 8 | /usr/bin/tic -x "${emacs_path}/share/emacs/${emacs_ver}/etc/e/eterm-color.ti" 9 | 10 | echo 'A "proper" `eterm-color` terminfo on this system (darwin) was missing and now it is installed by this script.' 11 | echo 'You should restart the shell/terminal to apply the change.' 12 | -------------------------------------------------------------------------------- /nix/pkgs/lang/nix.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | with pkgs; 4 | [ 5 | nixd # Feature-rich Nix language server interoperating with C++ nix 6 | # nil # Yet another language server for Nix 7 | # nixpkgs-fmt # Nix code formatter for nixpkgs - deprecated and now there is an official formatter below 8 | nixfmt-rfc-style # Official formatter for Nix code 9 | niv # Easy dependency management for Nix projects 10 | ] 11 | 12 | # regarding niv: 13 | # - https://lucperkins.dev/blog/nix-channel/ 14 | # - https://www.youtube.com/watch?v=atmoYyBAhF4 15 | -------------------------------------------------------------------------------- /nix/nixos/recipes/auto-timezone.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | 3 | # https://www.reddit.com/r/NixOS/comments/1411gjs/dynamically_set_the_timezone/ 4 | # https://unix.stackexchange.com/questions/778391/geoclue-failed-to-query-location-not-found 5 | # https://beacondb.net/ 6 | { 7 | time.timeZone = lib.mkForce null; 8 | services.automatic-timezoned.enable = true; 9 | services.geoclue2.enable = true; 10 | services.geoclue2.enableDemoAgent = lib.mkForce true; 11 | services.geoclue2.geoProviderUrl = "https://api.beacondb.net/v1/geolocate"; 12 | } 13 | -------------------------------------------------------------------------------- /nix/pkgs/custom/via-niv/README.md: -------------------------------------------------------------------------------- 1 | # via-niv 2 | It's a helper to track repos and pin versions for [../../custom](../../custom). 3 | 4 | Use [Makefile](./Makefile) to get help on usages 5 | 6 | ## Difference Between This One and niv-shim 7 | [../../../niv-shim](../../../niv-shim) is mostly for "system wide" 8 | and this one is for serving `custom` only 9 | 10 | Using `niv` it's flexible to place it in anywhere but I don't one to place everything at one place nor so many different places. 11 | So I'm balancing between too little and too many. 12 | -------------------------------------------------------------------------------- /gemini/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "model": "gemini-2.5-flash", 3 | "theme": "Atom One", 4 | "selectedAuthType": "oauth-personal", 5 | "contextFileName": [ 6 | "AGENTS.md", 7 | "AGENT.md", 8 | "GEMINI.md" 9 | ], 10 | "preferredEditor": "neovim", 11 | "mcpServers": { 12 | "serena": { 13 | "command": "uvx", 14 | "args": [ 15 | "--from", 16 | "git+https://github.com/oraios/serena", 17 | "serena", 18 | "start-mcp-server" 19 | ], 20 | "trust": false 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /bin/path/default/update-terminfo-tmux: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | tempdir="$(mktemp -d)" 4 | pushd "${tempdir}" || exit 5 | wget https://invisible-island.net/datafiles/current/terminfo.src.gz 6 | gunzip terminfo.src.gz 7 | cat ./terminfo.src 8 | 9 | # mitigate issue in Darwin platform by choosing its own `tic` 10 | case "$(uname -s)" in 11 | Darwin*) 12 | _tic_cmd=/usr/bin/tic 13 | ;; 14 | *) 15 | _tic_cmd=tic 16 | ;; 17 | esac 18 | 19 | ${_tic_cmd} -xe tmux-256color terminfo.src 20 | infocmp tmux-256color 21 | popd || exit 22 | rm -r "${tempdir}" 23 | -------------------------------------------------------------------------------- /nix/nixos/keyd/README.md: -------------------------------------------------------------------------------- 1 | # What Are the Files Here for 2 | They have the one same goal, mimic the macOS keybindings when makes sense. 3 | 4 | But you can pick and choose the one makes sense the most depends on where is NixOS installed. 5 | 6 | For example, if it's installed as VM on a macOS device, [./settings-min.nix](./settings-min.nix) would do. 7 | If it's installed on a laptop originally for Windows, [./settings-full-windows.nix](./settings-full-windows.nix) might do. 8 | 9 | List available keys with `nix-shell -p keyd --command 'keyd list-keys'`. 10 | -------------------------------------------------------------------------------- /nix/nixos/recipes/no-sleep.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | { 4 | # copied from https://discourse.nixos.org/t/stop-pc-from-sleep/5757/2 5 | # Disable the GNOME3/GDM auto-suspend feature that when it cannot be disabled in GUI! 6 | # but in my case of disabling in Gnome GUI didn't prevent all cases of suspend/hibernate 7 | # where enabling below haven't failed at preventing them 8 | systemd.targets.sleep.enable = false; 9 | systemd.targets.suspend.enable = false; 10 | systemd.targets.hibernate.enable = false; 11 | systemd.targets.hybrid-sleep.enable = false; 12 | } 13 | -------------------------------------------------------------------------------- /nushell/config.nu: -------------------------------------------------------------------------------- 1 | # expected to be sourced from ~/.config/nushell/config.nu 2 | $env.config.edit_mode = 'vi' 3 | 4 | # commands 5 | def is-linux [] { uname | get kernel-name | $in == Linux } 6 | def git-status [] { pwd | print $in; zsh -c 'ls'; git status } 7 | 8 | # aliases 9 | alias j = zi # zoxide to fit my muscle memory with fasd+fzf 10 | alias vi = nvim 11 | alias l = ls -la 12 | alias tree = ls **/* 13 | alias gs = git-status 14 | alias gl = git pull 15 | alias ggpush = git push 16 | alias gd = git diff 17 | alias gdc = gd --cached 18 | alias gap = git add -p 19 | -------------------------------------------------------------------------------- /nix/nixos/recipes/openssh.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | { 4 | services.openssh.enable = true; 5 | services.openssh.settings.X11Forwarding = true; 6 | services.openssh.extraConfig = '' 7 | # for https://github.com/superbrothers/opener#remote-environment 8 | # to clean the disconnect socket and prevent connection errors 9 | StreamLocalBindUnlink yes 10 | ''; 11 | 12 | # better security with disabling password auth on login 13 | # comment out in case temporarily allowing password auth 14 | services.openssh.settings.PasswordAuthentication = false; 15 | } 16 | -------------------------------------------------------------------------------- /nix/pkgs/custom/tag/deps.nix: -------------------------------------------------------------------------------- 1 | [ 2 | # goDeps is a list of Go dependencies. 3 | { 4 | # goPackagePath specifies Go package import path. 5 | goPackagePath = "github.com/fatih/color"; 6 | fetch = { 7 | # `fetch type` that needs to be used to get package source. 8 | # If `git` is used there should be `url`, `rev` and `sha256` defined next to it. 9 | type = "git"; 10 | url = "https://github.com/fatih/color"; 11 | rev = "v1.5.0"; 12 | sha256 = "1hw9hgkfzbzqjhy29pqpk20xggxaqjv45wx8yn69488mw5ph7khh"; 13 | }; 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /bin/path/nixos/nixos-option: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | curr_dir="$(dirname "$0")" 4 | pushd "${curr_dir}" > /dev/null 5 | 6 | nix_d="../../../nix" 7 | path_for="${nix_d}/niv-shim/bin/nix-path-via-niv.sh" 8 | 9 | nix_path="$("${path_for}" nixpkgs=nixos:nixos-hardware)" 10 | 11 | # making sure NIX_PATH matches same as the build time similar to ../../../bootstrap/foundation/nixos/nixos-rebuild.sh 12 | nix_path="${nix_path}" NIXOS_CONFIG="${my_dot_d}/bootstrap/foundation/nixos/configuration.nix" nix-shell -p nixos-option --command "NIX_PATH=\"\${nix_path}\" nixos-option ${@}" 13 | -------------------------------------------------------------------------------- /nix/pkgs/custom/alt-nid/default.nix: -------------------------------------------------------------------------------- 1 | # this is a even simpler version than ../alt-nix-index-database via https://nix.dev/manual/nix/2.18/language/builtins#builtins-getFlake 2 | # thanks to https://www.reddit.com/r/NixOS/comments/1ez9y69/how_to_import_a_flake_inside_a_non_flake_module/ 3 | let 4 | sources = import ../via-niv; 5 | flake = sources.nix-index-database.url; 6 | # flake = "github:nix-community/nix-index-database"; # this would work too but why not a pinned version that I already have 7 | result = builtins.getFlake flake; 8 | in 9 | result.hmModules.nix-index 10 | -------------------------------------------------------------------------------- /sublime/.link.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # run this script with nix-shell -p coreutils especially on macOS 4 | 5 | set -x 6 | 7 | # to be able to be call from anywhere 8 | cd "$(dirname "$0")" || exit 9 | 10 | # symlink to be read by zshrc 11 | this_dir_path="$(readlink -f .)" 12 | 13 | # keymap 14 | ln -sf "${this_dir_path}"/keymap ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/Default\ \(OSX\).sublime-keymap 15 | 16 | # settings 17 | ln -sf "${this_dir_path}"/settings ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/Preferences.sublime-settings 18 | -------------------------------------------------------------------------------- /nix/pkgs/custom/tf-helper.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | with pkgs; 4 | stdenv.mkDerivation rec { 5 | name = "tf-helper"; 6 | version = "0.2.9"; 7 | 8 | src = fetchFromGitHub { 9 | owner = "hashicorp-community"; 10 | repo = "tf-helper"; 11 | rev = "5b106a5dc2ec1e1a613ef555690955433d538652"; 12 | sha256 = "wXwNlzYHxyFjCeA0yRxvn/WHMNUz9nahRX/5FhYeVCs="; 13 | }; 14 | 15 | phases = "installPhase"; 16 | 17 | installPhase = '' 18 | mkdir -p $out/share 19 | cp -r ${src} -p $out/share/tf-helper 20 | ln -s $out/share/tf-helper/tfh/bin $out/bin 21 | ''; 22 | } 23 | -------------------------------------------------------------------------------- /nvim/snippets/nix.json: -------------------------------------------------------------------------------- 1 | { 2 | "shell.nix": { 3 | "prefix": "shell", 4 | "body": [ 5 | "{ pkgs ? import {} }:", 6 | "", 7 | "with pkgs;", 8 | "mkShell {", 9 | " buildInputs = [", 10 | " ${1:name}", 11 | " ];", 12 | "}" 13 | ], 14 | "description": "minimal template for shell.nix" 15 | }, 16 | "sha256-hash": { 17 | "prefix": "sha256", 18 | "body": [ 19 | "\"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\"" 20 | ], 21 | "description": "placeholder of sha256 hash" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /nix/darwin/Makefile: -------------------------------------------------------------------------------- 1 | arch_for_darwin := aarch64 2 | 3 | # use of prepending `path:` for the flake allows to avoid git tree is dirty (and fail) issue 4 | # with the file that is not checked into the git (e.g. ./configuration.nix) 5 | 6 | .PHONY: switch 7 | switch: render build 8 | sudo ./result/sw/bin/darwin-rebuild switch --flake path:.#$(arch_for_darwin) 9 | 10 | .PHONY: render 11 | render: 12 | ./gen-configuration.sh 13 | 14 | .PHONY: build 15 | build: 16 | nix build path:.#darwinConfigurations.$(arch_for_darwin).system 17 | 18 | .PHONY: update 19 | update: 20 | nix flake update 21 | -------------------------------------------------------------------------------- /nix/home/programs/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | ... 5 | }: 6 | 7 | let 8 | shells = import ./shells.nix { 9 | config = config; 10 | pkgs = pkgs; 11 | }; 12 | terminals = import ./terminals.nix { pkgs = pkgs; }; 13 | in 14 | { 15 | # https://nix-community.github.io/home-manager/index.html#_how_to_set_up_a_configuration_for_multiple_users_machines 16 | imports = [ 17 | ./home-manager.nix 18 | shells 19 | terminals 20 | ./direnv.nix 21 | ./navi.nix 22 | ]; 23 | 24 | # if anything doesn't want to belong to its own file it can be added below 25 | } 26 | -------------------------------------------------------------------------------- /zsh/integration/editors: -------------------------------------------------------------------------------- 1 | # -*- mode: sh; -*- vim: set ft=zsh: 2 | 3 | # extra things to load for emacs for seamless integration 4 | if test -n "${INSIDE_EMACS}"; then 5 | to_source_for_emacs="${my_dot_d}/emacs.d/shell/source.zsh" 6 | test -f "${to_source_for_emacs}" && source "${to_source_for_emacs}" 7 | fi 8 | 9 | # extra things to load for neovim for seamless integration 10 | 11 | if test -n "${NVIM_LISTEN_ADDRESS}" && fastcommandcheck nvr; then 12 | to_source_for_neovim="${my_dot_d}/nvim/shell/source.zsh" 13 | test -f "${to_source_for_neovim}" && source "${to_source_for_neovim}" 14 | fi 15 | -------------------------------------------------------------------------------- /bin/path/wsl/xdg-open: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # mimic xdg-open with the first priority of opening URLs 4 | # and fallback to explorer.exe when `wslview` is not available as I witnessed 5 | # that `wslu` from ../../../nix/pkgs/extra/default.nix didn't expose binaries sometimes 6 | command -v wslview2 > /dev/null && { 7 | wslview "$@" 8 | } || { 9 | explorer.exe "$@" || true 10 | } 11 | 12 | # `ln -s ./xdg-open open` would accomodate https://github.com/m3m0ryh0l3/extracturl/blob/422c3c26f7c50b09de6d53748c25d3c905b890d3/extract_url.pl#L206 13 | # which is used for https://github.com/tmux-plugins/tmux-urlview 14 | -------------------------------------------------------------------------------- /nix/nixos/recipes/mdns.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | let 4 | # use mkDefault just in case of conflict with ./uxplay.nix 5 | mkDefault = pkgs.lib.mkDefault; 6 | in 7 | { 8 | # https://wiki.archlinux.org/title/Avahi 9 | services.avahi = { 10 | # avahi to manage mdns 11 | enable = mkDefault true; 12 | # this allows to query *.local - aka being a mDNS client 13 | nssmdns4 = mkDefault true; 14 | publish = { 15 | enable = mkDefault true; 16 | # this publish the addresses. e.g. [hostname].local - aka being a mDNS server 17 | addresses = mkDefault true; 18 | }; 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/tools/treesit-support/readme.org: -------------------------------------------------------------------------------- 1 | #+title: Readme - treesit-support 2 | 3 | This module is a way to bridge the gap between [[https://github.com/doomemacs/doomemacs/tree/master/modules/tools/tree-sitter][the old way]] and the lack of support for the new way in the doom yet. 4 | 5 | Therefore, powering the support for tree-sitter via =treesit= until this issue, https://github.com/doomemacs/doomemacs/issues/7623 is resolved. 6 | 7 | * Some Links 8 | - https://robbmann.io/posts/emacs-treesit-auto/ 9 | - https://github.com/emacs-tree-sitter/treesit-langs 10 | - https://github.com/renzmann/treesit-auto 11 | -------------------------------------------------------------------------------- /nix/nixos/recipes/docker-rootful.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | # https://wiki.nixos.org/wiki/Docker 4 | # for a rootlees docker, `./docker.nix` 5 | # see why rootless docker is preferred for better security - https://www.redhat.com/en/blog/understanding-root-inside-and-outside-container 6 | # which can be tested with below; 7 | # `docker run --privileged -it -v /var:/host/var ubuntu touch /host/var/touched-on-host && ls -lah /var/touched-on-host` 8 | # and `docker run --privileged -it -v /var:/host/var ubuntu rm /host/var/touched-on-host` can delete the artifact to clean up 9 | { 10 | virtualisation.docker.enable = true; 11 | } 12 | -------------------------------------------------------------------------------- /lf/pv.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | lf_d="${XDG_CONFIG_HOME}/lf" 4 | less_sh="${lf_d}/less.sh" 5 | 6 | # if rsop is discovered, augment previewing with rsop 7 | if command -v rsop > /dev/null; then 8 | if test -n "${LF_PV_WITH_PAGER}"; then 9 | RSOP_MODE=preview COLUMNS="$2" LINES="$3" exec rsop "$1" | ${less_sh} 10 | else 11 | RSOP_MODE=preview COLUMNS="$2" LINES="$3" exec rsop "$1" 12 | fi 13 | # if not fallback to my own legacy script 14 | else 15 | if test -n "${LF_PV_WITH_PAGER}"; then 16 | "${lf_d}/pv-legacy.sh" "$@" | ${less_sh} 17 | else 18 | "${lf_d}/pv-legacy.sh" "$@" 19 | fi 20 | fi 21 | -------------------------------------------------------------------------------- /karabiner/assets/complex_modifications/1542075990.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Vim style escape key mapping", 3 | "rules": [ 4 | { 5 | "description": "Map ctrl + [ to escape", 6 | "manipulators": [ 7 | { 8 | "type": "basic", 9 | "from": { 10 | "key_code": "open_bracket", 11 | "modifiers": { 12 | "mandatory": ["control"], 13 | "optional": ["any"] 14 | } 15 | }, 16 | "to": [ 17 | { 18 | "key_code": "escape" 19 | } 20 | ] 21 | } 22 | ] 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /karabiner-uk/assets/complex_modifications/1542075990.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Vim style escape key mapping", 3 | "rules": [ 4 | { 5 | "description": "Map ctrl + [ to escape", 6 | "manipulators": [ 7 | { 8 | "type": "basic", 9 | "from": { 10 | "key_code": "open_bracket", 11 | "modifiers": { 12 | "mandatory": ["control"], 13 | "optional": ["any"] 14 | } 15 | }, 16 | "to": [ 17 | { 18 | "key_code": "escape" 19 | } 20 | ] 21 | } 22 | ] 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /nvim/lua/utils/shell.lua: -------------------------------------------------------------------------------- 1 | -- helper to run system command 2 | -- super simple for now 3 | local run_cmd = function(cmd) 4 | local handle = io.popen(cmd .. ' 2>/dev/null') 5 | 6 | if handle ~= nil then 7 | local result = handle:read '*a' 8 | handle:close() 9 | 10 | return result 11 | end 12 | return '' 13 | end 14 | 15 | -- usage: require('utils.shell').run_cmd 'which pwd' 16 | return { 17 | run_cmd = run_cmd, 18 | -- usage: require('utils.shell').grep 'lua' '~/dotfiles' 19 | grep = function(pattern, filename) 20 | local result = run_cmd('rg ' .. pattern .. ' ' .. filename) 21 | return result 22 | end, 23 | } 24 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/my-custom/lab/config.el: -------------------------------------------------------------------------------- 1 | ;;; $DOOMDIR/modules/my-custom/lab/config.el -*- lexical-binding: t; -*- 2 | 3 | ;; configs that where I can freely experiment without concerning about which specific module to manage the code yet 4 | 5 | ;; if this issue, https://github.com/magit/with-editor/issues/62 appears 6 | ;; these might resolve the issue and/or run `doom sync' to see if that helps 7 | ;; (when IS-MAC 8 | ;; (if (and (eq window-system nil) 9 | ;; (eq with-editor-emacsclient-executable nil)) 10 | ;; (setq with-editor-emacsclient-executable 11 | ;; (shell-command-to-string "command -v emacsclient")))) 12 | -------------------------------------------------------------------------------- /nvim/ftdetect/all.lua: -------------------------------------------------------------------------------- 1 | -- go to `../lua/boot/filetype.lua` for filetype specific configurations 2 | 3 | vim.filetype.add { 4 | extension = { 5 | kdl = 'kdl', 6 | hurl = 'hurl', 7 | astro = 'astro', 8 | alloy = 'alloy', 9 | }, 10 | filename = { 11 | Earthfile = 'Earthfile', 12 | ['.envrc'] = 'bash', 13 | }, 14 | } 15 | 16 | -- above replaces the old way like below 17 | -- 18 | -- vim.cmd [[ 19 | -- au BufRead,BufNewFile Earthfile set filetype=Earthfile 20 | -- au BufRead,BufNewFile *.kdl set filetype=kdl 21 | -- au BufRead,BufNewFile *.astro set filetype=astro 22 | -- au BufRead,BufNewFile *.hurl set filetype=hurl 23 | -- ]] 24 | -------------------------------------------------------------------------------- /nix/pkgs/lang/sql.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | with pkgs; 4 | [ 5 | usql # Universal command-line interface for SQL databases 6 | litecli # Command-line interface for SQLite 7 | postgresql # A powerful, open source object-relational database system also comes with psql cli 8 | pgcli # Alternative command-line interface for PostgreSQL 9 | steampipe # select * from cloud; 10 | # thanks to https://www.reddit.com/r/neovim/comments/1gqfvf9/how_do_you_think_about_dadbod/ 11 | lazysql # A cross-platform TUI database management tool written in Go 12 | rainfrog # A database management TUI for postgres 13 | harlequin # The SQL IDE for Your Terminal 14 | ] 15 | -------------------------------------------------------------------------------- /nushell/modules/fixtures/linux/files.nu: -------------------------------------------------------------------------------- 1 | const script_dir = path self . 2 | 3 | def open-rel [rel_path: string] { 4 | $script_dir | path join $rel_path | open $in 5 | } 6 | 7 | export def get-files [] { 8 | let adp = { 9 | on: (open-rel ./adp/on.txt), 10 | off: (open-rel ./adp/off.txt), 11 | } 12 | 13 | let bat = { 14 | full: (open-rel ./bat/full.txt), 15 | unknown: (open-rel ./bat/unknown.txt), 16 | charging: (open-rel ./bat/charging.txt), 17 | discharging: (open-rel ./bat/discharging.txt), 18 | not_charging: (open-rel ./bat/not-charging.txt), 19 | } 20 | 21 | { 22 | adp: $adp, 23 | bat: $bat, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /nix/pkgs/lang/java.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | # this needs might be satisfied just by ./graalvm.nix depends on usages 4 | 5 | # my preferred references: 6 | # - https://github.com/cachix/devenv/blob/main/src/modules/languages/java.nix 7 | # - https://github.com/cachix/devenv/blob/main/src/modules/languages/clojure.nix 8 | # - https://github.com/cachix/devenv/blob/main/src/modules/languages/scala.nix 9 | # - https://github.com/Olical/conjure/wiki/Quick-start:-Clojure-(babashka) 10 | with pkgs; 11 | [ 12 | jdk # openjdk The open-source Java Development Kit 13 | clojure # A Lisp dialect for the JVM 14 | clojure-lsp # Language Server Protocol (LSP) for Clojure 15 | ] 16 | -------------------------------------------------------------------------------- /nushell/modules/fixtures/linux/bat/charging.txt: -------------------------------------------------------------------------------- 1 | DEVTYPE=power_supply 2 | POWER_SUPPLY_NAME=BAT1 3 | POWER_SUPPLY_TYPE=Battery 4 | POWER_SUPPLY_STATUS=Charging 5 | POWER_SUPPLY_PRESENT=1 6 | POWER_SUPPLY_TECHNOLOGY=Li-ion 7 | POWER_SUPPLY_CYCLE_COUNT=111 8 | POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11380000 9 | POWER_SUPPLY_VOLTAGE_NOW=11713000 10 | POWER_SUPPLY_POWER_NOW=3513000 11 | POWER_SUPPLY_ENERGY_FULL_DESIGN=50230000 12 | POWER_SUPPLY_ENERGY_FULL=45540000 13 | POWER_SUPPLY_ENERGY_NOW=23800000 14 | POWER_SUPPLY_CAPACITY=83 15 | POWER_SUPPLY_CAPACITY_LEVEL=Normal 16 | POWER_SUPPLY_MODEL_NAME=1194729001 17 | POWER_SUPPLY_MANUFACTURER=SMP 18 | POWER_SUPPLY_SERIAL_NUMBER=0220791152 19 | -------------------------------------------------------------------------------- /nushell/modules/fixtures/linux/bat/unknown.txt: -------------------------------------------------------------------------------- 1 | DEVTYPE=power_supply 2 | POWER_SUPPLY_NAME=BAT1 3 | POWER_SUPPLY_TYPE=Battery 4 | POWER_SUPPLY_STATUS=Unknown 5 | POWER_SUPPLY_PRESENT=1 6 | POWER_SUPPLY_TECHNOLOGY=Li-ion 7 | POWER_SUPPLY_CYCLE_COUNT=111 8 | POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11380000 9 | POWER_SUPPLY_VOLTAGE_NOW=11713000 10 | POWER_SUPPLY_POWER_NOW=3513000 11 | POWER_SUPPLY_ENERGY_FULL_DESIGN=50230000 12 | POWER_SUPPLY_ENERGY_FULL=45540000 13 | POWER_SUPPLY_ENERGY_NOW=23800000 14 | POWER_SUPPLY_CAPACITY=62 15 | POWER_SUPPLY_CAPACITY_LEVEL=Normal 16 | POWER_SUPPLY_MODEL_NAME=1194729001 17 | POWER_SUPPLY_MANUFACTURER=SMP 18 | POWER_SUPPLY_SERIAL_NUMBER=0220791152 19 | -------------------------------------------------------------------------------- /nix/darwin/gen-configuration.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | curr_dir="$(dirname "$0")" 4 | cd "${curr_dir}" || exit 5 | 6 | cat <./configuration.nix 7 | # generated by ./gen-configuration.sh 8 | 9 | # Edit this configuration file to define what should be installed on 10 | # your system. Help is available in the configuration.nix(5) man page 11 | # and in the NixOS manual (accessible by running ‘nixos-help’). 12 | 13 | { config, pkgs, ... }: 14 | 15 | let 16 | username = "$(whoami)"; 17 | with-primary-user = import ./meta-configuration.nix { username = username; }; 18 | in 19 | { 20 | imports = 21 | [ 22 | with-primary-user 23 | ]; 24 | } 25 | EOF 26 | -------------------------------------------------------------------------------- /nushell/modules/fixtures/linux/bat/discharging.txt: -------------------------------------------------------------------------------- 1 | DEVTYPE=power_supply 2 | POWER_SUPPLY_NAME=BAT1 3 | POWER_SUPPLY_TYPE=Battery 4 | POWER_SUPPLY_STATUS=Discharging 5 | POWER_SUPPLY_PRESENT=1 6 | POWER_SUPPLY_TECHNOLOGY=Li-ion 7 | POWER_SUPPLY_CYCLE_COUNT=111 8 | POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11380000 9 | POWER_SUPPLY_VOLTAGE_NOW=10981000 10 | POWER_SUPPLY_POWER_NOW=15153000 11 | POWER_SUPPLY_ENERGY_FULL_DESIGN=50230000 12 | POWER_SUPPLY_ENERGY_FULL=45540000 13 | POWER_SUPPLY_ENERGY_NOW=23960000 14 | POWER_SUPPLY_CAPACITY=52 15 | POWER_SUPPLY_CAPACITY_LEVEL=Normal 16 | POWER_SUPPLY_MODEL_NAME=1194729001 17 | POWER_SUPPLY_MANUFACTURER=SMP 18 | POWER_SUPPLY_SERIAL_NUMBER=0220791152 19 | -------------------------------------------------------------------------------- /nushell/modules/fixtures/linux/bat/not-charging.txt: -------------------------------------------------------------------------------- 1 | DEVTYPE=power_supply 2 | POWER_SUPPLY_NAME=BAT1 3 | POWER_SUPPLY_TYPE=Battery 4 | POWER_SUPPLY_STATUS=Not charging 5 | POWER_SUPPLY_PRESENT=1 6 | POWER_SUPPLY_TECHNOLOGY=Li-ion 7 | POWER_SUPPLY_CYCLE_COUNT=111 8 | POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11380000 9 | POWER_SUPPLY_VOLTAGE_NOW=11713000 10 | POWER_SUPPLY_POWER_NOW=3513000 11 | POWER_SUPPLY_ENERGY_FULL_DESIGN=50230000 12 | POWER_SUPPLY_ENERGY_FULL=45540000 13 | POWER_SUPPLY_ENERGY_NOW=23800000 14 | POWER_SUPPLY_CAPACITY=57 15 | POWER_SUPPLY_CAPACITY_LEVEL=Normal 16 | POWER_SUPPLY_MODEL_NAME=1194729001 17 | POWER_SUPPLY_MANUFACTURER=SMP 18 | POWER_SUPPLY_SERIAL_NUMBER=0220791152 19 | -------------------------------------------------------------------------------- /gitmux.conf: -------------------------------------------------------------------------------- 1 | # gitmux doesn't load this file automatically so always add option like this `gitmux -cfg path/to/gitmux.conf` 2 | tmux: 3 | symbols: 4 | branch: '⎇ ' 5 | hashprefix: ':' 6 | ahead: ↑· 7 | behind: ↓· 8 | staged: ● 9 | conflict: '✖ ' 10 | modified: '✚ ' 11 | untracked: … 12 | stashed: '⚑ ' 13 | clean: ✔ 14 | styles: 15 | state: '#[fg=red,bold]' 16 | branch: '#[fg=colour39,bold]' 17 | remote: '#[fg=colour37]' 18 | staged: '#[fg=green,bold]' 19 | conflict: '#[fg=red,bold]' 20 | modified: '#[fg=red,bold]' 21 | untracked: '#[fg=magenta,bold]' 22 | stashed: '#[fg=cyan,bold]' 23 | clean: '#[fg=green,bold]' 24 | 25 | -------------------------------------------------------------------------------- /nix/nixos/recipes/no-tty-tickets.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | # basically all ttys to share the sudo cache (not just between tmux panes); 4 | # it's convenient so can be used until there is a good password-less solution is implemented 5 | 6 | let 7 | # debug with `cat /etc/group`, `sudo -l` and `sudo cat /etc/sudoers` 8 | noTtyTickets = '' 9 | # disable tty_ticekts - https://www.sudo.ws/docs/man/sudoers.man/#SUDOERS_OPTIONS 10 | Defaults:%wheel timestamp_type=global 11 | 12 | # basically the above used to be the below 13 | # Defaults:%wheel !tty_tickets 14 | ''; 15 | in 16 | { 17 | security.sudo.extraConfig = noTtyTickets; 18 | security.sudo-rs.extraConfig = noTtyTickets; 19 | } 20 | -------------------------------------------------------------------------------- /nushell/modules/fixtures/linux/bat/full.txt: -------------------------------------------------------------------------------- 1 | DEVTYPE=power_supply 2 | POWER_SUPPLY_NAME=BAT0 3 | POWER_SUPPLY_TYPE=Battery 4 | POWER_SUPPLY_STATUS=Full 5 | POWER_SUPPLY_PRESENT=1 6 | POWER_SUPPLY_TECHNOLOGY=Li-ion 7 | POWER_SUPPLY_CYCLE_COUNT=0 8 | POWER_SUPPLY_VOLTAGE_MIN_DESIGN=15400000 9 | POWER_SUPPLY_VOLTAGE_NOW=17437000 10 | POWER_SUPPLY_CURRENT_NOW=0 11 | POWER_SUPPLY_CHARGE_FULL_DESIGN=4360000 12 | POWER_SUPPLY_CHARGE_FULL=4043000 13 | POWER_SUPPLY_CHARGE_NOW=4043000 14 | POWER_SUPPLY_CAPACITY=100 15 | POWER_SUPPLY_CAPACITY_LEVEL=Full 16 | POWER_SUPPLY_TYPE=Battery 17 | POWER_SUPPLY_MODEL_NAME=SR Real Battery 18 | POWER_SUPPLY_MANUFACTURER=Standard 19 | POWER_SUPPLY_SERIAL_NUMBER=123456789 20 | -------------------------------------------------------------------------------- /bin/path/default/tmux-zoom: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # usages 4 | # - zoom in: tmux-zoom 5 | # - zoom out: tmux-zoom out 6 | 7 | # copied from https://superuser.com/a/1110035/1174289 8 | 9 | function zoom-in() { 10 | # Zoom in the current pane ONLY if it is not currently zoomed. 11 | # Requires tmux version >= 1.8 12 | 13 | tmux list-panes -F '#F' | grep -q Z || tmux resize-pane -Z 14 | } 15 | 16 | function zoom-out() { 17 | # Zoom out the current pane ONLY if it is not currently zoomed. 18 | # Requires tmux version >= 1.8 19 | 20 | tmux list-panes -F '#F' | grep -q Z && tmux resize-pane -Z 21 | } 22 | 23 | if test "${1}" == "out"; then 24 | zoom-out 25 | else 26 | zoom-in 27 | fi 28 | -------------------------------------------------------------------------------- /nix/nixos/recipes/podman-rootful-docker.nix: -------------------------------------------------------------------------------- 1 | { config, ... }: 2 | 3 | # check out `./podman.nix` and `./docker-rootful.nix` 4 | { 5 | imports = [ ./podman.nix ]; 6 | 7 | # shim for other docker tools 8 | virtualisation.podman.dockerSocket.enable = 9 | if config.virtualisation.docker.enable then false else true; 10 | # requires `systemctl restart podman.socket` to take effect 11 | # could this silently fail if there is existing `/run/docker.sock`? (e.g. from residue of previous rootful docker setup) 12 | # https://github.com/systemd/systemd/issues/6920 13 | # also undoing this doesn't clean up `/run/docker.sock` (even after `systemctl restart podman.socket`) either; thus need a manual clean up 14 | } 15 | -------------------------------------------------------------------------------- /bootstrap/foundation/linux.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | set -e 4 | set -x 5 | 6 | # If you are on linux, do this first before ./bootstrap.sh! 7 | # Either machine or human can run this script (there should be no interactions) 8 | 9 | # go to repo's root to be able to be call from anywhere 10 | cd "$(dirname "$0")" || exit 11 | cd ../../ || exit 12 | 13 | # install nix 14 | ./nix/bin/install/multi-user.sh 15 | 16 | # enable nix for the rest of script 17 | . /etc/profile.d/nix.sh 18 | 19 | # home-manager init and switch ("idempotent") 20 | ./nix/bin/init-hm.sh 21 | 22 | # install packages for current user 23 | ./nix/bin/hm.sh switch 24 | 25 | echo "You may continue the rest with $(readlink -f ./bootstrap/configuration.sh)" 26 | -------------------------------------------------------------------------------- /nix/pkgs/custom/gitwatch.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | with pkgs; 4 | stdenv.mkDerivation rec { 5 | name = "gitwatch"; 6 | version = "f895a5db275d8c49674961e42fa02e24f19db017"; 7 | 8 | src = fetchFromGitHub { 9 | owner = "gitwatch"; 10 | repo = "gitwatch"; 11 | rev = "f895a5db275d8c49674961e42fa02e24f19db017"; 12 | sha256 = "sha256-a2aNT5fuFccDJ+iMhdMAPKBYCN032uhZpWfLiuPiVvY="; 13 | }; 14 | 15 | phases = "installPhase"; 16 | 17 | installPhase = '' 18 | mkdir -p $out/share 19 | mkdir -p $out/bin 20 | cp -r ${src} -p $out/share/gitwatch 21 | ln -s $out/share/gitwatch/gitwatch.sh $out/bin/gitwatch 22 | ''; 23 | 24 | # also install `fswatch` as this package depends on it on darwin 25 | } 26 | -------------------------------------------------------------------------------- /nix/pkgs/custom/urlview.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | # obviously this is actually urlscan not urlview but i'm using it in place anyway 4 | # ../../../urlscan to view/edit config 5 | # fake the name until https://github.com/tmux-plugins/tmux-urlview/issues/29 gets resolved 6 | let 7 | wrapped = pkgs.writeShellScriptBin "urlview" '' 8 | exec ${pkgs.urlscan}/bin/urlscan -s "$@" 9 | ''; 10 | in 11 | pkgs.symlinkJoin { 12 | name = "urlview"; 13 | paths = [ 14 | wrapped 15 | pkgs.urlscan 16 | ]; 17 | } 18 | 19 | # favoring above instead of below according to https://nixos.wiki/wiki/Nix_Cookbook#Wrapping_packages 20 | 21 | # pkgs.writeShellScriptBin "urlview" '' 22 | # exec ${pkgs.urlscan}/bin/urlscan -s "$@" 23 | # '' 24 | -------------------------------------------------------------------------------- /bootstrap/foundation/wsl.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | set -x 4 | 5 | # If you are on linux on Windows via WSL2, do this first before ./bootstrap.sh! 6 | # Human can run this script as there will be interactions via prompt 7 | 8 | # go to repo's root to be able to be call from anywhere 9 | cd "$(dirname "$0")" || exit 10 | cd ../../ || exit 11 | 12 | # install nix 13 | ./nix/bin/install/single-user.sh 14 | 15 | # enable nix for the rest of script 16 | . ~/.nix-profile/etc/profile.d/nix.sh 17 | 18 | # home-manager init and switch ("idempotent") 19 | ./nix/bin/init-hm.sh 20 | 21 | # install packages for current user 22 | ./nix/bin/hm.sh switch 23 | 24 | echo "You may continue the rest with $(readlink -f ./bootstrap/configuration.sh)" 25 | -------------------------------------------------------------------------------- /nix/darwin/flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "One's darwin system"; 3 | 4 | inputs = { 5 | nixpkgs.url = "github:nixos/nixpkgs/master"; 6 | darwin.url = "github:lnl7/nix-darwin/master"; 7 | darwin.inputs.nixpkgs.follows = "nixpkgs"; 8 | }; 9 | 10 | outputs = 11 | { 12 | self, 13 | darwin, 14 | nixpkgs, 15 | }: 16 | { 17 | darwinConfigurations = { 18 | aarch64 = darwin.lib.darwinSystem { 19 | system = "aarch64-darwin"; 20 | modules = [ ./configuration.nix ]; 21 | }; 22 | amd64 = darwin.lib.darwinSystem { 23 | system = "amd64-darwin"; 24 | modules = [ ./configuration.nix ]; 25 | }; 26 | }; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /nix/pkgs/custom/pkgs.nix: -------------------------------------------------------------------------------- 1 | # a helper function to access a specific version of nixpkgs as an escape hatch 2 | # see ../../nixos/recipes/escape-hatch.nix for an example 3 | 4 | { 5 | # TODO: add optional sha256 so that fetchTarball can avoid fetching again 6 | # https://github.com/nix-community/NUR?tab=readme-ov-file#pinning 7 | rev ? "master", 8 | allowUnfree ? false, 9 | }: 10 | 11 | let 12 | url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz"; 13 | # https://www.reddit.com/r/NixOS/comments/1ci71ak/need_help_with_nixos_configuration_error_unfree/ 14 | # https://www.reddit.com/r/NixOS/comments/1ci71ak/comment/l27biep/ 15 | pkgs = (import (fetchTarball url) { config.allowUnfree = allowUnfree; }); 16 | in 17 | pkgs 18 | -------------------------------------------------------------------------------- /nvim/lua/plugins/config/efmls-configs/deno-fmt.lua: -------------------------------------------------------------------------------- 1 | -- Metadata 2 | -- languages: javascript,typescript 3 | -- url: https://docs.deno.com/runtime/manual/tools/formatter 4 | 5 | -- This is DEPRECATED as now it's merged to upstream https://github.com/creativenull/efmls-configs-nvim/pull/120 6 | local fs = require 'efmls-configs.fs' 7 | 8 | local formatter = 'deno' 9 | -- using ${FILEEXT} thanks to https://github.com/mattn/efm-langserver/pull/115/files 10 | local args = 'fmt - --ext ${FILEEXT}' 11 | 12 | local command = string.format('%s %s', fs.executable(formatter, nil), args) 13 | 14 | return { 15 | formatCommand = command, 16 | formatStdin = true, 17 | } 18 | 19 | -- note on this file: using this until there is a upstream version 20 | -------------------------------------------------------------------------------- /nvim/shell/source.zsh: -------------------------------------------------------------------------------- 1 | if test -z "${NVIM_LISTEN_ADDRESS}" || test -z "${commands[nvr]}"; then 2 | # only proceed for terminals inside neovim 3 | return 4 | fi 5 | 6 | # so that fzf just within the terminal instead of using a new temp pane in tmux 7 | unset TMUX TMUX_PANE 8 | 9 | # simply close the window instead of exiting 10 | # which bringing back the shell much faster 11 | # use `exit` to exit 12 | alias q="clear; nvr --remote-send ':q'" 13 | 14 | ## use host nvim instead of creating another nvim process 15 | # for programs like lf 16 | export EDITOR='editor-in-nvim' 17 | # for shell 18 | alias nvim='nvr --remote-tab' 19 | 20 | # try to maintain clean state for devenv 21 | test -z "${DEVENV_PROFILE}" || { cd ~ && cd - } 22 | -------------------------------------------------------------------------------- /bin/path/default/async-with-delay: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | # Confused with quotes? Read https://scriptingosx.com/2020/04/advanced-quoting-in-shell-scripts/ 4 | 5 | set -e 6 | # A helper script to run something with delay seconds 7 | # Usage example with 2 seconds delay: `async-with-delay 2 mkdir _test__` 8 | 9 | delay="${1}" # in seconds 10 | 11 | # discard the first arg from @ 12 | shift 13 | 14 | # keep quotes thanks to https://stackoverflow.com/a/25592614/1570165 15 | the_cmd="$(echo ${(qq)@})" 16 | # see this for bash - https://stackoverflow.com/a/64056898/1570165 17 | 18 | # completely detach from terminal - https://stackoverflow.com/a/10408906/1570165 19 | nohup bash -c "sleep ${delay} && ${the_cmd}" /dev/null 2>&1 & 20 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # vim: set ft=editorconfig: 2 | 3 | # there should be two symlinks to this file: 4 | # ./editorconfig without the leading dot (.) to discover this file easier within editors that ignore "dotfiles" 5 | # ~/.editorconfig for a user's home directory to cover all files (that has no closer .editorconfig) not just this repo 6 | 7 | # https://editorconfig.org/ 8 | 9 | root = true 10 | 11 | [*] 12 | indent_style = space 13 | indent_size = 2 14 | trim_trailing_whitespace = true 15 | insert_final_newline = true 16 | 17 | [*.py] 18 | indent_size = 4 19 | 20 | # inspired by https://github.com/Dreamscapes/makefiles/blob/master/.editorconfig 21 | [{Makefile,**.mk}] 22 | # Use tabs for indentation (Makefiles require tabs) 23 | indent_style = tab 24 | -------------------------------------------------------------------------------- /bin/path/default/async-with-wait4path: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | # Confused with quotes? Read https://scriptingosx.com/2020/04/advanced-quoting-in-shell-scripts/ 4 | 5 | set -e 6 | # A helper script to run something with wait4path 7 | # Usage example: `async-with-wait4path /bin/echo mkdir _test__` 8 | 9 | path_to_wait="${1}" 10 | 11 | # discard the first arg from @ 12 | shift 13 | 14 | # keep quotes thanks to https://stackoverflow.com/a/25592614/1570165 15 | the_cmd="$(echo ${(qq)@})" 16 | # see this for bash - https://stackoverflow.com/a/64056898/1570165 17 | 18 | # exit 0 19 | # completely detach from terminal - https://stackoverflow.com/a/10408906/1570165 20 | nohup bash -c "wait4path ${path_to_wait} && ${the_cmd}" /dev/null 2>&1 & 21 | -------------------------------------------------------------------------------- /karabiner/assets/complex_modifications/1542076094.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Command + Esc to Command + `", 3 | "rules": [ 4 | { 5 | "description": "Command + Esc to Command + `", 6 | "manipulators": [ 7 | { 8 | "type": "basic", 9 | "from": { 10 | "key_code": "escape", 11 | "modifiers": { 12 | "mandatory": [ 13 | "left_command" 14 | ] 15 | } 16 | }, 17 | "to": [ 18 | { 19 | "key_code": "grave_accent_and_tilde", 20 | "modifiers": [ 21 | "left_command" 22 | ] 23 | } 24 | ] 25 | } 26 | ] 27 | } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /karabiner-uk/assets/complex_modifications/1542076094.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Command + Esc to Command + `", 3 | "rules": [ 4 | { 5 | "description": "Command + Esc to Command + `", 6 | "manipulators": [ 7 | { 8 | "type": "basic", 9 | "from": { 10 | "key_code": "escape", 11 | "modifiers": { 12 | "mandatory": [ 13 | "left_command" 14 | ] 15 | } 16 | }, 17 | "to": [ 18 | { 19 | "key_code": "grave_accent_and_tilde", 20 | "modifiers": [ 21 | "left_command" 22 | ] 23 | } 24 | ] 25 | } 26 | ] 27 | } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /nvim/snippets/lua.json: -------------------------------------------------------------------------------- 1 | { 2 | "lazy-package-install": { 3 | "prefix": "li", 4 | "body": [ 5 | "{", 6 | " '${1:name}',", 7 | " event = 'VeryLazy',", 8 | " config = function ()", 9 | " ${0}", 10 | " end,", 11 | "}," 12 | ], 13 | "description": "lazy package install" 14 | }, 15 | "create autocmd": { 16 | "prefix": "au", 17 | "body": [ 18 | "local ${1:var} = vim.api.nvim_create_augroup('${2:name}', { clear = true })", 19 | "vim.api.nvim_create_autocmd('${3:event}', {", 20 | " callback = function ()", 21 | " ${4:function}", 22 | " end,", 23 | " group = ${1},", 24 | "})" 25 | ], 26 | "description": "create nvim autocmd" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /nix/bin/source/config.sh: -------------------------------------------------------------------------------- 1 | # This file is expected to be sourced not executed 2 | 3 | # see reference at https://nixos.org/manual/nix/stable/command-ref/conf-file.html 4 | 5 | # making sure NIX_CONFIG exist especially `nix eval requires nix-command feature` 6 | printenv NIX_CONFIG | grep nix-command >/dev/null || 7 | export NIX_CONFIG='extra-experimental-features = nix-command flakes' 8 | # also run `nix show-config` to see interpreted values 9 | 10 | # if test "$(uname -s)" = "Darwin"; then 11 | # test "$(arch)" = "arm64" \ 12 | # && export NIX_CONFIG="${NIX_CONFIG} 13 | # extra-platforms = x86_64-darwin aarch64-darwin" 14 | # fi 15 | # turn off above as `nix show-config | grep platform` already shows the value below 16 | # extra-platforms = x86_64-darwin 17 | -------------------------------------------------------------------------------- /bin/wsl/gen-wsl-conf.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | tempfile="$(mktemp)" 6 | cp /etc/wsl.conf "${tempfile}" 7 | echo "previous file's at ${tempfile} and its content was:" 8 | cat "${tempfile}" 9 | 10 | # should run this script with sudo because of writing to /etc/wsl.conf 11 | cat < /etc/wsl.conf 12 | [boot] 13 | systemd=true 14 | [network] 15 | generateResolvConf=false 16 | EOF 17 | 18 | # relavent links to explain options 19 | # - https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/ 20 | # - https://askubuntu.com/a/1398053/1666783 21 | 22 | echo 23 | echo "and printing the new one" 24 | echo 'cat /etc/wsl.conf' 25 | cat /etc/wsl.conf 26 | 27 | echo 28 | echo 'Rebooting would require to take effects on new changes.' 29 | -------------------------------------------------------------------------------- /nix/home/services/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | ... 5 | }: 6 | 7 | # debug services at `~/.config/systemd/user/` 8 | 9 | let 10 | emacs = import ./emacs.nix { pkgs = pkgs; }; 11 | opener = import ./opener.nix { pkgs = pkgs; }; 12 | syncthing = import ./syncthing.nix { pkgs = pkgs; }; 13 | tmux-watch-theme-change = import ./tmux-watch-theme-change.nix { 14 | config = config; 15 | pkgs = pkgs; 16 | }; 17 | in 18 | { 19 | # https://nix-community.github.io/home-manager/index.html#_how_to_set_up_a_configuration_for_multiple_users_machines 20 | imports = [ 21 | emacs 22 | opener 23 | syncthing 24 | tmux-watch-theme-change 25 | ]; 26 | 27 | # if anything doesn't want to belong to its own file it can be added below 28 | } 29 | -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This is intended to be used by github codespace as explained in here - https://docs.github.com/en/github/developing-online-with-codespaces/personalizing-codespaces-for-your-account 4 | 5 | set -e 6 | set -x 7 | 8 | # go to repo's root to be able to be call from anywhere 9 | cd "$(dirname "$0")" || exit 10 | 11 | ####### nix ####### 12 | 13 | # install nix 14 | ./nix/bin/install/single-user.sh 15 | 16 | # source nix 17 | . ${HOME}/.nix-profile/etc/profile.d/nix.sh 18 | 19 | # home-manager init and switch ("idempotent") 20 | ./nix/bin/init-hm.sh 21 | 22 | # install packages for current user 23 | ./nix/bin/hm.sh switch 24 | 25 | ####### configuration ####### 26 | 27 | # run the rest of personalization 28 | ./bootstrap/configuration.sh 29 | -------------------------------------------------------------------------------- /bin/path/lspx/README.md: -------------------------------------------------------------------------------- 1 | # `lspx` wrappers 2 | 3 | This is where I put wrapper executables that make use https://github.com/thefrontside/lspx to overcome the lack of multi server support from eglot, https://github.com/joaotavora/eglot/discussions/1429 4 | 5 | See these files to see how I weave the environment to help the lsp binaries discovered and also shadow them behind `lspx` and `emacs-lsp-booster` to improve the both performance and usability: 6 | - `../../../emacs.d/doom.d/modules/tools/lsp-support`: to wrap with `emacs-lsp-booster` 7 | - `../../../emacs.d/doom.d/shell/source.zsh`: to let neovim's installed lsp's too be discovered 8 | - `../../../nix/home/programs/shells.nix`: to handle tramp access case 9 | - `../../../zsh/path/set-special`: for local access from Emacs for both 10 | -------------------------------------------------------------------------------- /nix/nixos/recipes/desktop-cosmic.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | 8 | # https://wiki.nixos.org/wiki/COSMIC 9 | let 10 | isGnomeEnabled = config.services.xserver.desktopManager.gnome.enable; 11 | in 12 | { 13 | # this is original for ./desktop-kde.nix - https://github.com/NixOS/nixpkgs/issues/75867#issuecomment-974084634 14 | # is there any better option than this? it works though 15 | programs.ssh.askPassword = "${pkgs.kdePackages.ksshaskpass.out}/bin/ksshaskpass"; 16 | 17 | # due to gnome complains on not being able to lock screen without the use of gdm 18 | services.displayManager.cosmic-greeter.enable = pkgs.lib.mkForce ( 19 | if isGnomeEnabled then false else true 20 | ); 21 | services.desktopManager.cosmic.enable = true; 22 | } 23 | -------------------------------------------------------------------------------- /nvim/snippets/hcl.json: -------------------------------------------------------------------------------- 1 | { 2 | "reference": { 3 | "prefix": "ref", 4 | "body": [ 5 | "\\${${1:var}\\}" 6 | ], 7 | "description": "reference without typing with shifts" 8 | }, 9 | "variable": { 10 | "prefix": "var", 11 | "body": [ 12 | "variable \"${1:name}\" {", 13 | " description = \"${2:desc}\"", 14 | " type = ${3:type}", 15 | "}" 16 | ], 17 | "description": "define variable" 18 | }, 19 | "sensitive variable": { 20 | "prefix": "svar", 21 | "body": [ 22 | "variable \"${1:name}\" {", 23 | " description = \"${2:desc}\"", 24 | " type = ${3:type}", 25 | " sensitive = true", 26 | "}" 27 | ], 28 | "description": "define sensitive variable" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /bin/path/default/mux-zoom: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #!/usr/bin/env bash 4 | 5 | # usages 6 | # - zoom in: mux-zoom 7 | # - zoom out: mux-zoom out 8 | 9 | # copied from https://superuser.com/a/1110035/1174289 10 | 11 | function zoom-in() { 12 | if test -n "${ZELLIJ_SESSION_NAME}"; then 13 | zellij action toggle-fullscreen # WARN: this is actually not zooming in but I couldn't find a way to force that 14 | else 15 | tmux-zoom 16 | fi 17 | } 18 | 19 | function zoom-out() { 20 | if test -n "${ZELLIJ_SESSION_NAME}"; then 21 | zellij action toggle-fullscreen # WARN: this is actually not zooming out but I couldn't find a way to force that 22 | else 23 | tmux-zoom out 24 | fi 25 | } 26 | 27 | if test "${1}" == "out"; then 28 | zoom-out 29 | else 30 | zoom-in 31 | fi 32 | -------------------------------------------------------------------------------- /nix/nixos/keyd/settings-min.nix: -------------------------------------------------------------------------------- 1 | # - to be used for ../recipes/keyd-guest.nix 2 | # - you may debug with `sudo showkey` but there should should be better way too 3 | # - or with `sudo libinput debug-events --show-keycodes` 4 | 5 | let 6 | meta_mac = import ./meta-mac.nix; 7 | in 8 | { 9 | main = { 10 | meta = "layer(meta_mac)"; 11 | }; 12 | 13 | # meta_mac modifier layer; inherits from 'Meta(Super)' modifier layer 14 | # (not inheriting from 'Ctrl' modifier causes to define a lot of keys 15 | # but still this works for me while inheriting from `Ctrl` has an issue 16 | # with app switching) 17 | # 18 | # The main part! Using this layer, we can remap our new "Cmd" key to 19 | # do almost everything our muscle memory might need... 20 | "meta_mac:M" = meta_mac; 21 | } 22 | -------------------------------------------------------------------------------- /nix/nixos/recipes/escape-hatch.nix: -------------------------------------------------------------------------------- 1 | { config, ... }: 2 | 3 | # this is more of an example than a "recipe" that should be imported as-is 4 | 5 | let 6 | rev = "master"; # or "a3c0b3b21515f74fd2665903d4ce6bc4dc81c77c", etc. 7 | allowUnfree = config.nixpkgs.config.allowUnfree; 8 | pinnedPkgs = import ../../pkgs/custom/pkgs.nix { rev = rev; allowUnfree = allowUnfree; }; 9 | in 10 | { 11 | # examples of drifting the versions of certain packages on purpose from the `nixpkgs` as an escape hatch 12 | services.pipewire.wireplumber.package = pinnedPkgs.wireplumber; 13 | services.pipewire.package = pinnedPkgs.pipewire; 14 | hardware.bluetooth.package = pinnedPkgs.bluez; 15 | programs._1password-gui.package = pinnedPkgs._1password-gui; 16 | services.tailscale.package = pinnedPkgs.tailscale; 17 | } 18 | -------------------------------------------------------------------------------- /nix/pkgs/custom/hired.nix: -------------------------------------------------------------------------------- 1 | # based on the example code from the link below 2 | # https://github.com/NixOS/nixpkgs/blob/2387396258eb6ff2c436a6a1a5ba5bd05c6862d3/pkgs/tools/nix/nixpkgs-fmt/default.nix 3 | 4 | # more info on rust + nix can be found at 5 | # https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/rust.section.md 6 | 7 | { pkgs }: 8 | 9 | with pkgs; 10 | rustPlatform.buildRustPackage rec { 11 | pname = "hired"; 12 | version = "0.9.0-alpha4"; 13 | src = fetchFromGitHub { 14 | owner = "sidju"; 15 | repo = pname; 16 | rev = "ccc02c192c9f0b96662bf18709b49d8b9d2d53b5"; 17 | sha256 = "sha256-VP6NQltnQ6kFmYO6IIbwejJ6x4wDhnWvgtA4Pf/K8Yk="; 18 | fetchSubmodules = true; 19 | }; 20 | 21 | cargoSha256 = "sha256-LJV0oW3F7IIF5ar3o7X04I+AT42tJXN0oAVlt10KVjw="; 22 | } 23 | -------------------------------------------------------------------------------- /bin/path/default/pbpaste: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | should-use-osc() { 4 | ! test -n "${INSIDE_EMACS}" && 5 | test -z "${ZELLIJ_SESSION_NAME}" && 6 | command -v osc >/dev/null 7 | } 8 | 9 | is-remote-display-via-x11-forward() { 10 | test -n "${DISPLAY}" && test -n "${SSH_TTY}" 11 | } 12 | 13 | is-mac-os-local-connection() { 14 | test -x /usr/bin/pbpaste && ! is-remote-display-via-x11-forward 15 | } 16 | 17 | if is-mac-os-local-connection; then 18 | /usr/bin/pbpaste "$@" 19 | elif should-use-osc; then 20 | osc paste 21 | elif is-remote-display-via-x11-forward; then 22 | xsel -o -b | sed $'s/\r$//' # custom sed instead of dos2unix since it somwhow still carried the last line 23 | # thanks to https://stackoverflow.com/a/2613834/1570165 24 | else 25 | # fallback to xsel 26 | xsel -o -b 27 | fi 28 | -------------------------------------------------------------------------------- /nix/niv-shim/bin/nix-path-via-niv.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | default="nixpkgs=nixos:nixos-hardware" 4 | src="${1:-${default}}" 5 | 6 | pushd "$(dirname "$0")" > /dev/null || exit 7 | 8 | function item() 9 | { 10 | if echo "${1}" | grep '=' > /dev/null; then 11 | name="$(echo "${1}" | cut -d "=" -f 1)" 12 | pkg="$(echo "${1}" | cut -d "=" -f 2)" 13 | echo "{ src = \"${pkg}\"; name = \"${name}\"; } " 14 | else 15 | echo "{ src = \"${1}\"; }" 16 | fi 17 | } 18 | 19 | function construct() 20 | { 21 | echo "[" 22 | for chunk in $(echo "${src}" | tr ':' '\n') 23 | do 24 | item "${chunk}" 25 | done 26 | echo "]" 27 | } 28 | 29 | params="$(construct | tr '\n' ' ')" 30 | 31 | source ../../bin/source/config.sh 32 | 33 | nix eval --impure --expr "import ./nix-path-for-paths.nix ${params}" | xargs 34 | -------------------------------------------------------------------------------- /nix/nixos/recipes/compat.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | { 4 | # what is `nix-ld` and how it works? https://blog.thalheim.io/2022/12/31/nix-ld-a-clean-solution-for-issues-with-pre-compiled-executables-on-nixos/ 5 | programs.nix-ld.enable = true; # rebooting or logout is required after this change is applied due to `NIX_LD` env var only populates via start up 6 | # debug with `readlink /lib64/ld-linux-x86-64.so.2` and `printenv NIX_LD` 7 | # known use cases: 8 | # - to support pre compiled binaries via mason ../../../nvim/lua/plugins/lsp.lua 9 | # - as a replacement of `steam-run` approach described at https://gist.github.com/ryuheechul/c0dc3c0f39790f9a90404dae75fe2b3f; 10 | # via https://github.com/nix-community/nix-ld?tab=readme-ov-file#my-pythonnodejsrubyinterpreter-libraries-do-not-find-the-libraries-configured-by-nix-ld 11 | } 12 | -------------------------------------------------------------------------------- /nix/nixos/recipes/tailscale.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | # https://nixos.wiki/wiki/Tailscale 4 | { 5 | imports = [ 6 | ./resolved.nix 7 | ]; 8 | 9 | services.tailscale.enable = true; 10 | services.tailscale.useRoutingFeatures = "both"; 11 | 12 | # if using exit node or subnet routing; 13 | # https://discourse.nixos.org/t/tailscale-exit-node-not-working-on-nixos/39897 14 | # set it like this somewhere `services.tailscale.useRoutingFeatures = "both"`; # or "client" or "server" or none 15 | # `nixos-option services.tailscale.useRoutingFeatures` to read more about and; 16 | # see this for the detailed behavior https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/networking/tailscale.nix 17 | 18 | # WARN: watch out for the issue with 6.11.x kernel - https://github.com/tailscale/tailscale/issues/13863 19 | } 20 | -------------------------------------------------------------------------------- /bin/path/default/battery-icon: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | percent="$(battery)" 4 | is_charging="$(battery-status | xargs test "Charging" = && echo 1 || echo 0)" 5 | 6 | # find icons from https://www.nerdfonts.com/cheat-sheet 7 | 8 | test "${is_charging}" = 1 && icon='󰢜' || icon='' 9 | # be very careful not forget to wrap > with '' 10 | # to avoid using them as a redirection 11 | if expr "${percent}" '>' 80 >/dev/null; then 12 | test "${is_charging}" = 1 && icon='󰂋' || icon='' 13 | elif expr "${percent}" '>' 50 >/dev/null; then 14 | test "${is_charging}" = 1 && icon='󰢞' || icon='' 15 | elif expr "${percent}" '>' 25 >/dev/null; then 16 | test "${is_charging}" = 1 && icon='󰂈' || icon='' 17 | elif expr "${percent}" '>' 10 >/dev/null; then 18 | test "${is_charging}" = 1 && icon='󰂇' || icon='' 19 | fi 20 | 21 | echo "${icon}" 22 | -------------------------------------------------------------------------------- /bootstrap/foundation/nixos/switch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | curr_d="$(dirname "$0")" 6 | pushd "${curr_d}" 7 | 8 | ./nixos-rebuild.sh switch 9 | 10 | # assume that I only want to run `home-manager switch` for bootstrapping time only 11 | # since I'm almost always in TMUX or ZELLIJ after bootstrapping, 12 | # this is a good way to skip `home-manager switch` when I only want to rebuild nixos 13 | # this is not perfect but I don't actually care to run `home-manager switch` 14 | # in some cases if it's rare enough 15 | # don't apply this filter when it's on a SSH connection 16 | printenv TMUX ZELLIJ | xargs test -z || 17 | printenv SSH_CONNECTION >/dev/null || 18 | exit 0 19 | 20 | nix_d="../../../nix" 21 | # home-manager init and switch ("idempotent") 22 | "${nix_d}/bin/init-hm.sh" 23 | "${nix_d}/bin/hm.sh" switch 24 | -------------------------------------------------------------------------------- /nix/pkgs/custom/gemini.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | let 4 | viaDeno = import ../../utils/viaDeno.nix; 5 | in 6 | 7 | # declarative alternative to `deno install --global --allow-all npm:@google/gemini-cli/gemini`: 8 | # - `deno install --global` works better on NixOS than `npm install -g` 9 | # - since it installs on $HOME/.deno instead of /nix/store (in case of `npm install -g`) 10 | # - however this requires setting the path for the shells let alone not declarative 11 | # - installing directly from nixpkgs is inflexible 12 | # - as updating the versions requires the bumping nixpkgs that impacts other packages as well 13 | # - `deno cache --reload npm:@google/gemini-cli` may be the way to update? (let me test that later) 14 | viaDeno { 15 | pkgs = pkgs; 16 | pkg-name = "gemini"; 17 | deno-pkg-name = "npm:@google/gemini-cli"; 18 | } 19 | -------------------------------------------------------------------------------- /nix/utils/viaDeno.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | pkg-name, 4 | deno-pkg-name, 5 | }: 6 | 7 | # declarative alternative to `deno install --global --allow-all ${deno-pkg-name}`: 8 | # - `deno install --global` works better on NixOS than `npm install -g` 9 | # - since it installs on $HOME/.deno instead of /nix/store (in case of `npm install -g`) 10 | # - however this requires setting the path for the shells let alone not declarative 11 | # - installing directly from nixpkgs is inflexible 12 | # - as updating the versions requires the bumping nixpkgs that impacts other packages as well 13 | # - `deno cache --reload ${deno-pkg-name}` may be the way to update? (let me test that later) 14 | pkgs.writeShellScriptBin pkg-name '' 15 | ${pkgs.deno}/bin/deno run --allow-all ${deno-pkg-name} "$@" 16 | '' 17 | 18 | # see the usage at ../pkgs/custom/gemini.nix 19 | -------------------------------------------------------------------------------- /zsh/fn/system: -------------------------------------------------------------------------------- 1 | # -*- mode: sh; -*- vim: set ft=zsh: 2 | 3 | function is-nixos { 4 | grep "NAME=NixOS" /etc/os-release &> /dev/null 5 | } 6 | 7 | function is-linux { 8 | uname | xargs test "Linux" = 9 | } 10 | 11 | function is-darwin { 12 | uname | xargs test "Darwin" = 13 | } 14 | 15 | function is-wsl { 16 | test -n "${WSL_DISTRO_NAME}" 17 | } 18 | 19 | function is-ssh { 20 | # test -n "${SSH_TTY}" # since SSH_TTY is not present when there is no pseudo-terminal allocation; 21 | # which prevents non interactive invocation will fail to have a path set via ../path/set-basic 22 | # hence relies on another ENV_VAR that should be present whether it's interactive or not 23 | # test -n "${SSH_CLIENT}" 24 | test -n "${SSH_CONNECTION}" # is more reliable as this one is the only one that survives in the nested shell when `$SSH_TTY` is unset 25 | } 26 | -------------------------------------------------------------------------------- /karabiner-uk/assets/complex_modifications/1620405151.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Command_L|Command_R + Return to Backslash", 3 | "rules": [ 4 | { 5 | "description": "Command_[L|R] (⌘) + Return (⏎) to Backslash and Command_[L|R] (⌘) + Shift (⇧) + Return (⏎) to Pipe (|)", 6 | "manipulators": [ 7 | { 8 | "type": "basic", 9 | "from": { 10 | "key_code": "return_or_enter", 11 | "modifiers": { 12 | "mandatory": [ 13 | "command" 14 | ], 15 | "optional": [ 16 | "left_shift", 17 | "right_shift" 18 | ] 19 | } 20 | }, 21 | "to": [ 22 | { 23 | "key_code": "backslash" 24 | } 25 | ] 26 | } 27 | ] 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /bin/path/default/nix-outpath: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | # # since the command below seems to not work very well across different nix versions 5 | # nix eval nixpkgs.${1}.outPath | sed s/\\\"//g | tr -d '\n' 6 | # # I come up with my own solution below 7 | 8 | # this attempted to replace a bunch of commands below but not worked well across different environment 9 | # nix-store -q "$(which "${1}")" 10 | 11 | ## Somehow this version still works the best 12 | ## but this is still limited by binary file path so `ncurses` will not work but `infocmp` will work (to get ncurses store path) 13 | 14 | # get bin path 15 | bin_path="$(which "${1}")" 16 | 17 | # error if it's not from .nix-profile/bin 18 | echo -n "${bin_path}" | grep '.nix-profile/bin' >/dev/null 19 | 20 | real_path="$(realpath "${bin_path}")" 21 | dirname "$(dirname "${real_path}")" | tr -d '\n' 22 | -------------------------------------------------------------------------------- /nix/pkgs/custom/nix-index-database/flake.nix: -------------------------------------------------------------------------------- 1 | # NOTE: now there is another version that does the same thing without having to write a flake at ../alt-nix-index-database 2 | 3 | { 4 | description = "nix-index for home-manager via nix-index-database"; 5 | 6 | inputs = { 7 | nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; 8 | 9 | flake-utils.url = "github:numtide/flake-utils"; 10 | flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"; 11 | nix-index-database.url = "github:nix-community/nix-index-database"; 12 | nix-index-database.inputs.nixpkgs.follows = "nixpkgs"; 13 | }; 14 | 15 | outputs = 16 | { 17 | nix-index-database, 18 | flake-utils, 19 | ... 20 | }: 21 | flake-utils.lib.eachDefaultSystem (system: { 22 | packages.default = nix-index-database.hmModules.nix-index; 23 | }); 24 | } 25 | -------------------------------------------------------------------------------- /bin/path/nixos/search: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # help searching nix related stuff 4 | 5 | # these might be helpful - I will take a look later 6 | # https://github.com/mlvzk/manix 7 | # https://github.com/lf-/nix-doc 8 | 9 | command -v gum >/dev/null || { echo 'you need gum to proceed' exit 1; } 10 | 11 | echo 'This is a helper to search nix related stuff' 12 | 13 | exit_on_sigint() { 14 | # https://github.com/charmbracelet/gum/issues/469#issuecomment-1865391607 15 | if [[ $? -eq 130 ]]; then 16 | exit 130 17 | fi 18 | } 19 | 20 | echo 'run `man configuration.nix` for nixos options' 21 | echo 'run `man home-configuration.nix` for home-manager options' 22 | echo 23 | echo 'Now, enter a keyword for nixpkgs' 24 | keyword="$(gum input --placeholder "installable package to search (e.g. k9s)")" 25 | 26 | exit_on_sigint 27 | 28 | set -x 29 | nix search nixpkgs "${keyword}" 30 | -------------------------------------------------------------------------------- /nix/pkgs/custom/alt-nix-index-database/default.nix: -------------------------------------------------------------------------------- 1 | # this is a improvement over ../nix-index-database 2 | # which simplifies one's code to use a flake without having to write a flake 3 | # however I couldn't figure out how to propagate nixpkgs from the caller 4 | # because the flakeCompat only accepts flakeSrc and nothing more like which nixpkgs to propagate 5 | # which should be possible if I fork flakeCompat and modify to include that flexibility 6 | # but I will leave that for another day 7 | let 8 | sources = import ../via-niv; # see `../via-niv` on how to manage pinning (flake or none flake) repos 9 | flakeSrc = sources.nix-index-database; 10 | flakeCompat = sources.flake-compat; 11 | recipe = import flakeCompat { src = flakeSrc; }; 12 | result = recipe.defaultNix; 13 | in 14 | result.hmModules.nix-index 15 | 16 | # NOTE: now there is even simpler version at `../alt-nid` 17 | -------------------------------------------------------------------------------- /nvim/snippets/all.json: -------------------------------------------------------------------------------- 1 | { 2 | "Vim filetype hint comment (slash)": { 3 | "prefix": "vimfts", 4 | "body": [ 5 | "// vim: set ft=${1:filetype}:" 6 | ], 7 | "description": "Filetype hint for (neo)vim as a comment" 8 | }, 9 | "Vim filetype hint comment (pound)": { 10 | "prefix": "vimftp", 11 | "body": [ 12 | "# vim: set ft=${1:filetype}:" 13 | ], 14 | "description": "Filetype hint for (neo)vim as a comment" 15 | }, 16 | "Emacs mode hint comment (slash)": { 17 | "prefix": "emacsmds", 18 | "body": [ 19 | "// -*- mode: ${1:mode} -*-" 20 | ], 21 | "description": "mode hint for Emacs as a comment" 22 | }, 23 | "Emacs mode hint comment (pound)": { 24 | "prefix": "emacsmdp", 25 | "body": [ 26 | "# -*- mode: ${1:mode} -*-" 27 | ], 28 | "description": "mode hint for Emacs as a comment" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /nix/pkgs/custom/rsop.nix: -------------------------------------------------------------------------------- 1 | # based on the example code from the link below 2 | # https://github.com/NixOS/nixpkgs/blob/645bc49f34fa8eff95479f0345ff57e55b53437e/pkgs/tools/misc/hexyl/default.nix 3 | 4 | # more info on rust + nix can be found at 5 | # https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/rust.section.md 6 | { pkgs }: 7 | 8 | with pkgs; 9 | rustPlatform.buildRustPackage rec { 10 | pname = "rsop"; 11 | version = "1.4.2"; 12 | 13 | src = fetchFromGitHub { 14 | owner = "desbma"; 15 | repo = pname; 16 | rev = "${version}"; 17 | 18 | sha256 = "sha256-DbAtCExLcH6CxVmfiY0komGDvtLbDJsGCVfKeoSrOfo="; 19 | }; 20 | 21 | cargoHash = "sha256-WmgW5E0LyE7G0Jb3f1vJqMFcjgQSfsPfZdMTugdv+Rk="; 22 | 23 | postInstall = '' 24 | ln -rs "$out"/bin/rs{op,o} 25 | ln -rs "$out"/bin/rs{op,e} 26 | ln -rs "$out"/bin/rs{op,p} 27 | ln -rs "$out"/bin/rs{op,i} 28 | ''; 29 | } 30 | -------------------------------------------------------------------------------- /bin/path/default/base16-shell-auto-reload-on-tmux: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # running this inside tmux will be limiting to only one session 4 | # therefore it's recommened to run this outside tmux 5 | 6 | # all these unsets simulate being outside of tmux 7 | # so now it should be safe to run this inside tmux 8 | unset TERM 9 | unset TERM_PROGRAM 10 | unset TMUX 11 | unset TMUX_PANE 12 | unset TMUX_PLUGIN_MANAGER_PATH 13 | unset tmux_version 14 | 15 | # prevent failure when there is no such file (initially) 16 | touch ~/.base16_theme.updated-time 17 | 18 | echo "this process is to watch the base16-shell's theme change and apply automatically using tmux" 19 | 20 | # `-n`: non-interactive mode which makes possible to run as daemon 21 | # `-p`: "postpone" the first execution until the change is detected 22 | find ~/.base16_theme.updated-time | entr -p -n bash -c 'tmux new-window "sleep 0.1 && source ~/.base16_theme && exit"' 23 | -------------------------------------------------------------------------------- /zsh/env: -------------------------------------------------------------------------------- 1 | # -*- mode: sh; -*- vim: set ft=zsh: 2 | 3 | setopt no_global_rcs # prevent /etc/zshrc and /etc/zprofile to surprise me 4 | 5 | # go to ../nix/home/programs/shells.nix to edit what to source 6 | source "${HOME}/.nix-profile/etc/profile.d/hm-session-vars.sh" 7 | 8 | # just in case `nix` is still not loaded 9 | source "${my_dot_d}/nix/bin/source/nix.sh" 10 | 11 | # to set $NIX_CONFIG 12 | source "${my_dot_d}/nix/bin/source/config.sh" 13 | 14 | # important functions that require "system-wide" availability 15 | source "${my_zsh_d}/fn/system" 16 | 17 | # basically helper utils for zsh 18 | source "${my_zsh_d}/fn/zsh" 19 | 20 | source "${my_zsh_d}/path/set" 21 | 22 | # `light` and `dark` - helper function to change theme 23 | source "${my_zsh_d}/fn/theme" 24 | 25 | source "${my_zsh_d}/aliases" 26 | 27 | source "${my_zsh_d}/modules/history" 28 | 29 | test -f "${HOME}/.local.zshenv" && source "${HOME}/.local.zshenv" 30 | -------------------------------------------------------------------------------- /bin/path/default/git-remote-url: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # A helper script to extract url from `git remote -v` 4 | 5 | echo -n 'https://' 6 | git remote -v | 7 | head -n1 | cut -f2 | 8 | sed 's|^https://||' | 9 | sed 's|^ssh://git@||' | 10 | sed 's|.git\ .*$||' | 11 | sed 's| .*$||' 12 | 13 | # basically transform this one 14 | # ``` 15 | # origin ssh://git@github.com/org/repo.git (fetch) 16 | # origin ssh://git@github.com/org/repo.git (push) 17 | # ``` 18 | # or this one 19 | # ``` 20 | # origin https://github.com/org/repo.git (fetch) 21 | # origin https://github.com/org/repo.git (push) 22 | # or even this one 23 | # ``` 24 | # origin https://github.com/org/repo (fetch) 25 | # origin https://github.com/org/repo (push) 26 | # ``` 27 | # into 28 | # ``` 29 | # https://github.com/org 30 | # ``` 31 | # so that you can open it in the browser via `[xdg-]open` 32 | # try `git-remote-url | xargs open` inside any repo 33 | -------------------------------------------------------------------------------- /nix/nixos/recipes/rdp-server.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | # NOTE: with Gnome, this should be favored instead, https://release.gnome.org/46/#:~:text=Remote%20Login%20with%20RDP 4 | # read more at ./desktop-gnome.nix 5 | 6 | # but also read this about the limitation of current typical RDP setups - https://www.reddit.com/r/linux/comments/wrq4zh/why_remote_desktop_applications_lack_wayland/ 7 | 8 | # https://nixos.wiki/wiki/Remote_Desktop 9 | { 10 | services.xrdp = { 11 | enable = true; 12 | openFirewall = true; 13 | defaultWindowManager = "${pkgs.gnome-session}/bin/gnome-session"; 14 | }; 15 | 16 | # use a client like `remmina` to connect 17 | } 18 | 19 | # actually https://wiki.gnome.org/Projects/Mutter/RemoteDesktop seems to work better for gnome environment 20 | # "Settings > System > Desktop" Sharing to configure 21 | # `grdctl status` to debug 22 | # ./sunshine.nix can augment the experience of "remote desktop" 23 | -------------------------------------------------------------------------------- /nix/nixos/recipes/resolved.nix: -------------------------------------------------------------------------------- 1 | { lib, config, ... }: 2 | 3 | # this enables systemd-resolved - https://systemd.io/RESOLVED-VPNS/ 4 | # but beware... https://www.reddit.com/r/linux/comments/18kh1r5/im_shocked_that_almost_no_one_is_talking_about/ 5 | { 6 | # the benefits and motivation is explained at https://tailscale.com/blog/sisyphean-dns-client-linux 7 | # this basically put a stop on the fight over `/etc/resolv.conf` 8 | services.resolved.enable = true; 9 | services.resolved.llmnr = "false"; 10 | services.resolved.extraConfig = 11 | # maybe I should disable MulticastDNS regardless of using avahi or not? 12 | lib.optionalString config.services.avahi.enable '' 13 | MulticastDNS=false 14 | ''; # anyhow now host/dig/nslookup will stop resolving .local when ping does - https://serverfault.com/a/579996/633069 15 | 16 | # debug with: 17 | # - `cat /etc/resolv.conf` 18 | # - `resolvectl status` 19 | } 20 | -------------------------------------------------------------------------------- /bin/zellij-attach-or-new.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ## set path for nix otherwise tmux/zellij server can't access some binaries like `fpp` 4 | 5 | if [ -z "$(command -v nix)" ]; then 6 | [ -f ~/.nix-profile/etc/profile.d/nix.sh ] && 7 | . ~/.nix-profile/etc/profile.d/nix.sh 8 | fi 9 | 10 | # try another way next 11 | if [ -z "$(command -v nix)" ]; then 12 | [ -f /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ] && 13 | . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh 14 | fi 15 | 16 | # let brew (binaries) takes more priority then nix in case of apple silicon 17 | if test "Darwin" = "$(uname)" && test "arm64" = "$(uname -m)"; then 18 | [ -x /opt/homebrew/bin/brew ] && eval $(/opt/homebrew/bin/brew shellenv) 19 | true 20 | fi 21 | 22 | SHELL=$(which zsh) 23 | # set it `default` as default sessions name when no name is given 24 | session_name="${1:-default}" 25 | exec zellij a -c "${session_name}" 26 | -------------------------------------------------------------------------------- /nix/pkgs/fonts/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | # the actual linking is delegated to ../../home/default.nix 4 | 5 | # run https://github.com/ryanoasis/nerd-fonts/blob/master/bin/scripts/test-fonts.sh \ 6 | # to view and test fonts (visit the URL above to see how-to) 7 | # and watch if watch [Effective Nerd Fonts in Multiple Terminals](https://www.youtube.com/watch?v=mQdB_kHyZn8) 8 | # to get a feel about how to configure fonts for different terminals and linux (for fallbacks) 9 | # If Terminal app is installed on Windows host (e.g. Windows native Alacritty) not on WSL, 10 | # home-manager running within WSL won't cover installing fonts to Windows host. 11 | # so running a command below in Windows host would install the fonts above 12 | # `choco install nerd-fonts-firamono jetbrainsmononf` 13 | with pkgs.nerd-fonts; 14 | [ 15 | fira-mono 16 | jetbrains-mono 17 | ] 18 | # run `fc-cache -r` if there is an issue after (re)installing fonts 19 | -------------------------------------------------------------------------------- /nix/nixos/recipes/vm-guest-utm.nix: -------------------------------------------------------------------------------- 1 | # this is to support the case when it's running as a VM via UTM (powered by QEMU) 2 | # see also at ./vm-guest-qemu.nix 3 | { ... }: 4 | 5 | { 6 | imports = [ 7 | ./vm-guest-qemu.nix 8 | ]; 9 | 10 | # https://docs.getutm.app/guest-support/linux/#spice-agent 11 | services.spice-vdagentd.enable = true; 12 | # https://docs.getutm.app/guest-support/linux/#spice-webdav 13 | services.spice-webdavd.enable = true; 14 | # e.g. in a Gnome desktop environment, open Files, click other locations 15 | # and enter `dav://localhost:9843` to Connect to Server and click Connect 16 | # (Note that this is not very fast) 17 | 18 | # trusting the incoming traffic from host 19 | # this still requires individual apps to open on 0.0.0.0 not 127.0.0.1 20 | networking.firewall.trustedInterfaces = [ 21 | # the interface name below may not match the expected interface 22 | "enp0s1" 23 | ]; 24 | } 25 | -------------------------------------------------------------------------------- /nix/pkgs/lang/javascript.nix: -------------------------------------------------------------------------------- 1 | # this file is also for typescript 2 | 3 | { pkgs }: 4 | 5 | with pkgs; 6 | let 7 | bundle-deno = [ deno ]; 8 | nodejs = nodejs_24; 9 | bundle-nodejs-with-pkgs = ( 10 | # node essentials 11 | [ 12 | # Event-driven I/O framework for the V8 JavaScript engine 13 | nodejs 14 | # Fast, reliable, and secure dependency management for javascript 15 | yarn 16 | # npm packages via nodePackages 17 | ] 18 | ++ (with nodePackages; [ 19 | # Fast, disk space efficient package manager 20 | pnpm 21 | # Work with npm/yarn packages locally like a boss. 22 | yalc 23 | # TypeScript is a language for application scale JavaScript development 24 | typescript 25 | # Language Server Protocol (LSP) implementation for TypeScript using tsserver 26 | typescript-language-server 27 | ]) 28 | ); 29 | in 30 | bundle-nodejs-with-pkgs ++ bundle-deno 31 | -------------------------------------------------------------------------------- /nix/nixos/recipes/pam-sshagent.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | { 4 | # this replaces typing password with ssh agent 5 | # debug with `ssh-add -l` 6 | security.pam.sshAgentAuth = { 7 | enable = true; 8 | # `cat /etc/pam.d/sudo` to debug not `/etc/pam.d/login` 9 | authorizedKeysFiles = [ 10 | # relying on ../user.nix to set this up 11 | "/etc/ssh/authorized_keys.d/%u" 12 | ]; 13 | }; 14 | 15 | # (with 1password) why this doesn't work locally but remotely (if remote host configured that) 16 | # - it's explained at https://developer.1password.com/docs/ssh/agent/compatibility/ 17 | # - the gist is 1password guides you to setup `IdentityAgent` at `~/.ssh/config` instead of `SSH_AUTH_SOCK` environment variable 18 | # - `../../../zsh/zlogin` integrates this to zsh 19 | # - furthermore `IdentityAgent` will interfere with client's `SSH_AUTH_SOCK` so just sticking with `SSH_AUTH_SOCK` seems a smoother experience overall 20 | } 21 | -------------------------------------------------------------------------------- /gemini/AGENTS.md: -------------------------------------------------------------------------------- 1 | ## Gemini Added Memories 2 | - Do not run `git commit` unless explicitly asked by the user: 3 | - When constructing commit messages or any multi-line string for shell commands, ensure newlines are correctly preserved. Avoid using backticks (`) for code snippets within commit messages as they can interfere with shell parsing; prefer single quotes (') or double quotes (") for the entire message, and escape internal quotes if necessary. 4 | 5 | - Do not run `git restore .` nor `git checkout .`. 6 | - Prioritize and respect external modifications to the codebase; do not overwrite them with previously cached or 'stale' information. 7 | - If there are staged or unstaged Git changes at startup, attempt to infer the ongoing work to avoid redundant explanations from the user. 8 | - Show me the diff (not necessarily `git diff`) after each successful improvements if applicable 9 | - Do not use Serena MCP if it's already activated in some other session 10 | -------------------------------------------------------------------------------- /aliases/README.md: -------------------------------------------------------------------------------- 1 | # Why 2 | the purpose of this folder/method is to reduce typing hard ones by avoiding: 3 | - captial alphabets 4 | - special chars like `, or ~` 5 | - nested folders 6 | 7 | # Strategy 8 | - this real folder under dotfiles will not really contain real aliases since aliases will be different for each machine. 9 | - `$ mkdir -p ~/aliases` 10 | - `$ ln -sf ~/aliases al` 11 | - add `cd ~/al` at the end of the `~/.zshrc` or `~/.bashrc` if you use bash 12 | - now if you are in `~/al`, time to make some useful aliases that you cd often examples would be 13 | 14 | ```bash 15 | ln -sf /Applications apps 16 | ln -sf /Desktop desktop 17 | ln -sf /Downloads downloads 18 | ln -sf ~/.SpaceVim.d vimconfig 19 | ln -sf ~/.config config 20 | ln -sf ~/.zshrc zshrc 21 | ln -sf ~/dotfiles dot 22 | ln -sf ~/dotfiles/aliases/README.md readme.md # to remind yourself for the purpose and edit this README.md anytime 23 | ln -sf ~/your/project/that/nested unnested 24 | ``` 25 | -------------------------------------------------------------------------------- /bin/wsl/create-reload-ahk.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | WND_USERNAME="$(powershell.exe '$env:UserName' | sed 's/.$//')" # removing mysterious extra character at the end with sed 4 | 5 | if [ -z "${WND_USERNAME}" ]; then 6 | echo 'Exiting because no $WND_USERNAME is set' 7 | echo "Try again like WND_USERNAME=my-wnd-user $(readlink -f $0)" 8 | exit 1 9 | fi 10 | 11 | target_dir="/mnt/c/Users/${WND_USERNAME}/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup" 12 | target_path_for_win="$(wslpath -w "${target_dir}")\my-hotkeys.ahk.lnk" 13 | 14 | to_link="$(wslpath -w "${my_dot_d}/autohotkey/my-hotkeys.ahk")" 15 | 16 | cmd_to_run="powershell.exe 'New-Item -ItemType SymbolicLink -Path \"${target_path_for_win}\" -Target \"${to_link}\"'" 17 | 18 | wudo="python3 ${HOME}/.wsl-sudo/wsl-sudo.py" 19 | 20 | ${wudo} bash -c "${cmd_to_run}" 21 | 22 | echo "Now \`${target_path_for_win}\` will be loaded on start up" 23 | echo "which is linked to ${to_link}" 24 | -------------------------------------------------------------------------------- /gh/config.yml: -------------------------------------------------------------------------------- 1 | # What protocol to use when performing git operations. Supported values: ssh, https 2 | git_protocol: ssh 3 | # What editor gh should run when creating issues, pull requests, etc. If blank, will refer to environment. 4 | editor: 5 | # When to interactively prompt. This is a global config that cannot be overridden by hostname. Supported values: enabled, disabled 6 | prompt: enabled 7 | # A pager program to send command output to, e.g. "less". Set the value to "cat" to disable the pager. 8 | pager: less 9 | # Aliases allow you to create nicknames for gh commands 10 | aliases: 11 | co: pr checkout 12 | al: alias list 13 | il: issue list 14 | iv: issue view 15 | # The path to a unix socket through which send HTTP connections. If blank, HTTP traffic will be handled by net/http.DefaultTransport. 16 | http_unix_socket: 17 | # What web browser gh should use when opening URLs. If blank, will refer to environment. 18 | browser: 19 | version: "1" 20 | -------------------------------------------------------------------------------- /bin/path/default/pbcopy: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | should-use-osc() { 4 | # until this comment find a good answer https://github.com/theimpostor/osc/commit/4401feeeb146adcab48855f77535d2ac288a8c11#r153792038 5 | printenv TMUX >/dev/null && tmux show -gv allow-passthrough | grep on >/dev/null && tmux set allow-passthrough on 6 | 7 | test -z "${ZELLIJ_SESSION_NAME}" && command -v osc >/dev/null 8 | } 9 | 10 | is-remote-display-via-x11-forward() { 11 | test -n "${DISPLAY}" && test -n "${SSH_TTY}" 12 | } 13 | 14 | is-mac-os-local-connection() { 15 | test -x /usr/bin/pbcopy && ! is-remote-display-via-x11-forward 16 | } 17 | 18 | if is-mac-os-local-connection; then 19 | /usr/bin/pbcopy "$@" 20 | elif should-use-osc; then 21 | osc copy 22 | elif is-remote-display-via-x11-forward; then 23 | tee <&0 | nohup xsel -i -b >/dev/null 2>&1 & # use nohup to return quickly since this can be very slow 24 | else 25 | # fallback to xsel 26 | xsel -i -b 27 | fi 28 | -------------------------------------------------------------------------------- /nix/pkgs/custom/bat-riffle/default.nix: -------------------------------------------------------------------------------- 1 | # based on the example code from the link below 2 | # https://github.com/NixOS/nixpkgs/blob/2387396258eb6ff2c436a6a1a5ba5bd05c6862d3/pkgs/tools/nix/nixpkgs-fmt/default.nix 3 | 4 | # more info on rust + nix can be found at 5 | # https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/rust.section.md 6 | 7 | { pkgs }: 8 | 9 | with pkgs; 10 | rustPlatform.buildRustPackage rec { 11 | pname = "riffle"; 12 | version = "0.2.0"; 13 | 14 | src = fetchFromGitHub { 15 | owner = "sharkdp"; 16 | repo = pname; 17 | rev = "v${version}"; 18 | sha256 = "sha256-6xvg76js+CHqn9Ia5DVU2ILTCQlzpA4lEhDVTrXWLRw="; 19 | }; 20 | 21 | # # actually no need to override this 22 | # cargoBuildFlags = [ "--bin=bat-riffle" ]; 23 | 24 | cargoPatches = [ 25 | ./update-cargo-lock.patch 26 | ./update-cargo-toml.patch 27 | ]; 28 | 29 | cargoHash = "sha256-9Ah53B7VQJrm1jiXMyp2DIoW6cz0wDF/xf1VCrAKLP4="; 30 | } 31 | -------------------------------------------------------------------------------- /zsh/fn/zsh: -------------------------------------------------------------------------------- 1 | # -*- mode: sh; -*- vim: set ft=zsh: 2 | 3 | # inspired by https://www.topbug.net/blog/2016/10/11/speed-test-check-the-existence-of-a-command-in-bash-and-zsh/ 4 | function fastcommandcheck() { 5 | (($+commands[$1])) 6 | } 7 | 8 | # a helper function to determine if this shell is interactive 9 | function is-zsh-interactive() { 10 | case "$-" in 11 | *i*) return 0 ;; 12 | *) return 1 ;; 13 | esac 14 | } 15 | 16 | # convenient way to examine current and possible newer zsh versions installed 17 | # as well as the version of the OS 18 | function version() { 19 | case "$(uname -s)" in 20 | Darwin) echo '$(sw_vers): '; sw_vers 21 | ;; 22 | Linux) echo '$(lsb_release -a): '; lsb_release -a 23 | ;; 24 | esac 25 | echo 26 | echo -n "current zsh: "; print ${ZSH_VERSION} 27 | echo 28 | echo \$\("which zsh) = $(/usr/bin/which zsh):" 29 | zsh --version 30 | echo 31 | echo 'you may want to run `neofetch` to see more' 32 | } 33 | -------------------------------------------------------------------------------- /nix/nixos/recipes/airplay.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | # there is ./mdns.nix if all you need is just mdns feature 4 | 5 | # inspired by https://github.com/SimonBrandner/dotfiles/blob/main/Root/etc/nixos/configuration.nix#L96 6 | { 7 | services.avahi = { 8 | enable = true; 9 | publish = { 10 | enable = true; 11 | userServices = true; 12 | addresses = true; 13 | workstation = true; 14 | domain = true; 15 | }; 16 | nssmdns4 = true; 17 | openFirewall = true; 18 | }; 19 | 20 | environment.systemPackages = with pkgs;[ 21 | uxplay # AirPlay Unix mirroring server 22 | ]; 23 | 24 | networking = { 25 | # more info at https://github.com/antimof/UxPlay 26 | firewall = { 27 | enable = true; 28 | allowedTCPPorts = [ 29 | 7000 30 | 7001 31 | 7100 32 | ]; 33 | allowedUDPPorts = [ 34 | 6000 35 | 6001 36 | 7011 37 | ]; 38 | }; 39 | }; 40 | } 41 | -------------------------------------------------------------------------------- /nix/nixos/recipes/meta/caddy-over-tailscale.nix: -------------------------------------------------------------------------------- 1 | { 2 | appName, # usually should be the same as the container name if container has its own ts host with automatically generated name 3 | tailnetName, 4 | fqdn, # e.g. "http://${host}:${port}" 5 | }: 6 | { ... }: 7 | 8 | { 9 | services.tailscale = { 10 | enable = true; 11 | # allows caddy to issue a cert via tailscale: 12 | # - https://tailscale.com/blog/caddy 13 | # - https://caddyserver.com/docs/automatic-https#activation 14 | # - https://search.nixos.org/options?show=services.tailscale.permitCertUid 15 | permitCertUid = "caddy"; 16 | # interfaceName = "userspace-networking"; # critical for container operation if `containers.[name].enableTun = true;` is missing (in case of NixOS container usage) 17 | }; 18 | 19 | services.caddy = { 20 | enable = true; 21 | virtualHosts."${appName}.${tailnetName}.ts.net".extraConfig = '' 22 | reverse_proxy ${fqdn} 23 | ''; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /zsh/modules/history: -------------------------------------------------------------------------------- 1 | # -*- mode: sh; -*- vim: set ft=zsh: 2 | 3 | # NOTE: skip for dumb terminal 4 | test "${TERM}" = "dumb" && return 5 | 6 | # optimize and enhance history management 7 | # - https://www.soberkoder.com/better-zsh-history/ 8 | # - https://ryantoddgarza.medium.com/a-better-zsh-history-pt-2-dde323e0c9ca 9 | # - also these options will be 10 | # - combined with https://github.com/ohmyzsh/ohmyzsh/blob/master/lib/history.zsh 11 | # - via ../my_addons/zinit 12 | setopt HIST_IGNORE_ALL_DUPS; HISTSIZE=1000000; SAVEHIST=1000000; 13 | 14 | # because I want the history with interactive SSH session even via TRAMP 15 | test -n "${HISTFILE}" && test "${HISTFILE}" != ~/.zsh.history && >&2 echo "\$HISTFILE was ${HISTFILE}" 16 | # regarding `>&2 echo ...`: https://stackoverflow.com/a/23550347/1570165 17 | 18 | # setting a new path to avoid polluting from external source (e.g. tramp); 19 | # anything before this, should be at ~/.zsh_history 20 | export HISTFILE=~/.zsh.history 21 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/tools/lsp-support/packages.el: -------------------------------------------------------------------------------- 1 | ;; -*- no-byte-compile: t; -*- 2 | ;;; tools/lsp-support/packages.el 3 | 4 | ;; `eglot' is builtin 5 | ;; installing `lsp-mode' is handled via dooemacs modeul =:tools lsp= 6 | 7 | (when (and (modulep! :tools lsp) (modulep! +hover)) 8 | (package! eldoc-box)) 9 | 10 | (when (modulep! :tools lsp +eglot) 11 | (package! eglot-booster 12 | :recipe (:host github 13 | :repo "jdtsmith/eglot-booster"))) 14 | 15 | (when (not (modulep! :tools lsp)) 16 | (when (package! lsp-bridge 17 | :recipe (:host github 18 | :repo "manateelazycat/lsp-bridge" 19 | :branch "master" 20 | :files ("*.el" "*.py" "acm" "core" "langserver" "multiserver" "resources") 21 | ;; do not perform byte compilation or native compilation for lsp-bridge 22 | :build (:not compile))) 23 | (package! markdown-mode) 24 | (package! yasnippet))) 25 | -------------------------------------------------------------------------------- /karabiner/assets/complex_modifications/1750277837.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Spotlight on Meta/Command/Windows-Key", 3 | "maintainers": [ 4 | "9SMTM6" 5 | ], 6 | "rules": [ 7 | { 8 | "description": "Spotlight on Meta/Command/Windows-Key", 9 | "manipulators": [ 10 | { 11 | "from": { 12 | "key_code": "left_command", 13 | "modifiers": { "optional": ["any"] } 14 | }, 15 | "to": [ 16 | { 17 | "key_code": "left_command", 18 | "lazy": true 19 | } 20 | ], 21 | "to_if_alone": [{ "apple_vendor_keyboard_key_code": "spotlight" }], 22 | "to_if_held_down": [{ "key_code": "left_command" }], 23 | "type": "basic" 24 | } 25 | ] 26 | } 27 | ] 28 | } 29 | 30 | -------------------------------------------------------------------------------- /nix/pkgs/extra/rusty-fam.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | with pkgs; 4 | [ 5 | yazi # Blazing fast terminal file manager written in Rust, based on async I/O 6 | hyperfine # Command-line benchmarking tool 7 | dua # Tool to conveniently learn about the disk usage of directories 8 | ripgrep-all # Ripgrep, but also search in PDFs, E-Books, Office documents, zip, tar.gz, and more 9 | xh # Friendly and fast tool for sending HTTP requests 10 | fselect # Find files with SQL-like queries 11 | mprocs # TUI tool to run multiple commands in parallel and show the output of each command separately 12 | just # Handy way to save and run project-specific commands 13 | mask # CLI task runner defined by a simple markdown file 14 | presenterm # Terminal based slideshow tool 15 | kondo # Save disk space by cleaning unneeded files from software projects 16 | ] 17 | # inspired by "Oxidise Your Command Line (2025 Edition) - https://www.youtube.com/watch?v=rWMQ-g2QDsI" 18 | # except the tools that already installed or not interested at the moment 19 | -------------------------------------------------------------------------------- /lf/lfrc: -------------------------------------------------------------------------------- 1 | # show hidden files 2 | set hidden 3 | 4 | # show icons 5 | set icons 6 | 7 | # set previewer using bat 8 | set previewer ~/.config/lf/pv.sh 9 | map i $~/.config/lf/pv+pager.sh "$f" 10 | 11 | # type gh and go back to home directory 12 | map gh cd ~ 13 | 14 | ## l will open files with nvim 15 | # cmd open $nvim "$fx" 16 | # comment l to nvim to favor previewer 17 | # use e to edit instead 18 | 19 | # l will open files with previewer 20 | cmd open $~/.config/lf/pv+pager.sh "$fx" 21 | # enter will do samething as l 22 | map push l 23 | 24 | # f will fuzzy search file and open with nvim 25 | map f $$EDITOR $(fzf) 26 | # e will open the file with $EDITOR 27 | map e $eval $EDITOR "'$f'" # use this since somehow the pure version, `map e $$EDITOR "$f"` doesn't work very well 28 | 29 | # explanation about the above 30 | # first $ to indicate the start of command 31 | # second $ to reference env var 32 | 33 | # :q will quit lf just like vim 34 | cmd q push q 35 | 36 | # :help will show doc 37 | cmd help $lf -doc| ~/.config/lf/less.sh 38 | -------------------------------------------------------------------------------- /emacs.d/doom.d/modules/compat/neovim/config.el: -------------------------------------------------------------------------------- 1 | ;;; compat/neovim/config.el -*- lexical-binding: t; -*- 2 | 3 | ;; This layer exist to reduce the gap of neovim's default behavior + my config at =../../../../../nvim/= 4 | ;; There is also =../../my-custom/morevil/= that is more concerned on muscle memory (via keybindings); 5 | ;; when this module is more concerned in a bigger system layer 6 | 7 | ;; fuzzy match completions!!! 8 | (after! orderless ;; orderless is cool and all but I'm used to fuzzy matching more ... 9 | (defun hotfuzz-setup () 10 | "Set up `hotfuzz'." 11 | (setq completion-ignore-case t) 12 | (unless (memq 'hotfuzz completion-styles) 13 | (push 'hotfuzz completion-styles))) 14 | 15 | ;; to overtake orderless set by :completion vertico 16 | (use-package! hotfuzz 17 | :config 18 | (hotfuzz-setup))) 19 | 20 | ;; to make this to resemble the completion experience from Neovim 21 | (after! corfu 22 | ;; let's not make the enter key embarassing when there is no candidate 23 | (setq corfu-preselect 'first)) 24 | -------------------------------------------------------------------------------- /nix/nixos/recipes/podman.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | # https://nixos.wiki/wiki/Podman 4 | # https://wiki.nixos.org/wiki/Distrobox 5 | # https://wiki.nixos.org/wiki/NixOS_Containers 6 | # https://wiki.archlinux.org/title/Podman 7 | { 8 | # debug with `podman info` - https://www.reddit.com/r/podman/comments/14dgdf8/how_can_i_figure_out_which_storage_driver_podman/ 9 | virtualisation.podman.enable = true; 10 | 11 | environment.systemPackages = with pkgs; [ 12 | podman-tui # Podman Terminal UI - requires running `systemctl --user start podman.socket` (once) to work 13 | podman-compose # An implementation of docker-compose with podman backend 14 | docker-compose # Docker CLI plugin to define and run multi-container applications with Docker 15 | # https://www.redhat.com/en/blog/podman-compose-docker-compose 16 | ]; 17 | 18 | # run `systemctl --user start podman.socket` in case providing the socket API that expect $DOCKER_HOST socket to be listening 19 | # run `man podman-system-service` and see ./docker.nix to learn more 20 | } 21 | -------------------------------------------------------------------------------- /nix/pkgs/custom/emacs.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | let 4 | checkEnv = import ../../utils/checkEnv.nix; 5 | # https://blog.phundrak.com/emacs-29-what-can-we-expect/ 6 | # emacs-pgtk: wayland native via pure gtk 7 | emacs = if pkgs.stdenv.isLinux then pkgs.emacs-pgtk else pkgs.emacs; 8 | emacsWithOptions = emacs.override { 9 | # these are pretty much the default but still making it explicit for documentation purpose 10 | withNativeCompilation = true; # this is pretty much default 11 | withTreeSitter = true; # this is the default for 29+ version 12 | }; 13 | emacsWithPackages = (pkgs.emacsPackagesFor emacsWithOptions).emacsWithPackages; 14 | customizedEmacs = emacsWithPackages (epkgs: [ 15 | epkgs.vterm 16 | ]); # include libvterm 17 | # above is basically the broken down version of below 18 | # ((emacsPackagesFor (emacs.override { ... })).emacsWithPackages (epkgs: [ epkgs.vterm ])) 19 | in 20 | customizedEmacs # emacs editor including GUI, `emacs -nw` to run as TUI 21 | 22 | # more info on https://nixos.wiki/wiki/Emacs 23 | -------------------------------------------------------------------------------- /nix/bin/source/nix.sh: -------------------------------------------------------------------------------- 1 | # This file is expected to be sourced not executed 2 | 3 | function safe_source() { 4 | test -f "${1}" && source "${1}" 5 | } 6 | 7 | # try standard linux way first 8 | if ! command -v nix >/dev/null; then 9 | safe_source /etc/profile.d/nix.sh 10 | safe_source /etc/profile.d/user-shim-for-nix-path.sh 11 | fi 12 | 13 | # try another way next 14 | if ! command -v nix >/dev/null; then 15 | safe_source ~/.nix-profile/etc/profile.d/nix.sh 16 | fi 17 | 18 | # try another way next 19 | if ! command -v nix >/dev/null; then 20 | safe_source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh 21 | fi 22 | 23 | if ! command -v nix >/dev/null; then 24 | echo "Warning: \`nix\` is still not found" 25 | else 26 | # making sure `nix[-*]` binaries are still in the $PATH for some unusual environment e.g. distrobox 27 | path_to_append="$(env which nix | xargs readlink -f | sed 's|/nix$||')" 28 | if echo "${PATH}" | grep -v "${path_to_append}" >/dev/null; then 29 | export PATH="${PATH}:${path_to_append}" 30 | fi 31 | fi 32 | -------------------------------------------------------------------------------- /nix/pkgs/lang/graalvm.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | # could be an alternative to ./java.nix and more 4 | # mainly for faster startup and supporting other languages and ecosystem 5 | let 6 | # thanks to https://github.com/NixOS/nixpkgs/issues/202336#issuecomment-1430134653 7 | graalvm = (with pkgs;(graalvm17-ce.override { 8 | products = with graalvmCEPackages; [ 9 | # uncomment as more are required 10 | ruby-installable-svm-java17 # expose `ruby` binary 11 | # js-installable-svm-java17 12 | # llvm-installable-svm-java17 13 | # native-image-installable-svm-java17 14 | # nodejs-installable-svm-java17 15 | # python-installable-svm-java17 16 | # wasm-installable-svm-java17 17 | ]; 18 | })); 19 | in 20 | with pkgs; 21 | [ 22 | graalvm # High-Performance Polyglot VM that comes with the binaries like `java` and `javac`, etc. by default 23 | babashka # Native, fast starting Clojure interpreter for scripting - does not require JVM 24 | bbin # Install any Babashka script or project with one command 25 | ] 26 | -------------------------------------------------------------------------------- /nvim/lua/plugins/config/profile.lua: -------------------------------------------------------------------------------- 1 | -- profiling settings 2 | 3 | return function() 4 | local should_profile = os.getenv 'NVIM_PROFILE' 5 | if should_profile then 6 | vim.notify 'you entered profile recording mode' 7 | require('profile').instrument_autocmds() 8 | if should_profile:lower():match '^start' then 9 | require('profile').start '*' 10 | else 11 | require('profile').instrument '*' 12 | end 13 | 14 | local function toggle_profile() 15 | local prof = require 'profile' 16 | if prof.is_recording() then 17 | prof.stop() 18 | vim.ui.input({ prompt = 'Save profile to:', completion = 'file', default = 'profile.json' }, function(filename) 19 | if filename then 20 | prof.export(filename) 21 | vim.notify(string.format('Wrote %s', filename)) 22 | end 23 | end) 24 | else 25 | vim.notify 'start recording profile' 26 | prof.start '*' 27 | end 28 | end 29 | 30 | vim.keymap.set('', '', toggle_profile) 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /bootstrap/foundation/nixos/gen-configuration.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | curr_dir="$(dirname "$0")" 4 | cd "${curr_dir}" || exit 5 | 6 | mix_and_match=$(test -f ../../../nix/nixos/mix-and-match.nix && 7 | echo ../../../nix/nixos/mix-and-match.nix || 8 | echo ../../../nix/nixos/mix-and-match-empty.nix) 9 | 10 | cat <./configuration.nix 11 | # generated by ./gen-configuration.sh 12 | 13 | # Edit this configuration file to define what should be installed on 14 | # your system. Help is available in the configuration.nix(5) man page 15 | # and in the NixOS manual (accessible by running ‘nixos-help’). 16 | 17 | { config, pkgs, ... }: 18 | 19 | let 20 | my-nixos = ../../../nix/nixos/configuration.nix; 21 | username = "$(whoami)"; 22 | user = import ../../../nix/nixos/user.nix { 23 | username = username; 24 | }; 25 | mix-and-match = import ${mix_and_match} username; 26 | in 27 | { 28 | imports = 29 | [ 30 | # Include the results of the hardware scan. 31 | my-nixos 32 | user 33 | mix-and-match 34 | ]; 35 | } 36 | EOF 37 | -------------------------------------------------------------------------------- /starship.toml: -------------------------------------------------------------------------------- 1 | # https://starship.rs/config 2 | 3 | # https://starship.rs/config/#shell 4 | [shell] 5 | disabled = false 6 | 7 | # https://starship.rs/config/#shlvl 8 | [shlvl] 9 | disabled = false 10 | threshold = 3 11 | 12 | # https://starship.rs/config/#battery-display 13 | [[battery.display]] 14 | threshold = 80 15 | style = "yellow" 16 | 17 | # https://starship.rs/config/#git-branch 18 | [git_branch] 19 | symbol = "🌱 " 20 | 21 | # https://starship.rs/config/#git-status 22 | [git_status] 23 | conflicted = "🏳" 24 | ahead = "🏎💨${count}" 25 | behind = "🐢${count}" 26 | diverged = "😵" 27 | untracked = "🤷" 28 | stashed = "📦" 29 | modified = "📝" 30 | staged = '[++\(${count}\)](green)' 31 | renamed = "👅" 32 | deleted = "🗑" 33 | 34 | # https://starship.rs/config/#kubernetes 35 | [kubernetes] 36 | symbol = "⛴ " 37 | style = "dimmed green" 38 | disabled = false 39 | 40 | # https://starship.rs/config/#terraform 41 | [terraform] 42 | 43 | # https://starship.rs/config/#nix-shell 44 | [nix_shell] 45 | 46 | # https://starship.rs/config/#aws 47 | [aws] 48 | symbol = '🅰 ' 49 | -------------------------------------------------------------------------------- /bin/path/default/debug-network: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # this is to enhance the experience of debugging the status of network 4 | # there is also ./debug-resolve 5 | 6 | _run-cmd() { 7 | x="${1}" 8 | if command -v "${x}" >/dev/null; then 9 | # https://www.shellcheck.net/wiki/SC2145 10 | echo '[info] `'"${*}"'`' 11 | "${@}" 12 | echo 13 | else 14 | echo "[info] '${x}' not found - skipping" 15 | return 1 16 | fi 17 | } 18 | 19 | pager='less' 20 | command -v delta >/dev/null && pager='delta' 21 | 22 | _debug-network() { 23 | _run-cmd tailscale status 24 | _run-cmd warp-cli status 25 | _run-cmd ip -c link || _run-cmd ip link 26 | _run-cmd ip -c route || _run-cmd ip route 27 | _run-cmd ip -c tuntap || _run-cmd ip tuntap 28 | _run-cmd ip -c address || _run-cmd ip address 29 | 30 | echo "more commands to run to further debug:" 31 | echo "- \`ip -c neigh\`" 32 | echo "- \`sudo ip -c -d tuntap\`" 33 | 34 | echo '[info] there is also `'"debug-resolve"' example.com` that you can run' 35 | } 36 | 37 | _debug-network "${@}" | ${pager} 38 | -------------------------------------------------------------------------------- /nvim/lua/utils/keymap-layer-info.lua: -------------------------------------------------------------------------------- 1 | -- to bridge between keymap-layer and winbar on lualine 2 | -- usage: `{ require('utils.keymap-layer').get_summary, cond = require('utils.keymap-layer').determine_active }` 3 | return { 4 | determine_active = function() 5 | local activelayer = _G.active_keymap_layer 6 | return activelayer and activelayer.active 7 | end, 8 | get_summary = function() 9 | local activelayer = _G.active_keymap_layer 10 | if (not activelayer) or not activelayer.active then 11 | return 'no active layer found' 12 | end 13 | 14 | local kms = activelayer.layer_keymaps 15 | 16 | -- only care about normal mode keys for now 17 | local normal_kms = kms['n'] 18 | 19 | local summaries = {} 20 | 21 | -- collect description of each key 22 | for key, value in pairs(normal_kms) do 23 | local opt = value[2] 24 | local desc = '[' .. key .. ']' .. opt['desc'] 25 | table.insert(summaries, desc) 26 | end 27 | 28 | local summary = table.concat(summaries, ' ') 29 | return 'LAYER: ' .. summary 30 | end, 31 | } 32 | -------------------------------------------------------------------------------- /nvim/snippets/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my-nvim-snippets", 3 | "engines": { 4 | "vscode": "^1.11.0" 5 | }, 6 | "contributes": { 7 | "snippets": [ 8 | { 9 | "language": [ 10 | "all" 11 | ], 12 | "path": "./all.json" 13 | }, 14 | { 15 | "language": [ 16 | "make" 17 | ], 18 | "path": "./make.json" 19 | }, 20 | { 21 | "language": [ 22 | "lua" 23 | ], 24 | "path": "./lua.json" 25 | }, 26 | { 27 | "language": [ 28 | "hcl", 29 | "terraform" 30 | ], 31 | "path": "./hcl.json" 32 | }, 33 | { 34 | "language": [ 35 | "bash" 36 | ], 37 | "path": "./direnv.json" 38 | }, 39 | { 40 | "language": [ 41 | "nix" 42 | ], 43 | "path": "./nix.json" 44 | }, 45 | { 46 | "language": [ 47 | "sh", 48 | "bash", 49 | "zsh" 50 | ], 51 | "path": "./bash.json" 52 | } 53 | ] 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /nix/home/services/opener.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | # see `../../../bin/path/ssh/xdg-open` for context 4 | 5 | let 6 | opener = import ../../pkgs/custom/opener.nix { pkgs = pkgs; }; 7 | opener-display0 = pkgs.writeShellScriptBin "opener" '' 8 | DISPLAY=:0 exec ${opener}/bin/opener 9 | ''; 10 | in 11 | { 12 | # https://haseebmajid.dev/posts/2023-10-08-how-to-create-systemd-services-in-nix-home-manager/ 13 | systemd.user.services.opener = { 14 | Unit = { 15 | Description = "Open URL in your local web browser from the SSH-connected remote environment"; 16 | }; 17 | Install = { 18 | # probably requires logout/login for the service to be active probably 19 | # due to "graphical-session" has already been started by the time you install this for the first time 20 | # or just manually start by `systemctl --user start opener.service` once 21 | # run `systemctl --user restart opener.service` to debug after rebuilding 22 | WantedBy = [ "graphical-session.target" ]; 23 | }; 24 | Service = { 25 | ExecStart = "${opener-display0}/bin/opener"; 26 | }; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /bin/path/default/home-manager: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # why this wrapper? 4 | # - `home-manager` doesn't seem to blindly follow $NIX_BUILD_CORES so manually pass the value 5 | # - avoid using channel and use the explicit source set by `niv` 6 | 7 | curr_d="$(dirname "$0")" 8 | nix_d="${curr_d}/../../../nix" 9 | get_path_for="${nix_d}/niv-shim/bin/get-path-for.sh" 10 | alt_nixpkgs="$("${get_path_for}" nixpkgs)" 11 | alt_nixpkgs_stable_darwin="$("${get_path_for}" nixpkgs-stable-darwin)" 12 | alt_hm="$("${get_path_for}" home-manager)" 13 | 14 | channel_for_darwin="" 15 | uname | xargs test "Darwin" = && channel_for_darwin="-I nixpkgs-stable-darwin=${alt_nixpkgs_stable_darwin}" 16 | 17 | # making sure NIX_CONFIG exist especially for there are some flakes being used down the load with the command continued 18 | printenv NIX_CONFIG | grep flakes >/dev/null || 19 | export NIX_CONFIG="extra-experimental-features = nix-command flakes" 20 | 21 | "${HOME}/.nix-profile/bin/home-manager" \ 22 | -I "home-manager=${alt_hm}" \ 23 | -I "nixpkgs=${alt_nixpkgs}" \ 24 | ${channel_for_darwin} \ 25 | --cores "${NIX_BUILD_CORES:-4}" \ 26 | "$@" 27 | -------------------------------------------------------------------------------- /nix/nixos/recipes/meta/README.md: -------------------------------------------------------------------------------- 1 | # recipes/meta 2 | Meta here means to highorder functions unlike the recipes in the parent directory which adheres to be a (static) nixos module. 3 | 4 | For example, "regular" module would like below: 5 | 6 | ```nix 7 | # recipes/recipe1.nix 8 | { pkg, lib, ... }: 9 | 10 | { 11 | # ... 12 | } 13 | ``` 14 | 15 | And you call it like (for example from ../../mix-and-match.nix): 16 | 17 | ```nix 18 | { ... }: 19 | 20 | { 21 | imports = [ 22 | ./recipes/recipe1.nix 23 | ] 24 | 25 | # ... 26 | } 27 | ``` 28 | 29 | And the meta ones would be like 30 | 31 | ```nix 32 | # recipes/meta/example.nix 33 | { param1, param2 ? "param2" }: 34 | { pkg, lib, ... }: 35 | 36 | { 37 | # ... 38 | } 39 | ``` 40 | 41 | And you call it like (for example from ../../mix-and-match.nix): 42 | 43 | ```nix 44 | { ... }: 45 | 46 | { 47 | imports = [ 48 | ./recipes/recipe1.nix 49 | (import ./recipes/meta/example.nix { param1 = "param1"; }) 50 | ] 51 | 52 | # ... 53 | } 54 | ``` 55 | 56 | Real world examples are: 57 | - [zerotier.nix](./zerotier.nix) 58 | - [zeronsd.nix](./zeronsd.nix) 59 | - and more 60 | -------------------------------------------------------------------------------- /nvim/remote-container.md: -------------------------------------------------------------------------------- 1 | # We know 2 | That running apps with docker is great that it is portable and works pretty much the same with any device. 3 | 4 | # But Why This Doc? 5 | 6 | But because a container is a effectively a different "remote" machine, it is a lot harder to setup two things at least: 7 | - language servers aka LSP to assist for reading and writing code 8 | - debuggers aka DAP to take advantage of debugging process with breakpoints 9 | 10 | # How it works? What do I need? 11 | Well first of all, it is only possible thanks to all the tools and awesome plugins. 12 | ## LSP 13 | 14 | ### Tl;dr: 15 | - ./lua/plugins/lsp.lua 16 | - ./lua/plugins/config/lsp-servers.lua 17 | 18 | ### Explanation 19 | 20 | TBC 21 | 22 | ## DAP 23 | 24 | 25 | ### Tl;dr: 26 | - ./lua/plugins/debug.lua 27 | - ./lua/plugins/config/dap.lua 28 | 29 | ### Explanation 30 | TBC 31 | 32 | # Examples 33 | 34 | After many attempts to understand how things actually work and setup neovim to work with remote containers, I came up with few examples. 35 | 36 | ## LSP 37 | 38 | ### 1. nodejs 39 | ### 2. python 40 | 41 | 42 | 43 | ## DAP 44 | 45 | ### 1. nodejs 46 | ### 2. python 47 | -------------------------------------------------------------------------------- /zsh/zlogin: -------------------------------------------------------------------------------- 1 | # -*- mode: sh; -*- vim: set ft=zsh: 2 | 3 | # - persist a session via zellij on SSH connection 4 | # - but avoid doing this for tramp-mode on emacs - https://www.emacswiki.org/emacs/TrampMode 5 | # - also guard this behaviour for non-interactive shell usage 6 | if is-zsh-interactive && test "${TERM}" != 'dumb'; then 7 | if is-ssh && ! printenv DISTROBOX_ENTER_PATH >/dev/null; then 8 | source "${my_dot_d}/zsh/integration/interactive-ssh" 9 | else # when not SSH 10 | # to mimic secretive experience at macOS on NixOS 11 | is-nixos && source "${my_dot_d}/zsh/integration/1p" 12 | # to mimic secretive experience at macOS on WSL 13 | is-wsl && source "${my_dot_d}/zsh/integration/agent-bridge-via-1p" 14 | 15 | # restore theme that might have been changed via SSH connection 16 | if printenv TMUX > /dev/null; then 17 | # see `./integration/interactive-ssh` to understand why this is needed 18 | tmux show -gv @tmux_power_theme | grep gold > /dev/null && { 19 | tmux set -g @tmux_power_theme 'colour39' 20 | tmux set -g @tmux_power_g2 "4" 21 | ~/.tmux/plugins/tpm/tpm 22 | } 23 | fi 24 | fi 25 | fi 26 | -------------------------------------------------------------------------------- /bin/path/darwin/react-to-appearance-changes: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # WARN: now this is no longer necessary thanks to ../../../nix/home/services/tmux-watch-theme-change.nix 4 | 5 | # call this from An app/process that runs on start up - https://stackoverflow.com/a/6445525/1570165 6 | # by copying the command below 7 | # ~/.config/dfs-rhc/bin/darwin/watch-appearance-changes.sh 8 | 9 | # `timeout` is a part of GNU Coreutils - https://www.gnu.org/software/coreutils/manual/coreutils.html#timeout-invocation 10 | # Without it, all of the commands in this script will be in the same group - meaning killing one (by `single-daemon`) will kill all 11 | # Which is a undesired behavior with `single-daemon` 12 | # therefore use timeout to have a side effect of having separate process group id 13 | # This method was discovered at https://unix.stackexchange.com/a/403193/396504 14 | 15 | exec zsh -c ' 16 | timeout 5s single-daemon base16-shell-to-follow-system-appearance || true 17 | timeout 5s single-daemon base16-shell-auto-reload-on-tmux || true 18 | exit 19 | ' >/dev/null 2>&1 & 20 | # some how going into background is necessary to prevent hanging with automator https://apple.stackexchange.com/a/340443/368485 21 | -------------------------------------------------------------------------------- /espanso/match/base.yml: -------------------------------------------------------------------------------- 1 | # Automatically generated by espanso migration tool 2 | # Original file: default.yml 3 | 4 | matches: 5 | - trigger: ":espanso" 6 | replace: Hi there! 7 | - trigger: ":date" 8 | replace: "{{mydate}}" 9 | vars: 10 | - name: mydate 11 | type: date 12 | params: 13 | format: "%m/%d/%Y" 14 | - trigger: ":shell" 15 | replace: "{{output}}" 16 | vars: 17 | - name: output 18 | type: shell 19 | params: 20 | cmd: echo Hello from your shell 21 | - trigger: ":upcase" 22 | replace: "{{output}}" 23 | vars: 24 | - name: form1 25 | type: form 26 | params: 27 | layout: | 28 | to uppercase [[to_upper]] 29 | - name: output 30 | type: shell 31 | params: 32 | cmd: echo '{{form1.to_upper}}' | upcase 33 | - trigger: ":downcase" 34 | replace: "{{output}}" 35 | vars: 36 | - name: form1 37 | type: form 38 | params: 39 | layout: | 40 | to lowercase [[to_lower]] 41 | - name: output 42 | type: shell 43 | params: 44 | cmd: echo '{{form1.to_lower}}' | downcase 45 | -------------------------------------------------------------------------------- /bin/path/linux/wifi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # help discover commands and view status and select ssid 4 | 5 | command -v gum >/dev/null || { echo 'you need gum to proceed' exit 1; } 6 | 7 | exit_on_sigint() { 8 | # https://github.com/charmbracelet/gum/issues/469#issuecomment-1865391607 9 | if [[ $? -eq 130 ]]; then 10 | exit 130 11 | fi 12 | } 13 | 14 | tldr nmcli device 15 | 16 | gum spin --spinner dot --title "listing WiFi..." -- nmcli dev wifi list 17 | # above command somehow doesn't stay so call the below again (which hits the cached list) 18 | 19 | exit_on_sigint 20 | 21 | result=$(nmcli dev wifi list) 22 | echo "${result}" | head -n1 23 | 24 | chosen="$(echo "${result}" | awk 'NR>1 { print $0 }' | gum filter)" 25 | 26 | exit_on_sigint 27 | 28 | first_item=$(echo "${chosen}" | awk '{ print $1 }') 29 | 30 | if test "${first_item}" = '*'; then 31 | ssid="$(echo "${chosen}" | awk '{ print $3 }')" 32 | else 33 | ssid="$(echo "${chosen}" | awk '{ print $2 }')" 34 | fi 35 | 36 | cmd="nmcli dev wifi connect ${ssid}" 37 | gum confirm "run \`${cmd}\`?" && 38 | gum spin --spinner dot --title "running '${cmd}' ..." -- ${cmd} 39 | 40 | exit_on_sigint 41 | 42 | set -x 43 | nmcli dev wifi list --rescan no 44 | -------------------------------------------------------------------------------- /nix/bin/init-hm.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # run this script with nix-shell -p coreutils especially on macOS 4 | 5 | set -x 6 | 7 | # early exit to be "idempotent" 8 | # 9 | test -x "${HOME}/.nix-profile/bin/home-manager" && { echo 'home-manager already initialized'; exit 0; } 10 | 11 | curr_dir="$(dirname "$0")" 12 | repo_root="${curr_dir}/../.." 13 | nix_d="${repo_root}/nix" 14 | 15 | "${nix_d}/bin/install-hm.sh" 16 | 17 | path_for_hm="${HOME}/.config/home-manager" 18 | path_for_home_nix="${path_for_hm}/home.nix" 19 | 20 | # print previous file content in case there's one 21 | test -f "${path_for_home_nix}" && cat "${path_for_home_nix}" 22 | 23 | repo_root_abs="$(readlink -f "${repo_root}")" 24 | my_nix_home_path="${repo_root_abs}/nix/home" 25 | 26 | # use this as a template to replace ~/.config/nixpkgs/home.nix 27 | echo "generating ${path_for_home_nix}" 28 | mkdir -p "${path_for_hm}" 29 | cat << EOF > "${path_for_home_nix}" 30 | # generated via init-hm.sh 31 | let 32 | home-nix-path = /. + builtins.toPath "$(echo "${my_nix_home_path}")"; 33 | imports = [ home-nix-path ]; 34 | in 35 | { 36 | inherit imports; 37 | 38 | home.username = "$(whoami)"; 39 | home.homeDirectory = "$(echo "${HOME}")"; 40 | } 41 | EOF 42 | -------------------------------------------------------------------------------- /bin/path/default/debug-resolve: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # this is to enhance the experience of debugging DNS resolution 4 | # there is also ./debug-network 5 | 6 | _debug-resolve-x() { 7 | x="${1}" 8 | if command -v "${x}" >/dev/null; then 9 | echo '[info] `'"${x}" "${2}"'`' 10 | "${x}" "${2}" 11 | echo 12 | else 13 | echo "[info] '${x}' not found - skipping" 14 | return 1 15 | fi 16 | } 17 | 18 | printer='cat' 19 | command -v bat >/dev/null && printer='bat --decorations=always' 20 | pager='less' 21 | command -v delta >/dev/null && pager='delta' 22 | 23 | _debug-resolve() { 24 | ${printer} /etc/nsswitch.conf 25 | ${printer} /etc/resolv.conf 26 | test -f /run/systemd/resolve/resolv.conf && 27 | ${printer} /run/systemd/resolve/resolv.conf 28 | 29 | command -v resolvectl >/dev/null && { 30 | echo '[info] `'"resolvectl status"'`' 31 | resolvectl status 32 | echo 33 | } 34 | _debug-resolve-x avahi-resolve-host-name "${1}" 35 | _debug-resolve-x host "${1}" 36 | _debug-resolve-x nslookup "${1}" 37 | _debug-resolve-x dog "${1}" 38 | _debug-resolve-x dig "${1}" 39 | 40 | echo '[info] there is also `'debug-network'` that you can run' 41 | } 42 | 43 | _debug-resolve "${@}" | ${pager} 44 | -------------------------------------------------------------------------------- /bin/path/linux/bluetooth: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # help discover commands and view status and select device 4 | 5 | command -v gum >/dev/null || { echo 'you need gum to proceed' exit 1; } 6 | 7 | exit_on_sigint() { 8 | # https://github.com/charmbracelet/gum/issues/469#issuecomment-1865391607 9 | if [[ $? -eq 130 ]]; then 10 | exit 130 11 | fi 12 | } 13 | 14 | tldr bluetoothctl 15 | 16 | echo 'select a bluetooth device to connect:' 17 | 18 | device=$(bluetoothctl devices | gum filter --height=10) # use filter (same for wifi) 19 | 20 | exit_on_sigint 21 | 22 | macaddr="$(echo "${device}" | awk '{ print $2 }')" 23 | 24 | # https://stackoverflow.com/a/32774373/1570165 25 | name="$(echo "${device}" | awk '{ n=2; a="^["FS"]*[^"FS"]+["FS"]+"; for(i=1;i<=n;i++) sub( a , "" , $0 ) } 1 ')" 26 | 27 | echo "${macaddr} [${name}] is selected" 28 | 29 | if bluetoothctl devices Connected | grep "${macaddr}"; then 30 | echo "and it's currently connected" 31 | cmd="bluetoothctl disconnect ${macaddr}" 32 | else 33 | cmd="bluetoothctl connect ${macaddr}" 34 | fi 35 | 36 | gum confirm "run \`${cmd}\`?" && 37 | gum spin --spinner dot --title "running '${cmd}' ..." -- ${cmd} 38 | 39 | exit_on_sigint 40 | 41 | set -x 42 | bluetoothctl devices 43 | -------------------------------------------------------------------------------- /alacritty/unix.toml: -------------------------------------------------------------------------------- 1 | # ref: `man 5 alacritty` 2 | [colors] 3 | draw_bold_text_with_bright_colors = true 4 | 5 | # [env] 6 | # # I shouldn't need to set this as (default) `alacritty` terminfo should work better 7 | # TERM = "xterm-256color" 8 | 9 | 10 | [font] 11 | size = 15.0 12 | 13 | # adding Mono or not makes difference for characters like these [[tab:→\ ,eol:↵,trail:·,extends:↷,precedes:↶]] 14 | 15 | [font.normal] 16 | family = "FiraMono Nerd Font Mono" 17 | style = "Regular" 18 | # skip specifying families to below to fallback to normal ones 19 | [font.bold] 20 | style = "Bold" 21 | 22 | [font.bold_italic] 23 | style = "Bold Italic" 24 | 25 | [font.italic] 26 | style = "Italic" 27 | 28 | 29 | # [macOS] `^Aw`, pretty much `tmux lsw` 30 | [[keyboard.bindings]] 31 | chars = "\u0001w" 32 | key = "K" 33 | mods = "Command" 34 | 35 | # [linux] make "regular" paste shortcut work 36 | [[keyboard.bindings]] 37 | action = "Paste" 38 | key = "Insert" 39 | mods = "Shift" 40 | 41 | [terminal.shell] 42 | args = ["zsh", "-c", "source ~/.base16_theme; exec-tmux-attach alacritty"] 43 | program = "env" 44 | 45 | [window] 46 | decorations = "full" 47 | startup_mode = "Fullscreen" 48 | title = "Alacritty" 49 | 50 | [general] 51 | 52 | live_config_reload = true 53 | 54 | [terminal] 55 | -------------------------------------------------------------------------------- /karabiner/assets/complex_modifications/1542075239.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Change Poker Keyboard escape behavior", 3 | "rules": [ 4 | { 5 | "description": "Change left option+escape to escape", 6 | "manipulators": [ 7 | { 8 | "type": "basic", 9 | "from": { 10 | "key_code": "escape", 11 | "modifiers": { 12 | "mandatory": [ 13 | "left_option" 14 | ], 15 | "optional": [ 16 | "any" 17 | ] 18 | } 19 | }, 20 | "to": [ 21 | { 22 | "key_code": "escape" 23 | } 24 | ] 25 | } 26 | ] 27 | }, 28 | { 29 | "description": "Change escape to grave accent and tilde", 30 | "manipulators": [ 31 | { 32 | "type": "basic", 33 | "from": { 34 | "key_code": "escape", 35 | "modifiers": { 36 | "optional": [ 37 | "any" 38 | ] 39 | } 40 | }, 41 | "to": [ 42 | { 43 | "key_code": "grave_accent_and_tilde" 44 | } 45 | ] 46 | } 47 | ] 48 | } 49 | ] 50 | } 51 | -------------------------------------------------------------------------------- /zsh/aliases: -------------------------------------------------------------------------------- 1 | # -*- mode: sh; -*- vim: set ft=zsh: 2 | 3 | # aliases that is should be available for non-interactive shell too 4 | 5 | # eza 6 | alias eza="eza --icons --group-directories-first -F --ignore-glob='**/.git|**/.DS_Store'" 7 | alias ls="eza" 8 | alias l="ls -lah --group --git" 9 | alias lt="ls -lah -T -L=3 --git --git-ignore" 10 | alias tree="eza -G -T --git-ignore" 11 | alias treed="tree -D --no-icons" 12 | 13 | # navi 14 | alias navi='navi --print' 15 | alias navie='env navi' 16 | alias navih='navi fn welcome' 17 | 18 | # make ed slightly friendlier 19 | alias ed="ed -p '> '" 20 | # use hired in place of ed when available 21 | fastcommandcheck hired && alias ed="hired -nl" 22 | 23 | # quick way to attach to tmux and zellij 24 | alias tmux-attach="${my_dot_d}/bin/tmux-attach-or-new.sh" 25 | alias exec-tmux-attach="exec ${my_dot_d}/bin/tmux-attach-or-new.sh" 26 | alias zellij-attach="${my_dot_d}/bin/zellij-attach-or-new.sh" 27 | alias exec-zellij-attach="exec ${my_dot_d}/bin/zellij-attach-or-new.sh" 28 | 29 | # to be used for building source code from neovim plugins -- because sometimes they require these processes 30 | alias np-build-via-nix-shell="${my_dot_d}/nvim/shell/build-via-nix-shell.sh" 31 | 32 | is-wsl && alias wudo='python3 ~/.wsl-sudo/wsl-sudo.py' 33 | -------------------------------------------------------------------------------- /karabiner-uk/assets/complex_modifications/1542075239.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Change Poker Keyboard escape behavior", 3 | "rules": [ 4 | { 5 | "description": "Change left option+escape to escape", 6 | "manipulators": [ 7 | { 8 | "type": "basic", 9 | "from": { 10 | "key_code": "escape", 11 | "modifiers": { 12 | "mandatory": [ 13 | "left_option" 14 | ], 15 | "optional": [ 16 | "any" 17 | ] 18 | } 19 | }, 20 | "to": [ 21 | { 22 | "key_code": "escape" 23 | } 24 | ] 25 | } 26 | ] 27 | }, 28 | { 29 | "description": "Change escape to grave accent and tilde", 30 | "manipulators": [ 31 | { 32 | "type": "basic", 33 | "from": { 34 | "key_code": "escape", 35 | "modifiers": { 36 | "optional": [ 37 | "any" 38 | ] 39 | } 40 | }, 41 | "to": [ 42 | { 43 | "key_code": "grave_accent_and_tilde" 44 | } 45 | ] 46 | } 47 | ] 48 | } 49 | ] 50 | } 51 | -------------------------------------------------------------------------------- /nix/nixos/recipes/meta/zerotier.nix: -------------------------------------------------------------------------------- 1 | { 2 | network, 3 | useResolved ? true, 4 | }: 5 | { 6 | config, 7 | lib, 8 | pkgs, 9 | ... 10 | }: 11 | 12 | { 13 | imports = 14 | [ ] 15 | ++ lib.optionals useResolved [ 16 | ../resolved.nix 17 | ]; 18 | # https://discourse.nixos.org/t/mkmerge-as-the-body-of-a-configuration/9666/2 19 | config = lib.mkMerge [ 20 | { 21 | services.zerotierone = { 22 | enable = true; 23 | joinNetworks = [ 24 | network 25 | ]; 26 | }; 27 | } 28 | # fulfill the wish of ./bin/zerotier-dns-client.sh with automation in case of using systemd-resolved 29 | (lib.mkIf useResolved { 30 | systemd.services.zerotier-dns-resolved = { 31 | wantedBy = [ "multi-user.target" ]; 32 | after = [ "zerotierone.service" ]; 33 | 34 | serviceConfig = { 35 | Type = "oneshot"; 36 | Restart = "on-failure"; # https://unix.stackexchange.com/a/777329/396504 37 | }; 38 | 39 | path = [ 40 | config.services.zerotierone.package 41 | pkgs.jq 42 | ]; 43 | script = builtins.readFile ./bin/zerotier-dns-client.sh; 44 | }; 45 | }) 46 | # debug with `systemctl cat zerotier-dns-resolved.service` 47 | ]; 48 | } 49 | -------------------------------------------------------------------------------- /nvim/lua/utils/table.lua: -------------------------------------------------------------------------------- 1 | return { 2 | -- -- usage example 3 | -- local merge = require('utils.table').merge 4 | -- 5 | -- local t1 = { a = 0, b = 2 } 6 | -- local t2 = { a = 1, c = 3 } 7 | -- 8 | -- print( 9 | -- merge(t1,t2) -- basically same as vim.tbl_extend("force",a,b) 10 | -- ) 11 | -- 12 | -- -- this will not work very well with dict-array-mixed-tables 13 | -- 14 | -- -- in those cases just inserting at the end would be an workaround 15 | -- -- assuming `b` is fully array table 16 | -- for _, v in ipairs(b) do 17 | -- table.insert(c, v) 18 | -- end 19 | merge = function(a, b) 20 | -- https://stackoverflow.com/a/71433446/1570165 21 | local c = {} 22 | for k, v in pairs(a) do 23 | c[k] = v 24 | end 25 | for k, v in pairs(b) do 26 | c[k] = v 27 | end 28 | return c 29 | end, 30 | -- -- usage example 31 | -- local keys = require('utils.table').keys 32 | -- keys({ key1 = 1, key2 = 2 }) -- should result to be something like `{ 'key1', 'key2' }` 33 | keys = function(tbl) 34 | -- https://stackoverflow.com/a/12674376/1570165 35 | local keyset = {} 36 | local n = 0 37 | 38 | for k, _ in pairs(tbl) do 39 | n = n + 1 40 | keyset[n] = k 41 | end 42 | return keyset 43 | end, 44 | } 45 | -------------------------------------------------------------------------------- /nix/nixos/recipes/desktop-kde.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib, 4 | config, 5 | ... 6 | }: 7 | 8 | # https://wiki.nixos.org/wiki/KDE 9 | # https://www.reddit.com/r/linux_gaming/comments/d0njrr/to_reduce_cpu_consumption_when_using_kde/ 10 | 11 | # also see ./desktop-gnome.nix 12 | # read this when you go back to gnome - https://discourse.nixos.org/t/gnome-broke-after-trying-plasma/16019/3 13 | let 14 | isGnomeEnabled = config.services.xserver.desktopManager.gnome.enable; 15 | in 16 | { 17 | # https://github.com/NixOS/nixpkgs/issues/75867#issuecomment-974084634 18 | programs.ssh.askPassword = lib.mkIf isGnomeEnabled ( 19 | lib.mkForce "${pkgs.kdePackages.ksshaskpass.out}/bin/ksshaskpass" 20 | ); 21 | 22 | services.displayManager.sddm.enable = true; 23 | services.displayManager.sddm.wayland.enable = true; 24 | services.desktopManager.plasma6.enable = true; 25 | 26 | # for Settings > About this system > More System Information > Firmware Security 27 | services.fwupd.enable = true; 28 | 29 | environment.systemPackages = with pkgs.kdePackages; [ 30 | koi # Theme scheduling for the KDE Plasma Desktop 31 | ]; 32 | 33 | # https://wiki.nixos.org/wiki/KDE_Connect 34 | programs.kdeconnect = { 35 | enable = true; 36 | package = pkgs.kdePackages.kdeconnect-kde; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /nix/nixos/recipes/displaylink.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | # [DisplayLink](https://en.wikipedia.org/wiki/DisplayLink) is a specific technology 4 | { 5 | # https://nixos.wiki/wiki/Displaylink 6 | # first `nix-prefetch-url --name displaylink-580.zip https://www.synaptics.com/sites/default/files/exe_files/2023-08/DisplayLink%20USB%20Graphics%20Software%20for%20Ubuntu5.8-EXE.zip` 7 | services.xserver.videoDrivers = [ "displaylink" "modesetting" ]; 8 | } 9 | 10 | # Initially I ventured out to try setting because my monitor started to not work after I changed the cable from HDMI to DisplayPort 11 | # and this setting actually didn't help (because DisplayLink is a specific technology nothing to do with "regular" display setups) and what actually worked is following: 12 | # - (`cat ~/.config/monitors.xml*` before delete if you want to see) 13 | # - `rm ~/.config/monitors.xml*` via https://askubuntu.com/a/1450629/1666783 14 | # if above doesn't work, try to adjust the refresh rate especially if there are lots of option for certain display 15 | # find out about resolution and refresh rate with `xrandr -q --verbose` 16 | # 17 | # also when screen flickers, try to see if it's a hardware issue by trying different combinations of different cables (in my case even with same speed spec cables, one worked well when the other not) 18 | -------------------------------------------------------------------------------- /nix/darwin/flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "darwin": { 4 | "inputs": { 5 | "nixpkgs": [ 6 | "nixpkgs" 7 | ] 8 | }, 9 | "locked": { 10 | "lastModified": 1750618568, 11 | "narHash": "sha256-w9EG5FOXrjXGfbqCcQg9x1lMnTwzNDW5BMXp8ddy15E=", 12 | "owner": "lnl7", 13 | "repo": "nix-darwin", 14 | "rev": "1dd19f19e4b53a1fd2e8e738a08dd5fe635ec7e5", 15 | "type": "github" 16 | }, 17 | "original": { 18 | "owner": "lnl7", 19 | "ref": "master", 20 | "repo": "nix-darwin", 21 | "type": "github" 22 | } 23 | }, 24 | "nixpkgs": { 25 | "locked": { 26 | "lastModified": 1750730236, 27 | "narHash": "sha256-kSvVRooWR2N54FM8+kM4PrSOwdkIMT+2Ev9/5Y8Xz6g=", 28 | "owner": "nixos", 29 | "repo": "nixpkgs", 30 | "rev": "12e7fcfabf44336d1438962ecf8a3c50caf80e07", 31 | "type": "github" 32 | }, 33 | "original": { 34 | "owner": "nixos", 35 | "ref": "master", 36 | "repo": "nixpkgs", 37 | "type": "github" 38 | } 39 | }, 40 | "root": { 41 | "inputs": { 42 | "darwin": "darwin", 43 | "nixpkgs": "nixpkgs" 44 | } 45 | } 46 | }, 47 | "root": "root", 48 | "version": 7 49 | } 50 | -------------------------------------------------------------------------------- /bin/path/darwin/emacs-opff: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # - opff: `org-protocol://find-file` 4 | # - this is a simple hack that supports ../../../emacs.d/doom.d/modules/my-custom/org/config.el 5 | # - it workarounds the limitation of org-protocol not picking up when Emacs.app was not already running 6 | # - see the usage example at the bottom 7 | 8 | is_running="${1}" 9 | this_URL="${2}" 10 | 11 | if test "${is_running}" = "1"; then 12 | # simply let org-protocol to figure things out when it's already running 13 | open -a Emacs && echo "${this_URL}" | xargs emacsclient 14 | else 15 | # fallback to parse the file path and open via regular file path when it's not running yet 16 | echo "${this_URL}" | sed 's#org-protocol://find-file?path=##' | xargs open -a Emacs 17 | fi 18 | 19 | # Usage example would be 20 | # ```applescript 21 | # -- a little context: https://github.com/xuchunyang/setup-org-protocol-on-mac/issues/6 22 | 23 | # on is_running(appName) 24 | # tell application "System Events" to (name of processes) contains appName 25 | # end is_running 26 | 27 | # on open location this_URL 28 | # if is_running("Emacs") then 29 | # do shell script "zsh -c \"emacs-opff 1 '" & this_URL & "'\"" 30 | # else 31 | # do shell script "zsh -c \"emacs-opff 0 '" & this_URL & "'\"" 32 | # end if 33 | # end open location 34 | # ``` 35 | -------------------------------------------------------------------------------- /bin/tmux-attach-or-new.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ## set path for nix otherwise tmux server can't access some binaries like `fpp` 4 | 5 | if [ -z "$(command -v nix)" ]; then 6 | [ -f ~/.nix-profile/etc/profile.d/nix.sh ] && 7 | . ~/.nix-profile/etc/profile.d/nix.sh 8 | fi 9 | 10 | # try another way next 11 | if [ -z "$(command -v nix)" ]; then 12 | [ -f /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ] && 13 | . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh 14 | fi 15 | 16 | # let brew (binaries) takes more priority then nix in case of apple silicon 17 | if test "Darwin" = "$(uname)" && test "arm64" = "$(uname -m)"; then 18 | [ -x /opt/homebrew/bin/brew ] && eval $(/opt/homebrew/bin/brew shellenv) 19 | fi 20 | 21 | SHELL=$(which zsh) 22 | # set it `default` as default sessions name when no name is given 23 | session_name="${1:-default}" 24 | 25 | # recommended via https://stackoverflow.com/a/49134974/1570165 26 | exec tmux -u new-session -A -s "${session_name}" 27 | # adding `-u` for: 28 | # - Write UTF-8 output to the terminal even if the first environment variable of LC_ALL, LC_CTYPE, or LANG that is set does not contain "UTF-8" or "UTF8". 29 | # - useful when something like Nerd Fonts are not rendering properly over SSH + (remote)TMUX 30 | # - in case the mismatch between the client and server 31 | -------------------------------------------------------------------------------- /nix/pkgs/overlays/darwin.nix: -------------------------------------------------------------------------------- 1 | # to fallback to a darwin channel in case there are issues on certain packages on darwin 2 | self: super: 3 | let 4 | # thanks to https://evanrelf.com/building-x86-64-packages-with-nix-on-apple-silicon 5 | # now I can selectively fallback to a x86_64 when a pacakage doesn't support aarch64 yet 6 | x86_64 = import { system = "x86_64-darwin"; }; 7 | amazon-ecs-cli = x86_64.pkgs.amazon-ecs-cli; 8 | gdb = x86_64.pkgs.gdb; 9 | 10 | # when packages on unstable (in my case, ) is literally to unstable 11 | stable = import { }; 12 | ## commenting below as the unstable channel one is working fine again 13 | # starship = stable.pkgs.starship; 14 | # emacs = stable.pkgs.emacs; 15 | # emacsPackagesFor = stable.pkgs.emacsPackagesFor; 16 | 17 | ## these two lines are just examples 18 | # hello = stable.pkgs.hello; 19 | # bash = stable.pkgs.bash; 20 | in 21 | { 22 | # commenting as the unstable channel one is working fine again 23 | # inherit starship; 24 | inherit amazon-ecs-cli; # from x86 25 | inherit gdb; # from x86 26 | # inherit emacs; # from stable 27 | # inherit emacsPackagesFor; # from stable 28 | ## these two lines are just examples 29 | # inherit hello; # because `inherit stable.pkgs.hello` wouldn't work 30 | # inherit bash; 31 | } 32 | -------------------------------------------------------------------------------- /zsh/integration/fzf: -------------------------------------------------------------------------------- 1 | # -*- mode: sh; -*- vim: set ft=zsh: 2 | 3 | # better history search with fzf via https://nixos.wiki/wiki/Fzf; 4 | # actually now via https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/fzf/fzf.plugin.zsh 5 | 6 | # fzf + fd # fd ignores .gitignore files/directories by default 7 | # default 8 | export FZF_DEFAULT_COMMAND='fd --type f' 9 | # color is based on https://github.com/junegunn/fzf/wiki/Color-schemes#solarized-light 10 | export FZF_DEFAULT_OPTS=' 11 | --height 40% 12 | --layout=reverse 13 | --color fg:240,hl:33,fg+:241,bg+:221,hl+:33 14 | --color info:33,prompt:33,pointer:166,marker:166,spinner:33 15 | ' 16 | 17 | # CTRL-T - Paste the selected files and directories onto the command-line 18 | export FZF_CTRL_T_COMMAND='fd' 19 | export FZF_CTRL_T_OPTS='--preview "preview {}"' 20 | 21 | # ALT-C - cd into the selected directory 22 | export FZF_ALT_C_COMMAND='fd -t d' 23 | export FZF_ALT_C_OPTS='--preview "preview {}"' 24 | 25 | # sourcing itself is being taken care of at `../my_addons/zinit` 26 | # 27 | # 28 | # # free me from having to hold ctrl before `r` or `t` (since my ctrl act as ESC on tap) 29 | # bindkey -M vicmd 'r' fzf-history-widget 30 | # bindkey -M vicmd 't' fzf-file-widget 31 | # above would work with regular vi-mode but conflict with the advanced zvm 32 | # now it's taken care of at `./zvm` 33 | -------------------------------------------------------------------------------- /bin/path/default/teebug: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # teebug: debug with tee! 4 | # 5 | # test using commands below; 6 | # with multiple panes with tmux as described here - https://stackoverflow.com/questions/29274841/stdout-and-stderr-side-by-side-preview 7 | # - `1>/dev/pts/x 2>/dev/pts/y teebug bash -c 'echo out; >&2 echo err'` 8 | 9 | TEEBUG_LOG_PATH="${TEEBUG_LOG_PATH:-${HOME}/.teebug.log/}" 10 | 11 | mkdir -p "${TEEBUG_LOG_PATH}" 12 | file_in="${TEEBUG_LOG_PATH}in" 13 | file_out="${TEEBUG_LOG_PATH}out" 14 | file_err="${TEEBUG_LOG_PATH}err" 15 | 16 | errcho() { 17 | >&2 gum style --foreground 3 "${@}" 18 | } 19 | 20 | errcho 'If this hangs as it waits for /dev/stdin, ^D to force feeding EOF' 21 | errcho "tail -f ${file_in} to debug /dev/stdin" 22 | errcho "tail -f ${file_out} to debug /dev/stdout" 23 | errcho "tail -f ${file_err} to debug /dev/stderr" 24 | 25 | # capture stdin | target redirects stdout to `tee $file_out` and stderr to `tee $file_err` 26 | tee "${file_in}" | "${@}" > >(tee "${file_out}") 2> >(tee "${file_err}" >&2) 27 | # while the stdout and stderr is still "untouched" 28 | # thanks to https://labex.io/tutorials/linux-how-to-use-tee-to-capture-standard-error-417673! 29 | 30 | errcho "tail -f ${file_in} to debug /dev/stdin" 31 | errcho "tail -f ${file_out} to debug /dev/stdout" 32 | errcho "tail -f ${file_err} to debug /dev/stderr" 33 | -------------------------------------------------------------------------------- /nushell/modules/fixtures/linux.nu: -------------------------------------------------------------------------------- 1 | use linux/files.nu * 2 | 3 | # Function to get test cases 4 | export def get-test-cases [] { 5 | let files = (get-files) 6 | [ 7 | { 8 | name: "Battery Power - Discharging" 9 | input: { 10 | adp: $files.adp.off 11 | bat: $files.bat.discharging 12 | } 13 | expected: { source: 'battery', capacity: 0.52, charging: false } 14 | } 15 | { 16 | name: "Battery Power - Discharging" 17 | input: { 18 | adp: $files.adp.off 19 | bat: $files.bat.unknown 20 | } 21 | expected: { source: 'battery', capacity: 0.62, charging: false } 22 | } 23 | { 24 | name: "AC Power - Not Charging" 25 | input: { 26 | adp: $files.adp.on 27 | bat: $files.bat.not_charging 28 | } 29 | expected: { source: 'AC', capacity: 0.57, charging: false } 30 | } 31 | { 32 | name: "AC Power - Not Charging" 33 | input: { 34 | adp: $files.adp.on 35 | bat: $files.bat.unknown 36 | } 37 | expected: { source: 'AC', capacity: 0.62, charging: false } 38 | } 39 | { 40 | name: "AC Power - Charging" 41 | input: { 42 | adp: $files.adp.on 43 | bat: $files.bat.charging 44 | } 45 | expected: { source: 'AC', capacity: 0.83, charging: true } 46 | } 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /nvim/lua/boot/filetype.lua: -------------------------------------------------------------------------------- 1 | -- where I customize editing related behaviours per file type 2 | -- go to `../../ftdetect/all.lua` for detecting files 3 | 4 | -- show some hidden characters 5 | vim.opt.list = true 6 | vim.opt.listchars:append 'tab:> ' 7 | vim.opt.listchars:append 'eol:↵' 8 | vim.opt.listchars:append 'trail:·' 9 | vim.opt.listchars:append 'extends:↷' -- only visible when nowrap 10 | vim.opt.listchars:append 'precedes:↶' -- same as above 11 | 12 | -- fillchars 13 | vim.opt.fillchars:append 'eob: ' -- empty lines at the end of a buffer (the default is '~') 14 | 15 | -- default tabstop - optimized for 2 spaces - this is my go-to option 16 | vim.opt.tabstop = 2 17 | vim.opt.expandtab = true 18 | vim.opt.shiftwidth = 2 19 | vim.opt.softtabstop = 2 20 | 21 | local ftGrp = vim.api.nvim_create_augroup('MyFileTypeAG', { clear = true }) 22 | -- escape for must be tab based files 23 | vim.api.nvim_create_autocmd('FileType', { 24 | pattern = { 25 | 'make', 26 | }, 27 | callback = function() 28 | vim.bo.expandtab = false 29 | end, 30 | group = ftGrp, 31 | }) 32 | 33 | -- reinforce in case a drifted result is found for some filetype due to the usage of other plugins 34 | vim.api.nvim_create_autocmd('FileType', { 35 | pattern = { 36 | 'kdl', 37 | }, 38 | callback = function() 39 | vim.opt.tabstop = 2 40 | end, 41 | group = ftGrp, 42 | }) 43 | -------------------------------------------------------------------------------- /nix/darwin/README.md: -------------------------------------------------------------------------------- 1 | # nix/darwin 2 | 3 | It's an attempt to manage Darwin in a declarative fashion via [nix-darwin](https://github.com/LnL7/nix-darwin). 4 | 5 | Before I attempt to use `nix-darwin` (via [flake.nix](./flake.nix)), I already have been using [home-manager](https://github.com/nix-community/home-manager) which works great cross-platform. 6 | 7 | Currently I'm not interested to manage/control `home-manager` although it's possible. 8 | 9 | _Look at these code as examples:_ 10 | - https://github.com/malob/nixpkgs 11 | - https://github.com/kclejeune/system 12 | - https://github.com/thexyno/nixos-config 13 | 14 | Up until this point, I have not played with flakes before and it was a mysterious dragon to me. 15 | Thankfully these were helpful to get started: 16 | - https://nixos.wiki/wiki/Flakes 17 | - https://www.tweag.io/blog/2020-05-25-flakes/ 18 | - https://xyno.space/post/nix-darwin-introduction 19 | - https://www.lucacambiaghi.com/nixpkgs/readme.html 20 | - https://github.com/LnL7/nix-darwin#flakes-experimental 21 | 22 | Hopefully just doing `cd [to this directory]` and `make switch` should kick start `nix-darwin`. 23 | 24 | At this point, I'm not intended to do anything crazy with [configuration.nix](./configuration.nix) as I hope to maintain the difference between platforms minimal. 25 | So I will just focus on reproducible the configuration of macOS itself. 26 | -------------------------------------------------------------------------------- /nix/nixos/recipes/incus.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | # https://wiki.nixos.org/wiki/Incus 4 | # https://hashnode.adityakumar.xyz/install-incus-on-nixos 5 | { 6 | virtualisation.incus = { 7 | enable = true; 8 | # `incus admin init` to get started but couldn't pass the step with the error below actually... 9 | # 'Error: Failed to create local member network "incusbr0" in project "default": The DNS and DHCP service exited prematurely: exit status 127 ("dnsmasq: error while loading shared libraries: libdbus-1.so.3: cannot open shared object file: No such file or directory")' 10 | ui.enable = true; 11 | }; 12 | 13 | # I will work on more on the other detailed options below as I actually gain the experience with Incus 14 | 15 | # https://scvalex.net/posts/54/ 16 | # https://developers.redhat.com/blog/2020/08/18/iptables-the-two-variants-and-their-relationship-with-nftables#two_variants_of_the_iptables_command 17 | networking.nftables.enable = true; 18 | 19 | # https://wiki.nixos.org/wiki/Incus#Networking/Firewall 20 | networking.firewall.interfaces.incusbr0 = { 21 | allowedTCPPorts = [ 22 | 53 23 | 67 24 | ]; 25 | allowedUDPPorts = [ 26 | 53 27 | 67 28 | ]; 29 | }; 30 | # or below as replacement of above 31 | # networking.firewall.trustedInterfaces = [ "incusbr0" ]; 32 | 33 | security.apparmor.enable = true; # requires reboot 34 | } 35 | -------------------------------------------------------------------------------- /zsh/fn/theme: -------------------------------------------------------------------------------- 1 | # -*- mode: sh; -*- vim: set ft=zsh: 2 | 3 | export BASE16_SHELL="${XDG_CONFIG_HOME}/base16-shell" 4 | 5 | function _change_my_base16_theme() { 6 | # helper functions to make theme tone changes and that to be followable by other tools 7 | _update_theme_changed_time() { 8 | # let external tools to have a chance to follow the change and adopt to it 9 | date +%s > ~/.base16_theme.updated-time 10 | } 11 | 12 | if is-ssh; then 13 | if echo "${INSIDE_EMACS}" | grep tramp >/dev/null; then 14 | echo 'abort changing base16-shell when accessed via TRAMP' 15 | return 16 | elif command -v gum >/dev/null; then 17 | gum confirm "You appeared to be connected via SSH and this will change the theme on remote machine not client, still proceed?" && 18 | true || 19 | return 20 | else 21 | echo 'abort changing base16-shell when accessed via SSH' 22 | return 23 | fi 24 | fi 25 | 26 | # change theme manually - by coping how base16-shell theme change works 27 | ln -sf "${BASE16_SHELL}/scripts/base16-solarized-${1}.sh" ~/.base16_theme 28 | 29 | # and source the new one 30 | source ~/.base16_theme 31 | 32 | # update time to trigger notify subscribers too 33 | _update_theme_changed_time 34 | } 35 | 36 | light() { 37 | _change_my_base16_theme light 38 | } 39 | 40 | dark() { 41 | _change_my_base16_theme dark 42 | } 43 | -------------------------------------------------------------------------------- /nix/pkgs/lang/support.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: 2 | 3 | let 4 | checkEnv = import ../../utils/checkEnv.nix; 5 | ifEnv = envName: pkgs.lib.optionals (checkEnv envName); 6 | gitwatch = import ../custom/gitwatch.nix { pkgs = pkgs; }; 7 | in 8 | with pkgs; 9 | [ 10 | efm-langserver # General purpose Language Server 11 | emacs-lsp-booster # Emacs LSP performance booster - ../../../emacs.d/doom.d/modules/tools/lsp-support 12 | ] 13 | ++ ifEnv "MY_NIX_EXTRA_GIT" [ 14 | git-lfs # git extention for large file storage 15 | pre-commit # for managing multi-language pre-commit hooks 16 | gitwatch # Watch a file or folder and automatically commit changes to a git repo easily. 17 | # these below are technically not directly related to git - so maybe one day I will make its own category 18 | src-cli # Sourcegraph CLI 19 | comby # Tool for searching and changing code structure 20 | ] 21 | ++ 22 | ifEnv "MY_NIX_EXTRA_DEVENV" 23 | # devenv is not a language but help a quick setup of a dev environment for many languages 24 | # - https://devenv.sh/languages/ 25 | # - https://github.com/cachix/devenv/blob/main/examples/supported-languages/devenv.nix 26 | [ 27 | devenv # Fast, Declarative, Reproducible, and Composable Developer Environments 28 | devbox # same goal as devenv but approaches are different 29 | ] 30 | ++ ifEnv "MY_NIX_EXTRA_EXERCISM" [ 31 | exercism # CLI for exercism.org 32 | ] 33 | -------------------------------------------------------------------------------- /bin/path/darwin/open-gui-emacs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # this script can be called from an Automator app to mitigate https://github.com/nix-community/home-manager/issues/1341 4 | # and put the (Automator) app in either /Applications or ~/Applications so either Spotlight or Alfred can open (or activate the (Emacs) app quickly 5 | # Also avoid naming the Automator app "Emacs.app" to prevent collision with "~/.nix-profile/Applications/Emacs.app" on `"Emacs" to activate` Applescript side - For example, name it to "OpenEmacs.app" 6 | # 7 | # If OpenEmacs.app doesn't open emacs, possibly due to another Automator run might be stuck 8 | # "OpenEmacs.app" is not necessary to have when running ../../../nix/darwin/configuration.nix - but alfred/spotlight might need to clear/rebuild cache 9 | 10 | _try_open() { 11 | test -d "${1}" && open -a "${1}" 12 | } 13 | 14 | osascript -e 'if application "Emacs" is not running then 15 | error "emacs is not running" 16 | end if' 2> /dev/null && { 17 | osascript -e 'tell application "Emacs" to activate' 18 | } || { 19 | # Try three potential locations - all or some of them could be valid 20 | _try_open "${HOME}/Applications/Nix Apps/Applications/Emacs.app" \ 21 | || _try_open "${HOME}/Applications/Nix Apps/Emacs.app" \ 22 | || _try_open "${HOME}/.nix-profile/Applications/Emacs.app" \ 23 | || { echo 'Failed to open as Emacs.app is not discovered'; exit 1; } 24 | } 25 | --------------------------------------------------------------------------------