forked from rrah/hackyplayer
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdefault.nix
More file actions
65 lines (58 loc) · 2.28 KB
/
default.nix
File metadata and controls
65 lines (58 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{ sources ? import ./nix/sources.nix
, pkgs ? import sources.nixpkgs { }
, poetry2nix ? import sources.poetry2nix { inherit pkgs; }
, lib ? pkgs.lib
}:
let
hackyplayer' = groups: poetry2nix.mkPoetryApplication {
groups = [ "prod" ];
projectDir = ./.;
overrides = poetry2nix.overrides.withDefaults (final: prev: {
celery-singleton = prev.celery-singleton.overridePythonAttrs (old: {
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "poetry.masonry.api" "poetry.core.masonry.api"
'';
});
pyright = prev.pyright.overridePythonAttrs (old: {
nativeBuildInputs = old.nativeBuildInputs ++ [ final.setuptools ];
});
});
};
hackyplayerProd = hackyplayer' [ "prod" ];
hackyplayerDev = hackyplayer' [ "dev" ];
ffmpeg = pkgs.ffmpeg_7-full; # we need librsvg support (-full)
fontconfigConf = pkgs.makeFontsConf {
fontDirectories = [
(lib.sources.sourceFilesBySuffices ./hackyplayer/resources [ ".ttf" ])
];
};
ffmpegWrapper = pkgs.writeShellScript "ffmpeg-wrapper" ''
export FONTCONFIG_FILE="${fontconfigConf}"
export LADSPA_PATH="${lib.getLib pkgs.master_me}/lib/ladspa"
exec "${lib.getExe' ffmpeg "ffmpeg"}" "$@"
'';
in
(hackyplayerProd.dependencyEnv.override {
app = hackyplayerProd.overridePythonAttrs (old: {
postPatch = ''
${old.postPatch or ""}
substituteInPlace hackyplayer/formvideo.py \
--replace-fail 'FFMPEG_BIN = "ffmpeg"' 'FFMPEG_BIN = "${ffmpegWrapper}"' \
--replace-fail 'FFPROBE_BIN = "ffprobe"' 'FFPROBE_BIN = "${lib.getExe' ffmpeg "ffprobe"}"' \
--replace-fail 'IMAGEMAGICK_BIN = "convert"' 'IMAGEMAGICK_BIN = "${lib.getExe' pkgs.imagemagick "convert"}"' \
--replace-fail 'APP_ROOT = Path(".")' 'APP_ROOT = Path("${placeholder "out"}/${hackyplayerProd.python.sitePackages}/hackyplayer")'
'';
});
}) // {
inherit fontconfigConf ffmpegWrapper ffmpeg;
shell = pkgs.mkShell {
packages = [ ffmpeg pkgs.imagemagick pkgs.poetry pkgs.nodejs ];
inputsFrom = [ hackyplayerDev ];
shellHook = ''
export FONTCONFIG_FILE="${fontconfigConf}"
export LADSPA_PATH="${lib.getLib pkgs.master_me}/lib/ladspa"
export PYRIGHT_PYTHON_GLOBAL_NODE=true
'';
};
}