Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ bash 2, buildGoModule 3, fetchFromGitHub 4 5, withFish ? false 6, fish 7 8, lib 9, makeWrapper 10, xdg-utils 11}: 12 13buildGoModule rec { 14 pname = "granted"; 15 version = "0.16.0"; 16 17 src = fetchFromGitHub { 18 owner = "common-fate"; 19 repo = pname; 20 rev = "v${version}"; 21 sha256 = "sha256-s9HnZ+yZ/dPIn8d2510k+lpsq5KHvtNsULTxtWVlGAk="; 22 }; 23 24 vendorHash = "sha256-8wPQjxmY3EW0Y8BfNjZW1NNz4L9Rwzsvap0BF+7AtDc="; 25 26 nativeBuildInputs = [ makeWrapper ]; 27 28 ldflags = [ 29 "-s" 30 "-w" 31 "-X github.com/common-fate/granted/internal/build.Version=v${version}" 32 "-X github.com/common-fate/granted/internal/build.Commit=${src.rev}" 33 "-X github.com/common-fate/granted/internal/build.Date=1970-01-01-00:00:01" 34 "-X github.com/common-fate/granted/internal/build.BuiltBy=Nix" 35 ]; 36 37 subPackages = [ 38 "cmd/granted" 39 ]; 40 41 postInstall = '' 42 ln -s $out/bin/granted $out/bin/assumego 43 44 # Install shell script 45 install -Dm755 $src/scripts/assume $out/bin/assume 46 substituteInPlace $out/bin/assume \ 47 --replace /bin/bash ${bash}/bin/bash 48 49 wrapProgram $out/bin/assume \ 50 --suffix PATH : ${lib.makeBinPath [ xdg-utils ]} 51 52 '' + lib.optionalString withFish '' 53 # Install fish script 54 install -Dm755 $src/scripts/assume.fish $out/share/assume.fish 55 substituteInPlace $out/share/assume.fish \ 56 --replace /bin/fish ${fish}/bin/fish 57 ''; 58 59 meta = with lib; { 60 description = "The easiest way to access your cloud."; 61 homepage = "https://github.com/common-fate/granted"; 62 changelog = "https://github.com/common-fate/granted/releases/tag/${version}"; 63 license = licenses.mit; 64 maintainers = [ maintainers.ivankovnatsky ]; 65 }; 66}