Add Nix flake for Python 2.7 development environment
Uses nixpkgs-18.09 which has all required Python 2 packages: - fuse-python 0.2.1 - mutagen 1.41.1 - beets 1.4.9 (built from source) - jellyfish 0.6.1 - munkres 1.0.6 Run 'nix develop' or 'direnv allow' to enter the environment.
This commit is contained in:
Generated
+62
@@ -0,0 +1,62 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1731533236,
|
||||||
|
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-old": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1558254092,
|
||||||
|
"narHash": "sha256-5v6XuO9dOVpB3ZGNyDvLqOvCnzlyyvscTYbNiQouSZo=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "a7e559a5504572008567383c3dc8e142fa7a8633",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-18.09",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs-old": "nixpkgs-old"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
{
|
||||||
|
description = "beetfs - FUSE filesystem for beets with metadata overlay (Python 2.7)";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
# Using nixos-18.09 - has all Python 2 packages: fuse, mutagen, jellyfish, munkres
|
||||||
|
# Mark as non-flake since 18.09 predates flakes
|
||||||
|
nixpkgs-old = {
|
||||||
|
url = "github:NixOS/nixpkgs/nixos-18.09";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs-old, flake-utils }:
|
||||||
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs-old {
|
||||||
|
inherit system;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Build beets 1.4.9 for Python 2 (last Python 2 compatible version)
|
||||||
|
# Using minimal deps - autotagger features (munkres, jellyfish) not needed for beetfs
|
||||||
|
beets-py2 = pkgs.python2Packages.buildPythonPackage rec {
|
||||||
|
pname = "beets";
|
||||||
|
version = "1.4.9";
|
||||||
|
|
||||||
|
# Use legacy setup.py install (not pip/wheel)
|
||||||
|
format = "other";
|
||||||
|
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "beetbox";
|
||||||
|
repo = "beets";
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = "sha256-KO5jtqxw82ylbSKsJgUGr3bfxUPH8vanf/+kv//CreM=";
|
||||||
|
};
|
||||||
|
|
||||||
|
# No patching needed - nixpkgs-18.09 has all required Python 2 packages
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs.python2Packages; [ setuptools ];
|
||||||
|
|
||||||
|
buildPhase = "true"; # No build needed
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
# Direct copy to avoid dependency resolution
|
||||||
|
mkdir -p $out/lib/python2.7/site-packages
|
||||||
|
cp -r beets $out/lib/python2.7/site-packages/
|
||||||
|
cp -r beetsplug $out/lib/python2.7/site-packages/
|
||||||
|
|
||||||
|
# Create version file
|
||||||
|
echo "__version__ = '${version}'" >> $out/lib/python2.7/site-packages/beets/__init__.py
|
||||||
|
|
||||||
|
# Create beet command wrapper
|
||||||
|
mkdir -p $out/bin
|
||||||
|
cat > $out/bin/beet << 'EOF'
|
||||||
|
#!${pkgs.python2.interpreter}
|
||||||
|
import sys
|
||||||
|
from beets.ui import main
|
||||||
|
main()
|
||||||
|
EOF
|
||||||
|
chmod +x $out/bin/beet
|
||||||
|
'';
|
||||||
|
|
||||||
|
propagatedBuildInputs = with pkgs.python2Packages; [
|
||||||
|
pyyaml
|
||||||
|
mutagen
|
||||||
|
unidecode
|
||||||
|
enum34
|
||||||
|
six
|
||||||
|
musicbrainzngs
|
||||||
|
jellyfish
|
||||||
|
munkres
|
||||||
|
];
|
||||||
|
|
||||||
|
# Disable tests for faster builds
|
||||||
|
doCheck = false;
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Music library manager and tagger";
|
||||||
|
homepage = "https://beets.io/";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
pythonEnv = pkgs.python2.withPackages (ps: with ps; [
|
||||||
|
fuse
|
||||||
|
mutagen
|
||||||
|
pyyaml
|
||||||
|
enum34
|
||||||
|
six
|
||||||
|
jellyfish
|
||||||
|
munkres
|
||||||
|
unidecode
|
||||||
|
musicbrainzngs
|
||||||
|
] ++ [ beets-py2 ]);
|
||||||
|
|
||||||
|
in {
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
buildInputs = [
|
||||||
|
pythonEnv
|
||||||
|
pkgs.fuse
|
||||||
|
];
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
# Clear any system Python pollution and set clean PYTHONPATH
|
||||||
|
unset PYTHONPATH
|
||||||
|
export PYTHONPATH="$PWD/beetsplug"
|
||||||
|
echo "beetfs development environment (Python 2.7)"
|
||||||
|
echo " Python: $(python --version 2>&1)"
|
||||||
|
echo " Run: python -c 'import beets; print(beets.__version__)'"
|
||||||
|
echo ""
|
||||||
|
echo "To mount: beet mount <mountpoint>"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user