Files
nixpkgs/pkgs/by-name/so/sops/package.nix
2026-07-23 18:18:40 +02:00

75 lines
1.7 KiB
Nix

{
lib,
buildGoModule,
fetchFromGitHub,
installShellFiles,
versionCheckHook,
nix-update-script,
makeWrapper,
runCommand,
age,
}:
buildGoModule (finalAttrs: {
pname = "sops";
version = "3.13.3";
__structuredAttrs = true;
src = fetchFromGitHub {
owner = "getsops";
repo = finalAttrs.pname;
tag = "v${finalAttrs.version}";
hash = "sha256-TLThUgoJKcqqzQBIPzXLK+4VznMEf1wEkDUbz2pijiE=";
};
vendorHash = "sha256-LHMmSO6IDZA0hbattv3jM+9xLd57VrulVxOn+uYG4n0=";
subPackages = [ "cmd/sops" ];
ldflags = [
"-s"
"-w"
"-X github.com/getsops/sops/v3/version.Version=${finalAttrs.version}"
];
nativeBuildInputs = [
installShellFiles
makeWrapper
];
postInstall = ''
installShellCompletion --cmd sops --bash ${./bash_autocomplete}
installShellCompletion --cmd sops --zsh ${./zsh_autocomplete}
'';
nativeInstallCheckInputs = [ versionCheckHook ];
doInstallCheck = true;
passthru.updateScript = nix-update-script { };
# wrap sops with age plugins
passthru.withAgePlugins =
filter:
runCommand "sops-${finalAttrs.version}-with-age-plugins"
{
nativeBuildInputs = [ makeWrapper ];
}
''
makeWrapper ${lib.getBin finalAttrs.finalPackage}/bin/sops $out/bin/sops \
--prefix PATH : "${lib.makeBinPath (filter age.passthru.plugins)}"
'';
meta = {
homepage = "https://getsops.io/";
description = "Simple and flexible tool for managing secrets";
changelog = "https://github.com/getsops/sops/blob/v${finalAttrs.version}/CHANGELOG.md";
mainProgram = "sops";
maintainers = with lib.maintainers; [
Scrumplex
mic92
];
license = lib.licenses.mpl20;
};
})