modules/system/builder: init remote-builder module
This commit is contained in:
parent
bd462ef842
commit
f7e0a81ff2
3 changed files with 69 additions and 0 deletions
49
modules/system/builder.nix
Normal file
49
modules/system/builder.nix
Normal file
|
@ -0,0 +1,49 @@
|
|||
{ isLinux }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.settei.remote-builder;
|
||||
|
||||
sharedConfig = {
|
||||
users.users.${cfg.user} = {
|
||||
shell = pkgs.bash;
|
||||
openssh.authorizedKeys.keys = cfg.sshKeys;
|
||||
};
|
||||
|
||||
nix.settings.trusted-users = [ cfg.user ];
|
||||
};
|
||||
|
||||
linuxConfig = lib.optionalAttrs isLinux {
|
||||
users.users.${cfg.user} = {
|
||||
isSystemUser = true;
|
||||
group = cfg.user;
|
||||
};
|
||||
users.groups.${cfg.user} = { };
|
||||
};
|
||||
|
||||
mergedConfig = lib.mkMerge [
|
||||
sharedConfig
|
||||
linuxConfig
|
||||
];
|
||||
in
|
||||
{
|
||||
_file = ./builder.nix;
|
||||
|
||||
options.settei.remote-builder = {
|
||||
enable = lib.mkEnableOption "configuring this machine as a remote builder";
|
||||
user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "nixremote";
|
||||
};
|
||||
sshKeys = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.singleLineStr;
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable mergedConfig;
|
||||
}
|
|
@ -25,6 +25,7 @@
|
|||
(import ./github-runner.nix { inherit isLinux; })
|
||||
(import ./incus.nix { inherit isLinux; })
|
||||
(import ./monitoring.nix { inherit isLinux; })
|
||||
(import ./builder.nix { inherit isLinux; })
|
||||
];
|
||||
|
||||
options.settei = with lib; {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue