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": "2025-11-26T14:49:53Z", "stargazersCount": 6, "topics": [], "updatedAt": "2025-11-23T12:20:40Z", "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.
✨ 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”Prerequisites
Section titled “Prerequisites”- Nix with flakes enabled
- 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 (Coming Soon)
Section titled “From Cargo (Coming Soon)”cargo install flkWith Nix
Section titled “With Nix”nix profil install github:AEduardo-dev/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 infoflk deep-search ripgrep --versions
# Add packages to your environmentflk add ripgrepflk add gitflk add neovim3. Add Custom Commands
Section titled “3. Add Custom Commands”# Add inline commandsflk add-command test "cargo test --all"flk add-command dev "npm run dev"
# Source commands from a fileflk add-command scripts --file ./scripts/dev.sh4. 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”nix developYour 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.
📖 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.
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.
Options:
-v, --versions- Show version pinning information
Examples:
flk deep-search ripgrepflk deep-search python311 --versionsflk add <PACKAGE>
Section titled “flk add <PACKAGE>”Add a package to your flake.nix.
Examples:
flk add ripgrepflk add gitflk add nodejsNote: Version pinning is planned for a future release (see issue #5).
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 add-command <NAME> <COMMAND> [OPTIONS]
Section titled “flk add-command <NAME> <COMMAND> [OPTIONS]”Add a custom shell command to your development environment.
Options:
-f, --file <PATH>- Source commands from a file
Examples:
# Inline commandflk add-command test "cargo test --all"flk add-command dev "npm run dev -- --watch"
# Multi-line commandflk add-command deploy "cargo build --release && scp target/release/app server:/opt/"
# Source from fileflk add-command scripts --file ./dev-scripts.shCommand naming rules:
- Must contain only letters, numbers, hyphens, and underscores
- Cannot start with a hyphen
- Examples:
test,dev-server,build_prod
flk remove-command <NAME>
Section titled “flk remove-command <NAME>”Remove a custom command from your dev shell.
Examples:
flk remove-command 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 JSON💡 Usage Examples
Section titled “💡 Usage Examples”Python Data Science Environment
Section titled “Python Data Science Environment”flk init --template pythonflk add python311Packages.numpyflk add python311Packages.pandasflk add python311Packages.matplotlibflk add jupyter
flk add-command notebook "jupyter notebook --port=8888"flk env add JUPYTER_CONFIG_DIR "./.jupyter"
nix developnotebook # Your custom command is ready!Rust Web Development
Section titled “Rust Web Development”flk init --template rustflk add postgresqlflk add redis
flk add-command dev "cargo watch -x run"flk add-command migrate "sqlx migrate run"flk env add DATABASE_URL "postgresql://localhost/myapp"
nix developdev # 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 add-command dev "npm run dev"flk add-command db "docker-compose up -d postgres"flk env add NODE_ENV "development"
nix developdb # Start databasedev # Start development serverGo Microservice
Section titled “Go Microservice”flk init --template goflk add protobufflk add grpcurl
flk add-command build "go build -o bin/service ./cmd/service"flk add-command proto "protoc --go_out=. --go-grpc_out=. api/*.proto"flk env add GO_ENV "development"
nix developproto # Generate protobuf codebuild # Build the service🛠️ Development
Section titled “🛠️ Development”Prerequisites
Section titled “Prerequisites”- Rust 1.70+
- 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 integration testscargo test --test integration_tests
# Run with outputcargo test -- --nocaptureInstalling Locally
Section titled “Installing Locally”cargo install --path .🏗️ Project Structure
Section titled “🏗️ Project Structure”flk/├── src/│ ├── main.rs # CLI entry point│ ├── commands/ # Command implementations│ │ ├── activate.rs # Activate dev shell│ │ ├── add.rs # Add packages│ │ ├── add_command.rs # Add custom commands│ │ ├── completions.rs # Shell completions│ │ ├── env.rs # Environment variable management│ │ ├── export.rs # Export flake config│ │ ├── init.rs # Initialize flake│ │ ├── list.rs # List packages│ │ ├── lock.rs # Lock file management│ │ ├── mod.rs│ │ ├── remove.rs # Remove packages│ │ ├── remove_command.rs # Remove custom commands│ │ ├── search.rs # Search packages│ │ ├── show.rs # Display flake config│ │ └── update.rs # Update flake inputs│ ├── flake/ # Flake parsing and generation│ │ ├── generator.rs # Generate flake.nix│ │ ├── interface.rs # Data structures│ │ ├── mod.rs│ │ └── parser.rs # Parse flake.nix│ ├── nix/ # Nix command wrappers│ │ └── mod.rs│ └── utils/ # Utility functions│ ├── backup.rs # Backup management│ ├── mod.rs│ └── visual.rs # Visual enhancements├── templates/ # Flake templates│ ├── default_flake.nix│ ├── rust_flake.nix│ ├── python_flake.nix│ ├── node_flake.nix│ └── go_flake.nix└── tests/ # Test files ├── integration_tests.rs └── unit_tests.rs🗺️ 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
📞 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 (v0.1.0). While all core features are implemented and working, some advanced features like version pinning are still in progress. See the roadmap for details.