Skip to content

Latest commit

 

History

History
168 lines (123 loc) · 5.17 KB

File metadata and controls

168 lines (123 loc) · 5.17 KB

flkr

Detect your stack. Generate a flake. Ship it.

Scan any repository and produce a production-ready flake.nix in seconds.

Release CI Go Report Card License


flkr looks at your code (language, framework, package manager, lockfiles, build commands) and generates a thin flake.nix that delegates to the flkr-templates registry. The result is a reproducible Nix closure: sandboxed, cacheable, and ready to deploy.

No Nix knowledge required.

Usage

# Interactive wizard: detect, review, generate
flkr init

# Or go headless
flkr detect --json          # inspect what flkr sees
flkr generate               # write flake.nix
flkr generate --dry-run     # preview without writing

After generation:

nix run       # build and run
nix build     # build only
nix develop   # drop into a dev shell

What gets detected

Ecosystem Package Managers Frameworks
Go gomod Gin
Node.js npm, yarn, pnpm Next.js, Nuxt, Remix, Vite
Python pip, poetry, pipenv, uv Django, Flask, FastAPI
Rust cargo Actix
Ruby bundler Rails
Elixir mix Phoenix
PHP composer Laravel
Java maven, gradle Spring

Detection is layered: a base detector identifies the language and package manager, then specialized detectors refine the framework, build commands, ports, and system dependencies.

Example output

{
  description = "go-app -- generated by flkr";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flkr-templates.url = "github:narvanalabs/flkr-templates";
  };

  outputs = { self, nixpkgs, flkr-templates, ... }:
    flkr-templates.lib.mkApp {
      inherit nixpkgs;
      src = ./.;
      ecosystem = "go";
      version = "1.25.0";
      packageManager = "gomod";
      buildCommand = "go build -o myapp .";
      startCommand = "./myapp";
      port = 8080;
      vendorHash = "sha256-INXKKsT91oKPF7KYGTMKE2kCekumG8zuTylX2yEkIHQ=";
    };
}

The generated flake is config, not implementation. All build logic lives in flkr-templates: buildGoModule, buildRustPackage, mkDerivation, and friends.

Install

Nix (recommended)
# Run directly
nix run github:narvanalabs/flkr -- init

# Or install to profile
nix profile install github:narvanalabs/flkr
From source
git clone https://github.com/narvanalabs/flkr.git
cd flkr
make build    # produces ./flkr

Requires Go 1.25+.

go install
go install github.com/narvanalabs/flkr@latest

How it works

  your repo          flkr              flkr-templates
 ┌──────────┐    ┌──────────┐    ┌─────────────────────┐
 │ go.mod   │    │ Detect   │    │ buildGoModule        │
 │ package. │───▸│ Generate │───▸│ buildRustPackage     │───▸ Nix closure
 │ Cargo.   │    │ Hash     │    │ mkDerivation         │
 │ etc.     │    │          │    │ ...                  │
 └──────────┘    └──────────┘    └─────────────────────┘
  1. Detect:scan the repo, build an AppProfile (language, framework, commands, ports, deps)
  2. Generate:render flake.nix from the profile, compute vendorHash / cargoHash
  3. Build:the generated flake delegates to flkr-templates.lib.mkApp for sandboxed, cacheable Nix builds

Project structure

cmd/               CLI (Cobra)
internal/
  detector/        Language & framework detectors
  generator/       flake.nix rendering
  nixhash/         Nix hash computation
  parser/          Config file parsers
  tui/             Interactive wizard (Bubble Tea)
pkg/flkr/          Public API

Part of Narvana

flkr is the detection engine for Narvana, a Nix-native PaaS.

flkr → flkr-templates → Attic → sops-nix → Deploy

Contributing

make all     # vet + test + build
make test    # tests only

License

Apache 2.0