Introduction
flk manages Nix flake dev environments in the style of Devbox: you run commands instead of editing Nix files by hand.
The main difference is that all nix code involved is transparent and readable for you to check! Both your local flk environments, or the nix-profile-lib helper are public and available any time. Because for one, I did not want yet another wrapper/abstraction layer, and secondly and most important, you should be able to check what your PC is running.
Features
- Detects typical project types on init
- Add and remove packages, with optional version pins
- Custom shell commands
- Per-project environment variables
- Multiple profiles per project
- Option to combine said profiles
- Flake updates with rollback and backup options similar to nix/os generations
- Global flk environment for generally used packages within your system
Example
flk init
flk add ripgrep
flk command add build "cargo build --release"
flk activate
build
Staying on flk before v0.5.0
On flk older than v0.5.0, flk update or nix flake update can pull a newer nix-profile-lib whose activation changes break switch and refresh commands. To stay on the old version, either:
-
Don’t update flake inputs. If you already did, restore a backup:
flk lock restore <BACKUP> -
Pin
nix-profile-libto v0.1.0 inflake.nix:inputs = { nix-profile-lib.url = "git+https://gitlab.com/pixel-racks/flakes/nix-profile-lib?ref=v0.1.0"; };and update the lock entry:
nix flake lock --update-input nix-profile-lib(or
nix flake update --update-input nix-profile-lib)
flk v0.5.0 and later don’t have this problem.
Questions and bugs: GitLab issues.