Script Documentation - km-clay/nixos-config GitHub Wiki
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
overlay/env/userpkgs.nix
-
icanhazip
-
Description:
- Leverages
ipandicanhazip.comto return relevant IP information for the current machine.
- Leverages
-
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:
overlay/scripts/commands/icanhazip.nix
-
Description:
-
invoke
-
Description:
- Leverages
nix runto run any command once, including commands that are not installed. Works with arguments.
- Leverages
-
Usage:
invoke <command>
-
Example:
invoke hello
-
Defined in:
overlay/scripts/commands/invoke.nix
-
Description:
-
runbg
-
Description:
- Runs a command and detaches the process from the shell silently. Works with arguments.
- Credit to Frost-Phoenix for writing this script.
-
Usage:
runbg <command> <args>
-
Example:
runbg waybar
-
Defined in:
overlay/scripts/commands/runbg.nix
-
Description:
-
git-compose
-
Description:
- To be used in a git repository. Opens an interactive neovim session containing all currently uncommitted changes. Allows you to group files together and give individual commit messages to each group of files. Automatically creates commits for the file groups with the given commit messages.
-
Usage:
git-compose (inside of a git repository)
-
Defined in:
overlay/scripts/commands/git-compose.nix
-
Description:
-
toolbelt
-
Description:
- Opens a fuzzyfinder window with some useful utilities.
- Meant to be used with the
Super + Pbind defined inhyprland.nix, and not invoked directly from the shell.
-
Defined in:
overlay/scripts/commands/toolbelt.nix
-
Description:
-
viconf
-
Description:
- Searches the directory held in the
$FLAKEPATHenvironment 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.
- Searches the directory held in the
-
Usage:
viconf <part of path or filename>
-
Examples:
-
viconf hyprland- Opens$FLAKEPATH/overlay/environment/hyprland.nix. -
viconf sys- Opens a fuzzyfinder window containing all Nix files inmodules/sysand its subdirectories. -
viconf config- Opens a fuzzyfinder window containing all Nix files calledconfig.nix. -
viconf scripts/def- Opens$FLAKEPATH/overlay/scripts/default.nix.
-
-
Defined in:
overlay/scripts/commands/viconf.nix
-
Description:
-
vipkg
-
Description:
- Searches the
pkgsdirectory from the Nixpkgs GitHub repository. - Works almost identically to
viconfwith a few tweaks to accommodate the different directory structure. - Useful for overriding a package's build attributes or searching for a package name.
- Searches the
-
Usage:
vipkg <part of package name>
-
Example:
-
vipkg neofetch- Opensnixpkgs/pkgs/tools/misc/neofetch/default.nix.
-
-
Defined in:
overlay/scripts/commands/vipkg.nix
-
Description:
-
fetchfromgh
-
Description:
- Given a username and repo name like
someuser/somerepo, generates a fullpkgs.fetchFromGitHubcall. Uses the most recent commit.
- Given a username and repo name like
-
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="; };
- Returns:
-
-
Defined in:
overlay/scripts/nix/fetchfromgh.nix
-
Description:
-
garbage-collect
-
Description:
- Runs the Nix garbage collector and also deletes all files in
.local/share/Trash.
- Runs the Nix garbage collector and also deletes all files in
-
Usage:
-
garbage-collect- Does not take any arguments.
-
-
Defined in:
overlay/scripts/nix/garbage-collect.nix
-
Description:
-
nsp
-
Description:
- Simple alias for
nix-shell -p.
- Simple alias for
-
Usage:
nsp <package name>
-
Example:
nsp hello
-
Defined in:
overlay/scripts/nix/nsp.nix
-
Description:
-
rebuild
-
Description:
- Combines
nh os switchandnh home switchinto a single command.
- Combines
-
Usage:
-
rebuild -h- Runsnh home switch -c <currenthostname> $FLAKEPATH -
rebuild -s- Runsnh os switch -H <currenthostname> $FLAKEPATH -
rebuild -a- Runs both of the above commands. - Adding
nbefore any flag (e.g.,rebuild -na) performs a dry run.
-
-
Defined in:
overlay/scripts/nix/rebuild.nix
-
Description:
-
mntstack
-
Description:
- Keeps mounts in a stack and allows you to easily mount and then unmount volumes in the same order that they were mounted. Useful for quickly setting up and tearing down chroot environments.
-
Usage:
-
mntstack push </device/path> </mount/point/path>-Mount the device and push an entry into the stack -
mntstack push --bind </directory/path> </mount/point/path>-Use bind to mount directories -
mntstack pop-Unmounts and removes the most recently mounted volume -
mntstack pop -c #-Pops a given number of mounts -
mntstack pop -a-Pops the entire stack -
mntstack list-Shows the current stack, and the order which they will be popped in
-
-
Defined in:
overlay/scripts/misc/mntstack.nix
-
Description:
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
fzfmenu containing all of the color schemes available in thebase16schemespackage from Nixpkgs. - The
fzfpreview shows the colors so you can see them in your terminal before choosing one.
- Opens an
-
Usage:
-
chscheme- Does not take arguments.
-
-
Defined in:
overlay/scripts/wm-controls/chscheme.nix
-
Description:
-
chpaper
-
Description:
- Opens an
fzfmenu containing all wallpapers in$FLAKEPATH/assets/wallpapers. - The
fzfpreview shows the image file the user is hovering over.
- Opens an
-
Usage:
-
chpaper- Does not take arguments.
-
-
Defined in:
overlay/scripts/wm-controls/chpaper.nix
-
Description:
-
keyring
-
Description:
- Opens an
fzfmenu containing all directories/files in~/.password-store. - Selecting an entry uses
pass -cto 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.
- Opens an
-
Usage:
-
keyring- Does not take arguments.
-
-
Defined in:
overlay/scripts/wm-controls/keyring.nix
-
Description:
-
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.mdto include the commit hash of the current screenshots.
-
Usage:
-
mkscreenshots- Does not take arguments. Only runs if workspace 4 has no windows.
-
-
Defined in:
overlay/scripts/wm-controls/mkscreenshots.nix
-
Description:
-
moveonscreen
-
Description:
- Uses
hyprctlto move the currently active floating window relative to the cursor. - Prevents the window from moving outside the screen bounds.
- Often used with
toolbeltfor smooth window movements.
- Uses
-
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:
overlay/scripts/wm-controls/moveonscreen.nix
-
Description:
-
s_check
-
Description:
- Tests whether
$SOUNDS_ENABLEDis set to0or1. - Does not return anything except the status code from the test.
- Note: This does not work as a Zsh alias for unknown reasons.
- Tests whether
-
Usage:
-
s_check- Does not take arguments.
-
-
Defined in:
overlay/scripts/wm-controls/switchmon.nix
-
Description:
-
switchmon
-
Description:
- Uses
hyprctlto switch focus between two monitors. - Only supports setups with two monitors.
- Uses
-
Usage:
-
switchmon- Does not take arguments.
-
-
Defined in:
overlay/scripts/wm-controls/switchmon.nix
-
Description:
-
color-commit
-
Description:
- Colorizes the output of
git commitif piped into it via stdin
- Colorizes the output of
-
Usage:
git commit -m "message" | color-commit
-
Defined in:
overlay/scripts/misc/color-commit.nix
-
Description: