diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-23 17:34:01 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-23 17:42:49 +0300 |
| commit | ec2924d0d1f21417802c3efd0ed46b9db2c00582 (patch) | |
| tree | 00432d4dbb46bb82328dfb583e36293c1603bc81 /nix | |
| parent | 0d2c20a46235ae2535d4fdef59b9529e44faa98f (diff) | |
feat: add optional nix flake support
refs #208
refs #221
refs #264
Diffstat (limited to 'nix')
| -rw-r--r-- | nix/package.nix | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/nix/package.nix b/nix/package.nix new file mode 100644 index 00000000..ba9206d8 --- /dev/null +++ b/nix/package.nix @@ -0,0 +1,76 @@ +{ + lib, + rustPlatform, + callPackage, + runCommand, + zig_0_15, + zstd, + pkg-config, + git, +}: + +let + manifest = lib.importTOML ../Cargo.toml; + zigDeps = callPackage ../vendor/libghostty-vt/build.zig.zon.nix { + name = "herdr-libghostty-vt-zig-cache"; + inherit zstd; + linkFarm = name: entries: + runCommand name { } '' + mkdir -p $out + ${lib.concatMapStringsSep "\n" (entry: '' + cp -rL ${entry.path} $out/${entry.name} + '') entries} + ''; + }; +in +rustPlatform.buildRustPackage { + pname = "herdr"; + version = manifest.package.version; + + src = lib.fileset.toSource { + root = ./..; + fileset = lib.fileset.intersection (lib.fileset.fromSource (lib.sources.cleanSource ./..)) ( + lib.fileset.unions [ + ../assets + ../src + ../vendor/libghostty-vt + ../vendor/libghostty-vt.vendor.json + ../build.rs + ../Cargo.lock + ../Cargo.toml + ] + ); + }; + + cargoLock.lockFile = ../Cargo.lock; + + nativeBuildInputs = [ + git + pkg-config + ]; + + env = { + LIBGHOSTTY_VT_OPTIMIZE = "ReleaseFast"; + LIBGHOSTTY_VT_SIMD = "true"; + LIBGHOSTTY_VT_ZIG_SYSTEM_DIR = zigDeps; + ZIG = lib.getExe zig_0_15; + }; + + preBuild = '' + export ZIG_GLOBAL_CACHE_DIR="$TMPDIR/zig-global-cache" + export ZIG_LOCAL_CACHE_DIR="$TMPDIR/zig-local-cache" + ''; + + # Rust tests are covered by the normal CI workflow. The Nix check is + # intentionally build-only so it validates packaging inputs without + # duplicating the full Rust test suite. + doCheck = false; + + meta = { + description = "Terminal workspace manager for AI coding agents"; + homepage = "https://herdr.dev"; + license = lib.licenses.agpl3Plus; + mainProgram = "herdr"; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + }; +} |
