Merge pull request #132974 from asbachb/bugfix/isso-129277

isso: added generation of javascript files, added module
This commit is contained in:
Timothy DeHerrera 2021-08-09 21:18:54 -06:00 committed by GitHub
commit 53bd44342d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 1278 additions and 44 deletions

View File

@ -164,6 +164,13 @@
<link linkend="opt-services.influxdb2.enable">services.influxdb2</link>.
</para>
</listitem>
<listitem>
<para>
<link xlink:href="https://posativ.org/isso/">isso</link>, a
commenting server similar to Disqus. Available as
<link linkend="opt-services.isso.enable">isso</link>
</para>
</listitem>
</itemizedlist>
</section>
<section xml:id="sec-release-21.11-incompatibilities">
@ -654,32 +661,6 @@
to use wildcards in the <literal>source</literal> argument.
</para>
</listitem>
<listitem>
<para>
The <literal>openrazer</literal> and
<literal>openrazer-daemon</literal> packages as well as the
<literal>hardware.openrazer</literal> module now require users
to be members of the <literal>openrazer</literal> group
instead of <literal>plugdev</literal>. With this change, users
no longer need be granted the entire set of
<literal>plugdev</literal> group permissions, which can
include permissions other than those required by
<literal>openrazer</literal>. This is desirable from a
security point of view. The setting
<link xlink:href="options.html#opt-services.hardware.openrazer.users"><literal>harware.openrazer.users</literal></link>
can be used to add users to the <literal>openrazer</literal>
group.
</para>
</listitem>
<listitem>
<para>
The <literal>yambar</literal> package has been split into
<literal>yambar</literal> and
<literal>yambar-wayland</literal>, corresponding to the xorg
and wayland backend respectively. Please switch to
<literal>yambar-wayland</literal> if you are on wayland.
</para>
</listitem>
</itemizedlist>
</section>
<section xml:id="sec-release-21.11-notable-changes">
@ -849,15 +830,6 @@
version of zfs.
</para>
</listitem>
<listitem>
<para>
Nginx will use the value of
<literal>sslTrustedCertificate</literal> if provided for a
virtual host, even if <literal>enableACME</literal> is set.
This is useful for providers not using the same certificate to
sign OCSP responses and server certificates.
</para>
</listitem>
</itemizedlist>
</section>
</section>

View File

@ -50,6 +50,9 @@ pt-services.clipcat.enable).
- [influxdb2](https://github.com/influxdata/influxdb), a Scalable datastore for metrics, events, and real-time analytics. Available as [services.influxdb2](#opt-services.influxdb2.enable).
- [isso](https://posativ.org/isso/), a commenting server similar to Disqus.
Available as [isso](#opt-services.isso.enable)
## Backward Incompatibilities {#sec-release-21.11-incompatibilities}
- The `staticjinja` package has been upgraded from 1.0.4 to 3.0.1
@ -166,10 +169,6 @@ pt-services.clipcat.enable).
- `programs.neovim.runtime` switched to a `linkFarm` internally, making it impossible to use wildcards in the `source` argument.
- The `openrazer` and `openrazer-daemon` packages as well as the `hardware.openrazer` module now require users to be members of the `openrazer` group instead of `plugdev`. With this change, users no longer need be granted the entire set of `plugdev` group permissions, which can include permissions other than those required by `openrazer`. This is desirable from a security point of view. The setting [`harware.openrazer.users`](options.html#opt-services.hardware.openrazer.users) can be used to add users to the `openrazer` group.
- The `yambar` package has been split into `yambar` and `yambar-wayland`, corresponding to the xorg and wayland backend respectively. Please switch to `yambar-wayland` if you are on wayland.
## Other Notable Changes {#sec-release-21.11-notable-changes}
- The setting [`services.openssh.logLevel`](options.html#opt-services.openssh.logLevel) `"VERBOSE"` `"INFO"`. This brings NixOS in line with upstream and other Linux distributions, and reduces log spam on servers due to bruteforcing botnets.
@ -215,5 +214,3 @@ pt-services.clipcat.enable).
- The [services.syncoid.enable](options.html#opt-services.syncoid.enable) module now properly drops ZFS permissions after usage. Before it delegated permissions to whole pools instead of datasets and didn't clean up after execution. You can manually look this up for your pools by running `zfs allow your-pool-name` and use `zfs unallow syncoid your-pool-name` to clean this up.
- Zfs: `latestCompatibleLinuxPackages` is now exported on the zfs package. One can use `boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;` to always track the latest compatible kernel with a given version of zfs.
- Nginx will use the value of `sslTrustedCertificate` if provided for a virtual host, even if `enableACME` is set. This is useful for providers not using the same certificate to sign OCSP responses and server certificates.

View File

@ -960,6 +960,7 @@
./services/web-apps/icingaweb2/icingaweb2.nix
./services/web-apps/icingaweb2/module-monitoring.nix
./services/web-apps/ihatemoney
./services/web-apps/isso.nix
./services/web-apps/jirafeau.nix
./services/web-apps/jitsi-meet.nix
./services/web-apps/keycloak.nix

View File

@ -0,0 +1,69 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkEnableOption mkIf mkOption types literalExample;
cfg = config.services.isso;
settingsFormat = pkgs.formats.ini { };
configFile = settingsFormat.generate "isso.conf" cfg.settings;
in {
options = {
services.isso = {
enable = mkEnableOption ''
A commenting server similar to Disqus.
Note: The application's author suppose to run isso behind a reverse proxy.
The embedded solution offered by NixOS is also only suitable for small installations
below 20 requests per second.
'';
settings = mkOption {
description = ''
Configuration for <package>isso</package>.
See <link xlink:href="https://posativ.org/isso/docs/configuration/server/">Isso Server Configuration</link>
for supported values.
'';
type = types.submodule {
freeformType = settingsFormat.type;
};
example = literalExample ''
{
general = {
host = "http://localhost";
};
}
'';
};
};
};
config = mkIf cfg.enable {
services.isso.settings.general.dbpath = lib.mkDefault "/var/lib/isso/comments.db";
systemd.services.isso = {
description = "isso, a commenting server similar to Disqus";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
User = "isso";
Group = "isso";
DynamicUser = true;
StateDirectory = "isso";
ExecStart = ''
${pkgs.isso}/bin/isso -c ${configFile}
'';
Restart = "on-failure";
RestartSec = 1;
};
};
};
}

30
nixos/tests/isso.nix Normal file
View File

@ -0,0 +1,30 @@
import ./make-test-python.nix ({ pkgs, ... }: {
name = "isso";
meta = with pkgs.lib.maintainers; {
maintainers = [ asbachb ];
};
machine = { config, pkgs, ... }: {
services.isso = {
enable = true;
settings = {
general = {
dbpath = "/var/lib/isso/comments.db";
host = "http://localhost";
};
};
};
};
testScript = let
port = 8080;
in
''
machine.wait_for_unit("isso.service")
machine.wait_for_open_port("${toString port}")
machine.succeed("curl --fail http://localhost:${toString port}/?uri")
machine.succeed("curl --fail http://localhost:${toString port}/js/embed.min.js")
'';
})

View File

@ -1,11 +1,23 @@
{ lib, python3Packages, fetchFromGitHub }:
{ pkgs, nodejs, lib, python3Packages, fetchFromGitHub }:
let
nodeEnv = import ./node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile;
inherit pkgs nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
};
nodePackages = import ./node-packages.nix {
inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
inherit nodeEnv;
};
nodeDependencies = (nodePackages.shell.override (old: {
})).nodeDependencies;
in
with python3Packages; buildPythonApplication rec {
pname = "isso";
version = "0.12.5";
# no tests on PyPI
src = fetchFromGitHub {
owner = "posativ";
repo = pname;
@ -25,8 +37,16 @@ with python3Packages; buildPythonApplication rec {
nativeBuildInputs = [
cffi
nodejs
];
preBuild = ''
ln -s ${nodeDependencies}/lib/node_modules ./node_modules
export PATH="${nodeDependencies}/bin:$PATH"
make js
'';
checkInputs = [ nose ];
checkPhase = ''
@ -40,4 +60,3 @@ with python3Packages; buildPythonApplication rec {
maintainers = with maintainers; [ fgaz ];
};
}

View File

@ -0,0 +1,573 @@
# This file originates from node2nix
{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile}:
let
# Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master
utillinux = if pkgs ? utillinux then pkgs.utillinux else pkgs.util-linux;
python = if nodejs ? python then nodejs.python else python2;
# Create a tar wrapper that filters all the 'Ignoring unknown extended header keyword' noise
tarWrapper = runCommand "tarWrapper" {} ''
mkdir -p $out/bin
cat > $out/bin/tar <<EOF
#! ${stdenv.shell} -e
$(type -p tar) "\$@" --warning=no-unknown-keyword --delay-directory-restore
EOF
chmod +x $out/bin/tar
'';
# Function that generates a TGZ file from a NPM project
buildNodeSourceDist =
{ name, version, src, ... }:
stdenv.mkDerivation {
name = "node-tarball-${name}-${version}";
inherit src;
buildInputs = [ nodejs ];
buildPhase = ''
export HOME=$TMPDIR
tgzFile=$(npm pack | tail -n 1) # Hooks to the pack command will add output (https://docs.npmjs.com/misc/scripts)
'';
installPhase = ''
mkdir -p $out/tarballs
mv $tgzFile $out/tarballs
mkdir -p $out/nix-support
echo "file source-dist $out/tarballs/$tgzFile" >> $out/nix-support/hydra-build-products
'';
};
includeDependencies = {dependencies}:
lib.optionalString (dependencies != [])
(lib.concatMapStrings (dependency:
''
# Bundle the dependencies of the package
mkdir -p node_modules
cd node_modules
# Only include dependencies if they don't exist. They may also be bundled in the package.
if [ ! -e "${dependency.name}" ]
then
${composePackage dependency}
fi
cd ..
''
) dependencies);
# Recursively composes the dependencies of a package
composePackage = { name, packageName, src, dependencies ? [], ... }@args:
builtins.addErrorContext "while evaluating node package '${packageName}'" ''
DIR=$(pwd)
cd $TMPDIR
unpackFile ${src}
# Make the base dir in which the target dependency resides first
mkdir -p "$(dirname "$DIR/${packageName}")"
if [ -f "${src}" ]
then
# Figure out what directory has been unpacked
packageDir="$(find . -maxdepth 1 -type d | tail -1)"
# Restore write permissions to make building work
find "$packageDir" -type d -exec chmod u+x {} \;
chmod -R u+w "$packageDir"
# Move the extracted tarball into the output folder
mv "$packageDir" "$DIR/${packageName}"
elif [ -d "${src}" ]
then
# Get a stripped name (without hash) of the source directory.
# On old nixpkgs it's already set internally.
if [ -z "$strippedName" ]
then
strippedName="$(stripHash ${src})"
fi
# Restore write permissions to make building work
chmod -R u+w "$strippedName"
# Move the extracted directory into the output folder
mv "$strippedName" "$DIR/${packageName}"
fi
# Unset the stripped name to not confuse the next unpack step
unset strippedName
# Include the dependencies of the package
cd "$DIR/${packageName}"
${includeDependencies { inherit dependencies; }}
cd ..
${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
'';
pinpointDependencies = {dependencies, production}:
let
pinpointDependenciesFromPackageJSON = writeTextFile {
name = "pinpointDependencies.js";
text = ''
var fs = require('fs');
var path = require('path');
function resolveDependencyVersion(location, name) {
if(location == process.env['NIX_STORE']) {
return null;
} else {
var dependencyPackageJSON = path.join(location, "node_modules", name, "package.json");
if(fs.existsSync(dependencyPackageJSON)) {
var dependencyPackageObj = JSON.parse(fs.readFileSync(dependencyPackageJSON));
if(dependencyPackageObj.name == name) {
return dependencyPackageObj.version;
}
} else {
return resolveDependencyVersion(path.resolve(location, ".."), name);
}
}
}
function replaceDependencies(dependencies) {
if(typeof dependencies == "object" && dependencies !== null) {
for(var dependency in dependencies) {
var resolvedVersion = resolveDependencyVersion(process.cwd(), dependency);
if(resolvedVersion === null) {
process.stderr.write("WARNING: cannot pinpoint dependency: "+dependency+", context: "+process.cwd()+"\n");
} else {
dependencies[dependency] = resolvedVersion;
}
}
}
}
/* Read the package.json configuration */
var packageObj = JSON.parse(fs.readFileSync('./package.json'));
/* Pinpoint all dependencies */
replaceDependencies(packageObj.dependencies);
if(process.argv[2] == "development") {
replaceDependencies(packageObj.devDependencies);
}
replaceDependencies(packageObj.optionalDependencies);
/* Write the fixed package.json file */
fs.writeFileSync("package.json", JSON.stringify(packageObj, null, 2));
'';
};
in
''
node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"}
${lib.optionalString (dependencies != [])
''
if [ -d node_modules ]
then
cd node_modules
${lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies}
cd ..
fi
''}
'';
# Recursively traverses all dependencies of a package and pinpoints all
# dependencies in the package.json file to the versions that are actually
# being used.
pinpointDependenciesOfPackage = { packageName, dependencies ? [], production ? true, ... }@args:
''
if [ -d "${packageName}" ]
then
cd "${packageName}"
${pinpointDependencies { inherit dependencies production; }}
cd ..
${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
fi
'';
# Extract the Node.js source code which is used to compile packages with
# native bindings
nodeSources = runCommand "node-sources" {} ''
tar --no-same-owner --no-same-permissions -xf ${nodejs.src}
mv node-* $out
'';
# Script that adds _integrity fields to all package.json files to prevent NPM from consulting the cache (that is empty)
addIntegrityFieldsScript = writeTextFile {
name = "addintegrityfields.js";
text = ''
var fs = require('fs');
var path = require('path');
function augmentDependencies(baseDir, dependencies) {
for(var dependencyName in dependencies) {
var dependency = dependencies[dependencyName];
// Open package.json and augment metadata fields
var packageJSONDir = path.join(baseDir, "node_modules", dependencyName);
var packageJSONPath = path.join(packageJSONDir, "package.json");
if(fs.existsSync(packageJSONPath)) { // Only augment packages that exist. Sometimes we may have production installs in which development dependencies can be ignored
console.log("Adding metadata fields to: "+packageJSONPath);
var packageObj = JSON.parse(fs.readFileSync(packageJSONPath));
if(dependency.integrity) {
packageObj["_integrity"] = dependency.integrity;
} else {
packageObj["_integrity"] = "sha1-000000000000000000000000000="; // When no _integrity string has been provided (e.g. by Git dependencies), add a dummy one. It does not seem to harm and it bypasses downloads.
}
if(dependency.resolved) {
packageObj["_resolved"] = dependency.resolved; // Adopt the resolved property if one has been provided
} else {
packageObj["_resolved"] = dependency.version; // Set the resolved version to the version identifier. This prevents NPM from cloning Git repositories.
}
if(dependency.from !== undefined) { // Adopt from property if one has been provided
packageObj["_from"] = dependency.from;
}
fs.writeFileSync(packageJSONPath, JSON.stringify(packageObj, null, 2));
}
// Augment transitive dependencies
if(dependency.dependencies !== undefined) {
augmentDependencies(packageJSONDir, dependency.dependencies);
}
}
}
if(fs.existsSync("./package-lock.json")) {
var packageLock = JSON.parse(fs.readFileSync("./package-lock.json"));
if(![1, 2].includes(packageLock.lockfileVersion)) {
process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n");
process.exit(1);
}
if(packageLock.dependencies !== undefined) {
augmentDependencies(".", packageLock.dependencies);
}
}
'';
};
# Reconstructs a package-lock file from the node_modules/ folder structure and package.json files with dummy sha1 hashes
reconstructPackageLock = writeTextFile {
name = "addintegrityfields.js";
text = ''
var fs = require('fs');
var path = require('path');
var packageObj = JSON.parse(fs.readFileSync("package.json"));
var lockObj = {
name: packageObj.name,
version: packageObj.version,
lockfileVersion: 1,
requires: true,
dependencies: {}
};
function augmentPackageJSON(filePath, dependencies) {
var packageJSON = path.join(filePath, "package.json");
if(fs.existsSync(packageJSON)) {
var packageObj = JSON.parse(fs.readFileSync(packageJSON));
dependencies[packageObj.name] = {
version: packageObj.version,
integrity: "sha1-000000000000000000000000000=",
dependencies: {}
};
processDependencies(path.join(filePath, "node_modules"), dependencies[packageObj.name].dependencies);
}
}
function processDependencies(dir, dependencies) {
if(fs.existsSync(dir)) {
var files = fs.readdirSync(dir);
files.forEach(function(entry) {
var filePath = path.join(dir, entry);
var stats = fs.statSync(filePath);
if(stats.isDirectory()) {
if(entry.substr(0, 1) == "@") {
// When we encounter a namespace folder, augment all packages belonging to the scope
var pkgFiles = fs.readdirSync(filePath);
pkgFiles.forEach(function(entry) {
if(stats.isDirectory()) {
var pkgFilePath = path.join(filePath, entry);
augmentPackageJSON(pkgFilePath, dependencies);
}
});
} else {
augmentPackageJSON(filePath, dependencies);
}
}
});
}
}
processDependencies("node_modules", lockObj.dependencies);
fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2));
'';
};
prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}:
let
forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com";
in
''
# Pinpoint the versions of all dependencies to the ones that are actually being used
echo "pinpointing versions of dependencies..."
source $pinpointDependenciesScriptPath
# Patch the shebangs of the bundled modules to prevent them from
# calling executables outside the Nix store as much as possible
patchShebangs .
# Deploy the Node.js package by running npm install. Since the
# dependencies have been provided already by ourselves, it should not
# attempt to install them again, which is good, because we want to make
# it Nix's responsibility. If it needs to install any dependencies
# anyway (e.g. because the dependency parameters are
# incomplete/incorrect), it fails.
#
# The other responsibilities of NPM are kept -- version checks, build
# steps, postprocessing etc.
export HOME=$TMPDIR
cd "${packageName}"
runHook preRebuild
${lib.optionalString bypassCache ''
${lib.optionalString reconstructLock ''
if [ -f package-lock.json ]
then
echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!"
echo "This will most likely result in version mismatches! We will remove the lock file and regenerate it!"
rm package-lock.json
else
echo "No package-lock.json file found, reconstructing..."
fi
node ${reconstructPackageLock}
''}
node ${addIntegrityFieldsScript}
''}
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild
if [ "''${dontNpmInstall-}" != "1" ]
then
# NPM tries to download packages even when they already exist if npm-shrinkwrap is used.
rm -f npm-shrinkwrap.json
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install
fi
'';
# Builds and composes an NPM package including all its dependencies
buildNodePackage =
{ name
, packageName
, version
, dependencies ? []
, buildInputs ? []
, production ? true
, npmFlags ? ""
, dontNpmInstall ? false
, bypassCache ? false
, reconstructLock ? false
, preRebuild ? ""
, dontStrip ? true
, unpackPhase ? "true"
, buildPhase ? "true"
, meta ? {}
, ... }@args:
let
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" "meta" ];
in
stdenv.mkDerivation ({
name = "${name}-${version}";
buildInputs = [ tarWrapper python nodejs ]
++ lib.optional (stdenv.isLinux) utillinux
++ lib.optional (stdenv.isDarwin) libtool
++ buildInputs;
inherit nodejs;
inherit dontStrip; # Stripping may fail a build for some package deployments
inherit dontNpmInstall preRebuild unpackPhase buildPhase;
compositionScript = composePackage args;
pinpointDependenciesScript = pinpointDependenciesOfPackage args;
passAsFile = [ "compositionScript" "pinpointDependenciesScript" ];
installPhase = ''
# Create and enter a root node_modules/ folder
mkdir -p $out/lib/node_modules
cd $out/lib/node_modules
# Compose the package and all its dependencies
source $compositionScriptPath
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
# Create symlink to the deployed executable folder, if applicable
if [ -d "$out/lib/node_modules/.bin" ]
then
ln -s $out/lib/node_modules/.bin $out/bin
fi
# Create symlinks to the deployed manual page folders, if applicable
if [ -d "$out/lib/node_modules/${packageName}/man" ]
then
mkdir -p $out/share
for dir in "$out/lib/node_modules/${packageName}/man/"*
do
mkdir -p $out/share/man/$(basename "$dir")
for page in "$dir"/*
do
ln -s $page $out/share/man/$(basename "$dir")
done
done
fi
# Run post install hook, if provided
runHook postInstall
'';
meta = {
# default to Node.js' platforms
platforms = nodejs.meta.platforms;
} // meta;
} // extraArgs);
# Builds a node environment (a node_modules folder and a set of binaries)
buildNodeDependencies =
{ name
, packageName
, version
, src
, dependencies ? []
, buildInputs ? []
, production ? true
, npmFlags ? ""
, dontNpmInstall ? false
, bypassCache ? false
, reconstructLock ? false
, dontStrip ? true
, unpackPhase ? "true"
, buildPhase ? "true"
, ... }@args:
let
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ];
in
stdenv.mkDerivation ({
name = "node-dependencies-${name}-${version}";
buildInputs = [ tarWrapper python nodejs ]
++ lib.optional (stdenv.isLinux) utillinux
++ lib.optional (stdenv.isDarwin) libtool
++ buildInputs;
inherit dontStrip; # Stripping may fail a build for some package deployments
inherit dontNpmInstall unpackPhase buildPhase;
includeScript = includeDependencies { inherit dependencies; };
pinpointDependenciesScript = pinpointDependenciesOfPackage args;
passAsFile = [ "includeScript" "pinpointDependenciesScript" ];
installPhase = ''
mkdir -p $out/${packageName}
cd $out/${packageName}
source $includeScriptPath
# Create fake package.json to make the npm commands work properly
cp ${src}/package.json .
chmod 644 package.json
${lib.optionalString bypassCache ''
if [ -f ${src}/package-lock.json ]
then
cp ${src}/package-lock.json .
fi
''}
# Go to the parent folder to make sure that all packages are pinpointed
cd ..
${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
# Expose the executables that were installed
cd ..
${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
mv ${packageName} lib
ln -s $out/lib/node_modules/.bin $out/bin
'';
} // extraArgs);
# Builds a development shell
buildNodeShell =
{ name
, packageName
, version
, src
, dependencies ? []
, buildInputs ? []
, production ? true
, npmFlags ? ""
, dontNpmInstall ? false
, bypassCache ? false
, reconstructLock ? false
, dontStrip ? true
, unpackPhase ? "true"
, buildPhase ? "true"
, ... }@args:
let
nodeDependencies = buildNodeDependencies args;
in
stdenv.mkDerivation {
name = "node-shell-${name}-${version}";
buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs;
buildCommand = ''
mkdir -p $out/bin
cat > $out/bin/shell <<EOF
#! ${stdenv.shell} -e
$shellHook
exec ${stdenv.shell}
EOF
chmod +x $out/bin/shell
'';
# Provide the dependencies in a development shell through the NODE_PATH environment variable
inherit nodeDependencies;
shellHook = lib.optionalString (dependencies != []) ''
export NODE_PATH=${nodeDependencies}/lib/node_modules
export PATH="${nodeDependencies}/bin:$PATH"
'';
};
in
{
buildNodeSourceDist = lib.makeOverridable buildNodeSourceDist;
buildNodePackage = lib.makeOverridable buildNodePackage;
buildNodeDependencies = lib.makeOverridable buildNodeDependencies;
buildNodeShell = lib.makeOverridable buildNodeShell;
}

558
pkgs/servers/isso/node-packages.nix generated Normal file
View File

@ -0,0 +1,558 @@
# This file has been generated by node2nix 1.9.0. Do not edit!
{nodeEnv, fetchurl, fetchgit, nix-gitignore, stdenv, lib, globalBuildInputs ? []}:
let
sources = {
"acorn-1.2.2" = {
name = "acorn";
packageName = "acorn";
version = "1.2.2";
src = fetchurl {
url = "https://registry.npmjs.org/acorn/-/acorn-1.2.2.tgz";
sha1 = "c8ce27de0acc76d896d2b1fad3df588d9e82f014";
};
};
"acorn-2.7.0" = {
name = "acorn";
packageName = "acorn";
version = "2.7.0";
src = fetchurl {
url = "https://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz";
sha1 = "ab6e7d9d886aaca8b085bc3312b79a198433f0e7";
};
};
"acorn-globals-1.0.9" = {
name = "acorn-globals";
packageName = "acorn-globals";
version = "1.0.9";
src = fetchurl {
url = "https://registry.npmjs.org/acorn-globals/-/acorn-globals-1.0.9.tgz";
sha1 = "55bb5e98691507b74579d0513413217c380c54cf";
};
};
"align-text-0.1.4" = {
name = "align-text";
packageName = "align-text";
version = "0.1.4";
src = fetchurl {
url = "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz";
sha1 = "0cd90a561093f35d0a99256c22b7069433fad117";
};
};
"almond-0.3.3" = {
name = "almond";
packageName = "almond";
version = "0.3.3";
src = fetchurl {
url = "https://registry.npmjs.org/almond/-/almond-0.3.3.tgz";
sha1 = "a0e7c95ac7624d6417b4494b1e68bff693168a20";
};
};
"amdefine-1.0.1" = {
name = "amdefine";
packageName = "amdefine";
version = "1.0.1";
src = fetchurl {
url = "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz";
sha1 = "4a5282ac164729e93619bcfd3ad151f817ce91f5";
};
};
"asap-1.0.0" = {
name = "asap";
packageName = "asap";
version = "1.0.0";
src = fetchurl {
url = "https://registry.npmjs.org/asap/-/asap-1.0.0.tgz";
sha1 = "b2a45da5fdfa20b0496fc3768cc27c12fa916a7d";
};
};
"camelcase-1.2.1" = {
name = "camelcase";
packageName = "camelcase";
version = "1.2.1";
src = fetchurl {
url = "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz";
sha1 = "9bb5304d2e0b56698b2c758b08a3eaa9daa58a39";
};
};
"center-align-0.1.3" = {
name = "center-align";
packageName = "center-align";
version = "0.1.3";
src = fetchurl {
url = "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz";
sha1 = "aa0d32629b6ee972200411cbd4461c907bc2b7ad";
};
};
"character-parser-1.2.1" = {
name = "character-parser";
packageName = "character-parser";
version = "1.2.1";
src = fetchurl {
url = "https://registry.npmjs.org/character-parser/-/character-parser-1.2.1.tgz";
sha1 = "c0dde4ab182713b919b970959a123ecc1a30fcd6";
};
};
"clean-css-3.4.28" = {
name = "clean-css";
packageName = "clean-css";
version = "3.4.28";
src = fetchurl {
url = "https://registry.npmjs.org/clean-css/-/clean-css-3.4.28.tgz";
sha1 = "bf1945e82fc808f55695e6ddeaec01400efd03ff";
};
};
"cliui-2.1.0" = {
name = "cliui";
packageName = "cliui";
version = "2.1.0";
src = fetchurl {
url = "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz";
sha1 = "4b475760ff80264c762c3a1719032e91c7fea0d1";
};
};
"commander-2.6.0" = {
name = "commander";
packageName = "commander";
version = "2.6.0";
src = fetchurl {
url = "https://registry.npmjs.org/commander/-/commander-2.6.0.tgz";
sha1 = "9df7e52fb2a0cb0fb89058ee80c3104225f37e1d";
};
};
"commander-2.8.1" = {
name = "commander";
packageName = "commander";
version = "2.8.1";
src = fetchurl {
url = "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz";
sha1 = "06be367febfda0c330aa1e2a072d3dc9762425d4";
};
};
"constantinople-3.0.2" = {
name = "constantinople";
packageName = "constantinople";
version = "3.0.2";
src = fetchurl {
url = "https://registry.npmjs.org/constantinople/-/constantinople-3.0.2.tgz";
sha1 = "4b945d9937907bcd98ee575122c3817516544141";
};
};
"css-1.0.8" = {
name = "css";
packageName = "css";
version = "1.0.8";
src = fetchurl {
url = "https://registry.npmjs.org/css/-/css-1.0.8.tgz";
sha1 = "9386811ca82bccc9ee7fb5a732b1e2a317c8a3e7";
};
};
"css-parse-1.0.4" = {
name = "css-parse";
packageName = "css-parse";
version = "1.0.4";
src = fetchurl {
url = "https://registry.npmjs.org/css-parse/-/css-parse-1.0.4.tgz";
sha1 = "38b0503fbf9da9f54e9c1dbda60e145c77117bdd";
};
};
"css-stringify-1.0.5" = {
name = "css-stringify";
packageName = "css-stringify";
version = "1.0.5";
src = fetchurl {
url = "https://registry.npmjs.org/css-stringify/-/css-stringify-1.0.5.tgz";
sha1 = "b0d042946db2953bb9d292900a6cb5f6d0122031";
};
};
"decamelize-1.2.0" = {
name = "decamelize";
packageName = "decamelize";
version = "1.2.0";
src = fetchurl {
url = "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz";
sha1 = "f6534d15148269b20352e7bee26f501f9a191290";
};
};
"graceful-readlink-1.0.1" = {
name = "graceful-readlink";
packageName = "graceful-readlink";
version = "1.0.1";
src = fetchurl {
url = "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz";
sha1 = "4cafad76bc62f02fa039b2f94e9a3dd3a391a725";
};
};
"is-buffer-1.1.6" = {
name = "is-buffer";
packageName = "is-buffer";
version = "1.1.6";
src = fetchurl {
url = "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz";
sha512 = "NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==";
};
};
"is-promise-1.0.1" = {
name = "is-promise";
packageName = "is-promise";
version = "1.0.1";
src = fetchurl {
url = "https://registry.npmjs.org/is-promise/-/is-promise-1.0.1.tgz";
sha1 = "31573761c057e33c2e91aab9e96da08cefbe76e5";
};
};
"is-promise-2.2.2" = {
name = "is-promise";
packageName = "is-promise";
version = "2.2.2";
src = fetchurl {
url = "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz";
sha512 = "+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==";
};
};
"jade-1.11.0" = {
name = "jade";
packageName = "jade";
version = "1.11.0";
src = fetchurl {
url = "https://registry.npmjs.org/jade/-/jade-1.11.0.tgz";
sha1 = "9c80e538c12d3fb95c8d9bb9559fa0cc040405fd";
};
};
"jstransformer-0.0.2" = {
name = "jstransformer";
packageName = "jstransformer";
version = "0.0.2";
src = fetchurl {
url = "https://registry.npmjs.org/jstransformer/-/jstransformer-0.0.2.tgz";
sha1 = "7aae29a903d196cfa0973d885d3e47947ecd76ab";
};
};
"kind-of-3.2.2" = {
name = "kind-of";
packageName = "kind-of";
version = "3.2.2";
src = fetchurl {
url = "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz";
sha1 = "31ea21a734bab9bbb0f32466d893aea51e4a3c64";
};
};
"lazy-cache-1.0.4" = {
name = "lazy-cache";
packageName = "lazy-cache";
version = "1.0.4";
src = fetchurl {
url = "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz";
sha1 = "a1d78fc3a50474cb80845d3b3b6e1da49a446e8e";
};
};
"longest-1.0.1" = {
name = "longest";
packageName = "longest";
version = "1.0.1";
src = fetchurl {
url = "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz";
sha1 = "30a0b2da38f73770e8294a0d22e6625ed77d0097";
};
};
"minimist-1.2.5" = {
name = "minimist";
packageName = "minimist";
version = "1.2.5";
src = fetchurl {
url = "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz";
sha512 = "FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==";
};
};
"mkdirp-0.5.5" = {
name = "mkdirp";
packageName = "mkdirp";
version = "0.5.5";
src = fetchurl {
url = "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz";
sha512 = "NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==";
};
};
"optimist-0.3.7" = {
name = "optimist";
packageName = "optimist";
version = "0.3.7";
src = fetchurl {
url = "https://registry.npmjs.org/optimist/-/optimist-0.3.7.tgz";
sha1 = "c90941ad59e4273328923074d2cf2e7cbc6ec0d9";
};
};
"promise-2.0.0" = {
name = "promise";
packageName = "promise";
version = "2.0.0";
src = fetchurl {
url = "https://registry.npmjs.org/promise/-/promise-2.0.0.tgz";
sha1 = "46648aa9d605af5d2e70c3024bf59436da02b80e";
};
};
"promise-6.1.0" = {
name = "promise";
packageName = "promise";
version = "6.1.0";
src = fetchurl {
url = "https://registry.npmjs.org/promise/-/promise-6.1.0.tgz";
sha1 = "2ce729f6b94b45c26891ad0602c5c90e04c6eef6";
};
};
"repeat-string-1.6.1" = {
name = "repeat-string";
packageName = "repeat-string";
version = "1.6.1";
src = fetchurl {
url = "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz";
sha1 = "8dcae470e1c88abc2d600fff4a776286da75e637";
};
};
"requirejs-2.3.6" = {
name = "requirejs";
packageName = "requirejs";
version = "2.3.6";
src = fetchurl {
url = "https://registry.npmjs.org/requirejs/-/requirejs-2.3.6.tgz";
sha512 = "ipEzlWQe6RK3jkzikgCupiTbTvm4S0/CAU5GlgptkN5SO6F3u0UD0K18wy6ErDqiCyP4J4YYe1HuAShvsxePLg==";
};
};
"requirejs-text-2.0.16" = {
name = "requirejs-text";
packageName = "requirejs-text";
version = "2.0.16";
src = fetchurl {
url = "https://registry.npmjs.org/requirejs-text/-/requirejs-text-2.0.16.tgz";
sha512 = "XrzjeTb1pwzIWmkz8qnUiM20gENgiwB+66IciNuziwlaPAJsYQsQPSYyQ1kD4tGKGZxTisIfDbOHk02DpI/76Q==";
};
};
"right-align-0.1.3" = {
name = "right-align";
packageName = "right-align";
version = "0.1.3";
src = fetchurl {
url = "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz";
sha1 = "61339b722fe6a3515689210d24e14c96148613ef";
};
};
"source-map-0.1.43" = {
name = "source-map";
packageName = "source-map";
version = "0.1.43";
src = fetchurl {
url = "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz";
sha1 = "c24bc146ca517c1471f5dacbe2571b2b7f9e3346";
};
};
"source-map-0.4.4" = {
name = "source-map";
packageName = "source-map";
version = "0.4.4";
src = fetchurl {
url = "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz";
sha1 = "eba4f5da9c0dc999de68032d8b4f76173652036b";
};
};
"source-map-0.5.7" = {
name = "source-map";
packageName = "source-map";
version = "0.5.7";
src = fetchurl {
url = "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz";
sha1 = "8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc";
};
};
"transformers-2.1.0" = {
name = "transformers";
packageName = "transformers";
version = "2.1.0";
src = fetchurl {
url = "https://registry.npmjs.org/transformers/-/transformers-2.1.0.tgz";
sha1 = "5d23cb35561dd85dc67fb8482309b47d53cce9a7";
};
};
"uglify-js-2.2.5" = {
name = "uglify-js";
packageName = "uglify-js";
version = "2.2.5";
src = fetchurl {
url = "https://registry.npmjs.org/uglify-js/-/uglify-js-2.2.5.tgz";
sha1 = "a6e02a70d839792b9780488b7b8b184c095c99c7";
};
};
"uglify-js-2.8.29" = {
name = "uglify-js";
packageName = "uglify-js";
version = "2.8.29";
src = fetchurl {
url = "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz";
sha1 = "29c5733148057bb4e1f75df35b7a9cb72e6a59dd";
};
};
"uglify-to-browserify-1.0.2" = {
name = "uglify-to-browserify";
packageName = "uglify-to-browserify";
version = "1.0.2";
src = fetchurl {
url = "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz";
sha1 = "6e0924d6bda6b5afe349e39a6d632850a0f882b7";
};
};
"void-elements-2.0.1" = {
name = "void-elements";
packageName = "void-elements";
version = "2.0.1";
src = fetchurl {
url = "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz";
sha1 = "c066afb582bb1cb4128d60ea92392e94d5e9dbec";
};
};
"window-size-0.1.0" = {
name = "window-size";
packageName = "window-size";
version = "0.1.0";
src = fetchurl {
url = "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz";
sha1 = "5438cd2ea93b202efa3a19fe8887aee7c94f9c9d";
};
};
"with-4.0.3" = {
name = "with";
packageName = "with";
version = "4.0.3";
src = fetchurl {
url = "https://registry.npmjs.org/with/-/with-4.0.3.tgz";
sha1 = "eefd154e9e79d2c8d3417b647a8f14d9fecce14e";
};
};
"wordwrap-0.0.2" = {
name = "wordwrap";
packageName = "wordwrap";
version = "0.0.2";
src = fetchurl {
url = "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz";
sha1 = "b79669bb42ecb409f83d583cad52ca17eaa1643f";
};
};
"wordwrap-0.0.3" = {
name = "wordwrap";
packageName = "wordwrap";
version = "0.0.3";
src = fetchurl {
url = "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz";
sha1 = "a3d5da6cd5c0bc0008d37234bbaf1bed63059107";
};
};
"yargs-3.10.0" = {
name = "yargs";
packageName = "yargs";
version = "3.10.0";
src = fetchurl {
url = "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz";
sha1 = "f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1";
};
};
};
args = {
name = "isso";
packageName = "isso";
version = "latest";
src = ./.;
dependencies = [
sources."acorn-2.7.0"
sources."acorn-globals-1.0.9"
sources."align-text-0.1.4"
sources."almond-0.3.3"
sources."amdefine-1.0.1"
sources."asap-1.0.0"
sources."camelcase-1.2.1"
sources."center-align-0.1.3"
sources."character-parser-1.2.1"
(sources."clean-css-3.4.28" // {
dependencies = [
sources."commander-2.8.1"
];
})
(sources."cliui-2.1.0" // {
dependencies = [
sources."wordwrap-0.0.2"
];
})
sources."commander-2.6.0"
sources."constantinople-3.0.2"
sources."css-1.0.8"
sources."css-parse-1.0.4"
sources."css-stringify-1.0.5"
sources."decamelize-1.2.0"
sources."graceful-readlink-1.0.1"
sources."is-buffer-1.1.6"
sources."is-promise-2.2.2"
sources."jade-1.11.0"
sources."jstransformer-0.0.2"
sources."kind-of-3.2.2"
sources."lazy-cache-1.0.4"
sources."longest-1.0.1"
sources."minimist-1.2.5"
sources."mkdirp-0.5.5"
sources."optimist-0.3.7"
sources."promise-6.1.0"
sources."repeat-string-1.6.1"
sources."requirejs-2.3.6"
sources."requirejs-text-2.0.16"
sources."right-align-0.1.3"
sources."source-map-0.4.4"
(sources."transformers-2.1.0" // {
dependencies = [
sources."is-promise-1.0.1"
sources."promise-2.0.0"
sources."source-map-0.1.43"
sources."uglify-js-2.2.5"
];
})
(sources."uglify-js-2.8.29" // {
dependencies = [
sources."source-map-0.5.7"
];
})
sources."uglify-to-browserify-1.0.2"
sources."void-elements-2.0.1"
sources."window-size-0.1.0"
(sources."with-4.0.3" // {
dependencies = [
sources."acorn-1.2.2"
];
})
sources."wordwrap-0.0.3"
sources."yargs-3.10.0"
];
buildInputs = globalBuildInputs;
meta = {
description = "lightweight Disquis alternative";
license = "MIT";
};
production = false;
bypassCache = true;
reconstructLock = true;
};
in
{
args = args;
sources = sources;
tarball = nodeEnv.buildNodeSourceDist args;
package = nodeEnv.buildNodePackage args;
shell = nodeEnv.buildNodeShell args;
nodeDependencies = nodeEnv.buildNodeDependencies (lib.overrideExisting args {
src = stdenv.mkDerivation {
name = args.name + "-package-json";
src = nix-gitignore.gitignoreSourcePure [
"*"
"!package.json"
"!package-lock.json"
] args.src;
dontBuild = true;
installPhase = "mkdir -p $out; cp -r ./* $out;";
};
});
}

View File

@ -0,0 +1,15 @@
{
"name": "isso",
"version": "latest",
"author": "Martin Zimmermann",
"description": "lightweight Disquis alternative",
"license": "MIT",
"repository": "github:posativ/isso",
"dependencies": {},
"devDependencies": {
"almond": "^0.3.3",
"jade": "^1.5.0",
"requirejs": "^2.3.6",
"requirejs-text": "^2.0.15"
}
}