open-stage-control: turn on strictDeps and add updateScript

This commit is contained in:
Lily Foster 2022-10-20 10:54:18 -04:00
parent d2cfe468f8
commit 351632dd32
No known key found for this signature in database
GPG Key ID: 49340081E484C893
3 changed files with 38 additions and 21 deletions

View File

@ -9,7 +9,7 @@ in
nodeComposition.package.override rec {
pname = "open-stage-control";
inherit (nodeComposition.args) version;
version = "1.17.0";
src = fetchFromGitHub {
owner = "jean-emmanuel";
@ -18,16 +18,25 @@ nodeComposition.package.override rec {
hash = "sha256-q18pRtsHfme+OPmi3LhJDK1AdpfkwhoE9LA2rNenDtY=";
};
strictDeps = true;
nativeBuildInputs = [
copyDesktopItems
makeBinaryWrapper
nodejs
python3
];
buildInputs = [
python3.pkgs.python-rtmidi
];
dontNpmInstall = true;
doInstallCheck = true;
preRebuild = ''
# remove electron to prevent building since nixpkgs electron is used instead
rm -r node_modules/electron
'';
postInstall = ''
# build assets
@ -48,7 +57,6 @@ nodeComposition.package.override rec {
installCheckPhase = ''
XDG_CONFIG_HOME="$(mktemp -d)" $out/bin/open-stage-control --help
'';
doInstallCheck = true;
desktopItems = [
(makeDesktopItem {
@ -62,6 +70,8 @@ nodeComposition.package.override rec {
})
];
passthru.updateScript = ./update.sh;
meta = with lib; {
description = "Libre and modular OSC / MIDI controller";
homepage = "https://openstagecontrol.ammd.net/";

View File

@ -1,18 +0,0 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p jq nodePackages.node2nix
# Get latest release tag
tag="$(curl -s https://api.github.com/repos/jean-emmanuel/open-stage-control/releases/latest | jq -r .tag_name)"
# Download package.json from the latest release
curl -s https://raw.githubusercontent.com/jean-emmanuel/open-stage-control/"$tag"/package.json | grep -v '"electron"\|"electron-installer-debian"\|"electron-packager"\|"electron-packager-plugin-non-proprietary-codecs-ffmpeg"' >package.json
# Lock dependencies with node2nix
node2nix \
--node-env ../../../development/node-packages/node-env.nix \
--nodejs-16 \
--input package.json \
--output node-packages.nix \
--composition node-composition.nix
rm -f package.json

View File

@ -0,0 +1,25 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p common-updater-scripts jq nodePackages.node2nix
set -euo pipefail
# Find nixpkgs repo
nixpkgs="$(git rev-parse --show-toplevel || (printf 'Could not find root of nixpkgs repo\nAre we running from within the nixpkgs git repo?\n' >&2; exit 1))"
# Get latest release tag
tag="$(curl -s https://api.github.com/repos/jean-emmanuel/open-stage-control/releases/latest | jq -r .tag_name)"
# Download package.json from the latest release
curl -sSL https://raw.githubusercontent.com/jean-emmanuel/open-stage-control/"$tag"/package.json | grep -v '"electron"\|"electron-installer-debian"' >"$nixpkgs"/pkgs/applications/audio/open-stage-control/package.json
# Lock dependencies with node2nix
node2nix \
--node-env "$nixpkgs"/pkgs/development/node-packages/node-env.nix \
--nodejs-16 \
--input "$nixpkgs"/pkgs/applications/audio/open-stage-control/package.json \
--output "$nixpkgs"/pkgs/applications/audio/open-stage-control/node-packages.nix \
--composition "$nixpkgs"/pkgs/applications/audio/open-stage-control/node-composition.nix
rm -f "$nixpkgs"/pkgs/applications/audio/open-stage-control/package.json
# Update hash
(cd "$nixpkgs" && update-source-version "${UPDATE_NIX_ATTR_PATH:-open-stage-control}" "${tag#v}")