···328328 escape ["(" ")"] "(foo)"329329 => "\\(foo\\)"330330 */331331- escape = list: replaceChars list (map (c: "\\${c}") list);331331+ escape = list: replaceStrings list (map (c: "\\${c}") list);332332333333 /* Escape occurence of the element of `list` in `string` by334334 converting to its ASCII value and prefixing it with \\x.···341341 => "foo\\x20bar"342342343343 */344344- escapeC = list: replaceChars list (map (c: "\\x${ toLower (lib.toHexString (charToInt c))}") list);344344+ escapeC = list: replaceStrings list (map (c: "\\x${ toLower (lib.toHexString (charToInt c))}") list);345345346346 /* Quote string to be used safely within the Bourne shell.347347···471471 ["\"" "'" "<" ">" "&"]472472 [""" "'" "<" ">" "&"];473473474474- # Obsolete - use replaceStrings instead.475475- replaceChars = builtins.replaceStrings or (476476- del: new: s:477477- let478478- substList = lib.zipLists del new;479479- subst = c:480480- let found = lib.findFirst (sub: sub.fst == c) null substList; in481481- if found == null then482482- c483483- else484484- found.snd;485485- in486486- stringAsChars subst s);474474+ # warning added 12-12-2022475475+ replaceChars = lib.warn "replaceChars is a deprecated alias of replaceStrings, replace usages of it with replaceStrings." builtins.replaceStrings;487476488477 # Case conversion utilities.489478 lowerChars = stringToCharacters "abcdefghijklmnopqrstuvwxyz";···486497 toLower "HOME"487498 => "home"488499 */489489- toLower = replaceChars upperChars lowerChars;500500+ toLower = replaceStrings upperChars lowerChars;490501491502 /* Converts an ASCII string to upper-case.492503···496507 toUpper "home"497508 => "HOME"498509 */499499- toUpper = replaceChars lowerChars upperChars;510510+ toUpper = replaceStrings lowerChars upperChars;500511501512 /* Appends string context from another string. This is an implementation502513 detail of Nix and should be used carefully.
···1616 extraArgs = removeAttrs args ([ "name" ] ++ builtins.attrNames androidSdkFormalArgs);1717in1818stdenv.mkDerivation ({1919- name = lib.replaceChars [" "] [""] name; # Android APKs may contain white spaces in their names, but Nix store paths cannot1919+ name = lib.replaceStrings [" "] [""] name; # Android APKs may contain white spaces in their names, but Nix store paths cannot2020 ANDROID_HOME = "${androidsdk}/libexec/android-sdk";2121 buildInputs = [ jdk ant ];2222 buildPhase = ''
···5353 extraArgs = removeAttrs args ([ "name" "scheme" "xcodeFlags" "release" "certificateFile" "certificatePassword" "provisioningProfile" "signMethod" "generateIPA" "generateXCArchive" "enableWirelessDistribution" "installURL" "bundleId" "version" ] ++ builtins.attrNames xcodewrapperFormalArgs);5454in5555stdenv.mkDerivation ({5656- name = lib.replaceChars [" "] [""] name; # iOS app names can contain spaces, but in the Nix store this is not allowed5656+ name = lib.replaceStrings [" "] [""] name; # iOS app names can contain spaces, but in the Nix store this is not allowed5757 buildPhase = ''5858 # Be sure that the Xcode wrapper has priority over everything else.5959 # When using buildInputs this does not seem to be the case.
···11-# This file has been generated by node2nix 1.9.0. Do not edit!11+# This file has been generated by node2nix 1.11.1. Do not edit!2233{pkgs ? import <nixpkgs> {44 inherit system;···6677let88 nodeEnv = import ./node-env.nix {99- inherit (pkgs) stdenv lib python2 runCommand writeTextFile;99+ inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;1010 inherit pkgs nodejs;1111 libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;1212 };
+171-52
pkgs/development/web/newman/node-env.nix
···11# This file originates from node2nix2233-{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile}:33+{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile, writeShellScript}:4455let66 # Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master···4040 '';4141 };42424343- includeDependencies = {dependencies}:4444- lib.optionalString (dependencies != [])4545- (lib.concatMapStrings (dependency:4646- ''4747- # Bundle the dependencies of the package4848- mkdir -p node_modules4949- cd node_modules4343+ # Common shell logic4444+ installPackage = writeShellScript "install-package" ''4545+ installPackage() {4646+ local packageName=$1 src=$250475151- # Only include dependencies if they don't exist. They may also be bundled in the package.5252- if [ ! -e "${dependency.name}" ]5353- then5454- ${composePackage dependency}5555- fi4848+ local strippedName56495757- cd ..5858- ''5959- ) dependencies);6060-6161- # Recursively composes the dependencies of a package6262- composePackage = { name, packageName, src, dependencies ? [], ... }@args:6363- builtins.addErrorContext "while evaluating node package '${packageName}'" ''6464- DIR=$(pwd)5050+ local DIR=$PWD6551 cd $TMPDIR66526767- unpackFile ${src}5353+ unpackFile $src68546955 # Make the base dir in which the target dependency resides first7070- mkdir -p "$(dirname "$DIR/${packageName}")"5656+ mkdir -p "$(dirname "$DIR/$packageName")"71577272- if [ -f "${src}" ]5858+ if [ -f "$src" ]7359 then7460 # Figure out what directory has been unpacked7561 packageDir="$(find . -maxdepth 1 -type d | tail -1)"···6579 chmod -R u+w "$packageDir"66806781 # Move the extracted tarball into the output folder6868- mv "$packageDir" "$DIR/${packageName}"6969- elif [ -d "${src}" ]8282+ mv "$packageDir" "$DIR/$packageName"8383+ elif [ -d "$src" ]7084 then7185 # Get a stripped name (without hash) of the source directory.7286 # On old nixpkgs it's already set internally.7387 if [ -z "$strippedName" ]7488 then7575- strippedName="$(stripHash ${src})"8989+ strippedName="$(stripHash $src)"7690 fi77917892 # Restore write permissions to make building work7993 chmod -R u+w "$strippedName"80948195 # Move the extracted directory into the output folder8282- mv "$strippedName" "$DIR/${packageName}"9696+ mv "$strippedName" "$DIR/$packageName"8397 fi84988585- # Unset the stripped name to not confuse the next unpack step8686- unset strippedName9999+ # Change to the package directory to install dependencies100100+ cd "$DIR/$packageName"101101+ }102102+ '';871038888- # Include the dependencies of the package8989- cd "$DIR/${packageName}"104104+ # Bundle the dependencies of the package105105+ #106106+ # Only include dependencies if they don't exist. They may also be bundled in the package.107107+ includeDependencies = {dependencies}:108108+ lib.optionalString (dependencies != []) (109109+ ''110110+ mkdir -p node_modules111111+ cd node_modules112112+ ''113113+ + (lib.concatMapStrings (dependency:114114+ ''115115+ if [ ! -e "${dependency.packageName}" ]; then116116+ ${composePackage dependency}117117+ fi118118+ ''119119+ ) dependencies)120120+ + ''121121+ cd ..122122+ ''123123+ );124124+125125+ # Recursively composes the dependencies of a package126126+ composePackage = { name, packageName, src, dependencies ? [], ... }@args:127127+ builtins.addErrorContext "while evaluating node package '${packageName}'" ''128128+ installPackage "${packageName}" "${src}"90129 ${includeDependencies { inherit dependencies; }}91130 cd ..92131 ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}···165154 if(process.argv[2] == "development") {166155 replaceDependencies(packageObj.devDependencies);167156 }157157+ else {158158+ packageObj.devDependencies = {};159159+ }168160 replaceDependencies(packageObj.optionalDependencies);161161+ replaceDependencies(packageObj.peerDependencies);169162170163 /* Write the fixed package.json file */171164 fs.writeFileSync("package.json", JSON.stringify(packageObj, null, 2));···261246 var packageLock = JSON.parse(fs.readFileSync("./package-lock.json"));262247263248 if(![1, 2].includes(packageLock.lockfileVersion)) {264264- process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n");265265- process.exit(1);249249+ process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n");250250+ process.exit(1);266251 }267252268253 if(packageLock.dependencies !== undefined) {···274259275260 # Reconstructs a package-lock file from the node_modules/ folder structure and package.json files with dummy sha1 hashes276261 reconstructPackageLock = writeTextFile {277277- name = "addintegrityfields.js";262262+ name = "reconstructpackagelock.js";278263 text = ''279264 var fs = require('fs');280265 var path = require('path');···284269 var lockObj = {285270 name: packageObj.name,286271 version: packageObj.version,287287- lockfileVersion: 1,272272+ lockfileVersion: 2,288273 requires: true,274274+ packages: {275275+ "": {276276+ name: packageObj.name,277277+ version: packageObj.version,278278+ license: packageObj.license,279279+ bin: packageObj.bin,280280+ dependencies: packageObj.dependencies,281281+ engines: packageObj.engines,282282+ optionalDependencies: packageObj.optionalDependencies283283+ }284284+ },289285 dependencies: {}290286 };291287292292- function augmentPackageJSON(filePath, dependencies) {288288+ function augmentPackageJSON(filePath, packages, dependencies) {293289 var packageJSON = path.join(filePath, "package.json");294290 if(fs.existsSync(packageJSON)) {295291 var packageObj = JSON.parse(fs.readFileSync(packageJSON));292292+ packages[filePath] = {293293+ version: packageObj.version,294294+ integrity: "sha1-000000000000000000000000000=",295295+ dependencies: packageObj.dependencies,296296+ engines: packageObj.engines,297297+ optionalDependencies: packageObj.optionalDependencies298298+ };296299 dependencies[packageObj.name] = {297300 version: packageObj.version,298301 integrity: "sha1-000000000000000000000000000=",299302 dependencies: {}300303 };301301- processDependencies(path.join(filePath, "node_modules"), dependencies[packageObj.name].dependencies);304304+ processDependencies(path.join(filePath, "node_modules"), packages, dependencies[packageObj.name].dependencies);302305 }303306 }304307305305- function processDependencies(dir, dependencies) {308308+ function processDependencies(dir, packages, dependencies) {306309 if(fs.existsSync(dir)) {307310 var files = fs.readdirSync(dir);308311···336303 pkgFiles.forEach(function(entry) {337304 if(stats.isDirectory()) {338305 var pkgFilePath = path.join(filePath, entry);339339- augmentPackageJSON(pkgFilePath, dependencies);306306+ augmentPackageJSON(pkgFilePath, packages, dependencies);340307 }341308 });342309 } else {343343- augmentPackageJSON(filePath, dependencies);310310+ augmentPackageJSON(filePath, packages, dependencies);344311 }345312 }346313 });347314 }348315 }349316350350- processDependencies("node_modules", lockObj.dependencies);317317+ processDependencies("node_modules", lockObj.packages, lockObj.dependencies);351318352319 fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2));320320+ '';321321+ };322322+323323+ # Script that links bins defined in package.json to the node_modules bin directory324324+ # NPM does not do this for top-level packages itself anymore as of v7325325+ linkBinsScript = writeTextFile {326326+ name = "linkbins.js";327327+ text = ''328328+ var fs = require('fs');329329+ var path = require('path');330330+331331+ var packageObj = JSON.parse(fs.readFileSync("package.json"));332332+333333+ var nodeModules = Array(packageObj.name.split("/").length).fill("..").join(path.sep);334334+335335+ if(packageObj.bin !== undefined) {336336+ fs.mkdirSync(path.join(nodeModules, ".bin"))337337+338338+ if(typeof packageObj.bin == "object") {339339+ Object.keys(packageObj.bin).forEach(function(exe) {340340+ if(fs.existsSync(packageObj.bin[exe])) {341341+ console.log("linking bin '" + exe + "'");342342+ fs.symlinkSync(343343+ path.join("..", packageObj.name, packageObj.bin[exe]),344344+ path.join(nodeModules, ".bin", exe)345345+ );346346+ }347347+ else {348348+ console.log("skipping non-existent bin '" + exe + "'");349349+ }350350+ })351351+ }352352+ else {353353+ if(fs.existsSync(packageObj.bin)) {354354+ console.log("linking bin '" + packageObj.bin + "'");355355+ fs.symlinkSync(356356+ path.join("..", packageObj.name, packageObj.bin),357357+ path.join(nodeModules, ".bin", packageObj.name.split("/").pop())358358+ );359359+ }360360+ else {361361+ console.log("skipping non-existent bin '" + packageObj.bin + "'");362362+ }363363+ }364364+ }365365+ else if(packageObj.directories !== undefined && packageObj.directories.bin !== undefined) {366366+ fs.mkdirSync(path.join(nodeModules, ".bin"))367367+368368+ fs.readdirSync(packageObj.directories.bin).forEach(function(exe) {369369+ if(fs.existsSync(path.join(packageObj.directories.bin, exe))) {370370+ console.log("linking bin '" + exe + "'");371371+ fs.symlinkSync(372372+ path.join("..", packageObj.name, packageObj.directories.bin, exe),373373+ path.join(nodeModules, ".bin", exe)374374+ );375375+ }376376+ else {377377+ console.log("skipping non-existent bin '" + exe + "'");378378+ }379379+ })380380+ }353381 '';354382 };355383···460366461367 npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild462368369369+ runHook postRebuild370370+463371 if [ "''${dontNpmInstall-}" != "1" ]464372 then465373 # NPM tries to download packages even when they already exist if npm-shrinkwrap is used.466374 rm -f npm-shrinkwrap.json467375468468- npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install376376+ npm ${forceOfflineFlag} --nodedir=${nodeSources} --no-bin-links --ignore-scripts ${npmFlags} ${lib.optionalString production "--production"} install469377 fi378378+379379+ # Link executables defined in package.json380380+ node ${linkBinsScript}470381 '';471382472383 # Builds and composes an NPM package including all its dependencies473384 buildNodePackage =474385 { name475386 , packageName476476- , version387387+ , version ? null477388 , dependencies ? []478389 , buildInputs ? []479390 , production ? true···490391 , dontStrip ? true491392 , unpackPhase ? "true"492393 , buildPhase ? "true"394394+ , meta ? {}493395 , ... }@args:494396495397 let496496- extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" ];398398+ extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" "meta" ];497399 in498400 stdenv.mkDerivation ({499499- name = "node_${name}-${version}";401401+ name = "${name}${if version == null then "" else "-${version}"}";500402 buildInputs = [ tarWrapper python nodejs ]501403 ++ lib.optional (stdenv.isLinux) utillinux502404 ++ lib.optional (stdenv.isDarwin) libtool···514414 passAsFile = [ "compositionScript" "pinpointDependenciesScript" ];515415516416 installPhase = ''417417+ source ${installPackage}418418+517419 # Create and enter a root node_modules/ folder518420 mkdir -p $out/lib/node_modules519421 cd $out/lib/node_modules···529427 if [ -d "$out/lib/node_modules/.bin" ]530428 then531429 ln -s $out/lib/node_modules/.bin $out/bin430430+431431+ # Patch the shebang lines of all the executables432432+ ls $out/bin/* | while read i433433+ do434434+ file="$(readlink -f "$i")"435435+ chmod u+rwx "$file"436436+ patchShebangs "$file"437437+ done532438 fi533439534440 # Create symlinks to the deployed manual page folders, if applicable···556446 # Run post install hook, if provided557447 runHook postInstall558448 '';449449+450450+ meta = {451451+ # default to Node.js' platforms452452+ platforms = nodejs.meta.platforms;453453+ } // meta;559454 } // extraArgs);560455561456 # Builds a node environment (a node_modules folder and a set of binaries)562457 buildNodeDependencies =563458 { name564459 , packageName565565- , version460460+ , version ? null566461 , src567462 , dependencies ? []568463 , buildInputs ? []···585470 extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ];586471 in587472 stdenv.mkDerivation ({588588- name = "node-dependencies-${name}-${version}";473473+ name = "node-dependencies-${name}${if version == null then "" else "-${version}"}";589474590475 buildInputs = [ tarWrapper python nodejs ]591476 ++ lib.optional (stdenv.isLinux) utillinux···601486 passAsFile = [ "includeScript" "pinpointDependenciesScript" ];602487603488 installPhase = ''489489+ source ${installPackage}490490+604491 mkdir -p $out/${packageName}605492 cd $out/${packageName}606493···615498 if [ -f ${src}/package-lock.json ]616499 then617500 cp ${src}/package-lock.json .501501+ chmod 644 package-lock.json618502 fi619503 ''}620504···638520 buildNodeShell =639521 { name640522 , packageName641641- , version523523+ , version ? null642524 , src643525 , dependencies ? []644526 , buildInputs ? []···654536655537 let656538 nodeDependencies = buildNodeDependencies args;539539+ extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "unpackPhase" "buildPhase" ];657540 in658658- stdenv.mkDerivation {659659- name = "node-shell-${name}-${version}";541541+ stdenv.mkDerivation ({542542+ name = "node-shell-${name}${if version == null then "" else "-${version}"}";660543661544 buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs;662545 buildCommand = ''···676557 export NODE_PATH=${nodeDependencies}/lib/node_modules677558 export PATH="${nodeDependencies}/bin:$PATH"678559 '';679679- };560560+ } // extraArgs);680561in681562{682563 buildNodeSourceDist = lib.makeOverridable buildNodeSourceDist;
···1212# server, and the FHS userenv and corresponding NixOS module should1313# automatically pick up the changes.1414stdenv.mkDerivation rec {1515- version = "1.29.2.6364-6d72b0cf6";1515+ version = "1.30.0.6486-629d58034";1616 pname = "plexmediaserver";17171818 # Fetch the source1919 src = if stdenv.hostPlatform.system == "aarch64-linux" then fetchurl {2020 url = "https://downloads.plex.tv/plex-media-server-new/${version}/debian/plexmediaserver_${version}_arm64.deb";2121- sha256 = "sha256-rd8xnCRniDt6BoOo40g95EwgAT+lFpAOlYHlLAGn9Yc=";2121+ sha256 = "sha256-7blNvNx18sazfff6yIlRXp9vKWiRVISccx/8wjxWz34=";2222 } else fetchurl {2323 url = "https://downloads.plex.tv/plex-media-server-new/${version}/debian/plexmediaserver_${version}_amd64.deb";2424- sha256 = "sha256-6wLfhA1kPVWgREFJnhByewe4u4HCHbj8LY94+piewzE=";2424+ sha256 = "sha256-ol0WSYwk0Cmz6xJYe3mqaPDjgi4VPiH+vHnP0BIwVBU=";2525 };26262727 outputs = [ "out" "basedb" ];
+12-27
pkgs/servers/web-apps/morty/default.nix
···11-{ lib, buildGoPackage, fetchFromGitHub }:11+{ lib, buildGoModule, fetchFromGitHub }:2233-buildGoPackage rec {33+buildGoModule {44 pname = "morty";55- version = "0.2.0";66-77- goPackagePath = "github.com/asciimoo/morty";55+ version = "unstable-2021-04-22";8697 src = fetchFromGitHub {108 owner = "asciimoo";119 repo = "morty";1212- rev = "v${version}";1313- sha256 = "sha256-NWfsqJKJcRPKR8gWQbgal1JsenDesczPcz/+uzhtefM=";1010+ rev = "f5bff1e285d3f973cacf73318e55175edafd633f";1111+ sha256 = "sha256-ik2VAPdxllt76UVFt77c1ltxIwFNahAKjn3FuErNFYo=";1412 };15131616- goDeps = ./deps.nix;1414+ vendorSha256 = "sha256-3sllcoTDYQBAyAT7e9KeKNrlTEbgnoZc0Vt0ksQByvo=";17151816 meta = with lib; {1919- homepage = "https://github.com/asciimoo/morty";2020- maintainers = with maintainers; [ leenaars ];2121- license = licenses.agpl3;2217 description = "Privacy aware web content sanitizer proxy as a service";2318 longDescription = ''2424- Morty is a web content sanitizer proxy as a service. It rewrites web2525- pages to exclude malicious HTML tags and attributes. It also replaces2626- external resource references to prevent third party information leaks.1919+ Morty rewrites web pages to exclude malicious HTML tags and attributes.2020+ It also replaces external resource references to prevent third party information leaks.27212828- The main goal of morty is to provide a result proxy for searx, but it2929- can be used as a standalone sanitizer service too.3030-3131- Features:3232-3333- * HTML sanitization3434- * Rewrites HTML/CSS external references to locals3535- * JavaScript blocking3636- * No Cookies forwarded3737- * No Referrers3838- * No Caching/Etag3939- * Supports GET/POST forms and IFrames4040- * Optional HMAC URL verifier key to prevent service abuse2222+ The main goal of morty is to provide a result proxy for searx, but it can be used as a standalone sanitizer service too.4123 '';2424+ homepage = "https://github.com/asciimoo/morty";2525+ maintainers = with maintainers; [ leenaars SuperSandro2000 ];2626+ license = licenses.agpl3;4227 };4328}