home

My NixOS systems configurations.
Log | Files | Refs | LICENSE

commit 05501e05de122a98a05ed1dc90c57774ae4e54d6
parent f800de443013ea3914d86a34ca39c61bf8b533e5
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Fri,  2 Sep 2022 09:45:46 +0200

nix/packages: add opm

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Mnix/packages/default.nix | 5+++++
Mnix/packages/operator-sdk/default.nix | 2+-
Anix/packages/operator-sdk/opm.nix | 59+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mshells/osp.nix | 1+
Musers/vincent/containers/openshift.nix | 1+
5 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/nix/packages/default.nix b/nix/packages/default.nix @@ -108,6 +108,11 @@ rec { operator-sdk_0_19 operator-sdk ; + # OPM + inherit (pkgs.callPackage ./operator-sdk/opm.nix { }) + opm_1_26 + opm + ; # Tekton inherit (pkgs.callPackage ./tkn { }) diff --git a/nix/packages/operator-sdk/default.nix b/nix/packages/operator-sdk/default.nix @@ -20,7 +20,7 @@ rec { subPackages = [ "cmd/operator-sdk" ]; ldflags = let - t = "github.com/operator-framework/operator-sdk/version"; + t = "github.com/operator-framework/operator-sdk/internal/version"; in [ "-X ${t}.GitVersion=${version}" diff --git a/nix/packages/operator-sdk/opm.nix b/nix/packages/operator-sdk/opm.nix @@ -0,0 +1,59 @@ +{ stdenv, lib, buildGo117Module, git, fetchFromGitHub }: + +with lib; +rec { + opmGen = + { version + , sha256 + , vendorSha256 + }: + + buildGo117Module rec { + inherit vendorSha256; + pname = "opm"; + name = "${pname}-${version}"; + rev = "v${version}"; + + builtInputs = [ "git" ]; + + subPackages = [ "cmd/opm" ]; + ldflags = + let + t = "https://github.com/operator-framework/operator-registry/cmd/opm/version"; + in + [ + "-X ${t}.gitCommit=${version}" + "-X ${t}.opmVersion=${version}" + ]; + + src = fetchFromGitHub { + inherit rev; + owner = "operator-framework"; + repo = "operator-registry"; + sha256 = "${sha256}"; + }; + + postInstall = '' + # completions + mkdir -p $out/share/bash-completion/completions/ + $out/bin/opm completion bash > $out/share/bash-completion/completions/opm + mkdir -p $out/share/zsh/site-functions/ + $out/bin/opm completion zsh > $out/share/zsh/site-functions/_opm + ''; + + meta = { + description = "Operator Registry runs in a Kubernetes or OpenShift cluster to provide operator catalog data to Operator Lifecycle Manager. + +"; + homepage = https://github.com/operator-framework/operator-registry; + license = lib.licenses.asl20; + }; + }; + + opm_1_26 = makeOverridable opmGen { + version = "1.26.0"; + sha256 = "sha256-wOdHduHcuH5olPGwpV6v4wSTxZYZbkzwDGknQVGPQvI="; + vendorSha256 = null; + }; + opm = opm_1_26; +} diff --git a/shells/osp.nix b/shells/osp.nix @@ -16,6 +16,7 @@ pkgs.mkShell { my.oc my.operator-sdk my.tkn + my.opm python39Packages.pyaml skopeo yq-go diff --git a/users/vincent/containers/openshift.nix b/users/vincent/containers/openshift.nix @@ -7,5 +7,6 @@ my.oc my.openshift-install my.operator-sdk + my.opm ]; }