shack/gitlab-runner: use upstream gitlab module
This commit is contained in:
parent
a84ec5151b
commit
1183d84728
@ -1,24 +1,48 @@
|
|||||||
{ pkgs, ... }:
|
{ pkgs,lib, ... }:
|
||||||
let
|
|
||||||
runner-src = builtins.fetchTarball {
|
|
||||||
url = "https://gitlab.com/arianvp/nixos-gitlab-runner/-/archive/master/nixos-gitlab-runner-master.tar.gz";
|
|
||||||
sha256 = "1s0fy5ny2ygcfvx35xws8xz5ih4z4kdfqlq3r6byxpylw7r52fyi";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
imports = [
|
services.gitlab-runner = {
|
||||||
"${runner-src}/gitlab-runner.nix"
|
|
||||||
];
|
|
||||||
services.gitlab-runner2 = {
|
|
||||||
enable = true;
|
enable = true;
|
||||||
## registrationConfigurationFile contains:
|
services= {
|
||||||
# CI_SERVER_URL=<CI server URL>
|
# runner for building in docker via host's nix-daemon
|
||||||
# REGISTRATION_TOKEN=<registration secret>
|
# nix store will be readable in runner, might be insecure
|
||||||
# RUNNER_TAG_LIST=nix,shacklan
|
nix = with lib;{
|
||||||
# RUNNER_NAME=stockholm-runner-$name
|
# File should contain at least these two variables:
|
||||||
registrationConfigFile = <secrets/shackspace-gitlab-ci>;
|
# `CI_SERVER_URL`
|
||||||
#gracefulTermination = true;
|
# `REGISTRATION_TOKEN`
|
||||||
|
registrationConfigFile = toString <secrets/shackspace-gitlab-ci>;
|
||||||
|
dockerImage = "alpine";
|
||||||
|
dockerVolumes = [
|
||||||
|
"/nix/store:/nix/store:ro"
|
||||||
|
"/nix/var/nix/db:/nix/var/nix/db:ro"
|
||||||
|
"/nix/var/nix/daemon-socket:/nix/var/nix/daemon-socket:ro"
|
||||||
|
];
|
||||||
|
dockerDisableCache = true;
|
||||||
|
preBuildScript = pkgs.writeScript "setup-container" ''
|
||||||
|
mkdir -p -m 0755 /nix/var/log/nix/drvs
|
||||||
|
mkdir -p -m 0755 /nix/var/nix/gcroots
|
||||||
|
mkdir -p -m 0755 /nix/var/nix/profiles
|
||||||
|
mkdir -p -m 0755 /nix/var/nix/temproots
|
||||||
|
mkdir -p -m 0755 /nix/var/nix/userpool
|
||||||
|
mkdir -p -m 1777 /nix/var/nix/gcroots/per-user
|
||||||
|
mkdir -p -m 1777 /nix/var/nix/profiles/per-user
|
||||||
|
mkdir -p -m 0755 /nix/var/nix/profiles/per-user/root
|
||||||
|
mkdir -p -m 0700 "$HOME/.nix-defexpr"
|
||||||
|
. ${pkgs.nix}/etc/profile.d/nix.sh
|
||||||
|
${pkgs.nix}/bin/nix-env -i ${concatStringsSep " " (with pkgs; [ nix cacert git openssh ])}
|
||||||
|
${pkgs.nix}/bin/nix-channel --add https://nixos.org/channels/nixpkgs-unstable
|
||||||
|
${pkgs.nix}/bin/nix-channel --update nixpkgs
|
||||||
|
'';
|
||||||
|
environmentVariables = {
|
||||||
|
ENV = "/etc/profile";
|
||||||
|
USER = "root";
|
||||||
|
NIX_REMOTE = "daemon";
|
||||||
|
PATH = "/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:/bin:/sbin:/usr/bin:/usr/sbin";
|
||||||
|
NIX_SSL_CERT_FILE = "/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt";
|
||||||
|
};
|
||||||
|
tagList = [ "nix" "shacklan" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
systemd.services.gitlab-runner2.restartIfChanged = false;
|
systemd.services.gitlab-runner.restartIfChanged = false;
|
||||||
systemd.services.docker.restartIfChanged = false;
|
systemd.services.docker.restartIfChanged = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user