57 lines
1.6 KiB
Nix
57 lines
1.6 KiB
Nix
{
|
|
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
|
|
|
|
outputs =
|
|
{ self, nixpkgs }:
|
|
let
|
|
systems = [
|
|
"x86_64-linux"
|
|
"aarch64-darwin"
|
|
];
|
|
forAllSystems = fn: nixpkgs.lib.genAttrs systems (system: fn nixpkgs.legacyPackages.${system});
|
|
in
|
|
{
|
|
packages = forAllSystems (pkgs: {
|
|
default = pkgs.buildGoModule {
|
|
pname = "nix-cache-login";
|
|
version = "0.1.0";
|
|
src = ./.;
|
|
vendorHash = "sha256-1s77IEGP7/6sgXSNdByRQqisLHSeJuRSsrnxUGfkxos=";
|
|
meta = {
|
|
description = "CLI tool for authenticating with a Nix binary cache via OIDC";
|
|
mainProgram = "nix-cache-login";
|
|
};
|
|
};
|
|
});
|
|
|
|
apps = forAllSystems (pkgs: {
|
|
default = {
|
|
type = "app";
|
|
program = "${self.packages.${pkgs.stdenv.hostPlatform.system}.default}/bin/nix-cache-login";
|
|
meta.description = "CLI tool for authenticating with a Nix binary cache via OIDC";
|
|
};
|
|
});
|
|
|
|
checks = forAllSystems (pkgs: {
|
|
tests = self.packages.${pkgs.stdenv.hostPlatform.system}.default.overrideAttrs (_: {
|
|
pname = "nix-cache-login-tests";
|
|
checkPhase = ''
|
|
runHook preCheck
|
|
go test ./...
|
|
runHook postCheck
|
|
'';
|
|
doCheck = true;
|
|
});
|
|
devShell = self.devShells.${pkgs.stdenv.hostPlatform.system}.default;
|
|
});
|
|
|
|
devShells = forAllSystems (pkgs: {
|
|
default = pkgs.mkShell {
|
|
packages = with pkgs; [
|
|
go
|
|
cobra-cli
|
|
];
|
|
};
|
|
});
|
|
};
|
|
}
|