2023-07-15 17:15:38 +00:00
|
|
|
{ bash
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
2023-10-09 19:29:22 +00:00
|
|
|
|
|
|
|
, withFish ? false
|
2023-07-15 17:15:38 +00:00
|
|
|
, fish
|
2023-10-09 19:29:22 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
, lib
|
|
|
|
, makeWrapper
|
|
|
|
, xdg-utils
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "granted";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "0.33.0";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "common-fate";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2024-09-19 14:19:46 +00:00
|
|
|
sha256 = "sha256-prvdxWdv580BmhjhP6h4FHyjCDlgr5/Z1kg2wOS+pR0=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
vendorHash = "sha256-g7GKABv7SunVhRUd4y3ZSqD5lnFxM5nuaHJhxFuF/FE=";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
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 = ''
|
2023-10-09 19:29:22 +00:00
|
|
|
ln -s $out/bin/granted $out/bin/assumego
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
# 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 ]}
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
'' + lib.optionalString withFish ''
|
2023-07-15 17:15:38 +00:00
|
|
|
# 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; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Easiest way to access your cloud";
|
2023-07-15 17:15:38 +00:00
|
|
|
homepage = "https://github.com/common-fate/granted";
|
|
|
|
changelog = "https://github.com/common-fate/granted/releases/tag/${version}";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = [ maintainers.ivankovnatsky ];
|
|
|
|
};
|
|
|
|
}
|