Skip to content

Instantly share code, notes, and snippets.

@ibizaman
Last active January 5, 2023 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ibizaman/b0205c0105a482ab6b137ea85e9631ce to your computer and use it in GitHub Desktop.
Save ibizaman/b0205c0105a482ab6b137ea85e9631ce to your computer and use it in GitHub Desktop.
python deluge/scripts/create_plugin.py
{
description = "Deluge";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-22.05;
# delugesource.url = "./.";
delugesource.url = "git://deluge-torrent.org/deluge.git?ref=master";
delugesource.flake = false;
};
outputs =
{ self
, delugesource
, nixpkgs
}:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
deluge = with pkgs.python3Packages;
buildPythonPackage rec {
pname = "deluge";
version = "2.1.1";
src = delugesource;
preBuild = ''
cat > RELEASE-VERSION <<HERE
${version}
HERE
'';
propagatedBuildInputs = [
chardet #==4.0.0
distro
ifaddr #==0.2.0
libtorrent-rasterbar
Mako
pillow
pyasn1
pygeoip
pyopenssl
pyxdg
rencode
service-identity
setproctitle
setuptools
twisted
zope_interface #>=4.4.2
pytest
pytest-twisted
];
doCheck = false;
# This is needed for the tests, otherwise you get:
# [Errno 13] Permission denied: '/homeless-shelter'
preCheck = ''
export XDG_CONFIG_HOME=$(pwd)
'';
postInstall = ''
cp deluge/scripts/create_plugin.py $out/bin
'';
meta = with pkgs.lib; {
};
};
pythonEnv = pkgs.python39.withPackages (p: with p; [
deluge
]);
in {
packages.${system}.default = deluge;
devShells.${system}.default = pkgs.mkShell {
packages = [
pythonEnv
];
};
apps.${system}.default =
let
create_plugin = pkgs.writeScript "create_plugin" ''
${pythonEnv.interpreter} ${deluge}/bin/create_plugin.py
'';
in {
type = "app";
program = "${create_plugin}";
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment