Clean up dev workflow a bit

This commit is contained in:
Tristan Daniël Maat 2022-08-01 21:14:18 +01:00
parent 689afa04e8
commit af062715d9
Signed by: tlater
GPG key ID: 49670FD774E43268
9 changed files with 2198 additions and 67 deletions

44
nix/package.nix Normal file
View file

@ -0,0 +1,44 @@
{
self,
nix-filter,
pkgs,
}: let
node_modules_attrs = {
# Dependencies that should be available in the node build
buildInputs = with pkgs; [
pkg-config
python3
vips
glib
];
};
# Dependencies that should be available outside of the node build
buildInputs = with pkgs; [
util-linux
];
in {
package = pkgs.npmlock2nix.build {
inherit buildInputs node_modules_attrs;
src = pkgs.lib.cleanSource self;
buildCommands = ["npm run build-dist"];
installPhase = ''
cp -r dist $out/
'';
};
shell = pkgs.npmlock2nix.shell {
inherit buildInputs node_modules_attrs;
src = nix-filter.lib {
root = self;
include = [
"package.json"
"package-lock.json"
];
};
};
}

17
nix/update-lockfile Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env -S nix run 'github:clhodapp/nix-runner/32a984cfa14e740a34d14fad16fc479dec72bf07'
#!pure
#!package nixpkgs#bash
#!package nixpkgs#coreutils
#!package nixpkgs#direnv
#!package nixpkgs#git
#!package nixpkgs#nodejs-14_x
#!command bash
# shellcheck shell=bash
set -eu
cd "$(git rev-parse --show-toplevel)"
unlink node_modules
npm install --package-lock-only
rm -rf node_modules
direnv reload