Skip to content

Instantly share code, notes, and snippets.

@gfrey
Last active April 30, 2025 18:02
Show Gist options
  • Save gfrey/2101b155e1d1d9f56517bfd00fa06dcb to your computer and use it in GitHub Desktop.
Save gfrey/2101b155e1d1d9f56517bfd00fa06dcb to your computer and use it in GitHub Desktop.
Nix Flake for kro

Nix Flake for kro

Make sure you have the Nix package manager installed and the "experimental" flake feature enabled:

$ cat ~/.config/nix/nix.conf
experimental-features = nix-command flakes

Then run nix develop to get all required tools installed. Starting VSCode using code . will configure most parts of the IDE properly (the Go extension is necessary, of course).

On Darwin it might be helpful to add additional tools like gnumake to the deps_build variable (line 12 of the flake.nix file).

In kro: copy the flake.nix file to the kro repository. Add it using git add -N flake.nix. Run nix flake lock and also add the flake.lock file.

{
description = "Nix Flake for kro";
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixpkgs-unstable;
inputs.flake-utils.url = github:numtide/flake-utils;
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; overlays = []; };
deps_runtime = pkgs: with pkgs; [setup-envtest];
deps_build = pkgs: with pkgs; [go] ++ (deps_runtime pkgs);
in rec {
devShells.default = pkgs.mkShell {
packages = with pkgs; [] ++ (deps_build pkgs);
shellHook = "";
};
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment