infra/ci.nix

20 lines
800 B
Nix
Raw Normal View History

2020-04-18 00:12:32 +02:00
# Add derivations to be built from the cache to this file
2021-12-23 21:15:46 +01:00
{ system ? builtins.currentSystem
, src ? { ref = null; }
}:
2020-04-18 00:12:32 +02:00
let
2022-04-10 22:29:46 +02:00
self = builtins.getFlake (toString ./.);
nixpkgs = self.inputs.nixpkgs;
effects = self.inputs.hercules-ci-effects.lib.withPkgs nixpkgs.legacyPackages.x86_64-linux;
2020-04-18 00:12:32 +02:00
2022-04-10 22:29:46 +02:00
deploy = machine: effects.runIf (src.ref == "refs/heads/master") (effects.runCachixDeploy {
2022-01-15 08:13:13 +01:00
deploy.agents = {
${machine.config.networking.hostName} = machine.config.system.build.toplevel;
};
});
2020-04-18 00:12:32 +02:00
in
2022-04-10 22:29:46 +02:00
(nixpkgs.lib.mapAttrs'
(name: config: nixpkgs.lib.nameValuePair "nixos-${name}" config.config.system.build.toplevel) self.outputs.nixosConfigurations)
// (nixpkgs.lib.mapAttrs'
(name: config: nixpkgs.lib.nameValuePair "deploy-${name}" (deploy config)) self.outputs.nixosConfigurations)