-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add nix flake for setting up dev env (#1641)
## Description: This PR adds the a nix flake configuration to deterministically install dev dependencies for Kurtosis. ## Is this change user facing? NO - but changes contributor's experience. Readme page is updated.
- Loading branch information
Showing
7 changed files
with
239 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
{ | ||
description = "Kurtosis dev flake"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; | ||
unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
}; | ||
|
||
outputs = { nixpkgs, unstable, flake-utils, ... }: | ||
let utils = flake-utils; | ||
in utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
unstable_pkgs = unstable.legacyPackages.${system}; | ||
in { | ||
formatter = pkgs.nixpkgs-fmt; | ||
|
||
devShell = pkgs.mkShell { | ||
nativeBuildInputs = with pkgs; | ||
let | ||
|
||
renamed_grpc_tools = stdenv.mkDerivation { | ||
name = "renamed-grpc-tools"; | ||
version = "0.1"; | ||
phases = [ "installPhase" ]; | ||
installPhase = '' | ||
mkdir -p $out/bin | ||
cp -r ${protobuf}/include/ $out/bin/ | ||
cp "${grpc-tools}/bin/protoc" $out/bin/grpc_tools_node_protoc | ||
cp "${grpc-tools}/bin/grpc_node_plugin" $out/bin/grpc_tools_node_protoc_plugin | ||
''; | ||
}; | ||
|
||
ts_protoc = stdenv.mkDerivation rec { | ||
name = "protoc-gen-ts-wksp"; | ||
src = fetchFromGitHub { | ||
owner = "thesayyn"; | ||
repo = "protoc-gen-ts"; | ||
rev = "0.8.7"; | ||
hash = "sha256-PGprtSPMRTodt/SD6gpEr/n22jiNqB1/C6HJGlDndLg="; | ||
}; | ||
buildInputs = [ git cacert nodejs bazel ]; | ||
buildPhase = '' | ||
export HOME=$(pwd) | ||
mkdir -p $out/bin | ||
npm ci | ||
bazel build package | ||
''; | ||
installPhase = '' | ||
cp bazel-bin/package/package/protoc-gen-ts.js $out/bin/protoc-gen-ts | ||
''; | ||
}; | ||
|
||
in [ | ||
goreleaser | ||
go_1_19 | ||
gopls | ||
golangci-lint | ||
delve | ||
enumer | ||
nodejs_20 | ||
yarn | ||
protobuf | ||
protoc-gen-go | ||
protoc-gen-go-grpc | ||
protoc-gen-connect-go | ||
protoc-gen-grpc-web | ||
grpc-tools | ||
rustc | ||
cargo | ||
rustfmt | ||
rust-analyzer | ||
clippy | ||
libiconv | ||
bash-completion | ||
# local definition (see above) | ||
renamed_grpc_tools | ||
ts_protoc | ||
]; | ||
|
||
shellHook = '' | ||
export CARGO_NET_GIT_FETCH_WITH_CLI=true | ||
printf '\u001b[32m | ||
@@@@@@@@ | ||
@@@ @@ @@@ @@@ | ||
@@@ @@ @@ @@ | ||
@ @@ @@ @@ | ||
@@ @@ @@ | ||
@@ @@ @@ | ||
@ @@ @@ @@ | ||
@ @@ @@ @@ | ||
@@ @@@ @@@ @@ | ||
@@@ @@@@@@@@ | ||
\u001b[0m | ||
Starting Kurtosis dev shell. Setup the alias to local compiled Kurtosis cli command "ktdev" by running: | ||
\e[32m | ||
source ./scripts/set_ktdev.sh | ||
\e[0m | ||
' | ||
''; | ||
}; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Add alias to compiled CLI | ||
alias ktdev="$(pwd)/cli/cli/scripts/launch-cli.sh" | ||
|
||
# Setup bash completion | ||
source <(ktdev completion bash) | ||
complete -F __start_kurtosis ktdev |