diff --git a/assets/sound/invoke.wav b/assets/sound/invoke.wav new file mode 100644 index 0000000..d3f75a8 Binary files /dev/null and b/assets/sound/invoke.wav differ diff --git a/docs/options/home_options.md b/docs/options/home_options.md index 4eec1d4..5163292 100755 --- a/docs/options/home_options.md +++ b/docs/options/home_options.md @@ -192,34 +192,3 @@ - *Type*: Boolean - *Default*: `true` - *Defined in*: `modules/home/programs/bat.nix` - ---- - - - **movScripts** - - - **enable** - - Enables all custom script binaries. - - *Type*: Boolean - - *Default*: `true` - - *Defined in*: `modules/home/scripts/default.nix` - - - **commandScripts** - - **enable** - - Enables my custom command scripts. - - *Type*: Boolean - - *Default*: `true` - - *Defined in*: `modules/home/scripts/default.nix` - - - **hyprlandControls** - - **enable** - - Enables my Hyprland control shortcut scripts. - - *Type*: Boolean - - *Default*: `true` - - *Defined in*: `modules/home/scripts/default.nix` - - - **nixShortcuts** - - **enable** - - Enables my NixOS alias scripts. - - *Type*: Boolean - - *Default*: `true` - - *Defined in*: `modules/home/scripts/default.nix` diff --git a/docs/scripts.md b/docs/scripts.md new file mode 100644 index 0000000..16d215f --- /dev/null +++ b/docs/scripts.md @@ -0,0 +1,208 @@ +# pagedMov's scripts + +--- + +This document contains information about the scripts I've written for this configuration. All of the scripts listed here are +included in my nixpkgs overlay as custom packages, and these packages are declared in the configuration in the file +`modules/home/env/userpkgs.nix` + +- **icanhazip** + - **Description**: + - Leverages `ip` and `icanhazip.com` to return relevant IP information for the current machine. + - **Usage**: + - `icanhazip` - Returns public IP, local IP, and default gateway. + - `icanhazip -p` - Returns only public IP. + - `icanhazip -l` - Returns only local IP. + - `icanhazip -d` - Returns only default gateway. + - *Defined in*: `modules/home/scripts/commands/icanhazip.nix` + +--- + +- **invoke** + - **Description**: + - Leverages `nix run` to run any command once. Works with arguments. + - **Usage**: + - `invoke ` + - **Example**: + - `invoke hello` + - *Defined in*: `modules/home/scripts/commands/invoke.nix` + +--- + +- **runbg** + - **Description**: + - Runs a command and detaches the process from the shell silently. Works with arguments. + - Credit to [Frost-Phoenix](https://github.com/Frost-Phoenix) for writing this script. + - **Usage**: + - `runbg ` + - **Example**: + - `runbg waybar` + - *Defined in*: `modules/home/scripts/commands/runbg.nix` + +--- + +- **toolbelt** + - **Description**: + - Opens a fuzzyfinder window with some useful utilities. + - Meant to be used with the `Super + P` bind defined in `hyprland.nix`, and not invoked directly from the shell. + - *Defined in*: `modules/home/scripts/commands/toolbelt.nix` + +--- + +- **viconf** + - **Description**: + - Searches the directory held in the `$FLAKEPATH` environment variable for a given Nix file or directory name. + - Opens the file in Neovim, or if there are multiple matches, opens a fuzzyfinder window to allow you to choose one. + - **Usage**: + - `viconf ` + - **Examples**: + - `viconf hyprland` - Opens `$FLAKEPATH/modules/home/environment/hyprland.nix`. + - `viconf sys` - Opens a fuzzyfinder window containing all Nix files in `modules/sys` and its subdirectories. + - `viconf config` - Opens a fuzzyfinder window containing all Nix files called `config.nix`. + - `viconf scripts/def` - Opens `$FLAKEPATH/modules/home/scripts/default.nix`. + - *Defined in*: `modules/home/scripts/commands/viconf.nix` + +--- + +- **vipkg** + - **Description**: + - Searches the `pkgs` directory from the Nixpkgs GitHub repository. + - Works almost identically to `viconf` with a few tweaks to accommodate the different directory structure. + - Useful for overriding a package's build attributes or searching for a package name. + - **Usage**: + - `vipkg ` + - **Example**: + - `vipkg neofetch` - Opens `nixpkgs/pkgs/tools/misc/neofetch/default.nix`. + - *Defined in*: `modules/home/scripts/commands/vipkg.nix` + +--- + +- **fetchfromgh** + - **Description**: + - Given a username and repo name like `someuser/somerepo`, generates a full `pkgs.fetchFromGitHub` call. Uses the most recent commit. + - **Usage**: + - `fetchfromgh someuser/somerepo` + - **Example**: + - `fetchfromgh pagedMov/nixos-config` + - Returns: + ``` + src = pkgs.fetchFromGitHub { + owner = "pagedMov"; + repo = "nixos-config"; + rev = "fcf19c65971c667f67abf57bcaf88be410fb0759"; + hash = "sha256-z+3E+ueSd2QNqtrbBKt8bwIfboPCXSUrGn690Hc/kl0="; + }; + ``` + - *Defined in*: `modules/home/scripts/nix/fetchfromgh.nix` + +--- + +- **garbage-collect** + - **Description**: + - Runs the Nix garbage collector and also deletes all files in `.local/share/Trash`. + - **Usage**: + - `garbage-collect` - Does not take any arguments. + - *Defined in*: `modules/home/scripts/nix/garbage-collect.nix` + +--- + +- **nsp** + - **Description**: + - Simple alias for `nix-shell -p`. + - **Usage**: + - `nsp ` + - **Example**: + - `nsp hello` + - *Defined in*: `modules/home/scripts/nix/nsp.nix` + +--- + +- **rebuild** + - **Description**: + - Combines `nh os switch` and `nh home switch` into a single command. + - **Usage**: + - `rebuild -h` - Runs `nh home switch -c $FLAKEPATH` + - `rebuild -s` - Runs `nh os switch -H $FLAKEPATH` + - `rebuild -a` - Runs both of the above commands. + - Adding `n` before any flag (e.g., `rebuild -na`) performs a dry run. + - *Defined in*: `modules/home/scripts/nix/rebuild.nix` + +--- + +*Note*: None of the following scripts are meant to be invoked directly in the terminal and are primarily used as helpers for other scripts. However, they are documented here in case you wish to use them in your own scripts. + +--- + +- **chscheme** + - **Description**: + - Opens an `fzf` menu containing all of the color schemes available in the `base16schemes` package from Nixpkgs. + - The `fzf` preview shows the colors so you can see them in your terminal before choosing one. + - **Usage**: + - `chscheme` - Does not take arguments. + - *Defined in*: `modules/home/scripts/wm-controls/chscheme.nix` + +--- + +- **chpaper** + - **Description**: + - Opens an `fzf` menu containing all wallpapers in `$FLAKEPATH/assets/wallpapers`. + - The `fzf` preview shows the image file the user is hovering over. + - **Usage**: + - `chpaper` - Does not take arguments. + - *Defined in*: `modules/home/scripts/wm-controls/chpaper.nix` + +--- + +- **keyring** + - **Description**: + - Opens an `fzf` menu containing all directories/files in `~/.password-store`. + - Selecting an entry uses `pass -c` to copy it to the clipboard. + - Temporarily pauses the clipboard history daemon to ensure the password is not added to clipboard history. + - Automatically clears the password from the clipboard after 10 seconds unless overwritten. + - **Usage**: + - `keyring` - Does not take arguments. + - *Defined in*: `modules/home/scripts/wm-controls/keyring.nix` + +--- + +- **mkscreenshots** + - **Description**: + - Switches to workspace 4 (if empty) and takes screenshots showcasing the desktop environment. + - Saves the screenshots to `$FLAKEPATH/assets/screens`, overwriting the old ones. + - Updates `README.md` to include the commit hash of the current screenshots. + - **Usage**: + - `mkscreenshots` - Does not take arguments. Only runs if workspace 4 has no windows. + - *Defined in*: `modules/home/scripts/wm-controls/mkscreenshots.nix` + +--- + +- **moveonscreen** + - **Description**: + - Uses `hyprctl` to move the currently active floating window relative to the cursor. + - Prevents the window from moving outside the screen bounds. + - Often used with `toolbelt` for smooth window movements. + - **Usage**: + - `moveonscreen` - Moves the window to the cursor's position, anchored at the top-left corner. + - `moveonscreen --center` - Moves the window to the cursor's position, anchored at the center of the window. + - *Defined in*: `modules/home/scripts/wm-controls/moveonscreen.nix` + +--- + +- **s_check** + - **Description**: + - Tests whether `$SOUNDS_ENABLED` is set to `0` or `1`. + - Does not return anything except the status code from the test. + - *Note*: This does not work as a Zsh alias for unknown reasons. + - **Usage**: + - `s_check` - Does not take arguments. + - *Defined in*: `modules/home/scripts/wm-controls/switchmon.nix` + +--- + +- **switchmon** + - **Description**: + - Uses `hyprctl` to switch focus between two monitors. + - Only supports setups with two monitors. + - **Usage**: + - `switchmon` - Does not take arguments. + - *Defined in*: `modules/home/scripts/wm-controls/switchmon.nix` diff --git a/docs/scripts/commands.md b/docs/scripts/commands.md deleted file mode 100644 index bc17da3..0000000 --- a/docs/scripts/commands.md +++ /dev/null @@ -1,70 +0,0 @@ -# pagedMov's Custom Command Scripts - -- **icanhazip** - - **Description**: - - Leverages `ip` and `icanhazip.com` to return relevant IP information for the current machine. - - **Usage**: - - `icanhazip` - Returns public IP, local IP, and default gateway. - - `icanhazip -p` - Returns only public IP. - - `icanhazip -l` - Returns only local IP. - - `icanhazip -d` - Returns only default gateway. - - *Defined in*: `modules/home/scripts/commands/icanhazip.nix` - ---- - -- **invoke** - - **Description**: - - Leverages `nix run` to run any command once. Works with arguments. - - **Usage**: - - `invoke ` - - **Example**: - - `invoke hello` - - *Defined in*: `modules/home/scripts/commands/invoke.nix` - ---- - -- **runbg** - - **Description**: - - Runs a command and detaches the process from the shell silently. Works with arguments. - - Credit to [Frost-Phoenix](https://github.com/Frost-Phoenix) for writing this script. - - **Usage**: - - `runbg ` - - **Example**: - - `runbg waybar` - - *Defined in*: `modules/home/scripts/commands/runbg.nix` - ---- - -- **toolbelt** - - **Description**: - - Opens a fuzzyfinder window with some useful utilities. - - Meant to be used with the `Super + P` bind defined in `hyprland.nix`, and not invoked directly from the shell. - - *Defined in*: `modules/home/scripts/commands/toolbelt.nix` - ---- - -- **viconf** - - **Description**: - - Searches the directory held in the `$FLAKEPATH` environment variable for a given Nix file or directory name. - - Opens the file in Neovim, or if there are multiple matches, opens a fuzzyfinder window to allow you to choose one. - - **Usage**: - - `viconf ` - - **Examples**: - - `viconf hyprland` - Opens `$FLAKEPATH/modules/home/environment/hyprland.nix`. - - `viconf sys` - Opens a fuzzyfinder window containing all Nix files in `modules/sys` and its subdirectories. - - `viconf config` - Opens a fuzzyfinder window containing all Nix files called `config.nix`. - - `viconf scripts/def` - Opens `$FLAKEPATH/modules/home/scripts/default.nix`. - - *Defined in*: `modules/home/scripts/commands/viconf.nix` - ---- - -- **vipkg** - - **Description**: - - Searches the `pkgs` directory from the Nixpkgs GitHub repository. - - Works almost identically to `viconf` with a few tweaks to accommodate the different directory structure. - - Useful for overriding a package's build attributes or searching for a package name. - - **Usage**: - - `vipkg ` - - **Example**: - - `vipkg neofetch` - Opens `nixpkgs/pkgs/tools/misc/neofetch/default.nix`. - - *Defined in*: `modules/home/scripts/commands/vipkg.nix` diff --git a/docs/scripts/nixshortcuts.md b/docs/scripts/nixshortcuts.md deleted file mode 100644 index e73d26d..0000000 --- a/docs/scripts/nixshortcuts.md +++ /dev/null @@ -1,51 +0,0 @@ -# pagedMov's Nix Aliases - -- **fetchfromgh** - - **Description**: - - Given a username and repo name like `someuser/somerepo`, generates a full `pkgs.fetchFromGitHub` call. Uses the most recent commit. - - **Usage**: - - `fetchfromgh someuser/somerepo` - - **Example**: - - `fetchfromgh pagedMov/nixos-config` - - Returns: - ``` - src = pkgs.fetchFromGitHub { - owner = "pagedMov"; - repo = "nixos-config"; - rev = "fcf19c65971c667f67abf57bcaf88be410fb0759"; - hash = "sha256-z+3E+ueSd2QNqtrbBKt8bwIfboPCXSUrGn690Hc/kl0="; - }; - ``` - - *Defined in*: `modules/home/scripts/nix/fetchfromgh.nix` - ---- - -- **garbage-collect** - - **Description**: - - Runs the Nix garbage collector and also deletes all files in `.local/share/Trash`. - - **Usage**: - - `garbage-collect` - Does not take any arguments. - - *Defined in*: `modules/home/scripts/nix/garbage-collect.nix` - ---- - -- **nsp** - - **Description**: - - Simple alias for `nix-shell -p`. - - **Usage**: - - `nsp ` - - **Example**: - - `nsp hello` - - *Defined in*: `modules/home/scripts/nix/nsp.nix` - ---- - -- **rebuild** - - **Description**: - - Combines `nh os switch` and `nh home switch` into a single command. - - **Usage**: - - `rebuild -h` - Runs `nh home switch -c $FLAKEPATH` - - `rebuild -s` - Runs `nh os switch -H $FLAKEPATH` - - `rebuild -a` - Runs both of the above commands. - - Adding `n` before any flag (e.g., `rebuild -na`) performs a dry run. - - *Defined in*: `modules/home/scripts/nix/rebuild.nix` diff --git a/docs/scripts/wmcontrols.md b/docs/scripts/wmcontrols.md deleted file mode 100644 index 1ef8ba3..0000000 --- a/docs/scripts/wmcontrols.md +++ /dev/null @@ -1,79 +0,0 @@ -# Custom Hyprland Controls - -*Note*: None of these are meant to be invoked directly in the terminal and are primarily used as helpers for other scripts. However, they are documented here in case you wish to use them in your own scripts. - ---- - -- **chscheme** - - **Description**: - - Opens an `fzf` menu containing all of the color schemes available in the `base16schemes` package from Nixpkgs. - - The `fzf` preview shows the colors so you can see them in your terminal before choosing one. - - **Usage**: - - `chscheme` - Does not take arguments. - - *Defined in*: `modules/home/scripts/wm-controls/chscheme.nix` - ---- - -- **chpaper** - - **Description**: - - Opens an `fzf` menu containing all wallpapers in `$FLAKEPATH/assets/wallpapers`. - - The `fzf` preview shows the image file the user is hovering over. - - **Usage**: - - `chpaper` - Does not take arguments. - - *Defined in*: `modules/home/scripts/wm-controls/chpaper.nix` - ---- - -- **keyring** - - **Description**: - - Opens an `fzf` menu containing all directories/files in `~/.password-store`. - - Selecting an entry uses `pass -c` to copy it to the clipboard. - - Temporarily pauses the clipboard history daemon to ensure the password is not added to clipboard history. - - Automatically clears the password from the clipboard after 10 seconds unless overwritten. - - **Usage**: - - `keyring` - Does not take arguments. - - *Defined in*: `modules/home/scripts/wm-controls/keyring.nix` - ---- - -- **mkscreenshots** - - **Description**: - - Switches to workspace 4 (if empty) and takes screenshots showcasing the desktop environment. - - Saves the screenshots to `$FLAKEPATH/assets/screens`, overwriting the old ones. - - Updates `README.md` to include the commit hash of the current screenshots. - - **Usage**: - - `mkscreenshots` - Does not take arguments. Only runs if workspace 4 has no windows. - - *Defined in*: `modules/home/scripts/wm-controls/mkscreenshots.nix` - ---- - -- **moveonscreen** - - **Description**: - - Uses `hyprctl` to move the currently active floating window relative to the cursor. - - Prevents the window from moving outside the screen bounds. - - Often used with `toolbelt` for smooth window movements. - - **Usage**: - - `moveonscreen` - Moves the window to the cursor's position, anchored at the top-left corner. - - `moveonscreen --center` - Moves the window to the cursor's position, anchored at the center of the window. - - *Defined in*: `modules/home/scripts/wm-controls/moveonscreen.nix` - ---- - -- **s_check** - - **Description**: - - Tests whether `$SOUNDS_ENABLED` is set to `0` or `1`. - - Does not return anything except the status code from the test. - - *Note*: This does not work as a Zsh alias for unknown reasons. - - **Usage**: - - `s_check` - Does not take arguments. - - *Defined in*: `modules/home/scripts/wm-controls/switchmon.nix` - ---- - -- **switchmon** - - **Description**: - - Uses `hyprctl` to switch focus between two monitors. - - Only supports setups with two monitors. - - **Usage**: - - `switchmon` - Does not take arguments. - - *Defined in*: `modules/home/scripts/wm-controls/switchmon.nix` diff --git a/docs/sounds.md b/docs/sounds.md new file mode 100644 index 0000000..7f27349 --- /dev/null +++ b/docs/sounds.md @@ -0,0 +1,42 @@ +# Terminal Sound Effects + +--- + +My zsh configuration has several aliases and wrapper functions that essentially wrap commands such that they play a sound effect when +invoked. The sound effects are from Earthbound, and are stored in `assets/sound`. Notable examples include `ls` and `cd` which +both play a sound when invoked, among some of the other common utilities, for both GNU and NixOS. If you wish to disable these sound +effects, you can do so by changing the `SOUNDS_ENABLED` environment variable defined in `modules/home/environment/zsh/env.nix` from `true` to `false`. + +--- + +The aliases and commands which use sound effects are: + +- `grimblast` + - Uses: `assets/sound/screenshot.wav` + +- `ls` + - Uses: `assets/sound/ls.wav` + +- `cd` + - Uses: `assets/sound/cd.wav` + +- `gcomm (alias for 'git commit')` + - Uses: `assets/sound/gitcommit.wav` + +- `gpush (alias for 'git push')` + - Uses: `assets/sound/` + +- `gpull (alias for 'git pull')` + - Uses: `assets/sound/gitpull.wav` + +- `greb (alias for 'git rebase')` + - Uses: `assets/sound/gitrebase.wav` + +- `ga (alias for 'git add')` + - Uses: `assets/sound/gitadd.wav` + +- `gtp (alias for 'gtrash put')` + - Uses: `assets/sound/rm.wav` + +- `rebuild` + - Uses: `assets/sound/update.wav` or `assets/sound/error.wav` diff --git a/modules/home/environment/userpkgs.nix b/modules/home/environment/userpkgs.nix index 3dc5163..c63e475 100755 --- a/modules/home/environment/userpkgs.nix +++ b/modules/home/environment/userpkgs.nix @@ -44,6 +44,7 @@ in { config = lib.mkIf config.movOpts.envConfig.userPkgs.enable { home.packages = with pkgs; [ nemo + feh yubikey-manager yubikey-personalization gtk3 diff --git a/modules/home/environment/zsh/env.nix b/modules/home/environment/zsh/env.nix index 6925825..f1e205b 100644 --- a/modules/home/environment/zsh/env.nix +++ b/modules/home/environment/zsh/env.nix @@ -7,7 +7,7 @@ config = lib.mkIf config.movOpts.envConfig.zshConfig.envVariables.enable { programs.zsh = { sessionVariables = { - SOUNDS_ENABLED = "1"; + SOUNDS_ENABLED = "true"; EDITOR = "nvim"; SUDO_EDITOR = "nvim"; VISUAL = "nvim"; diff --git a/modules/home/environment/zsh/extraconfig.nix b/modules/home/environment/zsh/extraconfig.nix index 991e879..24cbd67 100644 --- a/modules/home/environment/zsh/extraconfig.nix +++ b/modules/home/environment/zsh/extraconfig.nix @@ -18,6 +18,14 @@ runbg aplay "$1" fi } + build-drv() { # Put the derivation path in $RESULT instead of making a 'result' symlink + RESULT=$(nix-build "$@" --no-link) + if [ -z "$RESULT" ]; then + return 1 + fi + export RESULT + echo "\$RESULT = $RESULT" + } ssh() { # reverts ssh theme upon returning command ssh "$@" kitty_ssh_theme @@ -149,8 +157,6 @@ { eval "$(starship init zsh)" } - unalias ls - clear playshellsound ${self}/assets/sound/sh-source.wav [ ! -f $FLAKEPATH/flake.nix ] && echo "WARNING: flake.nix not found at \$FLAKEPATH. Shell aliases for editing config files won't work correctly!" && echo "Edit the FLAKEPATH session variable in zshell.nix to point to the path where you saved the system configuration flake." ''; diff --git a/overlay/overlay.nix b/overlay/overlay.nix index 185a31e..aead2a9 100644 --- a/overlay/overlay.nix +++ b/overlay/overlay.nix @@ -9,7 +9,7 @@ myScripts = { # Scripts written using pkgs.writeShellApplication icanhazip = super.callPackage ./scripts/commands/icanhazip.nix { pkgs = super; }; - invoke = super.callPackage ./scripts/commands/invoke.nix { pkgs = super; }; + invoke = super.callPackage ./scripts/commands/invoke.nix { pkgs = super; self = root; }; runbg = super.callPackage ./scripts/commands/runbg.nix { pkgs = super; }; splash = super.callPackage ./scripts/commands/splash.nix { pkgs = super; }; toolbelt = super.callPackage ./scripts/commands/toolbelt.nix { pkgs = super; }; diff --git a/overlay/scripts/commands/invoke.nix b/overlay/scripts/commands/invoke.nix index 7aabfcd..bb41979 100755 --- a/overlay/scripts/commands/invoke.nix +++ b/overlay/scripts/commands/invoke.nix @@ -1,9 +1,10 @@ -{ pkgs }: +{ pkgs, self }: pkgs.writeShellApplication { name = "invoke"; text = '' cmd="$1" shift + playshellsound ${self}/assets/sound/invoke.wav nix run nixpkgs#"$cmd" -- "$@" ''; } diff --git a/overlay/scripts/wm-controls/s_check.nix b/overlay/scripts/wm-controls/s_check.nix index d1f8240..3c76c84 100755 --- a/overlay/scripts/wm-controls/s_check.nix +++ b/overlay/scripts/wm-controls/s_check.nix @@ -4,6 +4,6 @@ pkgs.writeShellApplication { text = '' #!/run/current-system/sw/bin/bash - [ "$SOUNDS_ENABLED" -eq 1 ] + [ "$SOUNDS_ENABLED" = "true" ] ''; }