nix package

This commit is contained in:
Chinpo Nya 2023-04-04 17:27:57 +02:00 committed by ed
parent 8f5f8a3cda
commit 05bbd41c4b
4 changed files with 111 additions and 0 deletions

3
.gitignore vendored
View file

@ -34,3 +34,6 @@ up.*.txt
.hist/ .hist/
scripts/docker/*.out scripts/docker/*.out
scripts/docker/*.err scripts/docker/*.err
# nix build output link
result

View file

@ -0,0 +1,39 @@
{ lib, stdenv, makeWrapper, fetchurl, utillinux, python, jinja2, mutagen, pillow
, pyvips, pyftpdlib, pyopenssl, impacket, ffmpeg }:
let
pyEnv = python.withPackages (ps:
with ps; [
# mandatory
jinja2
# thumbnails
pyvips
ffmpeg
# alternative thumbnails, but not needed in the presence of pyvips and ffmpeg
# pillow pyheif-pillow-opener pillow-avif-plugin
# audio metadata
mutagen
# ftp server
pyftpdlib
pyopenssl
# smb server
impacket
]);
in stdenv.mkDerivation rec {
pname = "copyparty";
version = "1.6.11";
src = fetchurl {
url =
"https://github.com/9001/copyparty/releases/download/v${version}/copyparty-sfx.py";
hash = "sha256-0JbjOrZm70UhOJndOhBzX2K1RBM5y3N0+TsjLQtsjTQ=";
};
buildInputs = [ makeWrapper ];
dontUnpack = true;
dontBuild = true;
installPhase = ''
install -Dm755 $src $out/share/copyparty-sfx.py
makeWrapper ${pyEnv.interpreter} $out/bin/copyparty \
--set PATH '${lib.makeBinPath [ utillinux ffmpeg ]}:$PATH' \
--add-flags "$out/share/copyparty-sfx.py"
'';
}

42
flake.lock Normal file
View file

@ -0,0 +1,42 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1678901627,
"narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1680334310,
"narHash": "sha256-ISWz16oGxBhF7wqAxefMPwFag6SlsA9up8muV79V9ck=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "884e3b68be02ff9d61a042bc9bd9dd2a358f95da",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-22.11",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

27
flake.nix Normal file
View file

@ -0,0 +1,27 @@
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-22.11";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
{
overlays.default = self: super: {
copyparty =
self.python3.pkgs.callPackage ./contrib/package/nix/copyparty {
ffmpeg = self.ffmpeg-full;
};
};
} // flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
in {
packages = {
inherit (pkgs) copyparty;
default = self.packages.${system}.copyparty;
};
});
}