plain vanilla flakes
This commit is contained in:
parent
d986a0b31a
commit
8e29bf9aa6
2 changed files with 46 additions and 89 deletions
34
flake.lock
generated
34
flake.lock
generated
|
|
@ -1,23 +1,5 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"flake-parts": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs-lib": "nixpkgs-lib"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1769996383,
|
|
||||||
"narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=",
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "flake-parts",
|
|
||||||
"rev": "57928607ea566b5db3ad13af0e57e921e6b12381",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "flake-parts",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1771848320,
|
"lastModified": 1771848320,
|
||||||
|
|
@ -32,24 +14,8 @@
|
||||||
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1"
|
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs-lib": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1769909678,
|
|
||||||
"narHash": "sha256-cBEymOf4/o3FD5AZnzC3J9hLbiZ+QDT/KDuyHXVJOpM=",
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "nixpkgs.lib",
|
|
||||||
"rev": "72716169fe93074c333e8d0173151350670b824c",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "nixpkgs.lib",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-parts": "flake-parts",
|
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
101
flake.nix
101
flake.nix
|
|
@ -1,66 +1,57 @@
|
||||||
{
|
{
|
||||||
inputs = {
|
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
|
||||||
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; # tracks nixpkgs unstable branch
|
|
||||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
||||||
};
|
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
inputs@{ flake-parts, ... }:
|
{ self, nixpkgs }:
|
||||||
# https://flake.parts/module-arguments.html
|
let
|
||||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
|
||||||
flake = {
|
|
||||||
# Put your original flake attributes here.
|
|
||||||
};
|
|
||||||
systems = [
|
systems = [
|
||||||
# systems for which you want to build the `perSystem` attributes
|
|
||||||
"x86_64-linux"
|
"x86_64-linux"
|
||||||
"aarch64-darwin"
|
"aarch64-darwin"
|
||||||
];
|
];
|
||||||
perSystem =
|
forAllSystems = fn: nixpkgs.lib.genAttrs systems (system: fn nixpkgs.legacyPackages.${system});
|
||||||
{
|
in
|
||||||
config,
|
{
|
||||||
self',
|
packages = forAllSystems (pkgs: {
|
||||||
inputs',
|
default = pkgs.buildGoModule {
|
||||||
pkgs,
|
pname = "nix-cache-login";
|
||||||
lib,
|
version = "0.1.0";
|
||||||
system,
|
src = ./.;
|
||||||
...
|
vendorHash = "sha256-1s77IEGP7/6sgXSNdByRQqisLHSeJuRSsrnxUGfkxos=";
|
||||||
}:
|
meta = {
|
||||||
{
|
description = "CLI tool for authenticating with a Nix binary cache via OIDC";
|
||||||
packages.default = pkgs.buildGoModule {
|
mainProgram = "nix-cache-login";
|
||||||
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.default = {
|
|
||||||
type = "app";
|
|
||||||
program = "${self'.packages.default}/bin/nix-cache-login";
|
|
||||||
};
|
|
||||||
|
|
||||||
checks.tests = self'.packages.default.overrideAttrs (old: {
|
|
||||||
pname = "nix-cache-login-tests";
|
|
||||||
checkPhase = ''
|
|
||||||
runHook preCheck
|
|
||||||
go test ./...
|
|
||||||
runHook postCheck
|
|
||||||
'';
|
|
||||||
doCheck = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
devShells = {
|
|
||||||
default = pkgs.mkShell {
|
|
||||||
packages = with pkgs; [
|
|
||||||
go
|
|
||||||
cobra-cli
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
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
|
||||||
|
];
|
||||||
|
};
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue