{ description = "larc"; 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 = nixpkgs.legacyPackages.${system}; /* * NOTE(kroot): go-sqlite3 requires cgo, so we need to enable it * and provide the necessary build inputs */ buildInputs = with pkgs; [ sqlite ]; nativeBuildInputs = with pkgs; [ pkg-config ]; commonGoArgs = { inherit buildInputs nativeBuildInputs; src = ./.; vendorHash = "sha256-z45q+0un+SrgdM3a4do/TYkaFenhgc0VqZyE9eWq8PE="; env.CGO_ENABLED = "1"; env.GOTOOLCHAIN = "local"; /* FIXME(kroot): nixpkgs has go 1.25, but go.mod wants 1.26 */ postPatch = '' sed -i 's/go 1.26.0/go 1.25.0/' go.mod ''; }; in { packages = { larc = pkgs.buildGoModule (commonGoArgs // { pname = "larc"; version = "0.1.0"; subPackages = [ "cmd/larc" ]; }); larcs = pkgs.buildGoModule (commonGoArgs // { pname = "larcs"; version = "0.1.0"; subPackages = [ "cmd/larcs" ]; }); compile = pkgs.buildGoModule (commonGoArgs // { pname = "larc-compile"; version = "0.1.0"; subPackages = [ "cmd/compile" ]; }); default = self.packages.${system}.larc; }; devShells.default = pkgs.mkShell { buildInputs = buildInputs ++ (with pkgs; [ go_1_26 gopls gotools go-tools delve ]); inherit nativeBuildInputs; CGO_ENABLED = "1"; }; } ); }