nix: build from source

nix: remove u2c and partyfuse packages
The main copyparty package has u2c and partyfuse, so these packages are
redundant now

nix: add fusepy dependency

fix: nix:  use replace pyfuse with fusepy
This commit is contained in:
Toast 2025-07-29 03:19:56 +02:00
parent 9f6c983231
commit 2bada04b9d
4 changed files with 21 additions and 86 deletions

View File

@ -1,10 +1,10 @@
{ {
lib, lib,
stdenv, buildPythonApplication,
makeWrapper,
fetchurl, fetchurl,
util-linux, util-linux,
python, python,
setuptools,
jinja2, jinja2,
impacket, impacket,
pyopenssl, pyopenssl,
@ -15,6 +15,7 @@
pyzmq, pyzmq,
ffmpeg, ffmpeg,
mutagen, mutagen,
fusepy, # for partyfuse
# 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,
@ -58,11 +59,18 @@
let let
pinData = lib.importJSON ./pin.json; pinData = lib.importJSON ./pin.json;
pyEnv = python.withPackages ( runtimeDeps = ([ util-linux ] ++ extraPackages ++ lib.optional withMediaProcessing ffmpeg);
ps: in
with ps; buildPythonApplication {
pname = "copyparty";
inherit (pinData) version;
src = fetchurl {
inherit (pinData) url hash;
};
dependencies =
[ [
jinja2 jinja2
fusepy
] ]
++ lib.optional withSMB impacket ++ lib.optional withSMB impacket
++ lib.optional withFTPS pyopenssl ++ lib.optional withFTPS pyopenssl
@ -73,25 +81,13 @@ let
++ lib.optional withBasicAudioMetadata mutagen ++ lib.optional withBasicAudioMetadata mutagen
++ lib.optional withHashedPasswords argon2-cffi ++ lib.optional withHashedPasswords argon2-cffi
++ lib.optional withZeroMQ pyzmq ++ lib.optional withZeroMQ pyzmq
++ (extraPythonPackages ps) ++ (extraPythonPackages python.packages);
); makeWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath runtimeDeps}" ];
runtimeDeps = ([ util-linux ] ++ extraPackages ++ lib.optional withMediaProcessing ffmpeg); pyproject = true;
in build-system = [
stdenv.mkDerivation { setuptools
pname = "copyparty"; ];
inherit (pinData) version;
src = fetchurl {
inherit (pinData) url hash;
};
nativeBuildInputs = [ makeWrapper ];
dontUnpack = true;
installPhase = ''
install -Dm755 $src $out/share/copyparty-sfx.py
makeWrapper ${pyEnv.interpreter} $out/bin/copyparty \
--prefix PATH : ${lib.makeBinPath runtimeDeps} \
--add-flag $out/share/copyparty-sfx.py
'';
meta = { meta = {
description = "Turn almost any device into a file server"; description = "Turn almost any device into a file server";
longDescription = '' longDescription = ''
@ -101,8 +97,7 @@ stdenv.mkDerivation {
homepage = "https://github.com/9001/copyparty"; homepage = "https://github.com/9001/copyparty";
changelog = "https://github.com/9001/copyparty/releases/tag/v${pinData.version}"; changelog = "https://github.com/9001/copyparty/releases/tag/v${pinData.version}";
license = lib.licenses.mit; license = lib.licenses.mit;
inherit (python.meta) platforms;
mainProgram = "copyparty"; mainProgram = "copyparty";
sourceProvenance = [ lib.sourceTypes.binaryBytecode ]; sourceProvenance = [ lib.sourceTypes.fromSource ];
}; };
} }

View File

@ -1,26 +0,0 @@
{
stdenvNoCC,
copyparty,
python3,
makeBinaryWrapper,
}:
let
python = python3.withPackages (p: [ p.fusepy ]);
in
stdenvNoCC.mkDerivation {
pname = "partyfuse";
inherit (copyparty) version meta;
src = ../../../..;
nativeBuildInputs = [ makeBinaryWrapper ];
installPhase = ''
runHook preInstall
install -Dm444 bin/partyfuse.py -t $out/share/copyparty
makeWrapper ${python.interpreter} $out/bin/partyfuse \
--add-flag $out/share/copyparty/partyfuse.py
runHook postInstall
'';
}

View File

@ -1,24 +0,0 @@
{
stdenvNoCC,
copyparty,
python312,
makeBinaryWrapper,
}:
stdenvNoCC.mkDerivation {
pname = "u2c";
inherit (copyparty) version meta;
src = ../../../..;
nativeBuildInputs = [ makeBinaryWrapper ];
installPhase = ''
runHook preInstall
install -Dm444 bin/u2c.py -t $out/share/copyparty
mkdir $out/bin
makeWrapper ${python312.interpreter} $out/bin/u2c \
--add-flag $out/share/copyparty/u2c.py
runHook postInstall
'';
}

View File

@ -12,18 +12,10 @@
}: }:
{ {
nixosModules.default = ./contrib/nixos/modules/copyparty.nix; nixosModules.default = ./contrib/nixos/modules/copyparty.nix;
overlays.default = final: prev: rec { overlays.default = final: prev: {
copyparty = final.python3.pkgs.callPackage ./contrib/package/nix/copyparty { copyparty = final.python3.pkgs.callPackage ./contrib/package/nix/copyparty {
ffmpeg = final.ffmpeg-full; ffmpeg = final.ffmpeg-full;
}; };
partyfuse = prev.callPackage ./contrib/package/nix/partyfuse {
inherit copyparty;
};
u2c = prev.callPackage ./contrib/package/nix/u2c {
inherit copyparty;
};
}; };
} }
// flake-utils.lib.eachDefaultSystem ( // flake-utils.lib.eachDefaultSystem (
@ -54,8 +46,6 @@
packages = { packages = {
inherit (pkgs) inherit (pkgs)
copyparty copyparty
partyfuse
u2c
; ;
default = self.packages.${system}.copyparty; default = self.packages.${system}.copyparty;
}; };