From 16b5704d1549ba18d2a3ed0d90297993eca4c9a8 Mon Sep 17 00:00:00 2001 From: Philip Taron Date: Thu, 12 Feb 2026 16:03:43 -0800 Subject: [PATCH] niks3: init at 1.3.0 It's a S3-backed Nix binary cache with garbage collection. The derivation is mostly taken from https://github.com/Mic92/niks3/blob/main/nix/packages/niks3.nix and adapted for Nixpkgs. There's an upstream NixOS test I could also port, but chose not to. --- pkgs/by-name/ni/niks3/package.nix | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 pkgs/by-name/ni/niks3/package.nix diff --git a/pkgs/by-name/ni/niks3/package.nix b/pkgs/by-name/ni/niks3/package.nix new file mode 100644 index 000000000000..258932f3bfe4 --- /dev/null +++ b/pkgs/by-name/ni/niks3/package.nix @@ -0,0 +1,51 @@ +{ + lib, + buildGoModule, + fetchFromGitHub, + makeWrapper, + nix, +}: + +buildGoModule (finalAttrs: { + pname = "niks3"; + version = "1.3.0"; + + src = fetchFromGitHub { + owner = "Mic92"; + repo = "niks3"; + tag = "v${finalAttrs.version}"; + hash = "sha256-taQgMTbC+k/b+9mJH5vx7BMM3gKSI+MZWL26ZhePThk="; + }; + + vendorHash = "sha256-MoYTq1rY1GMmBBP/ypx6DqrHLGtccgsHa+2rpoztI4U="; + + subPackages = [ + "cmd/niks3" + "cmd/niks3-server" + ]; + + nativeBuildInputs = [ makeWrapper ]; + + ldflags = [ + "-s" + "-w" + ]; + + # The niks3 client shells out to `nix path-info` which differs between Nix and Lix; pinning Nix + # here allows the format to be consistent. See https://github.com/Mic92/niks3/issues/181 + postInstall = '' + wrapProgram $out/bin/niks3 --prefix PATH : ${lib.makeBinPath [ nix ]} + ''; + + meta = { + description = "S3-backed Nix binary cache with garbage collection"; + homepage = "https://github.com/Mic92/niks3"; + changelog = "https://github.com/Mic92/niks3/releases/tag/v${finalAttrs.version}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ + mic92 + philiptaron + ]; + mainProgram = "niks3"; + }; +})