Skip to content

Commit

Permalink
Merge pull request #251705 from dotlambda/asar-buildNpmPackage
Browse files Browse the repository at this point in the history
asar: use buildNpmPackage
  • Loading branch information
dotlambda authored Aug 30, 2023
2 parents b9f22e1 + 745de51 commit a63a64b
Show file tree
Hide file tree
Showing 16 changed files with 134 additions and 58 deletions.
4 changes: 2 additions & 2 deletions pkgs/applications/editors/pulsar/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
, makeDesktopItem
, copyDesktopItems
, makeWrapper
, nodePackages
, asar
, python3
}:

Expand Down Expand Up @@ -60,7 +60,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [
wrapGAppsHook
copyDesktopItems
nodePackages.asar
asar
];

buildInputs = [
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/editors/vscode/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
, tests

# needed to fix "Save as Root"
, nodePackages, bash
, asar, bash

# Attributes inherit from specific versions
, version, src, meta, sourceRoot, commandLineArgs
Expand Down Expand Up @@ -74,7 +74,7 @@ let
nativeBuildInputs = [ unzip ]
++ lib.optionals stdenv.isLinux [
autoPatchelfHook
nodePackages.asar
asar
# override doesn't preserve splicing https://github.com/NixOS/nixpkgs/issues/132651
(buildPackages.wrapGAppsHook.override { inherit (buildPackages) makeWrapper; })
];
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/misc/teleprompter/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, electron_10, makeDesktopItem, makeWrapper, nodePackages, autoPatchelfHook}:
{ lib, stdenv, fetchurl, electron_10, makeDesktopItem, makeWrapper, asar, autoPatchelfHook}:

let
electron = electron_10;
Expand All @@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
dontBuild = true;
dontStrip = true;

nativeBuildInputs = [ autoPatchelfHook makeWrapper nodePackages.asar ];
nativeBuildInputs = [ autoPatchelfHook makeWrapper asar ];
installPhase = ''
mkdir -p $out/bin $out/opt/teleprompter $out/share/applications
asar e resources/app.asar $out/opt/teleprompter/resources/app.asar.unpacked
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/misc/whalebird/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ lib, stdenv, fetchurl
, autoPatchelfHook, makeDesktopItem, copyDesktopItems, makeWrapper, gnugrep, nodePackages
, autoPatchelfHook, makeDesktopItem, copyDesktopItems, makeWrapper, gnugrep, asar
, electron, python3, alsa-lib, gtk3, libdbusmenu, libxshmfence, mesa, nss
}:

Expand Down Expand Up @@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
makeWrapper
copyDesktopItems
gnugrep
nodePackages.asar
asar
];

buildInputs = [ alsa-lib gtk3 libdbusmenu libxshmfence mesa nss ];
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/networking/breitbandmessung/default.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{ lib
, stdenv
, fetchurl
, asar
, dpkg
, electron_24
, makeWrapper
, nixosTests
, nodePackages
, undmg
}:

Expand All @@ -22,9 +22,9 @@ let
};

nativeBuildInputs = [
asar
dpkg
makeWrapper
nodePackages.asar
];

unpackPhase = "dpkg-deb -x $src .";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, nodejs, bash, nodePackages, unzip }:
{ lib, stdenv, fetchFromGitHub, nodejs, bash, asar, unzip }:

stdenv.mkDerivation rec {
pname = "openasar";
Expand All @@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
bash scripts/injectPolyfills.sh
substituteInPlace src/index.js --replace 'nightly' '${version}'
${nodejs}/bin/node scripts/strip.js
${nodePackages.asar}/bin/asar pack src app.asar
${asar}/bin/asar pack src app.asar
runHook postBuild
'';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
, dpkg
, undmg
, makeWrapper
, nodePackages
, asar
, alsa-lib
, at-spi2-atk
, at-spi2-core
Expand Down Expand Up @@ -143,7 +143,7 @@ let
gtk3 # needed for GSETTINGS_SCHEMAS_PATH
];

nativeBuildInputs = [ dpkg makeWrapper nodePackages.asar ];
nativeBuildInputs = [ dpkg makeWrapper asar ];

dontUnpack = true;
dontBuild = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
, gawk
, xdg-utils
, systemd
, nodePackages
, asar
, xar
, cpio
, makeWrapper
Expand Down Expand Up @@ -55,7 +55,7 @@ let
hash = hashes.linux;
};

nativeBuildInputs = [ dpkg autoPatchelfHook wrapGAppsHook nodePackages.asar ];
nativeBuildInputs = [ dpkg autoPatchelfHook wrapGAppsHook asar ];

unpackCmd = "dpkg -x $curSrc .";

Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/office/morgen/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ lib, stdenv, fetchurl, dpkg, autoPatchelfHook, makeWrapper, electron
, nodePackages, alsa-lib, gtk3, libxshmfence, mesa, nss }:
, asar, alsa-lib, gtk3, libxshmfence, mesa, nss }:

stdenv.mkDerivation rec {
pname = "morgen";
Expand All @@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
dpkg
autoPatchelfHook
makeWrapper
nodePackages.asar
asar
];

buildInputs = [ alsa-lib gtk3 libxshmfence mesa nss ];
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/node-packages/aliases.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ mapAliases {
"@medable/mdctl-cli" = throw "@medable/mdctl-cli was removed because it was broken"; # added 2023-08-21
"@nestjs/cli" = pkgs.nest-cli; # Added 2023-05-06
antennas = pkgs.antennas; # added 2023-07-30
inherit (pkgs) asar; # added 2023-08-26
balanceofsatoshis = pkgs.balanceofsatoshis; # added 2023-07-31
bibtex-tidy = pkgs.bibtex-tidy; # added 2023-07-30
bitwarden-cli = pkgs.bitwarden-cli; # added 2023-07-25
Expand Down
1 change: 0 additions & 1 deletion pkgs/development/node-packages/node-packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
, {"@webassemblyjs/wast-refmt": "1.11.1"}
, "alex"
, "alloy"
, "asar"
, "audiosprite"
, "autoprefixer"
, "auto-changelog"
Expand Down
36 changes: 0 additions & 36 deletions pkgs/development/node-packages/node-packages.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions pkgs/tools/compression/asar/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{ lib
, mkYarnPackage
, fetchFromGitHub
, fetchYarnDeps
}:

mkYarnPackage rec {
pname = "asar";
version = "3.2.4";

src = fetchFromGitHub {
owner = "electron";
repo = "asar";
rev = "v${version}";
hash = "sha256-12FP8VRDo1PQ+tiN4zhzkcfAx9zFs/0MU03t/vFo074=";
};

packageJSON = ./package.json;

offlineCache = fetchYarnDeps {
yarnLock = "${src}/yarn.lock";
hash = "sha256-/fV3hd98pl46+fgmiMH9sDQrrZgdLY1oF9c3TaIxRSg=";
};

doDist = false;

installPhase = ''
runHook preInstall
mkdir -p "$out/lib/node_modules"
mv deps/@electron "$out/lib/node_modules"
rm "$out/lib/node_modules/@electron/asar/node_modules"
mv node_modules "$out/lib/node_modules/@electron/asar"
mkdir "$out/bin"
ln -s "$out/lib/node_modules/@electron/asar/bin/asar.js" "$out/bin/asar"
runHook postInstall
'';

meta = {
description = "Simple extensive tar-like archive format with indexing";
homepage = "https://github.com/electron/asar";
license = lib.licenses.mit;
mainProgram = "asar";
maintainers = with lib.maintainers; [ xvapx ];
};
}
62 changes: 62 additions & 0 deletions pkgs/tools/compression/asar/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"name": "@electron/asar",
"description": "Creating Electron app packages",
"version": "0.0.0-development",
"main": "./lib/asar.js",
"types": "./lib/index.d.ts",
"bin": {
"asar": "./bin/asar.js"
},
"files": [
"bin",
"lib",
"lib/index.d.ts"
],
"engines": {
"node": ">=10.12.0"
},
"license": "MIT",
"homepage": "https://github.com/electron/asar",
"repository": {
"type": "git",
"url": "https://github.com/electron/asar.git"
},
"bugs": {
"url": "https://github.com/electron/asar/issues"
},
"scripts": {
"mocha": "xvfb-maybe electron-mocha --reporter spec && mocha --reporter spec",
"test": "npm run lint && npm run mocha",
"lint": "tsd && standard",
"standard": "standard",
"tsd": "tsd"
},
"standard": {
"env": {
"mocha": true
},
"globals": [
"BigInt"
]
},
"tsd": {
"directory": "test"
},
"dependencies": {
"chromium-pickle-js": "^0.2.0",
"commander": "^5.0.0",
"glob": "^7.1.6",
"minimatch": "^3.0.4"
},
"devDependencies": {
"@continuous-auth/semantic-release-npm": "^3.0.0",
"electron": "^22.0.0",
"electron-mocha": "^11.0.2",
"lodash": "^4.17.15",
"mocha": "^10.1.0",
"rimraf": "^3.0.2",
"standard": "^14.3.3",
"tsd": "^0.25.0",
"xvfb-maybe": "^0.2.1"
}
}
6 changes: 3 additions & 3 deletions pkgs/tools/misc/flexoptix-app/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, appimageTools, fetchurl, nodePackages }: let
{ lib, appimageTools, fetchurl, asar }: let
pname = "flexoptix-app";
version = "5.13.4";

Expand All @@ -18,9 +18,9 @@
${oA.buildCommand}
# Get rid of the autoupdater
${nodePackages.asar}/bin/asar extract $out/resources/app.asar app
${asar}/bin/asar extract $out/resources/app.asar app
sed -i 's/async isUpdateAvailable.*/async isUpdateAvailable(updateInfo) { return false;/g' app/node_modules/electron-updater/out/AppUpdater.js
${nodePackages.asar}/bin/asar pack app $out/resources/app.asar
${asar}/bin/asar pack app $out/resources/app.asar
'';
});

Expand Down
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,8 @@ with pkgs;

amidst = callPackage ../tools/games/minecraft/amidst { };

asar = callPackage ../tools/compression/asar { };

askalono = callPackage ../tools/misc/askalono { };

asleap = callPackage ../tools/networking/asleap { };
Expand Down

0 comments on commit a63a64b

Please sign in to comment.