Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] ldgallery: init at 1.0 #86599

Draft
wants to merge 1 commit into
base: master
from
Draft

[WIP] ldgallery: init at 1.0 #86599

wants to merge 1 commit into from

Conversation

@pacien
Copy link
Contributor

pacien commented May 2, 2020

Motivation for this change

This is an attempt at packaging ldgallery, a static gallery generator.

It's made out of three parts:

  • "ldgallery-viewer" which requires NodeJS to be built
  • "haskellPackages.ldgallery-compiler" which is an Haskell app
  • the "ldgallery" package that assembles the two previous ones
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
ldgallery-compiler = self.callPackage ../../tools/graphics/ldgallery/compiler { };

Comment on lines +10 to +11

This comment has been minimized.

Copy link
@pacien

pacien May 2, 2020

Author Contributor

The program is a command line tool and not a library, so I'm not sure whether it belongs to Hackage, or even to this listing. Is it sensible to put it in "non-hackage-packages"?

This comment has been minimized.

Copy link
@cdepillabout

cdepillabout May 5, 2020

Member

It is easiest for us if it is on Hackage.

It if was on Hackage, then you wouldn't need the pkgs/tools/graphics/ldgallery/compiler/default.nix, since the Haskell automation in nixpkgs would keep it up to date automatically.

Hackage provides hosting for quite a few command line tools that don't provide a library.

@@ -0,0 +1,17 @@
# This file has been generated by node2nix 1.8.0. Do not edit!

This comment has been minimized.

Copy link
@pacien

pacien May 2, 2020

Author Contributor

For some reason, npm now fails to find some dependency.

npm ERR! code ENOTCACHEDtchPackageMetaData error for eslint-K
npm ERR! request to https://registry.npmjs.org/eslint-utils failed: cache mode is 'only-if-cached' but no cached response available.

npm ERR! A complete log of this run can be found in:
npm ERR!     /build/.npm/_logs/2020-05-02T15_46_11_921Z-debug.log

builder for '/nix/store/wkac3zzw316cx7mzh70ikw7j9ammcbl7-node_ldgallery-viewer-1.0.0.drv' failed with exit code 1
cannot build derivation '/nix/store/fqjisvda6pvd9lpj5rbapsqiwfslmliy-ldgallery-viewer.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/6whc0iz2qgzmv59nh7nlycv2l1h0ma33-ldgallery-1.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/6whc0iz2qgzmv59nh7nlycv2l1h0ma33-ldgallery-1.0.drv' failed

"eslint-utils" is however present (twice) in the generated ./node-packages.nix.

@pacien pacien force-pushed the pacien:ldgallery-init branch from dc184a5 to f5a643c May 2, 2020
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p nodePackages.node2nix

# TODO: merge with other node packages once support for npm projects in sub-directories
# is added to node2nix: https://github.com/svanderburg/node2nix/issues/177

# Development dependencies are required for this Vue application to build

TAG="v1.0"

wget https://github.com/pacien/ldgallery/raw/$TAG/viewer/package.json
wget https://github.com/pacien/ldgallery/raw/$TAG/viewer/package-lock.json

node2nix \
--nodejs-12 \
--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
Comment on lines +1 to +23

This comment has been minimized.

Copy link
@pacien

pacien May 2, 2020

Author Contributor

Here I have two problems that prevent me from simply adding the "viewer" part to the common list of node packages in pkgs/development/node-packages/node-packages-12.json:

  • node2nix/npm doesn't allow importing projects from a sub-directory in a repository (svanderburg/node2nix#177), so I have to manually extract the package.json and package-lock.json files and run node2nix on those.
  • Building the package (which uses TypeScript and WebPack) also requires downloading development dependencies with the "--development" option when calling node2nix, which isn't used for the common list of node packages.

Keeping this package separate with a generate.sh script seems to be an acceptable option to work around those issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.