xvfb-run: refactor && add update script
This commit is contained in:
parent
21299f3dd3
commit
27d3a6e649
@ -1,18 +1,39 @@
|
|||||||
{ lib, stdenv, fetchurl, makeWrapper, xorgserver, getopt
|
{ lib
|
||||||
, xauth, util-linux, which, fontsConf, gawk, coreutils }:
|
, stdenvNoCC
|
||||||
let
|
, fetchFromGitHub
|
||||||
xvfb-run = fetchurl {
|
, makeWrapper
|
||||||
name = "xvfb-run";
|
, xorgserver
|
||||||
url = "https://raw.githubusercontent.com/archlinux/svntogit-packages/9cb733cefa92af3fca608fb051d5251160c9bbff/trunk/xvfb-run";
|
, getopt
|
||||||
sha256 = "1307mz4nr8ga3qz73i8hbcdphky75rq8lrvfk2zm4kmv6pkbk611";
|
, xauth
|
||||||
};
|
, util-linux
|
||||||
in
|
, which
|
||||||
stdenv.mkDerivation {
|
, fontsConf
|
||||||
|
, gawk
|
||||||
|
, coreutils
|
||||||
|
, installShellFiles
|
||||||
|
, xterm
|
||||||
|
}:
|
||||||
|
stdenvNoCC.mkDerivation rec {
|
||||||
name = "xvfb-run";
|
name = "xvfb-run";
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
version = "1+g87f6705";
|
||||||
buildCommand = ''
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "archlinux";
|
||||||
|
repo = "svntogit-packages";
|
||||||
|
rev = "87f67054c49b32511893acd22be94c47ecd44b4a";
|
||||||
|
sha256 = "sha256-KEg92RYgJd7naHFDKbdXEy075bt6NLcmX8VhQROHVPs=";
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [ makeWrapper installShellFiles ];
|
||||||
|
|
||||||
|
dontUnpack = true;
|
||||||
|
dontBuild = true;
|
||||||
|
dontConfigure = true;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cp ${xvfb-run} $out/bin/xvfb-run
|
cp $src/trunk/xvfb-run $out/bin/xvfb-run
|
||||||
|
installManPage $src/trunk/xvfb-run.1
|
||||||
|
|
||||||
chmod a+x $out/bin/xvfb-run
|
chmod a+x $out/bin/xvfb-run
|
||||||
patchShebangs $out/bin/xvfb-run
|
patchShebangs $out/bin/xvfb-run
|
||||||
@ -21,8 +42,23 @@ stdenv.mkDerivation {
|
|||||||
--prefix PATH : ${lib.makeBinPath [ getopt xorgserver xauth which util-linux gawk coreutils ]}
|
--prefix PATH : ${lib.makeBinPath [ getopt xorgserver xauth which util-linux gawk coreutils ]}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
doInstallCheck = true;
|
||||||
|
installCheckPhase = ''
|
||||||
|
(
|
||||||
|
unset PATH
|
||||||
|
echo "running xterm with xvfb-run"
|
||||||
|
$out/bin/xvfb-run ${lib.getBin xterm}/bin/xterm -e true
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
|
||||||
|
passthru = {
|
||||||
|
updateScript = ./update.sh;
|
||||||
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
description = "Convenience script to run a virtualized X-Server";
|
||||||
platforms = platforms.linux;
|
platforms = platforms.linux;
|
||||||
license = licenses.gpl2;
|
license = licenses.gpl2;
|
||||||
|
maintainers = [ maintainers.artturin ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
21
pkgs/tools/misc/xvfb-run/update.sh
Executable file
21
pkgs/tools/misc/xvfb-run/update.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#!nix-shell -i bash -p curl gnused nix-prefetch jq common-updater-scripts
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
info=$(nix-prefetch-git --quiet --url "https://github.com/archlinux/svntogit-packages" --rev "refs/heads/packages/xorg-server")
|
||||||
|
|
||||||
|
rev=$(jq -r '.rev' <<< "$info")
|
||||||
|
sha256=$(nix hash to-sri --type sha256 "$(jq -r '.sha256' <<< "$info")")
|
||||||
|
dir=$(jq -r '.path' <<< "$info")
|
||||||
|
|
||||||
|
newXvfbsha=$(sha256sum "$dir/trunk/xvfb-run")
|
||||||
|
oldXvfbsha=$(sha256sum "$(nix build --quiet ".#xvfb-run.src" --json --no-link | jq -r '.[].outputs.out')/trunk/xvfb-run")
|
||||||
|
|
||||||
|
if [[ "$newXvfbsha" != "$oldXvfbsha" ]]; then
|
||||||
|
(
|
||||||
|
cd "$(git rev-parse --show-toplevel)"
|
||||||
|
update-source-version xvfb-run "1+g${rev:0:7}" "$sha256" --rev="$rev"
|
||||||
|
)
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user