Skip to content

Instantly share code, notes, and snippets.

@JamesAtIntegratnIO
Last active June 23, 2025 21:15
Show Gist options
  • Select an option

  • Save JamesAtIntegratnIO/4c594ee91443a0a873b245f868206398 to your computer and use it in GitHub Desktop.

Select an option

Save JamesAtIntegratnIO/4c594ee91443a0a873b245f868206398 to your computer and use it in GitHub Desktop.
idpbuilder nix flake
## flake.nix
{
description = "A Nix flake for score-compose";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
idpbuilder-src = {
url = "github:cnoe-io/idpbuilder?ref=v0.9.0";
flake = false;
};
};
outputs = { self, nixpkgs, flake-utils, idpbuilder-src }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
lib = pkgs.lib;
idpbuilder_version = "v0.9.0";
gitRev = self.rev or "dirty";
shortRev = lib.strings.substring 0 7 gitRev;
buildDate = "1970-01-01T00:00:00Z";
ldflags = [
"-X github.com/cnoe-io/idpbuilder/pkg/cmd/version.idpbuilderVersion=${shortRev}"
"-X github.com/cnoe-io/idpbuilder/pkg/cmd/version.gitCommit=${gitRev}"
"-X github.com/cnoe-io/idpbuilder/pkg/cmd/version.buildDate=${buildDate}"
];
in
{
packages.idpbuilder = pkgs.buildGoModule {
pname = "idpbuilder";
version = idpbuilder_version;
src = idpbuilder-src;
vendorHash = "sha256-iQy83cPLXvsUf5gHd042KLO9CbPwQMQPUc5efytCHJc=";
subPackages = [ "." ];
ldflags = ldflags;
nativeBuildInputs = [ pkgs.kustomize pkgs.kubernetes-helm ];
doCheck = false;
};
devShells.default = pkgs.mkShell {
packages = with pkgs; [
go gopls gotools delve docker kind kubectl kustomize kubernetes-helm kubernetes-controller-tools setup-envtest
# Add the locally built idpbuilder binary to the shell
self.packages.${system}.idpbuilder
shellHook = ''
echo "\n[devShell] idpbuilder dev environment ready."
export PATH=$PWD/bin:$PATH
export KUBEBUILDER_ASSETS="$(setup-envtest use 1.29.1 --bin-dir $PWD/bin -p path)"
echo "Run: controller-gen, go test, go vet, ./hack/embedded-resources.sh"
echo "Run: `idpbuilder create` to create a new IDP cluster with Kind"
'';
};
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment