Skip to content

Commit

Permalink
gancio: remove mkYarnPackage usagef
Browse files Browse the repository at this point in the history
  • Loading branch information
TomaSajt committed Oct 29, 2024
1 parent e9c4417 commit 4b9c251
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 223 deletions.
145 changes: 0 additions & 145 deletions pkgs/by-name/ga/gancio/package.json

This file was deleted.

102 changes: 43 additions & 59 deletions pkgs/by-name/ga/gancio/package.nix
Original file line number Diff line number Diff line change
@@ -1,89 +1,73 @@
{
mkYarnPackage,
lib,
stdenv,
fetchFromGitLab,
fetchYarnDeps,
python3,

yarnConfigHook,
yarnBuildHook,
yarnInstallHook,
nodejs,

python311,
pkg-config,
nodePackages,
node-gyp,

vips,
lib,
sqlite,

nixosTests,
}:
mkYarnPackage rec {
inherit (nodePackages) nodejs;

stdenv.mkDerivation (finalAttrs: {
pname = "gancio";
version = "1.19.4";

src = fetchFromGitLab {
domain = "framagit.org";
owner = "les";
repo = "gancio";
rev = "v${version}";
rev = "v${finalAttrs.version}";
hash = "sha256-x8s7eBVmHCY3kAjHjACotCncvZq6OBiLPJGF6hvfawE=";
};

offlineCache = fetchYarnDeps {
yarnLock = src + "/yarn.lock";
yarnLock = finalAttrs.src + "/yarn.lock";
hash = "sha256-LXeAyxZSZOm6GxRuJb5rlHTlQpYa1fdKSENVjwLY4tU=";
};

packageJSON = ./package.json;
nativeBuildInputs = [
yarnConfigHook
yarnBuildHook
yarnInstallHook
nodejs
python311
pkg-config
];

# for pkg-config dependencies:
yarnPreBuild = ''
export npm_config_nodedir=${nodePackages.nodejs}
'';
# So that sqlite can be found:
pkgConfig.sqlite3 = {
nativeBuildInputs = [
pkg-config
nodePackages.prebuild-install
node-gyp
python3
];
postInstall = ''
yarn --offline run install
'';
};
# Sharp need to find a vips library
pkgConfig.sharp = {
nativeBuildInputs = [
pkg-config
python3
node-gyp
nodePackages.semver
];
buildInputs = [ vips ];
postInstall = ''
yarn --offline run install
'';
};

# build need a writeable node_modules
configurePhase = ''
runHook preConfigure
buildInputs = [
vips
sqlite
];

cp -r $node_modules node_modules
chmod -R +w node_modules
runHook postConfigure
# generate .node binaries
preBuild = ''
npm rebuild --verbose --nodedir=${nodejs} --sqlite=${lib.getDev sqlite}
'';

buildPhase = ''
runHook preBuild
export HOME=$(mktemp -d)
yarn --offline build
yarn --offline pack --filename gancio.tgz
mkdir -p deps/gancio
tar -C deps/gancio/ --strip-components=1 -xf gancio.tgz
rm gancio.tgz
# the node_modules directory will be regenerated by yarnInstallHook, so we save our .node binaries
preInstall = ''
cp node_modules/sharp/build/Release/sharp.node .
cp node_modules/sqlite3/build/Release/node_sqlite3.node .
'';

runHook postBuild
# and then place them where they belong
postInstall = ''
install -Dm755 sharp.node -t $out/lib/node_modules/gancio/node_modules/sharp/build/Release
install -Dm755 node_sqlite3.node -t $out/lib/node_modules/gancio/node_modules/sqlite3/build/Release
'';

passthru = {
updateScript = ./update.sh;
inherit nodejs;
tests = {
inherit (nixosTests) gancio;
};
Expand All @@ -98,4 +82,4 @@ mkYarnPackage rec {
mainProgram = "gancio";
maintainers = with lib.maintainers; [ jbgi ];
};
}
})
19 changes: 0 additions & 19 deletions pkgs/by-name/ga/gancio/update.sh

This file was deleted.

0 comments on commit 4b9c251

Please sign in to comment.