infrastructure/patches/nixpkgs/09-init-openbao.patch
Elias Coppens 96d8478568
feat(modules/nixos): init openbao module
Signed-off-by: Elias Coppens <elias@dgnum.eu>
2025-03-10 22:31:52 +01:00

79 lines
2.2 KiB
Diff

From ad2e433d0a0089a28a0b4fee03f6a819b9a35ec9 Mon Sep 17 00:00:00 2001
From: Brian May <brian@linuxpenguins.xyz>
Date: Sat, 14 Dec 2024 07:54:30 +1100
Subject: [PATCH] openbao: init at 2.1.0
Release notes - https://github.com/openbao/openbao/releases/tag/v2.1.0
Changelog - https://github.com/openbao/openbao/blob/main/CHANGELOG.md
---
pkgs/by-name/op/openbao/package.nix | 60 +++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
create mode 100644 pkgs/by-name/op/openbao/package.nix
diff --git a/pkgs/by-name/op/openbao/package.nix b/pkgs/by-name/op/openbao/package.nix
new file mode 100644
index 00000000000000..6990e97cca5428
--- /dev/null
+++ b/pkgs/by-name/op/openbao/package.nix
@@ -0,0 +1,60 @@
+{
+ lib,
+ fetchFromGitHub,
+ buildGoModule,
+ testers,
+ openbao,
+}:
+buildGoModule rec {
+ pname = "openbao";
+ version = "2.1.0";
+
+ src = fetchFromGitHub {
+ owner = "openbao";
+ repo = "openbao";
+ rev = "v${version}";
+ hash = "sha256-QzUNb4T9uau9bWZX6ulUDyfdInGd86iClBAG72C+7mo=";
+ };
+
+ vendorHash = "sha256-Lg58NbwO7vLNRCBwJujcoVcrV018FevvdrUassnAg3k=";
+
+ proxyVendor = true;
+
+ subPackages = [ "." ];
+
+ tags = [
+ "openbao"
+ "bao"
+ ];
+
+ ldflags = [
+ "-s"
+ "-w"
+ "-X github.com/openbao/openbao/version.GitCommit=${src.rev}"
+ "-X github.com/openbao/openbao/version.fullVersion=${version}"
+ ];
+
+ postInstall = ''
+ mv $out/bin/openbao $out/bin/bao
+ '';
+
+ # TODO: Enable the NixOS tests after adding OpenBao as a NixOS service in an upcoming PR and
+ # adding NixOS tests
+ #
+ # passthru.tests = { inherit (nixosTests) vault vault-postgresql vault-dev vault-agent; };
+
+ passthru.tests.version = testers.testVersion {
+ package = openbao;
+ command = "HOME=$(mktemp -d) bao --version";
+ version = "v${version}";
+ };
+
+ meta = with lib; {
+ homepage = "https://www.openbao.org/";
+ description = "Open source, community-driven fork of Vault managed by the Linux Foundation";
+ changelog = "https://github.com/openbao/openbao/blob/v${version}/CHANGELOG.md";
+ license = licenses.mpl20;
+ mainProgram = "bao";
+ maintainers = with maintainers; [ brianmay ];
+ };
+}