AEduardo-dev/flk
{ "createdAt": "2025-10-24T09:55:00Z", "defaultBranch": "main", "description": "Flakes development environments management tool", "fullName": "AEduardo-dev/flk", "homepage": null, "language": "Rust", "name": "flk", "pushedAt": "2026-01-19T15:39:58Z", "stargazersCount": 6, "topics": [], "updatedAt": "2026-01-18T16:15:47Z", "url": "https://github.com/AEduardo-dev/flk"}A modern CLI tool for managing Nix flake development environments with the simplicity of Devbox
flk makes managing Nix flakes feel like using a package manager. No more manually editing flake.nix files—just use simple commands to add packages, create custom shell commands, and manage your development environment with ease.
✨ Features
Section titled “✨ Features”- 🎯 Smart Initialization - Auto-detects your project type (Rust, Python, Node.js, Go) and creates the right template
- 🔍 Package Search - Search nixpkgs directly from your terminal
- 📦 Easy Package Management - Add and remove packages with simple commands
- ⚡ Custom Shell Commands - Define reusable commands for your development workflow
- 🌍 Environment Variables - Manage environment variables through the CLI
- 🔒 Lock File Management - View, backup, and restore your flake.lock with ease
- 🎨 Language Templates - Pre-configured templates for popular languages and frameworks
📦 Installation
Section titled “📦 Installation”Upgrading to v0.5.0 (switch/refresh changes)
Section titled “Upgrading to v0.5.0 (switch/refresh changes)”WARNING (pre v0.5.0 users): If you are using flk < v0.5.0 and you run flk update / nix flake update, your devshell switch / refresh behavior may break because the nix-profile-lib input may update to a newer version with different activation semantics.
If you intend to stay on flk < v0.5.0, use one of these options:
-
Do not update flake inputs. Avoid running
flk updateornix flake update. If you already did, restore a previous lockfile backup with:Terminal window flk lock restore <BACKUP> -
Pin
nix-profile-libto v0.1.0. In yourflake.nix:inputs = {nix-profile-lib.url = "github:AEduardo-dev/nix-profile-lib?ref=v0.1.0";};Then update the lock entry:
Terminal window nix flake lock --update-input nix-profile-lib(or
nix flake update --update-input nix-profile-lib)
Once you upgrade to flk v0.5.0+, this restriction is lifted.
Prerequisites
Section titled “Prerequisites”- Nix with flakes enabled
- We recommend the Lix package manager for easy Nix installation: Lix since it comes with flakes enabled by default.
- Or using the Determinate System installer: Determinate, as it provides a user-friendly way to install (and uninstall) Nix.
- Rust 1.83+ (if building from source)
From Source
Section titled “From Source”git clone https://github.com/AEduardo-dev/flk.gitcd flkcargo build --releasesudo cp target/release/flk /usr/local/bin/From Cargo
Section titled “From Cargo”cargo install flk🚀 Quick Start
Section titled “🚀 Quick Start”1. Initialize Your Project
Section titled “1. Initialize Your Project”# Auto-detect project type and create flake.nixflk init
# Or specify a templateflk init --template rustflk init --template pythonflk init --template nodeflk init --template goSupported auto-detection:
Cargo.toml→ Rust templatepackage.json→ Node.js templatepyproject.tomlorrequirements.txt→ Python templatego.mod→ Go template
2. Add Packages
Section titled “2. Add Packages”# Search for packagesflk search ripgrep
# Get detailed package info and versionsflk deep-search ripgrep
# Add packages to your environmentflk add ripgrepflk add gitflk add neovim
# Or add pinned versionsflk add ripgrep --version '15.1.0'flk add git --version '2.42.0'3. Add Custom Commands
Section titled “3. Add Custom Commands”# Add inline commandsflk command add test "cargo test --all"flk command add dev "npm run dev"4. Manage Environment Variables
Section titled “4. Manage Environment Variables”# Add environment variablesflk env add DATABASE_URL "postgresql://localhost/mydb"flk env add API_KEY "your-api-key"
# List all environment variablesflk env list
# Remove an environment variableflk env remove API_KEY5. Enter Your Development Environment
Section titled “5. Enter Your Development Environment”flk activateYour custom commands and environment variables will be automatically available!
6. Generate completions
Section titled “6. Generate completions”# Generates the completion file and prints itflk completions
# Install the generated completions to the detected shellflk completions --installFollow the instructions after the command to make the completions available for you.
7. Attach to your direnv (optional)
Section titled “7. Attach to your direnv (optional)”If you use direnv, you can set it up to automatically load your flk environment when you enter the project directory.
# Generates a .envrc file for direnv with use flake commandflk direnv init
#or
# Add the direnv hook to an existing projectflk direnv attachif you ever want to detach the direnv hook, you can run:
flk direnv detach8. Switch / Refresh your environment
Section titled “8. Switch / Refresh your environment”switch <profile_name> # Switch to a different profile_namerefresh # Refresh the current profile (useful after modifying the environment)📖 Command Reference
Section titled “📖 Command Reference”Project Management
Section titled “Project Management”flk init [OPTIONS]
Section titled “flk init [OPTIONS]”Initialize a new flake.nix in the current directory.
Options:
-t, --template <TYPE>- Project type:rust,python,node,go, orgeneric-f, --force- Overwrite existingflake.nix
Examples:
flk init # Auto-detect project typeflk init --template rust # Use Rust templateflk init --force # Overwrite existing flake.nixflk activate
Section titled “flk activate”Activate the nix shell for the current shell session. This command sets up the necessary environment for your
project based on the flake.nix configuration. It also installs some convenience features, such as a shell hook to refresh.
Future implementations will include the option to activate specific profiles.
flk show
Section titled “flk show”Display the contents and configuration of your flake.nix in a human-readable format.
flk showflk list
Section titled “flk list”List all packages in your development environment.
flk listPackage Management
Section titled “Package Management”flk search <QUERY> [OPTIONS]
Section titled “flk search <QUERY> [OPTIONS]”Search for packages in nixpkgs.
Options:
-l, --limit <NUMBER>- Limit number of results (default: 10)
Examples:
flk search ripgrepflk search python --limit 20flk deep-search <PACKAGE> [OPTIONS]
Section titled “flk deep-search <PACKAGE> [OPTIONS]”Get detailed information about a specific package.
Examples:
flk deep-search ripgrepflk deep-search python311```
#### `flk add <PACKAGE>`
Add a package to your `flake.nix`.
**Examples:**
```bashflk add ripgrepflk add gitflk add nodejsOr add a specific version:
flk add ripgrep --version '15.1.0'flk add git --version '2.42.0'flk remove <PACKAGE>
Section titled “flk remove <PACKAGE>”Remove a package from your flake.nix.
Examples:
flk remove ripgrepCustom Commands
Section titled “Custom Commands”flk command add <NAME> <COMMAND> [OPTIONS]
Section titled “flk command add <NAME> <COMMAND> [OPTIONS]”Add a custom shell command to your development environment.
Examples:
# Inline commandflk command add test "cargo test --all"flk command add dev "npm run dev -- --watch"
# Multi-line commandflk command add deploy "cargo build --release && scp target/release/app server:/opt/"Command naming rules:
- Must contain only letters, numbers, hyphens, and underscores
- Cannot start with a hyphen
- Examples:
test,dev-server,build_prod
flk command remove <NAME>
Section titled “flk command remove <NAME>”Remove a custom command from your dev shell.
Examples:
flk command remove testEnvironment Variables
Section titled “Environment Variables”flk env add <NAME> <VALUE>
Section titled “flk env add <NAME> <VALUE>”Add an environment variable to your dev shell.
Examples:
flk env add DATABASE_URL "postgresql://localhost:5432/mydb"flk env add NODE_ENV "development"flk env add API_KEY "sk-..."Variable naming rules:
- Must start with a letter or underscore
- Can only contain letters, numbers, and underscores
- Examples:
MY_VAR,_private,API_KEY_2
flk env remove <NAME>
Section titled “flk env remove <NAME>”Remove an environment variable from your dev shell.
Examples:
flk env remove DATABASE_URLflk env list
Section titled “flk env list”List all environment variables in your dev shell.
flk env listLock File Management
Section titled “Lock File Management”flk lock show
Section titled “flk lock show”Display detailed information about your flake.lock file.
flk lock showflk lock history
Section titled “flk lock history”Show backup history of your lock file.
flk lock historyflk lock restore <BACKUP>
Section titled “flk lock restore <BACKUP>”Restore a previous version of your lock file.
Examples:
flk lock restore latest # Restore most recent backupflk lock restore 2025-01-27_14-30-00 # Restore specific backupUpdates
Section titled “Updates”flk update [OPTIONS]
Section titled “flk update [OPTIONS]”Update all flake inputs to their latest versions.
Options:
--show- Preview updates without applying them
Examples:
flk update # Update all inputsflk update --show # Preview available updatesNote: A backup of your flake.lock is automatically created before updating.
Exports
Section titled “Exports”flk export --format <FORMAT> [OPTIONS]
Section titled “flk export --format <FORMAT> [OPTIONS]”Export the current flake configuration to different formats. Options:
--format <FORMAT>- Export format:docker,podman,json
Examples:
flk export --format docker # Export as Dockerfileflk export --format podman # Export as Podmanfileflk export --format json # Export as JSONDirenv Integration
Section titled “Direnv Integration”flk direnv init
Section titled “flk direnv init”Generate a .envrc file for direnv with use flake command.
flk direnv initflk direnv attach
Section titled “flk direnv attach”Add the direnv hook to an existing project.
flk direnv attachflk direnv detach
Section titled “flk direnv detach”Remove the direnv hook from the project.
flk direnv detach💡 Usage Examples
Section titled “💡 Usage Examples”Python Data Science Environment
Section titled “Python Data Science Environment”flk init --template pythonflk add python312Packages.numpyflk add python312Packages.pandasflk add python312Packages.matplotlibflk add jupyter
flk command add notebook "jupyter notebook --port=8888"flk env add JUPYTER_CONFIG_DIR "./.jupyter"
flk activatenotebook # Your custom command is ready!Rust Web Development
Section titled “Rust Web Development”flk init --template rustflk add postgresqlflk add redis
flk command add dev "cargo watch -x run"flk command add migrate "sqlx migrate run"flk env add DATABASE_URL "postgresql://localhost/myapp"
flk activatedev # Start development server with auto-reloadmigrate # Run database migrationsNode.js Full-Stack Project
Section titled “Node.js Full-Stack Project”flk init --template nodeflk add postgresqlflk add docker-compose
flk command add dev "npm run dev"flk command add db "docker-compose up -d postgres"flk env add NODE_ENV "development"
flk activatedb # Start databasedev # Start development serverGo Microservice
Section titled “Go Microservice”flk init --template goflk add protobufflk add grpcurl
flk command add build "go build -o bin/service ./cmd/service"flk command add proto "protoc --go_out=. --go-grpc_out=. api/*.proto"flk env add GO_ENV "development"
flk activateproto # Generate protobuf codebuild # Build the service🛠️ Development
Section titled “🛠️ Development”Prerequisites
Section titled “Prerequisites”- Rust 1.83+
- Nix with flakes enabled
Building
Section titled “Building”git clone https://github.com/AEduardo-dev/flk.gitcd flkcargo buildRunning Tests
Section titled “Running Tests”# Run all testscargo test
# Run unit tests onlycargo test --test unit_tests
# Run integration tests onlycargo test --test integration_tests
# Run with outputcargo test -- --nocapture
# Run a specific testcargo test test_nameThe test suite includes comprehensive unit tests for the parser, generator, and interface modules, as well as integration tests covering the complete CLI workflow including the dendritic . flk/profiles/ architecture.
Installing Locally
Section titled “Installing Locally”cargo install --path .🏗️ Project Structure
Section titled “🏗️ Project Structure” .├── Cargo.lock├── Cargo.toml├── CHANGELOG.md├── cliff.toml├── CODE_OF_CONDUCT.md├── CONTRIBUTING.md├── dist-workspace.toml├── flake.lock├── flake.nix├── LICENSE├── README.md├── release-plz.toml├── src│ ├── commands│ │ ├── activate.rs│ │ ├── add.rs│ │ ├── command.rs│ │ ├── completions.rs│ │ ├── direnv.rs│ │ ├── env.rs│ │ ├── export.rs│ │ ├── init.rs│ │ ├── list.rs│ │ ├── lock.rs│ │ ├── mod.rs│ │ ├── remove.rs│ │ ├── search.rs│ │ ├── show.rs│ │ └── update.rs│ ├── flake│ │ ├── generator.rs│ │ ├── interfaces│ │ │ ├── mod.rs│ │ │ ├── overlays.rs│ │ │ ├── profiles.rs│ │ │ ├── shellhooks.rs│ │ │ └── utils.rs│ │ ├── mod.rs│ │ ├── nix_render.rs│ │ └── parsers│ │ ├── commands.rs│ │ ├── env.rs│ │ ├── flake.rs│ │ ├── mod.rs│ │ ├── overlays.rs│ │ ├── packages.rs│ │ └── utils.rs│ ├── lib.rs│ ├── main.rs│ ├── nix│ │ └── mod.rs│ └── utils│ ├── backup.rs│ ├── mod.rs│ └── visual.rs├── templates│ ├── default.nix│ ├── flake.nix│ ├── overlays.nix│ ├── pins.nix│ └── profiles│ ├── base.nix│ ├── default.nix│ ├── go.nix│ ├── node.nix│ ├── python.nix│ └── rust.nix├── tests│ ├── flake_tests.nix│ ├── integration_tests.rs│ ├── pins_tests.nix│ ├── profile_tests.nix│ └── unit_tests.rs└── wix └── main.wxs🗺️ Roadmap
Section titled “🗺️ Roadmap”🤝 Contributing
Section titled “🤝 Contributing”Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
How to Contribute
Section titled “How to Contribute”- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
🐛 Bug Reports
Section titled “🐛 Bug Reports”If you find a bug, please open an issue with:
- A clear description of the problem
- Steps to reproduce
- Expected vs actual behavior
- Your environment (OS, Nix version, etc.)
🔗 Related Projects
Section titled “🔗 Related Projects”- Devbox - Instant, portable dev environments (inspiration for flk)
- devenv - Fast, declarative developer environments
- Flox - Developer environments you can take with you
- direnv - Shell extension for loading environments
📄 License
Section titled “📄 License”This project is licensed under the MIT License - see the [LICENSE]!(LICENSE) file for details.
🙏 Acknowledgments
Section titled “🙏 Acknowledgments”- The Nix community for creating an amazing ecosystem
- Jetify for the Devbox inspiration and showing what’s possible
- All contributors and users of flk
- Special mention to @vic for creating nix-versions
📞 Support
Section titled “📞 Support”- 📧 Open an issue for bug reports or feature requests
- 💬 Start a discussion for questions or ideas
- ⭐ Star the repository if you find it useful!
Made with ❤️ by AEduardo-dev
Note: This project is under active development. While all core features are implemented and working, some advanced features are still in progress and will be subject to change.