nix-cache-login/flake.nix

81 lines
2.2 KiB
Nix
Raw Permalink Normal View History

2026-02-26 09:25:58 +01:00
{
2026-02-26 11:07:32 +01:00
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
2026-02-26 09:25:58 +01:00
outputs =
2026-02-26 11:07:32 +01:00
{ self, nixpkgs }:
let
2026-02-26 09:25:58 +01:00
systems = [
"x86_64-linux"
"aarch64-darwin"
];
2026-02-26 11:07:32 +01:00
forAllSystems = fn: nixpkgs.lib.genAttrs systems (system: fn nixpkgs.legacyPackages.${system});
in
{
packages = forAllSystems (pkgs: {
2026-02-26 11:24:48 +01:00
default = pkgs.callPackage ./package.nix { };
2026-02-26 11:07:32 +01:00
});
2026-02-26 11:05:16 +01:00
2026-02-26 11:07:32 +01:00
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";
};
});
2026-02-26 11:05:16 +01:00
2026-02-26 11:07:32 +01:00
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;
});
2026-02-26 11:05:16 +01:00
2026-02-26 11:07:32 +01:00
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
packages = with pkgs; [
go
cobra-cli
];
2026-02-26 09:25:58 +01:00
};
2026-02-26 11:07:32 +01:00
});
2026-02-26 19:11:53 +01:00
nixosModules = {
# Workstation: systemd user timer+service running `nix-cache-login refresh`
default =
{
config,
lib,
pkgs,
...
}:
{
imports = [ ./nixos-module.nix ];
services.nix-cache-login.package =
lib.mkDefault
self.packages.${pkgs.stdenv.hostPlatform.system}.default;
};
# Server: system-level timer+service running `nix-cache-login service-account`
server =
{
config,
lib,
pkgs,
...
}:
{
imports = [ ./nixos-module-server.nix ];
services.nix-cache-login-server.package =
lib.mkDefault
self.packages.${pkgs.stdenv.hostPlatform.system}.default;
};
};
2026-02-26 09:25:58 +01:00
};
}