mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 15:56:50 +01:00
xvfb-run: refactor && add update script
This commit is contained in:
parent
21299f3dd3
commit
27d3a6e649
2 changed files with 70 additions and 13 deletions
|
@ -1,18 +1,39 @@
|
|||
{ lib, stdenv, fetchurl, makeWrapper, xorgserver, getopt
|
||||
, xauth, util-linux, which, fontsConf, gawk, coreutils }:
|
||||
let
|
||||
xvfb-run = fetchurl {
|
||||
name = "xvfb-run";
|
||||
url = "https://raw.githubusercontent.com/archlinux/svntogit-packages/9cb733cefa92af3fca608fb051d5251160c9bbff/trunk/xvfb-run";
|
||||
sha256 = "1307mz4nr8ga3qz73i8hbcdphky75rq8lrvfk2zm4kmv6pkbk611";
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
{ lib
|
||||
, stdenvNoCC
|
||||
, fetchFromGitHub
|
||||
, makeWrapper
|
||||
, xorgserver
|
||||
, getopt
|
||||
, xauth
|
||||
, util-linux
|
||||
, which
|
||||
, fontsConf
|
||||
, gawk
|
||||
, coreutils
|
||||
, installShellFiles
|
||||
, xterm
|
||||
}:
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
name = "xvfb-run";
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
buildCommand = ''
|
||||
version = "1+g87f6705";
|
||||
|
||||
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
|
||||
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
|
||||
patchShebangs $out/bin/xvfb-run
|
||||
|
@ -21,8 +42,23 @@ stdenv.mkDerivation {
|
|||
--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; {
|
||||
description = "Convenience script to run a virtualized X-Server";
|
||||
platforms = platforms.linux;
|
||||
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 a new issue