Skip to content

Comments

[Proposition] Add nix flake for flow-cli installation and development#2277

Merged
janezpodhostnik merged 2 commits intomasterfrom
janez/nix-flake
Feb 21, 2026
Merged

[Proposition] Add nix flake for flow-cli installation and development#2277
janezpodhostnik merged 2 commits intomasterfrom
janez/nix-flake

Conversation

@janezpodhostnik
Copy link
Contributor

@janezpodhostnik janezpodhostnik commented Feb 10, 2026

Description

I have been using this flake locally to install flow-cli on NixOs and on NixDarvin. I think it might be nice to add it for anyone else trying to use the flow-cli in a nix environment.

I will also update the install documentation to include Nix.

Eventually I would like to add this to https://github.com/NixOS/nixpkgs. so its even easier to use.

The nix instructions (that I will put in the docs) would be:

Installing Flow CLI with Nix

The Flow CLI can be installed on NixOS and systems with Nix package manager using Nix flakes.

Prerequisites

Ensure you have Nix installed with flakes enabled. Add to /etc/nix/nix.conf or ~/.config/nix/nix.conf:

experimental-features = nix-command flakes

Installation Methods

1. Try Without Installing

Run the latest version directly:

nix run github:onflow/flow-cli

2. Install to User Profile

Install persistently:

nix profile install github:onflow/flow-cli

3. Use in NixOS Configuration

Add to your configuration.nix:

{
  inputs.flow-cli.url = "github:onflow/flow-cli";

  outputs = { self, nixpkgs, flow-cli, ... }: {
    nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
      modules = [
        {
          environment.systemPackages = [
            flow-cli.packages.x86_64-linux.default
          ];
        }
      ];
    };
  };
}

4. Use in Home Manager

Add to your flake inputs and home configuration:

{
  inputs.flow-cli.url = "github:onflow/flow-cli";

  outputs = { self, nixpkgs, home-manager, flow-cli, ... }: {
    homeConfigurations.myuser = home-manager.lib.homeManagerConfiguration {
      pkgs = nixpkgs.legacyPackages.x86_64-linux;
      modules = [
        {
          home.packages = [
            flow-cli.packages.x86_64-linux.default
          ];
        }
      ];
    };
  };
}

5. Development Shell

Enter a development environment with Flow CLI and Go tooling:

nix develop github:onflow/flow-cli

Or for local development:

cd flow-cli
nix develop

Installing Specific Versions

Install a specific version using git tags:

nix profile install github:onflow/flow-cli/v2.14.2

The flake automatically extracts the version from the git tag when building from a tagged ref.

Upgrading

Update to the latest version:

nix profile upgrade flow-cli

Uninstalling

Remove from profile:

nix profile remove flow-cli

For contributor use:

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@chasefleming
Copy link
Member

I’m not very familiar with Nix. What are the benefits compared to the additional maintenance this would introduce?

Base automatically changed from janez/cleanup to master February 17, 2026 13:59
@janezpodhostnik
Copy link
Contributor Author

This adds a very convenient way to try/install flow-cli on nixos (or nix-darwin for that matter).

for instance you can just do nix shell github:onflow/flow-cli and it will drop you into a shell where flow-cli is installed and ready to use.

There won't be any additional overhead for any other installation or any parts of the code. The flake.nix (and the lock) might need some adjusting from time to time for continued support of nix installation. I can do that for now, as I will be using it, and if someone complains down the line, they can update it or you can remove it.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds Nix flake support for installing and developing the Flow CLI on NixOS and systems with the Nix package manager. This provides an alternative installation and development method that complements the existing installation scripts and build tools (Makefile, goreleaser).

Changes:

  • Added flake.nix with package definition, development shell, and version detection from git tags
  • Added flake.lock to pin Nix dependencies
  • Updated CONTRIBUTING.md with Nix-specific development instructions
  • Updated .gitignore to exclude Nix build artifacts

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 3 comments.

File Description
flake.nix Defines Nix package build for flow-cli using buildGoModule, development shell with Go tooling, and apps configuration
flake.lock Locks Nix flake dependencies (nixpkgs and flake-utils)
CONTRIBUTING.md Adds "Getting Started with Nix" section with instructions for nix develop and nix build
.gitignore Adds Nix-specific artifacts (result, result-*, .direnv/) to gitignore

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@janezpodhostnik janezpodhostnik merged commit 1ac077a into master Feb 21, 2026
11 of 12 checks passed
@janezpodhostnik janezpodhostnik deleted the janez/nix-flake branch February 21, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants