infra/roles/nix-community-cache.nix
Jonas Chevalier 37e48b712e
move things around a bit ()
* keep ./services for instances

./profiles is for config-only modules

./services are like profiles, but configure a single instance of a
service. Those are fronted by Nginx as the load-balancer and have a DNS
entry as well.

* ci: build build03 as well

* move hydra to services

* move matterbridge to services

* move marvin-mk2 to services

* build01: share the remainder profiles

* build02: use the nix-community-cache

* fixup kexec

* rename profiles to roles

* README: sync with reality
2021-03-07 16:28:44 +00:00

48 lines
1.3 KiB
Nix

{ config, pkgs, ... }:
let
postBuildHook = pkgs.writeScript "post-build-hook.sh" ''
#!${pkgs.runtimeShell}
export PATH=$PATH:${pkgs.nix}/bin
exec ${pkgs.cachix}/bin/cachix -c /var/lib/post-build-hook/nix-community-cachix.dhall push nix-community $OUT_PATHS
'';
sockPath = "/run/post-build-hook.sock";
queueBuildHook = pkgs.writeScript "post-build-hook.sh" ''
${pkgs.queued-build-hook}/bin/queued-build-hook queue --socket ${sockPath}
'';
sources = import ../nix/sources.nix;
in
{
nixpkgs.overlays = [
(self: super: {
queued-build-hook = (import sources.queued-build-hook { pkgs = super; });
})
];
systemd.sockets.queued-build-hook = {
description = "Post-build-hook socket";
wantedBy = [ "sockets.target" ];
socketConfig = {
ListenStream = sockPath;
SocketUser = "root";
SocketMode = "0600";
};
};
systemd.services.queued-build-hook = {
description = "Post-build-hook service";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" "queued-build-hook.socket" ];
requires = [ "queued-build-hook.socket" ];
serviceConfig.ExecStart = "${pkgs.queued-build-hook}/bin/queued-build-hook daemon --retry-interval 30 --hook ${postBuildHook}";
};
nix.extraOptions = ''
post-build-hook = ${queueBuildHook}
'';
}