nixpkgs/pkgs/tools/admin/granted/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

61 lines
1.5 KiB
Nix
Raw Normal View History

{ bash
, buildGoModule
, fetchFromGitHub
, fish
, lib
, makeWrapper
, xdg-utils
}:
buildGoModule rec {
pname = "granted";
2023-08-09 01:29:39 +00:00
version = "0.14.2";
src = fetchFromGitHub {
owner = "common-fate";
repo = pname;
rev = "v${version}";
2023-08-09 01:29:39 +00:00
sha256 = "sha256-BxtEMIWJaZaCtd5auGRq+F3VkRTZXGBa6GdLWgvC+ZE=";
};
2023-08-09 01:29:39 +00:00
vendorHash = "sha256-tPWdzPJyjxcjDM5UgIeQek60Df/7dSaKedZF04tfu6Q=";
nativeBuildInputs = [ makeWrapper ];
ldflags = [
"-s"
"-w"
"-X github.com/common-fate/granted/internal/build.Version=v${version}"
"-X github.com/common-fate/granted/internal/build.Commit=${src.rev}"
"-X github.com/common-fate/granted/internal/build.Date=1970-01-01-00:00:01"
"-X github.com/common-fate/granted/internal/build.BuiltBy=Nix"
];
subPackages = [
"cmd/granted"
];
postInstall = ''
# Install shell script
install -Dm755 $src/scripts/assume $out/bin/assume
substituteInPlace $out/bin/assume \
--replace /bin/bash ${bash}/bin/bash
wrapProgram $out/bin/assume \
--suffix PATH : ${lib.makeBinPath [ xdg-utils ]}
# Install fish script
install -Dm755 $src/scripts/assume.fish $out/share/assume.fish
substituteInPlace $out/share/assume.fish \
--replace /bin/fish ${fish}/bin/fish
'';
meta = with lib; {
description = "The easiest way to access your cloud.";
homepage = "https://github.com/common-fate/granted";
changelog = "https://github.com/common-fate/granted/releases/tag/${version}";
license = licenses.mit;
maintainers = [ maintainers.ivankovnatsky ];
};
}