Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2411148dd076
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3080f1bd77ac
Choose a head ref
  • 2 commits
  • 9 files changed
  • 2 contributors

Commits on Jan 1, 2021

  1. ldgallery: init at 2.0

    pacien committed Jan 1, 2021
    Copy the full SHA
    0f005c2 View commit details

Commits on Jan 2, 2021

  1. Merge pull request #86599 from pacien/ldgallery-init

    ldgallery: init at 2.0
    cdepillabout authored Jan 2, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3080f1b View commit details
2 changes: 2 additions & 0 deletions pkgs/development/haskell-modules/non-hackage-packages.nix
Original file line number Diff line number Diff line change
@@ -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 changes: 37 additions & 0 deletions pkgs/tools/graphics/ldgallery/compiler/default.nix
Original file line number Diff line number Diff line change
@@ -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 changes: 19 additions & 0 deletions pkgs/tools/graphics/ldgallery/compiler/generate.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 53 additions & 0 deletions pkgs/tools/graphics/ldgallery/default.nix
Original file line number Diff line number Diff line change
@@ -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 changes: 53 additions & 0 deletions pkgs/tools/graphics/ldgallery/viewer/default.nix
Original file line number Diff line number Diff line change
@@ -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 changes: 34 additions & 0 deletions pkgs/tools/graphics/ldgallery/viewer/generate.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 17 additions & 0 deletions pkgs/tools/graphics/ldgallery/viewer/node-composition.nix
Original file line number Diff line number Diff line change
@@ -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;
}
Loading