Merge pull request #121702 from hercules-ci/nixos-hercules-ci-agent-update
nixos/hercules-ci-agent: updates
This commit is contained in:
commit
316b82563a
|
@ -37,15 +37,22 @@ let
|
||||||
description = ''
|
description = ''
|
||||||
Number of tasks to perform simultaneously.
|
Number of tasks to perform simultaneously.
|
||||||
|
|
||||||
A task is a single derivation build or an evaluation.
|
A task is a single derivation build, an evaluation or an effect run.
|
||||||
At minimum, you need 2 concurrent tasks for <literal>x86_64-linux</literal>
|
At minimum, you need 2 concurrent tasks for <literal>x86_64-linux</literal>
|
||||||
in your cluster, to allow for import from derivation.
|
in your cluster, to allow for import from derivation.
|
||||||
|
|
||||||
<literal>concurrentTasks</literal> can be around the CPU core count or lower if memory is
|
<literal>concurrentTasks</literal> can be around the CPU core count or lower if memory is
|
||||||
the bottleneck.
|
the bottleneck.
|
||||||
|
|
||||||
|
The optimal value depends on the resource consumption characteristics of your workload,
|
||||||
|
including memory usage and in-task parallelism. This is typically determined empirically.
|
||||||
|
|
||||||
|
When scaling, it is generally better to have a double-size machine than two machines,
|
||||||
|
because each split of resources causes inefficiencies; particularly with regards
|
||||||
|
to build latency because of extra downloads.
|
||||||
'';
|
'';
|
||||||
type = types.int;
|
type = types.either types.ints.positive (types.enum [ "auto" ]);
|
||||||
default = 4;
|
default = "auto";
|
||||||
};
|
};
|
||||||
workDirectory = mkOption {
|
workDirectory = mkOption {
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -186,7 +193,18 @@ in
|
||||||
# even shortly after the previous lookup. This *also* applies to the daemon.
|
# even shortly after the previous lookup. This *also* applies to the daemon.
|
||||||
narinfo-cache-negative-ttl = 0
|
narinfo-cache-negative-ttl = 0
|
||||||
'';
|
'';
|
||||||
services.hercules-ci-agent.tomlFile =
|
services.hercules-ci-agent = {
|
||||||
format.generate "hercules-ci-agent.toml" cfg.settings;
|
tomlFile =
|
||||||
|
format.generate "hercules-ci-agent.toml" cfg.settings;
|
||||||
|
|
||||||
|
settings.labels = {
|
||||||
|
agent.source =
|
||||||
|
if options.services.hercules-ci-agent.package.highestPrio == (lib.modules.mkOptionDefault { }).priority
|
||||||
|
then "nixpkgs"
|
||||||
|
else lib.mkOptionDefault "override";
|
||||||
|
pkgs.version = pkgs.lib.version;
|
||||||
|
lib.version = lib.version;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,23 @@ in
|
||||||
# Trusted user allows simplified configuration and better performance
|
# Trusted user allows simplified configuration and better performance
|
||||||
# when operating in a cluster.
|
# when operating in a cluster.
|
||||||
nix.trustedUsers = [ config.systemd.services.hercules-ci-agent.serviceConfig.User ];
|
nix.trustedUsers = [ config.systemd.services.hercules-ci-agent.serviceConfig.User ];
|
||||||
services.hercules-ci-agent.settings.nixUserIsTrusted = true;
|
services.hercules-ci-agent = {
|
||||||
|
settings = {
|
||||||
|
nixUserIsTrusted = true;
|
||||||
|
labels =
|
||||||
|
let
|
||||||
|
mkIfNotNull = x: mkIf (x != null) x;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
nixos.configurationRevision = mkIfNotNull config.system.configurationRevision;
|
||||||
|
nixos.release = config.system.nixos.release;
|
||||||
|
nixos.label = mkIfNotNull config.system.nixos.label;
|
||||||
|
nixos.codeName = config.system.nixos.codeName;
|
||||||
|
nixos.tags = config.system.nixos.tags;
|
||||||
|
nixos.systemName = mkIfNotNull config.system.name;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
users.users.hercules-ci-agent = {
|
users.users.hercules-ci-agent = {
|
||||||
home = cfg.settings.baseDirectory;
|
home = cfg.settings.baseDirectory;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ gnutar, gzip, git, haskell, haskellPackages, lib, makeWrapper, runc, stdenv }:
|
{ gnutar, gzip, git, haskell, haskellPackages, lib, makeWrapper, nixos, runc, stdenv }:
|
||||||
let
|
let
|
||||||
inherit (haskell.lib) overrideCabal addBuildDepends;
|
inherit (haskell.lib) overrideCabal addBuildDepends;
|
||||||
inherit (lib) makeBinPath;
|
inherit (lib) makeBinPath;
|
||||||
|
@ -16,8 +16,16 @@ let
|
||||||
makeWrapper $out/libexec/hercules-ci-agent $out/bin/hercules-ci-agent --prefix PATH : ${makeBinPath bundledBins}
|
makeWrapper $out/libexec/hercules-ci-agent $out/bin/hercules-ci-agent --prefix PATH : ${makeBinPath bundledBins}
|
||||||
'';
|
'';
|
||||||
});
|
});
|
||||||
in pkg // {
|
in pkg.overrideAttrs (o: {
|
||||||
meta = pkg.meta // {
|
meta = o.meta // {
|
||||||
position = toString ./default.nix + ":1";
|
position = toString ./default.nix + ":1";
|
||||||
};
|
};
|
||||||
}
|
passthru = o.passthru // {
|
||||||
|
# Does not test the package, but evaluation of the related NixOS module.
|
||||||
|
tests.nixos-minimal-config = nixos {
|
||||||
|
boot.loader.grub.enable = false;
|
||||||
|
fileSystems."/".device = "bogus";
|
||||||
|
services.hercules-ci-agent.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in New Issue