Merge master into staging-next

This commit is contained in:
github-actions[bot]
2023-01-05 12:01:22 +00:00
committed by GitHub
12 changed files with 221 additions and 72 deletions
+1
View File
@@ -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
+37
View File
@@ -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;
}
@@ -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 {
+22 -11
View File
@@ -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}")
+2 -2
View File
@@ -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 ];
+3 -3
View File
@@ -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";
@@ -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";
@@ -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 { };
@@ -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;
};
}
@@ -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 = [
+2 -2
View File
@@ -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;
+2 -3
View File
@@ -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 ];
};
}