srx.astro.nix/nix/package.nix
Sebastian Wendel 34db9d8fbb fixed file path
2024-05-17 13:56:34 +02:00

55 lines
1.3 KiB
Nix

{ inputs, ... }:
let
inherit (inputs.nix-filter.lib) filter inDirectory matchExt;
in
{
perSystem =
{ pkgs, ... }:
{
packages.srx-digital = pkgs.mkYarnPackage rec {
name = "srx-digital";
src = filter {
root = ../.;
include = [
(inDirectory "public")
(inDirectory "src")
(matchExt "js")
(matchExt "cjs")
(matchExt "mjs")
(matchExt "json")
(matchExt "ts")
../package.json
../yarn.lock
../nix/yarn.nix
];
};
packageJSON = ../package.json;
yarnLock = ../yarn.lock;
yarnNix = ../nix/yarn.nix;
yarnFlags = [
"--offline"
"--production=true"
];
CI = "true";
pkgConfig.sharp = {
nativeBuildInputs = builtins.attrValues {
inherit (pkgs.nodePackages) node-gyp;
inherit (pkgs) python3 pkg-config;
};
buildInputs = with pkgs; [ vips.dev ];
postInstall = "node-gyp --node-dir=${pkgs.nodePackages.nodejs} rebuild";
};
postConfigure = "export HOME=$(mktemp -d)";
buildPhase = "yarn build";
installPhase = "mv -v deps/${name}/dist \${out}";
distPhase = "true";
};
};
}