nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, python
4, buildPythonPackage
5, fetchFromGitHub
6, substituteAll
7, file
8, glibcLocales
9}:
10
11buildPythonPackage rec {
12 pname = "python-magic";
13 version = "0.4.25";
14
15 src = fetchFromGitHub {
16 owner = "ahupp";
17 repo = "python-magic";
18 rev = version;
19 sha256 = "sha256-h7YQVH5Z7zunT6AdLPBh3TWpxLpZ5unSHDhkVDFOWDI=";
20 };
21
22 patches = [
23 (substituteAll {
24 src = ./libmagic-path.patch;
25 libmagic = "${file}/lib/libmagic${stdenv.hostPlatform.extensions.sharedLibrary}";
26 })
27 ];
28
29 checkInputs = [ glibcLocales ];
30
31 checkPhase = ''
32 LC_ALL="en_US.UTF-8" ${python.interpreter} test/test.py
33 '';
34
35 meta = with lib; {
36 description = "A python interface to the libmagic file type identification library";
37 homepage = "https://github.com/ahupp/python-magic";
38 license = licenses.mit;
39 maintainers = with maintainers; [ SuperSandro2000 ];
40 };
41}