ldgallery: init at 2.0
This commit is contained in:
parent
f6251a5f55
commit
0f005c2132
@ -9,6 +9,8 @@ self: super: {
|
||||
|
||||
dconf2nix = self.callPackage ../tools/haskell/dconf2nix/dconf2nix.nix { };
|
||||
|
||||
ldgallery-compiler = self.callPackage ../../tools/graphics/ldgallery/compiler { };
|
||||
|
||||
# https://github.com/channable/vaultenv/issues/1
|
||||
vaultenv = self.callPackage ../tools/haskell/vaultenv { };
|
||||
|
||||
|
37
pkgs/tools/graphics/ldgallery/compiler/default.nix
Normal file
37
pkgs/tools/graphics/ldgallery/compiler/default.nix
Normal file
@ -0,0 +1,37 @@
|
||||
# generated with cabal2nix by ./generate.sh
|
||||
{ mkDerivation, aeson, base, cmdargs, containers, data-ordlist
|
||||
, directory, fetchgit, filepath, Glob, hpack, parallel-io, process
|
||||
, safe, stdenv, text, time, yaml
|
||||
}:
|
||||
mkDerivation {
|
||||
pname = "ldgallery-compiler";
|
||||
version = "2.0";
|
||||
src = fetchgit {
|
||||
url = "https://github.com/pacien/ldgallery.git";
|
||||
sha256 = "1a82wy6ns1434gdba2l04crvr5waf03y02bappcxqci2cfb1cznz";
|
||||
rev = "e93f7b1eb84c083d67567115284c0002a3a7d5fc";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
postUnpack = "sourceRoot+=/compiler; echo source root reset to $sourceRoot";
|
||||
isLibrary = true;
|
||||
isExecutable = true;
|
||||
enableSeparateDataOutput = true;
|
||||
libraryHaskellDepends = [
|
||||
aeson base cmdargs containers data-ordlist directory filepath Glob
|
||||
parallel-io process safe text time yaml
|
||||
];
|
||||
libraryToolDepends = [ hpack ];
|
||||
executableHaskellDepends = [
|
||||
aeson base cmdargs containers data-ordlist directory filepath Glob
|
||||
parallel-io process safe text time yaml
|
||||
];
|
||||
testHaskellDepends = [
|
||||
aeson base cmdargs containers data-ordlist directory filepath Glob
|
||||
parallel-io process safe text time yaml
|
||||
];
|
||||
prePatch = "hpack";
|
||||
homepage = "https://ldgallery.pacien.org";
|
||||
description = "A static generator which turns a collection of tagged pictures into a searchable web gallery";
|
||||
license = stdenv.lib.licenses.agpl3;
|
||||
maintainers = with stdenv.lib.maintainers; [ pacien ];
|
||||
}
|
19
pkgs/tools/graphics/ldgallery/compiler/generate.sh
Executable file
19
pkgs/tools/graphics/ldgallery/compiler/generate.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p cabal2nix
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ "$#" -ne 1 ] || [[ "$1" == -* ]]; then
|
||||
echo "Regenerates the nix file for the ldgallery-compiler package."
|
||||
echo "Usage: $0 <git release tag>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "# generated with cabal2nix by ./generate.sh" > default.nix
|
||||
|
||||
cabal2nix \
|
||||
--maintainer pacien \
|
||||
--subpath compiler \
|
||||
--revision $1 \
|
||||
"https://github.com/pacien/ldgallery.git" \
|
||||
>> default.nix
|
53
pkgs/tools/graphics/ldgallery/default.nix
Normal file
53
pkgs/tools/graphics/ldgallery/default.nix
Normal file
@ -0,0 +1,53 @@
|
||||
{ lib, pkgs, makeWrapper, haskellPackages, haskell, pandoc, imagemagick7 }:
|
||||
|
||||
with lib;
|
||||
with haskell.lib;
|
||||
|
||||
let
|
||||
ldgallery-viewer = pkgs.callPackage ./viewer { };
|
||||
inherit (haskellPackages) ldgallery-compiler;
|
||||
|
||||
in
|
||||
|
||||
# making sure that the versions of the compiler and viewer parts are in sync
|
||||
assert ldgallery-compiler.version == versions.majorMinor ldgallery-viewer.version;
|
||||
|
||||
justStaticExecutables (overrideCabal ldgallery-compiler (oldAttrs: {
|
||||
pname = "ldgallery"; # bundled viewer + compiler
|
||||
|
||||
buildTools = (oldAttrs.buildTools or []) ++ [ makeWrapper pandoc ];
|
||||
|
||||
prePatch = ''
|
||||
# add viewer dist to data
|
||||
ln -s "${ldgallery-viewer}/share/ldgallery/viewer" "data/"
|
||||
|
||||
${oldAttrs.prePatch or ""}
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
${oldAttrs.postInstall or ""}
|
||||
|
||||
# wrapper for runtime dependencies registration
|
||||
wrapProgram "$out/bin/ldgallery" \
|
||||
--prefix PATH : ${lib.makeBinPath [ imagemagick7 ]}
|
||||
|
||||
# bash completion
|
||||
mkdir -p "$out/share/bash-completion/completions"
|
||||
"$out/bin/ldgallery" \
|
||||
--help=bash \
|
||||
> "$out/share/bash-completion/completions/ldgallery"
|
||||
|
||||
# man pages
|
||||
mkdir -p $out/share/man/man{1,7}
|
||||
ln -s ${ldgallery-viewer}/share/man/man7/* "$out/share/man/man7/"
|
||||
pandoc --standalone --to man \
|
||||
"../ldgallery-quickstart.7.md" \
|
||||
--output "$out/share/man/man7/ldgallery-quickstart.7"
|
||||
pandoc --standalone --to man \
|
||||
"ldgallery.1.md" \
|
||||
--output "$out/share/man/man1/ldgallery.1"
|
||||
'';
|
||||
|
||||
# other package metadata (maintainer, description, license, ...)
|
||||
# are inherited from the compiler package
|
||||
}))
|
53
pkgs/tools/graphics/ldgallery/viewer/default.nix
Normal file
53
pkgs/tools/graphics/ldgallery/viewer/default.nix
Normal file
@ -0,0 +1,53 @@
|
||||
{ lib, stdenv, fetchFromGitHub, pkgs, nodejs-12_x, pandoc }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
# Note for maintainers:
|
||||
# * keep version in sync with the ldgallery compiler
|
||||
# * regenerate node-*.nix with `./generate.sh <git release tag>`
|
||||
sourcePkg = fetchFromGitHub {
|
||||
owner = "pacien";
|
||||
repo = "ldgallery";
|
||||
rev = "v2.0";
|
||||
sha256 = "1a82wy6ns1434gdba2l04crvr5waf03y02bappcxqci2cfb1cznz";
|
||||
};
|
||||
|
||||
nodePackages = import ./node-composition.nix {
|
||||
inherit pkgs;
|
||||
inherit (stdenv.hostPlatform) system;
|
||||
|
||||
# some native node dependencies still require NodeJS 12 with Python 2
|
||||
nodejs = nodejs-12_x;
|
||||
};
|
||||
|
||||
nodePkg = nodePackages.package.override {
|
||||
src = "${sourcePkg}/viewer";
|
||||
postInstall = "npm run build";
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
# making sure that the source and the node package are in sync
|
||||
assert versions.majorMinor nodePkg.version == removePrefix "v" sourcePkg.rev;
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = nodePkg.packageName;
|
||||
version = nodePkg.version;
|
||||
src = nodePkg;
|
||||
|
||||
buildInputs = [ pandoc ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out/share/ldgallery"
|
||||
cp -rp "lib/node_modules/ldgallery-viewer/dist" \
|
||||
"$out/share/ldgallery/viewer/"
|
||||
cp -rp "lib/node_modules/ldgallery-viewer/examples" \
|
||||
"$out/share/ldgallery/viewer/"
|
||||
|
||||
mkdir -p "$out/share/man/man7"
|
||||
pandoc --standalone --to man \
|
||||
"lib/node_modules/ldgallery-viewer/ldgallery-viewer.7.md" \
|
||||
--output "$out/share/man/man7/ldgallery-viewer.7"
|
||||
'';
|
||||
}
|
34
pkgs/tools/graphics/ldgallery/viewer/generate.sh
Executable file
34
pkgs/tools/graphics/ldgallery/viewer/generate.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -I nixpkgs=../../../../.. -i bash -p nodePackages.node2nix
|
||||
|
||||
# TODO: merge with other node packages in nixpkgs/pkgs/development/node-packages once
|
||||
# * support for npm projects in sub-directories is added to node2nix:
|
||||
# https://github.com/svanderburg/node2nix/issues/177
|
||||
# * we find a way to enable development dependencies for some of the packages
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ "$#" -ne 1 ] || [[ "$1" == -* ]]; then
|
||||
echo "Regenerates the node composition and package nix files for the ldgallery-viewer package."
|
||||
echo "Usage: $0 <git release tag>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
wget https://github.com/pacien/ldgallery/raw/$1/viewer/package.json
|
||||
wget https://github.com/pacien/ldgallery/raw/$1/viewer/package-lock.json
|
||||
|
||||
# Development dependencies are required for this Vue application to build
|
||||
node2nix \
|
||||
--node-env ../../../../development/node-packages/node-env.nix \
|
||||
--development \
|
||||
--input ./package.json \
|
||||
--lock ./package-lock.json \
|
||||
--output node-packages.nix \
|
||||
--composition node-composition.nix
|
||||
|
||||
rm package.json package-lock.json
|
||||
|
||||
# Temporary quickfix to accomodate for the util-linux package rename.
|
||||
# See https://github.com/svanderburg/node2nix/issues/213
|
||||
git restore :/pkgs/development/node-packages/node-env.nix
|
||||
sed -i 's/utillinux/util-linux/g' node-composition.nix
|
17
pkgs/tools/graphics/ldgallery/viewer/node-composition.nix
Normal file
17
pkgs/tools/graphics/ldgallery/viewer/node-composition.nix
Normal file
@ -0,0 +1,17 @@
|
||||
# This file has been generated by node2nix 1.8.0. Do not edit!
|
||||
|
||||
{pkgs ? import <nixpkgs> {
|
||||
inherit system;
|
||||
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-12_x"}:
|
||||
|
||||
let
|
||||
nodeEnv = import ../../../../development/node-packages/node-env.nix {
|
||||
inherit (pkgs) stdenv python2 util-linux runCommand writeTextFile;
|
||||
inherit nodejs;
|
||||
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
|
||||
};
|
||||
in
|
||||
import ./node-packages.nix {
|
||||
inherit (pkgs) fetchurl fetchgit;
|
||||
inherit nodeEnv;
|
||||
}
|
13269
pkgs/tools/graphics/ldgallery/viewer/node-packages.nix
generated
Normal file
13269
pkgs/tools/graphics/ldgallery/viewer/node-packages.nix
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -5177,6 +5177,8 @@ in
|
||||
|
||||
ldc = callPackage ../development/compilers/ldc { };
|
||||
|
||||
ldgallery = callPackage ../tools/graphics/ldgallery { };
|
||||
|
||||
lbreakout2 = callPackage ../games/lbreakout2 { };
|
||||
|
||||
lefthook = gitAndTools.lefthook;
|
||||
|
Loading…
Reference in New Issue
Block a user