emacs-twist / twist.nix

Build an entire Emacs configuration as a Nix package in a pure, reproducible way
GNU General Public License v3.0
78 stars 7 forks source link

Add a new API for generating a fresh lock directory without configuration #141

Closed akirak closed 10 months ago

akirak commented 10 months ago

This will add a new API for generating a lock directory without pre-configuring the location of the directory.

a. This feature is especially important for managing multiple lock directories within a single project. The user can specify the lock directory to be created at runtime, so the configuration won't be complicated. Also, the output directory must be explicitly specified, so there is a much less likelihood of accidentally destroying files by running the command outside a designated project.

The command lines look tedious, but your shell (e.g. zsh) may have good Nix completions that save an effort of typing.

Example usages are shown below:

Create a new lock directory. The directory must not exist:

nix run .\#emacs-config.generateLockDir -L --impure -- ./lock

Create a lock directory. With --force/-f option, it is allowed to override an existing lock directory. If there are existing lock files, all lock entries will be updated (for flake.lock, nix flake update will be run in the lock directory to update it):

nix run .\#emacs-config.generateLockDir -L --impure -- --force ./lock

Create a lock directory. If --no-update-flake-lock flag is given, nix flake lock is used to add missing lock entries instead of nix flake update, so existing lock entries won't be updated. archive.lock is recreated, so all archive packages will become the latest:

nix run .\#emacs-config.generateLockDir -L --impure -- --no-update-flake-lock --force ./lock

This API is heavier than the previous one, so the older API will remain for the time being.

b. Another feature is localPackages option, which lets the user specify a list of packages to be not included in the generated flake.nix.

akirak commented 10 months ago

https://github.com/akirak/bookmark-frecency.el/pull/1 is an example usage of this API. Merging.