diff --git a/flake.lock b/flake.lock index 60e9d3d49c..9c05eae1a9 100644 --- a/flake.lock +++ b/flake.lock @@ -58,11 +58,11 @@ }, "unstable": { "locked": { - "lastModified": 1706371002, - "narHash": "sha256-dwuorKimqSYgyu8Cw6ncKhyQjUDOyuXoxDTVmAXq88s=", + "lastModified": 1716509168, + "narHash": "sha256-4zSIhSRRIoEBwjbPm3YiGtbd8HDWzFxJjw5DYSDy1n8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c002c6aa977ad22c60398daaa9be52f2203d0006", + "rev": "bfb7a882678e518398ce9a31a881538679f6f092", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index ef4d08fceb..cb00960565 100644 --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,7 @@ flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { nixpkgs, unstable, flake-utils, ... }: + outputs = { self, nixpkgs, unstable, flake-utils, ... }: let utils = flake-utils; in utils.lib.eachDefaultSystem (system: let @@ -17,9 +17,15 @@ inherit pkgs system; nodejs = pkgs.nodejs_20; }; - in { + in + { formatter = pkgs.nixpkgs-fmt; + packages = rec { + default = kurtosis; + kurtosis = unstable_pkgs.callPackage ./package.nix { }; + }; + devShell = pkgs.mkShell { nativeBuildInputs = with pkgs; let @@ -27,7 +33,8 @@ import ./nix-pkgs/openapi-codegen.nix { inherit pkgs; }; grpc-tools-node = import ./nix-pkgs/grpc-tools-node.nix { inherit pkgs; }; - in [ + in + [ goreleaser go_1_20 gopls diff --git a/package.nix b/package.nix new file mode 100644 index 0000000000..34bab7f01b --- /dev/null +++ b/package.nix @@ -0,0 +1,55 @@ +{ lib +, buildGoModule +, writeTextFile +}: + +buildGoModule rec { + pname = "kurtosis"; + version = "0.89.11"; + + src = ./.; + + proxyVendor = true; + vendorHash = "sha256-GaEIitoRiuYxtS7cDKobFyIlraDNQjcvbRvzG3nUKFU="; + + postPatch = + let + kurtosisVersion = writeTextFile { + name = "kurtosis_verion.go"; + text = '' + package kurtosis_version + const ( + KurtosisVersion = "${version}" + ) + ''; + }; + in + '' + ln -s ${kurtosisVersion} kurtosis_version/kurtosis_version.go + ''; + + # disable checks temporarily since they connect to the internet + # namely user_support_constants_test.go + doCheck = false; + + # keep this for future reference + preCheck = '' + # some tests in commands use XDG home related environment variables + export HOME=/tmp + ''; + + postInstall = '' + mv $out/bin/cli $out/bin/kurtosis + mv $out/bin/files_artifacts_expander $out/bin/files-artifacts-expander + mv $out/bin/api_container $out/bin/api-container + + ''; + + meta = with lib; { + description = "A platform for launching an ephemeral Ethereum backend"; + mainProgram = "kurtosis"; + homepage = "https://github.com/kurtosis-tech/kurtosis"; + license = licenses.bsl11; + maintainers = with maintainers; [ marijanp ]; + }; +}