mirror of
https://github.com/RichieCahill/dotfiles.git
synced 2026-04-17 04:58:19 -04:00
added runners dir
This commit is contained in:
27
systems/jeeves/runners/default.nix
Normal file
27
systems/jeeves/runners/default.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
imports = [ ./nix_builder.nix ];
|
||||
|
||||
users = {
|
||||
users.github-runners = {
|
||||
shell = pkgs.bash;
|
||||
isSystemUser = true;
|
||||
group = "github-runners";
|
||||
uid = 601;
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA/S8i+BNX/12JNKg+5EKGX7Aqimt5KM+ve3wt/SyWuO github-runners" # cspell:disable-line
|
||||
];
|
||||
};
|
||||
groups.github-runners.gid = 601;
|
||||
};
|
||||
|
||||
|
||||
services.nix_builder.containers = {
|
||||
nix-builder-0.enable = true;
|
||||
nix-builder-1.enable = true;
|
||||
nix-builder-2.enable = true;
|
||||
nix-builder-3.enable = true;
|
||||
nix-builder-4.enable = true;
|
||||
nix-builder-5.enable = true;
|
||||
};
|
||||
}
|
||||
83
systems/jeeves/runners/nix_builder.nix
Normal file
83
systems/jeeves/runners/nix_builder.nix
Normal file
@@ -0,0 +1,83 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
vars = import ./vars.nix;
|
||||
in
|
||||
{
|
||||
options.services.nix_builder.containers = mkOption {
|
||||
type = types.attrsOf (types.submodule ({ name, ... }: {
|
||||
options.enable = mkEnableOption "GitHub runner container";
|
||||
}));
|
||||
default = {};
|
||||
description = "GitHub runner container configurations";
|
||||
};
|
||||
|
||||
config.containers = mapAttrs (name: cfg:
|
||||
mkIf cfg.enable {
|
||||
autoStart = true;
|
||||
bindMounts = {
|
||||
"/storage" = {
|
||||
mountPoint = "/zfs/media/github-runners/${name}";
|
||||
isReadOnly = false;
|
||||
};
|
||||
"/secrets".mountPoint = "${vars.storage_secrets}/services/github-runners/${name}";
|
||||
"ssh-keys".mountPoint = "${vars.storage_secrets}/services/github-runners/id_ed25519_github-runners";
|
||||
};
|
||||
config = { config, pkgs, lib, ... }: {
|
||||
nix.settings = {
|
||||
trusted-substituters = [
|
||||
"https://cache.nixos.org"
|
||||
"https://cache.tmmworkshop.com"
|
||||
"https://nix-community.cachix.org"
|
||||
];
|
||||
substituters = [
|
||||
"https://cache.nixos.org/?priority=2&want-mass-query=true"
|
||||
"https://cache.tmmworkshop.com/?priority=2&want-mass-query=true"
|
||||
"https://nix-community.cachix.org/?priority=10&want-mass-query=true"
|
||||
];
|
||||
trusted-public-keys = [
|
||||
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
||||
"cache.tmmworkshop.com:jHffkpgbmEdstQPoihJPYW9TQe6jnQbWR2LqkNGV3iA="
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
];
|
||||
experimental-features = [
|
||||
"flakes"
|
||||
"nix-command"
|
||||
];
|
||||
};
|
||||
programs.ssh.extraConfig = ''
|
||||
Host jeeves
|
||||
Port 629
|
||||
User github-runners
|
||||
HostName 192.168.95.14
|
||||
IdentityFile ${vars.storage_secrets}/services/github-runners/id_ed25519_github-runners
|
||||
StrictHostKeyChecking no
|
||||
UserKnownHostsFile /dev/null
|
||||
'';
|
||||
services.github-runners.${name} = {
|
||||
enable = true;
|
||||
replace = true;
|
||||
workDir = "/zfs/media/github-runners/${name}";
|
||||
url = "https://github.com/RichieCahill/dotfiles";
|
||||
extraLabels = [ "nixos" ];
|
||||
tokenFile = "${vars.storage_secrets}/services/github-runners/${name}";
|
||||
user = "github-runners";
|
||||
group = "github-runners";
|
||||
extraPackages = with pkgs; [ nixos-rebuild openssh ];
|
||||
};
|
||||
users = {
|
||||
users.github-runners = {
|
||||
shell = pkgs.bash;
|
||||
isSystemUser = true;
|
||||
group = "github-runners";
|
||||
uid = 601;
|
||||
};
|
||||
groups.github-runners.gid = 601;
|
||||
};
|
||||
system.stateVersion = "24.11";
|
||||
};
|
||||
}
|
||||
) config.services.nix_builder.containers;
|
||||
}
|
||||
Reference in New Issue
Block a user