diff --git a/.gitignore b/.gitignore index 128fa60..3889db2 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,6 @@ Thumbs.db .codex/skills .github/skills .gemini/skills + +# Nix output +result diff --git a/docs/INSTALLATION.md b/docs/INSTALLATION.md index 732976c..89a12b9 100644 --- a/docs/INSTALLATION.md +++ b/docs/INSTALLATION.md @@ -3,6 +3,7 @@ # Installation - [Homebrew (macOS / Linux)](#homebrew-macos--linux) +- [Nix](#nix) - [Windows](#windows) - [Install from source (macOS / Linux)](#install-from-source-macos--linux) - [Download binary (all platforms)](#download-binary-all-platforms) @@ -31,6 +32,70 @@ brew update && brew upgrade engram --- +## Nix + +Run directly without installing: + +```bash +nix run github:Gentleman-Programming/engram +``` + +Build locally: + +```bash +nix build +./result/bin/engram +``` + +Enter a development shell: + +```bash +nix develop +``` + +
+Home Manager / NixOS integration + +You can also add Engram from this repository flake into your own Nix configuration. + +#### As a flake input + +```nix +{ + inputs.engram.url = "github:Gentleman-Programming/engram"; +} +``` + +#### Home Manager + +```nix +{ inputs, pkgs, ... }: + +{ + home.packages = [ + inputs.engram.packages.${pkgs.system}.default + ]; +} +``` + +#### NixOS + +```nix +{ inputs, pkgs, ... }: + +{ + environment.systemPackages = [ + inputs.engram.packages.${pkgs.system}.default + ]; +} +``` + +This makes the `engram` binary available in your environment without installing Go manually. + +
+ +--- + ## Windows **Option A: Download the binary (recommended)** diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..25ec39a --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1773389992, + "narHash": "sha256-wvfdLLWJ2I9oEpDd9PfMA8osfIZicoQ5MT1jIwNs9Tk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c06b4ae3d6599a672a6210b7021d699c351eebda", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..045017c --- /dev/null +++ b/flake.nix @@ -0,0 +1,72 @@ +{ + description = "engram - Persistent memory for AI coding agents"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = + { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { inherit system; }; + + pname = "engram"; + version = "1.10.0"; + + engram = pkgs.buildGoModule { + inherit pname; + inherit version; + vendorHash = "sha256-wnRtuBn5H+UdWkXucpfHPEbFosVCUa8i9hVRXg5Wqc4="; + proxyVendor = true; + + src = ./.; + subPackages = [ "cmd/engram" ]; + + env = { + CGO_ENABLED = "0"; + }; + + ldflags = [ + "-s" + "-w" + "-X main.version=${version}" + ]; + + meta = with pkgs.lib; { + description = "Persistent memory for AI coding agents"; + homepage = "https://github.com/Gentleman-Programming/engram"; + license = licenses.mit; + mainProgram = "engram"; + platforms = platforms.linux ++ platforms.darwin; + }; + }; + in + { + packages.default = engram; + packages.engram = engram; + + apps.default = flake-utils.lib.mkApp { + drv = engram; + }; + + devShells.default = pkgs.mkShell { + packages = with pkgs; [ + go_1_25 + gopls + gotools + golangci-lint + delve + ]; + }; + + formatter = pkgs.nixfmt-rfc-style; + } + ); +}