From 8e01188bdfd8bac2c32d7ac6404b9623dea88744 Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Wed, 30 Mar 2022 06:02:50 +0000 Subject: [PATCH 1/9] cmt: 1.17 -> 1.18 --- pkgs/applications/audio/cmt/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/audio/cmt/default.nix b/pkgs/applications/audio/cmt/default.nix index 1062d897c6bd..bf7ed0ee37d4 100644 --- a/pkgs/applications/audio/cmt/default.nix +++ b/pkgs/applications/audio/cmt/default.nix @@ -5,11 +5,11 @@ stdenv.mkDerivation rec { pname = "cmt"; - version = "1.17"; + version = "1.18"; src = fetchurl { url = "http://www.ladspa.org/download/cmt_${version}.tgz"; - sha256 = "07xd0xmwpa0j12813jpf87fr9hwzihii5l35mp8ady7xxfmxfmpb"; + sha256 = "sha256-qC+GNt4fSto4ahmaAXqc13Wkm0nnFrEejdP3I8k99so="; }; buildInputs = [ ladspaH ]; From 93224c214eb3340e2c7c9cb9f063c2220cd9ab74 Mon Sep 17 00:00:00 2001 From: Masanori Ogino <167209+omasanori@users.noreply.github.com> Date: Mon, 26 Dec 2022 13:59:20 +0900 Subject: [PATCH 2/9] nixos/iay: add module; iay: add myself as a maintainer Signed-off-by: Masanori Ogino <167209+omasanori@users.noreply.github.com> --- nixos/modules/module-list.nix | 1 + nixos/modules/programs/iay.nix | 37 +++++++++++++++++++++++++++++++++ pkgs/tools/misc/iay/default.nix | 5 ++--- 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 nixos/modules/programs/iay.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index af7fd4f712ca..4ae918567a4b 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -179,6 +179,7 @@ ./programs/haguichi.nix ./programs/hamster.nix ./programs/htop.nix + ./programs/iay.nix ./programs/iftop.nix ./programs/i3lock.nix ./programs/iotop.nix diff --git a/nixos/modules/programs/iay.nix b/nixos/modules/programs/iay.nix new file mode 100644 index 000000000000..1fa00e43795a --- /dev/null +++ b/nixos/modules/programs/iay.nix @@ -0,0 +1,37 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.programs.iay; + inherit (lib) mkEnableOption mkIf mkOption mkPackageOption optionalString types; +in { + options.programs.iay = { + enable = mkEnableOption (lib.mdDoc "iay"); + package = mkPackageOption pkgs "iay" {}; + + minimalPrompt = mkOption { + type = types.bool; + default = false; + description = lib.mdDoc "Use minimal one-liner prompt."; + }; + }; + + config = mkIf cfg.enable { + programs.bash.promptInit = '' + if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then + PS1='$(iay ${optionalString cfg.minimalPrompt "-m"})' + fi + ''; + + programs.zsh.promptInit = '' + if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then + autoload -Uz add-zsh-hook + _iay_prompt() { + PROMPT="$(iay -z ${optionalString cfg.minimalPrompt "-m"})" + } + add-zsh-hook precmd _iay_prompt + fi + ''; + }; + + meta.maintainers = pkgs.iay.meta.maintainers; +} diff --git a/pkgs/tools/misc/iay/default.nix b/pkgs/tools/misc/iay/default.nix index 9c8b0a47ab86..88e14f582394 100644 --- a/pkgs/tools/misc/iay/default.nix +++ b/pkgs/tools/misc/iay/default.nix @@ -38,10 +38,9 @@ rustPlatform.buildRustPackage rec { NIX_LDFLAGS = lib.optionals stdenv.isDarwin [ "-framework" "AppKit" ]; meta = with lib; { - description = - "Minimalistic, blazing-fast, and extendable prompt for bash and zsh"; + description = "Minimalistic, blazing-fast, and extendable prompt for bash and zsh"; homepage = "https://github.com/aaqaishtyaq/iay"; license = licenses.mit; - maintainers = with maintainers; [ aaqaishtyaq ]; + maintainers = with maintainers; [ aaqaishtyaq omasanori ]; }; } From 97bcd45a07d2e30c9109f586cdec407e0392bfd0 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Sun, 1 Jan 2023 11:28:22 +0100 Subject: [PATCH 3/9] qq: 2.0.3-543 -> 3.0.0-565 --- .../instant-messengers/qq/default.nix | 37 ++++++------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/qq/default.nix b/pkgs/applications/networking/instant-messengers/qq/default.nix index 6d1a2696a4c9..42b8a929a213 100644 --- a/pkgs/applications/networking/instant-messengers/qq/default.nix +++ b/pkgs/applications/networking/instant-messengers/qq/default.nix @@ -17,20 +17,18 @@ , at-spi2-core , autoPatchelfHook , wrapGAppsHook -, copyDesktopItems -, makeDesktopItem }: let - version = "2.0.3-543"; + version = "3.0.0-565"; srcs = { x86_64-linux = fetchurl { - url = "https://dldir1.qq.com/qqfile/qq/QQNT/50eed662/QQ-v${version}_x64.deb"; - sha256 = "sha256-O8zaVHt/oXserPVHe/r6pAFpWFeLDVsiaazgaX7kxu8="; + url = "https://dldir1.qq.com/qqfile/qq/QQNT/64bd2578/linuxqq_${version}_amd64.deb"; + sha256 = "sha256-IfBbheVwg4b5PuLX9bzqSuTcElxNaV3tmbGd3v/NkCY="; }; aarch64-linux = fetchurl { - url = "https://dldir1.qq.com/qqfile/qq/QQNT/50eed662/QQ-v${version}_arm64.deb"; - sha256 = "sha256-01ZpcoSDc5b0MCKAMq16N4cXzbouHNckOGsv+Z4et7w="; + url = "https://dldir1.qq.com/qqfile/qq/QQNT/64bd2578/linuxqq_${version}_arm64.deb"; + sha256 = "sha256-6IlAJdPknaQzOE48sdxb5QbB+ZF1xKstF3ARGHM30GY="; }; }; src = srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); @@ -44,7 +42,6 @@ stdenv.mkDerivation { nativeBuildInputs = [ autoPatchelfHook wrapGAppsHook - copyDesktopItems dpkg ]; @@ -67,28 +64,18 @@ stdenv.mkDerivation { installPhase = '' runHook preInstall - mkdir -p "$out/share/icons/hicolor/0x0/apps" - cp usr/share/icons/hicolor/0x0/apps/qq.png $out/share/icons/hicolor/0x0/apps - mkdir -p "$out/opt" - cp -r "opt/"* $out/opt + mkdir -p $out/bin + cp -r opt $out/opt + cp -r usr/share $out/share + substituteInPlace $out/share/applications/qq.desktop \ + --replace "/opt/QQ/qq" "$out/bin/qq" \ + --replace "/usr/share" "$out/share" + ln -s $out/opt/QQ/qq $out/bin/qq - mkdir -p "$out/bin" - ln -s "$out/opt/QQ/qq" "$out/bin/qq" runHook postInstall ''; - desktopItems = [ - (makeDesktopItem { - desktopName = "Tencent QQ"; - genericName = "A messaging app"; - categories = [ "Network" ]; - icon = "qq"; - exec = "qq"; - name = "qq"; - }) - ]; - meta = with lib; { homepage = "https://im.qq.com/linuxqq/"; description = "Messaging app"; From ca7101f5d423de44eb971f4c424dc4cea0596e3a Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 5 Jan 2023 01:29:18 +0100 Subject: [PATCH 4/9] josm: 18621 -> 18622 --- pkgs/applications/misc/josm/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/misc/josm/default.nix b/pkgs/applications/misc/josm/default.nix index 2efe9ec440e1..9890ea9ad8db 100644 --- a/pkgs/applications/misc/josm/default.nix +++ b/pkgs/applications/misc/josm/default.nix @@ -3,15 +3,15 @@ }: let pname = "josm"; - version = "18621"; + version = "18622"; srcs = { jar = fetchurl { url = "https://josm.openstreetmap.de/download/josm-snapshot-${version}.jar"; - hash = "sha256-RZiYHDqowk0oG/rQVcsoYpZvL4wNmegZD2EHlsQggw8="; + hash = "sha256-AtV7Lj+z1GOCEl8xUaumYcN848pMsLIfMGmBXved6WU="; }; macosx = fetchurl { url = "https://josm.openstreetmap.de/download/macosx/josm-macos-${version}-java17.zip"; - hash = "sha256-Sf5mgxWjq240U1tUByBS6FFb0Tpj/QP7yHl+wvTIfng="; + hash = "sha256-q3Kr0YWe6Jm6wO6h7fMANKLCWKfU0zDpBZjRH662eSg="; }; pkg = fetchsvn { url = "https://josm.openstreetmap.de/svn/trunk/native/linux/tested"; From 983ec889b3a83d1ed80173bdb10a35bc3b857c95 Mon Sep 17 00:00:00 2001 From: Bobby Rong Date: Thu, 5 Jan 2023 10:05:53 +0800 Subject: [PATCH 5/9] pantheon.elementary-wallpapers: 6.1.0 -> 7.0.0 --- .../pantheon/artwork/elementary-wallpapers/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/desktops/pantheon/artwork/elementary-wallpapers/default.nix b/pkgs/desktops/pantheon/artwork/elementary-wallpapers/default.nix index b3568fb0bc38..addef5891d2c 100644 --- a/pkgs/desktops/pantheon/artwork/elementary-wallpapers/default.nix +++ b/pkgs/desktops/pantheon/artwork/elementary-wallpapers/default.nix @@ -10,13 +10,13 @@ stdenv.mkDerivation rec { pname = "elementary-wallpapers"; - version = "6.1.0"; + version = "7.0.0"; src = fetchFromGitHub { owner = "elementary"; repo = "wallpapers"; rev = version; - sha256 = "sha256-E/cUxa/GNt/01EjuuvurHxJu3qV9e+jcdcCi2+NxVDA="; + sha256 = "sha256-i9tIz5UckON8uwGlE62b/y0M0Neqt86rR3VdNUWBo04="; }; nativeBuildInputs = [ From de49ddabaea028aec44225424c1a3be8279e9162 Mon Sep 17 00:00:00 2001 From: Colin Arnott Date: Thu, 5 Jan 2023 02:38:22 +0000 Subject: [PATCH 6/9] nixosTests.wordpress: iterate over versions As a follow up to f9d1f80045d3ae01741896127837eba9f1559603, we should add the ability to test explicit versions of the wordpress derivation. Since we are currently only supporting wordpress6_1 in unstable, this change is a noop. Updates #209051 --- nixos/tests/wordpress.nix | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/nixos/tests/wordpress.nix b/nixos/tests/wordpress.nix index 416a20aa7fe8..6a460dbce354 100644 --- a/nixos/tests/wordpress.nix +++ b/nixos/tests/wordpress.nix @@ -1,6 +1,6 @@ -import ./make-test-python.nix ({ pkgs, ... }: +import ./make-test-python.nix ({ lib, pkgs, ... }: -{ +rec { name = "wordpress"; meta = with pkgs.lib.maintainers; { maintainers = [ @@ -10,17 +10,22 @@ import ./make-test-python.nix ({ pkgs, ... }: ]; }; - nodes = { - wp_httpd = { ... }: { + nodes = lib.foldl (a: version: let + package = pkgs."wordpress${version}"; + in a // { + "wp${version}_httpd" = _: { services.httpd.adminAddr = "webmaster@site.local"; services.httpd.logPerVirtualHost = true; + services.wordpress.webserver = "httpd"; services.wordpress.sites = { "site1.local" = { database.tablePrefix = "site1_"; + inherit package; }; "site2.local" = { database.tablePrefix = "site2_"; + inherit package; }; }; @@ -28,14 +33,16 @@ import ./make-test-python.nix ({ pkgs, ... }: networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ]; }; - wp_nginx = { ... }: { + "wp${version}_nginx" = _: { services.wordpress.webserver = "nginx"; services.wordpress.sites = { "site1.local" = { database.tablePrefix = "site1_"; + inherit package; }; "site2.local" = { database.tablePrefix = "site2_"; + inherit package; }; }; @@ -43,34 +50,38 @@ import ./make-test-python.nix ({ pkgs, ... }: networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ]; }; - wp_caddy = { ... }: { + "wp${version}_caddy" = _: { services.wordpress.webserver = "caddy"; services.wordpress.sites = { "site1.local" = { database.tablePrefix = "site1_"; + inherit package; }; "site2.local" = { database.tablePrefix = "site2_"; + inherit package; }; }; networking.firewall.allowedTCPPorts = [ 80 ]; networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ]; }; - }; + }) {} [ + "6_1" + ]; testScript = '' import re start_all() - wp_httpd.wait_for_unit("httpd") - wp_nginx.wait_for_unit("nginx") - wp_caddy.wait_for_unit("caddy") + ${lib.concatStrings (lib.mapAttrsToList (name: value: '' + ${name}.wait_for_unit("${(value null).services.wordpress.webserver}") + '') nodes)} site_names = ["site1.local", "site2.local"] - for machine in (wp_httpd, wp_nginx, wp_caddy): + for machine in (${lib.concatStringsSep ", " (builtins.attrNames nodes)}): for site_name in site_names: machine.wait_for_unit(f"phpfpm-wordpress-{site_name}") From 19a8a0ad21f9168d358abc36dea35c3a10081fd5 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Thu, 5 Jan 2023 06:36:01 +1000 Subject: [PATCH 7/9] go_1_20: 1.20rc1 -> 1.20rc2 --- pkgs/development/compilers/go/1.20.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/go/1.20.nix b/pkgs/development/compilers/go/1.20.nix index 5081e5efecfe..9ae9af3c6682 100644 --- a/pkgs/development/compilers/go/1.20.nix +++ b/pkgs/development/compilers/go/1.20.nix @@ -45,11 +45,11 @@ let in stdenv.mkDerivation rec { pname = "go"; - version = "1.20rc1"; + version = "1.20rc2"; src = fetchurl { url = "https://go.dev/dl/go${version}.src.tar.gz"; - sha256 = "sha256-FzEFTKmE8l/dCD0Ejt+gghDMkWf1oIanHeuhKMcTtBQ="; + sha256 = "sha256-V1IqKi4pXKYpJJRQHxMfiJO1kRqMD4VzfniqdOC5/PY="; }; strictDeps = true; From 1ccd088796a6757d2f20483e8f970bb39a83d52e Mon Sep 17 00:00:00 2001 From: Ulrik Strid Date: Tue, 15 Nov 2022 08:50:42 +0100 Subject: [PATCH 8/9] obs-studio-plugins.droidcam-obs: init at 2.0.1 --- .../video/obs-studio/plugins/default.nix | 2 + .../plugins/droidcam-obs/default.nix | 70 +++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 pkgs/applications/video/obs-studio/plugins/droidcam-obs/default.nix diff --git a/pkgs/applications/video/obs-studio/plugins/default.nix b/pkgs/applications/video/obs-studio/plugins/default.nix index 493079a25bba..1a7be5aa9811 100644 --- a/pkgs/applications/video/obs-studio/plugins/default.nix +++ b/pkgs/applications/video/obs-studio/plugins/default.nix @@ -6,6 +6,8 @@ # - Add plugin to it's own directory (because of future patches). { + droidcam-obs = callPackage ./droidcam-obs { }; + input-overlay = qt6Packages.callPackage ./input-overlay.nix { }; looking-glass-obs = callPackage ./looking-glass-obs.nix { }; diff --git a/pkgs/applications/video/obs-studio/plugins/droidcam-obs/default.nix b/pkgs/applications/video/obs-studio/plugins/droidcam-obs/default.nix new file mode 100644 index 000000000000..131817a2589f --- /dev/null +++ b/pkgs/applications/video/obs-studio/plugins/droidcam-obs/default.nix @@ -0,0 +1,70 @@ +{ lib +, stdenv +, fetchFromGitHub +, obs-studio +, ffmpeg +, libjpeg +, libimobiledevice +, libusbmuxd +, libplist +}: + +stdenv.mkDerivation rec { + pname = "droidcam-obs"; + version = "2.0.1"; + + src = fetchFromGitHub { + owner = "dev47apps"; + repo = "droidcam-obs-plugin"; + rev = version; + sha256 = "sha256-oaw/mq4WCQMlf3sv9WtNlv9J9rm79xnqDwKzHtyFW50="; + }; + + postPatch = '' + substituteInPlace ./linux/linux.mk \ + --replace "-limobiledevice" "-limobiledevice-1.0" \ + --replace "-I/usr/include/obs" "-I${obs-studio}/include/obs" \ + --replace "-I/usr/include/ffmpeg" "-I${ffmpeg}/include" + ''; + + preBuild = '' + mkdir ./build + ''; + + buildInputs = [ + libjpeg + libimobiledevice + libusbmuxd + libplist + obs-studio + ffmpeg + ]; + + makeFlags = [ + "ALLOW_STATIC=no" + "JPEG_DIR=${lib.getDev libjpeg}" + "JPEG_LIB=${lib.getLib libjpeg}/lib" + "IMOBILEDEV_DIR=${libimobiledevice}" + ]; + + installPhase = '' + runHook preInstall + + mkdir -p $out/share/obs/obs-plugins/droidcam-obs + mkdir -p $out/lib/obs-plugins + cp build/droidcam-obs.so $out/lib/obs-plugins + cp -R ./data/locale $out/share/obs/obs-plugins/droidcam-obs/locale + + runHook postInstall + ''; + + doCheck = false; + + meta = with lib; { + description = "DroidCam OBS"; + homepage = "https://github.com/dev47apps/droidcam-obs-plugin"; + license = licenses.gpl2Plus; + maintainers = with maintainers; [ ulrikstrid ]; + platforms = platforms.linux; + }; +} From c61f554c1aa9fbec38b73cb7bbb205572673a5ba Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Fri, 21 Oct 2022 15:18:10 +0200 Subject: [PATCH 9/9] modules.gitlab-runner: accept space in names when you register a runner with spaces in its name (possible if you use 'description' option) then the runners never get unregistered because our bash scripts assume no space in names. This solves the issue Retreiving the fullname of the runner via `gitlab-runner list` got surprisingly hard between lazy-capture issues and `gitlab-runner list` displaying invisible (CSI) characters that break the regex etc. Which is why I fell back on the pseudo-json format. This PR adds the hash in the name, which allows to keep both the stateless aspect of the module while allowing for a freeform name. I found using bash associative arrays easier to use/debug than the current approach. --- .../continuous-integration/gitlab-runner.nix | 90 ++++++++++++++----- 1 file changed, 66 insertions(+), 24 deletions(-) diff --git a/nixos/modules/services/continuous-integration/gitlab-runner.nix b/nixos/modules/services/continuous-integration/gitlab-runner.nix index 7b1c4da86260..d18c4cff0405 100644 --- a/nixos/modules/services/continuous-integration/gitlab-runner.nix +++ b/nixos/modules/services/continuous-integration/gitlab-runner.nix @@ -4,24 +4,41 @@ with lib; let cfg = config.services.gitlab-runner; hasDocker = config.virtualisation.docker.enable; + + /* The whole logic of this module is to diff the hashes of the desired vs existing runners + The hash is recorded in the runner's name because we can't do better yet + See https://gitlab.com/gitlab-org/gitlab-runner/-/issues/29350 for more details + */ + genRunnerName = service: let + hash = substring 0 12 (hashString "md5" (unsafeDiscardStringContext (toJSON service))); + in if service ? description + then "${hash} ${service.description}" + else "${name}_${config.networking.hostName}_${hash}"; + hashedServices = mapAttrs' - (name: service: nameValuePair - "${name}_${config.networking.hostName}_${ - substring 0 12 - (hashString "md5" (unsafeDiscardStringContext (toJSON service)))}" - service) - cfg.services; - configPath = "$HOME/.gitlab-runner/config.toml"; - configureScript = pkgs.writeShellScriptBin "gitlab-runner-configure" ( - if (cfg.configFile != null) then '' - mkdir -p $(dirname ${configPath}) + (name: service: nameValuePair (genRunnerName service) service) cfg.services; + configPath = ''"$HOME"/.gitlab-runner/config.toml''; + configureScript = pkgs.writeShellApplication { + name = "gitlab-runner-configure"; + runtimeInputs = with pkgs; [ + bash + gawk + jq + moreutils + remarshal + util-linux + cfg.package + perl + python3 + ]; + text = if (cfg.configFile != null) then '' cp ${cfg.configFile} ${configPath} # make config file readable by service chown -R --reference=$HOME $(dirname ${configPath}) '' else '' export CONFIG_FILE=${configPath} - mkdir -p $(dirname ${configPath}) + mkdir -p "$(dirname "${configPath}")" touch ${configPath} # update global options @@ -34,22 +51,43 @@ let # remove no longer existing services gitlab-runner verify --delete - # current and desired state - NEEDED_SERVICES=$(echo ${concatStringsSep " " (attrNames hashedServices)} | tr " " "\n") - REGISTERED_SERVICES=$(gitlab-runner list 2>&1 | grep 'Executor' | awk '{ print $1 }') + ${toShellVar "NEEDED_SERVICES" (lib.mapAttrs (name: value: 1) hashedServices)} + + declare -A REGISTERED_SERVICES + + while IFS="," read -r name token; + do + REGISTERED_SERVICES["$name"]="$token" + done < <(gitlab-runner --log-format json list 2>&1 | grep Token | jq -r '.msg +"," + .Token') + + echo "NEEDED_SERVICES: " "''${!NEEDED_SERVICES[@]}" + echo "REGISTERED_SERVICES:" "''${!REGISTERED_SERVICES[@]}" # difference between current and desired state - NEW_SERVICES=$(grep -vxF -f <(echo "$REGISTERED_SERVICES") <(echo "$NEEDED_SERVICES") || true) - OLD_SERVICES=$(grep -vxF -f <(echo "$NEEDED_SERVICES") <(echo "$REGISTERED_SERVICES") || true) + declare -A NEW_SERVICES + for name in "''${!NEEDED_SERVICES[@]}"; do + if [ ! -v 'REGISTERED_SERVICES[$name]' ]; then + NEW_SERVICES[$name]=1 + fi + done + + declare -A OLD_SERVICES + # shellcheck disable=SC2034 + for name in "''${!REGISTERED_SERVICES[@]}"; do + if [ ! -v 'NEEDED_SERVICES[$name]' ]; then + OLD_SERVICES[$name]=1 + fi + done # register new services ${concatStringsSep "\n" (mapAttrsToList (name: service: '' - if echo "$NEW_SERVICES" | grep -xq "${name}"; then + # TODO so here we should mention NEW_SERVICES + if [ -v 'NEW_SERVICES["${name}"]' ] ; then bash -c ${escapeShellArg (concatStringsSep " \\\n " ([ "set -a && source ${service.registrationConfigFile} &&" "gitlab-runner register" "--non-interactive" - (if service.description != null then "--description \"${service.description}\"" else "--name '${name}'") + "--name '${name}'" "--executor ${service.executor}" "--limit ${toString service.limit}" "--request-concurrency ${toString service.requestConcurrency}" @@ -92,22 +130,26 @@ let fi '') hashedServices)} + # check key is in array https://stackoverflow.com/questions/30353951/how-to-check-if-dictionary-contains-a-key-in-bash + + echo "NEW_SERVICES: ''${NEW_SERVICES[*]}" + echo "OLD_SERVICES: ''${OLD_SERVICES[*]}" # unregister old services - for NAME in $(echo "$OLD_SERVICES") + for NAME in "''${!OLD_SERVICES[@]}" do - [ ! -z "$NAME" ] && gitlab-runner unregister \ + [ -n "$NAME" ] && gitlab-runner unregister \ --name "$NAME" && sleep 1 done # make config file readable by service - chown -R --reference=$HOME $(dirname ${configPath}) - ''); + chown -R --reference="$HOME" "$(dirname ${configPath})" + ''; + }; startScript = pkgs.writeShellScriptBin "gitlab-runner-start" '' export CONFIG_FILE=${configPath} exec gitlab-runner run --working-directory $HOME ''; -in -{ +in { options.services.gitlab-runner = { enable = mkEnableOption (lib.mdDoc "Gitlab Runner"); configFile = mkOption {