This is a collection of scripts I have written over the course of developing my nixconf to make working on my system easier, with shortcuts and aliases. It may grow over time.
The fundamental options this script offers are to have easy-to-access fetching utils for working on your system, testing your config while you're working on it, and rebuilding it when you're ready to switch and push.
Let's take a deeper dive into each of these.
- Fetch URL: Uses nix-prefetch to prefetch a hash for using fetchURL in your system config.
- nurl: Uses nurl to generate fetch code for any URL. Mainly useful for sourcing projects from remote Git repos.
- Fetch pkg Tree: Builds a package in a temporary directory, and fetches its pkg tree using eza
This script will automatically git add .
, format the code with alejandra, and deletes a gtk file that home-manager likes to have issues with before prompting the following options:
- Basic Test: Runs a test rebuild. Prompts for commit if successful.
- Boot Test: Asks if you want to update the flake, then runs a boot rebuild. Prompts for commit if successful.
- Refresh Tofi-Drun Cache: Tofi-Drun will not work properly unless the cache is cleared before application changes, so this option will perform a test rebuild after clearing it so that it will be refreshed.
- Special Case: Prompts you for a custom command for special situations.
Here's where the only real logic of the scripts come into play: the script will test with git diff
if a commit is needed, then will check to see if the local is behind, ahead, or divergent from the remote branch with git rev-list
. Then, according to that, the script will perform the following options:
- Behind Case: Pulls and rebuilds, switching either now or at boot.
- Ahead Case: Rebuilds, either at switch or at boot, optionally updating the flake. Then pushes, with optional rebase.
- Divergent Case: Tries to pull, if merge conflict, runs
git mergetool
. Then test builds, and if it is successful, it will run the script again to run the Ahead Case.
Idk tbh, I designed it for me. If you're actually interested in it and know how I can make it easier for others to use, go ahead and leave either a PR or an issue. I currently don't have a reason to invest the time in it myself.