feat: package WebStudio/presenter
This commit is contained in:
parent
31c89a6808
commit
ae487a9a40
3 changed files with 75 additions and 1 deletions
11
flake.nix
11
flake.nix
|
@ -14,6 +14,9 @@
|
|||
inherit (pkgs) lib;
|
||||
inherit (pkgs.python311Packages) setuptools packaging sanic buildPythonPackage fetchPypi;
|
||||
};
|
||||
webstudio = import ./webstudio.nix {
|
||||
inherit pkgs;
|
||||
};
|
||||
dependencies = ps: with ps; [
|
||||
setuptools
|
||||
wheel
|
||||
|
@ -36,7 +39,7 @@
|
|||
version = self.shortRev or self.dirtyShortRev or "dirty-inputs";
|
||||
in
|
||||
{
|
||||
packages = {
|
||||
packages = rec {
|
||||
default = pkgs.python311Packages.buildPythonApplication {
|
||||
pname = "bapsicle";
|
||||
inherit version;
|
||||
|
@ -45,8 +48,14 @@
|
|||
src = ./.;
|
||||
patches = [
|
||||
./patches/0-setup.py-fixes.patch
|
||||
(pkgs.substituteAll {
|
||||
src = ./patches/1-presenter-build-path.patch;
|
||||
baps_presenter = "${webstudio}";
|
||||
})
|
||||
];
|
||||
};
|
||||
|
||||
inherit webstudio;
|
||||
};
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
|
|
18
patches/1-presenter-build-path.patch
Normal file
18
patches/1-presenter-build-path.patch
Normal file
|
@ -0,0 +1,18 @@
|
|||
diff --git a/web_server.py b/web_server.py
|
||||
index ccc3979..dc36db3 100644
|
||||
--- a/web_server.py
|
||||
+++ b/web_server.py
|
||||
@@ -449,11 +449,11 @@ app.static(
|
||||
app.static("/static", resolve_local_file_path("ui-static"), name="ui-static")
|
||||
|
||||
|
||||
-dist_directory = resolve_local_file_path("presenter-build")
|
||||
+dist_directory = "@baps_presenter@";
|
||||
app.static("/presenter", dist_directory)
|
||||
app.static(
|
||||
"/presenter/",
|
||||
- resolve_local_file_path("presenter-build/index.html"),
|
||||
+ "@baps_presenter@/index.html",
|
||||
strict_slashes=True,
|
||||
name="presenter-index",
|
||||
)
|
47
webstudio.nix
Normal file
47
webstudio.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
{ pkgs }:
|
||||
let
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "UniversityRadioYork";
|
||||
repo = "WebStudio";
|
||||
rev= "8b7f59cdc6ed80b525b2dff665308d808a526d97";
|
||||
hash = "sha256-I+N/mskX8/gN065SqPxmOn3nrHKPWPcIZygSGbB6GEE=";
|
||||
};
|
||||
yarnOfflineCache = pkgs.fetchYarnDeps {
|
||||
yarnLock = "${src}/yarn.lock";
|
||||
hash = "sha256-AmKui+Sqyipy4/9lcg8vGWfp9lM2+/fHHDzEWoG8fqw=";
|
||||
};
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
pname = "baps-presenter";
|
||||
name = "baps-presenter";
|
||||
inherit src;
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
nodejs
|
||||
yarn
|
||||
yarn2nix-moretea.fixup_yarn_lock
|
||||
];
|
||||
|
||||
configurePhase = ''
|
||||
export HOME=$(mktemp -d)
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
yarn config --offline set yarn-offline-mirror ${yarnOfflineCache}
|
||||
fixup_yarn_lock yarn.lock
|
||||
yarn install --offline \
|
||||
--frozen-lockfile \
|
||||
--ignore-engines \
|
||||
--ignore-scripts
|
||||
patchShebangs .
|
||||
|
||||
yarn run build-baps
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -R build/. $out
|
||||
'';
|
||||
|
||||
doDist = false;
|
||||
}
|
Loading…
Reference in a new issue