mirror of
https://github.com/9001/copyparty.git
synced 2025-11-24 07:23:22 -07:00
Nix: build dependencies from source
This commit is contained in:
parent
3f2d8e8087
commit
b8dc89ae81
|
|
@ -2,6 +2,9 @@
|
||||||
lib,
|
lib,
|
||||||
buildPythonApplication,
|
buildPythonApplication,
|
||||||
fetchurl,
|
fetchurl,
|
||||||
|
runCommand,
|
||||||
|
compressDrvWeb,
|
||||||
|
pigz,
|
||||||
util-linux,
|
util-linux,
|
||||||
python,
|
python,
|
||||||
setuptools,
|
setuptools,
|
||||||
|
|
@ -20,6 +23,16 @@
|
||||||
partftpy,
|
partftpy,
|
||||||
fusepy, # for partyfuse
|
fusepy, # for partyfuse
|
||||||
|
|
||||||
|
# deps in /copyparty/web/deps
|
||||||
|
marked,
|
||||||
|
easy-mde,
|
||||||
|
busy-mp3,
|
||||||
|
copyparty-fonts,
|
||||||
|
asmcrypto,
|
||||||
|
hash-wasm,
|
||||||
|
prism,
|
||||||
|
fusepy-copyparty,
|
||||||
|
|
||||||
# use argon2id-hashed passwords in config files (sha2 is always available)
|
# use argon2id-hashed passwords in config files (sha2 is always available)
|
||||||
withHashedPasswords ? true,
|
withHashedPasswords ? true,
|
||||||
|
|
||||||
|
|
@ -72,6 +85,26 @@
|
||||||
let
|
let
|
||||||
pinData = lib.importJSON ./pin.json;
|
pinData = lib.importJSON ./pin.json;
|
||||||
runtimeDeps = ([ util-linux ] ++ extraPackages ++ lib.optional withMediaProcessing ffmpeg);
|
runtimeDeps = ([ util-linux ] ++ extraPackages ++ lib.optional withMediaProcessing ffmpeg);
|
||||||
|
|
||||||
|
sitePackages = drv: "${drv.outPath}/lib/python${lib.versions.majorMinor python.version}/site-packages";
|
||||||
|
nodeModules = drv: "${drv.outPath}/lib/node_modules";
|
||||||
|
webDeps = runCommand "copyparty-webdeps" {
|
||||||
|
nativeBuildInputs = [ util-linux ];
|
||||||
|
} ''
|
||||||
|
mkdir $out
|
||||||
|
cp --verbose -r --target-directory $out \
|
||||||
|
${copyparty-fonts}/* ${prism}/* \
|
||||||
|
${sitePackages fusepy-copyparty}/fuse.py \
|
||||||
|
${nodeModules easy-mde}/easymde/dist/* \
|
||||||
|
${nodeModules marked}/marked/marked.min.js
|
||||||
|
cp ${busy-mp3} $out/busy.mp3.gz
|
||||||
|
cp ${hash-wasm}/sha512.umd.min.js $out/sha512.hw.js
|
||||||
|
cp ${nodeModules asmcrypto}/@openpgp/asmcrypto.js/asmcrypto.all.es5.js $out/sha512.ac.js
|
||||||
|
rename -v ".min" "" $out/*
|
||||||
|
'';
|
||||||
|
smolWebDeps = compressDrvWeb webDeps {
|
||||||
|
compressors.gz = "${lib.getExe pigz} -11 -I 2048 --force {}";
|
||||||
|
};
|
||||||
in
|
in
|
||||||
buildPythonApplication {
|
buildPythonApplication {
|
||||||
pname = "copyparty";
|
pname = "copyparty";
|
||||||
|
|
@ -103,6 +136,14 @@ buildPythonApplication {
|
||||||
build-system = [
|
build-system = [
|
||||||
setuptools
|
setuptools
|
||||||
];
|
];
|
||||||
|
# Build webdeps when building from source
|
||||||
|
preBuild = lib.optionalString (true) ''
|
||||||
|
# TODO: remove this when we build this from source.
|
||||||
|
# This is just so that we can try this without building from source
|
||||||
|
rm -r copyparty/web/deps/* && touch copyparty/web/deps/__init__.py
|
||||||
|
|
||||||
|
cp -vr ${smolWebDeps}/* copyparty/web/deps/
|
||||||
|
'';
|
||||||
meta = {
|
meta = {
|
||||||
description = "Turn almost any device into a file server";
|
description = "Turn almost any device into a file server";
|
||||||
longDescription = ''
|
longDescription = ''
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue