post-build-hook: Make post build hook async
This commit is contained in:
parent
a5404a8379
commit
981ae44851
2 changed files with 46 additions and 1 deletions
|
@ -4,13 +4,46 @@ let
|
||||||
|
|
||||||
postBuildHook = pkgs.writeScript "post-build-hook.sh" ''
|
postBuildHook = pkgs.writeScript "post-build-hook.sh" ''
|
||||||
#!${pkgs.runtimeShell}
|
#!${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
|
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 {
|
in {
|
||||||
|
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(self: super: {
|
||||||
|
queued-build-hook = (import sources.queued-build-hook {});
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
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 = ''
|
nix.extraOptions = ''
|
||||||
post-build-hook = ${postBuildHook}
|
post-build-hook = ${queueBuildHook}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,18 @@
|
||||||
"url": "https://github.com/jonringer/nixpkgs-update-pypi-releases/archive/cf72f9a94b0ccc306c025eba222a70456378433d.tar.gz",
|
"url": "https://github.com/jonringer/nixpkgs-update-pypi-releases/archive/cf72f9a94b0ccc306c025eba222a70456378433d.tar.gz",
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||||
},
|
},
|
||||||
|
"queued-build-hook": {
|
||||||
|
"branch": "master",
|
||||||
|
"description": "Queue and retry Nix post-build-hook",
|
||||||
|
"homepage": null,
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "queued-build-hook",
|
||||||
|
"rev": "24882efb9b61fc39273c6421b914d45701f85cb8",
|
||||||
|
"sha256": "0q1bvbsny5xs5wnzn17zwgigb3xkrjxy7vm1yxk24kam1vcwymv9",
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://github.com/nix-community/queued-build-hook/archive/24882efb9b61fc39273c6421b914d45701f85cb8.tar.gz",
|
||||||
|
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||||
|
},
|
||||||
"simple-hydra": {
|
"simple-hydra": {
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"description": "A simple module for enabling Hydra",
|
"description": "A simple module for enabling Hydra",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue