Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
add flake
Browse files Browse the repository at this point in the history
  • Loading branch information
lostbean committed Sep 26, 2024
1 parent 2f93ac4 commit 9802df7
Show file tree
Hide file tree
Showing 2 changed files with 263 additions and 0 deletions.
174 changes: 174 additions & 0 deletions flake.lock

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

89 changes: 89 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
description = "Go development environment";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
flake-utils.url = "github:numtide/flake-utils";
unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
kardinal.url = "github:kurtosis-tech/kardinal/4be70324e7b2";
};
outputs = {
self,
nixpkgs,
flake-utils,
unstable,
kardinal,
...
}:
flake-utils.lib.eachDefaultSystem
(
system: let
pkgs = import nixpkgs {
inherit system;
overlays = [
(final: prev: {
kardinal = kardinal.outputs.packages.${system};
})
];
};
in {
devShells.default = let
start-local-cluster = pkgs.writeShellApplication {
name = "start-local-cluster";
runtimeInputs = with pkgs; [minikube istioctl kubectl];
text = ''
kubectl config set-context minikube
minikube start --driver=docker
minikube addons enable ingress
minikube addons enable metrics-server
istioctl install --set profile=minimal --set meshConfig.accessLogFile=/dev/stdout -y
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.1.0/standard-install.yaml
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.10/samples/addons/prometheus.yaml
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.10/samples/addons/grafana.yaml
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.10/samples/addons/jaeger.yaml
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.10/samples/addons/kiali.yaml
kubectl rollout status deployment/kiali -n istio-system
'';
};

kardinal-cli = pkgs.stdenv.mkDerivation {
name = "kardinal";
dontUnpack = true;
buildInputs = [pkgs.kardinal.kardinal-cli];
installPhase = ''
mkdir -p $out/bin
ln -s ${pkgs.kardinal.kardinal-cli}/bin/kardinal.cli $out/bin/kardinal
'';
};
in
pkgs.mkShell {
buildInputs = with pkgs; [
go
gopls
go-tools
golangci-lint
reflex

# local demo tools
kardinal-cli
minikube
kubectl
istioctl
telepresence2

# Scripts
start-local-cluster
];

shellHook = ''
source <(kardinal completion bash)
echo "Go development environment loaded"
go version
'';
};
}
);
}

0 comments on commit 9802df7

Please sign in to comment.