on main help sign in
build(nix): add default package to flake

Add a buildGoModule-based packages.default so the project can be built and run with `nix build`/`nix run`. Pins the Go 1.26 toolchain to match the dev shell, stamps the version via ldflags like the goreleaser config, and ignores the nix `result` symlink. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

commit5fd111ad45a28d6d25db120fb28cba6000e436ec authoriko <mail@iko.soy> dateThu 2 Jul 2026, 05:04 (3 months ago) parent0e74f12
3 files changed+36−5
.gitignore+1 flake.lock+3−4 flake.nix+32−1
.gitignore+1
@@ -44,6 +44,7 @@ Thumbs.db
4444
4545# Nix/direnv
4646.direnv/
47+/result
4748
4849**/.crush/**
4950
flake.lock+3−4
@@ -20,16 +20,15 @@
2020 },
2121 "nixpkgs": {
2222 "locked": {
23− "lastModified": 1775423009,
24− "narHash": "sha256-vPKLpjhIVWdDrfiUM8atW6YkIggCEKdSAlJPzzhkQlw=",
23+ "lastModified": 1782964654,
24+ "narHash": "sha256-oqyac50OyRdni5ZK9H7ZuAJoR3LzgsOdUcbBlUsk9lg=",
2525 "owner": "NixOS",
2626 "repo": "nixpkgs",
27− "rev": "68d8aa3d661f0e6bd5862291b5bb263b2a6595c9",
27+ "rev": "3130a1cf8f7c794ea5a4760c3fa4c745d64ec269",
2828 "type": "github"
2929 },
3030 "original": {
3131 "owner": "NixOS",
32− "ref": "nixos-unstable",
3332 "repo": "nixpkgs",
3433 "type": "github"
3534 }
flake.nix+32−1
@@ -2,7 +2,7 @@
22 description = "Crush development environment";
33
44 inputs = {
5− nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
5+ nixpkgs.url = "github:NixOS/nixpkgs";
66 flake-utils.url = "github:numtide/flake-utils";
77 };
88
@@ -14,7 +14,38 @@
1414 flake-utils.lib.eachDefaultSystem (
1515 system: let
1616 pkgs = nixpkgs.legacyPackages.${system};
17+ version = "devel";
1718 in {
19+ packages.default = pkgs.buildGoModule {
20+ pname = "crush";
21+ inherit version;
22+
23+ src = ./.;
24+
25+ vendorHash = "sha256-4gHvyEqiFhEvZ90lJbXeI/1fMMo6L19P/PD5Eu5YUmI=";
26+
27+ # Match the Go toolchain used in the dev shell.
28+ go = pkgs.go_1_26;
29+
30+ env.CGO_ENABLED = 0;
31+
32+ ldflags = [
33+ "-s"
34+ "-w"
35+ "-X github.com/charmbracelet/crush/internal/version.Version=${version}"
36+ ];
37+
38+ # The test suite requires network access and external tools.
39+ doCheck = false;
40+
41+ meta = {
42+ description = "Terminal-based AI coding assistant";
43+ homepage = "https://github.com/charmbracelet/crush";
44+ license = pkgs.lib.licenses.mit;
45+ mainProgram = "crush";
46+ };
47+ };
48+
1849 devShells.default = pkgs.mkShell {
1950 buildInputs = with pkgs; [
2051 # Go toolchain