Skip to content

Commit

Permalink
feat: package kurtosis with nix
Browse files Browse the repository at this point in the history
  • Loading branch information
marijanp committed Jul 4, 2024
1 parent 59ba36d commit a31d546
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 6 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -17,17 +17,24 @@
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
openapi-codegen-go =
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
Expand Down
55 changes: 55 additions & 0 deletions package.nix
Original file line number Diff line number Diff line change
@@ -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 ];
};
}

0 comments on commit a31d546

Please sign in to comment.