-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
84 lines (70 loc) · 2.22 KB
/
flake.nix
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
rust-templates = {
url = "github:figsoda/rust-templates";
flake = false;
};
ymdl = {
url = "github:figsoda/ymdl";
flake = false;
};
};
outputs = { self, nixpkgs, rust-templates, ymdl }:
let
inherit (nixpkgs.lib) genAttrs systems;
in
{
formatter = genAttrs systems.flakeExposed
(system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt);
packages = genAttrs
[
"aarch64-darwin"
"aarch64-linux"
"i686-linux"
"x86_64-darwin"
"x86_64-linux"
]
(system:
let
inherit (nixpkgs.legacyPackages.${system}) python3 sd stdenv yt-dlp;
date = input: builtins.substring 0 8 input.lastModifiedDate;
in
{
rust-templates = stdenv.mkDerivation {
pname = "rust-templates";
version = date rust-templates;
src = rust-templates;
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,lib}
cp -r bin binlib lib $out/lib
substitute {,$out/bin/}generate \
--replace {,$out/lib/}\$1 \
--replace {,${sd}/bin/}sd
chmod +x $out/bin/generate
runHook postInstall
'';
meta.mainProgram = "generate";
};
ymdl = stdenv.mkDerivation {
pname = "ymdl";
version = date ymdl;
src = ymdl;
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,lib}
cp postdl.py $out/lib
substitute {,$out/bin/}ymdl \
--replace "python3 postdl.py" "${
(python3.withPackages (ps: [ ps.pytaglib ])).interpreter
} $out/lib/postdl.py" \
--replace yt-dlp ${yt-dlp}/bin/yt-dlp
chmod +x $out/bin/ymdl
runHook postInstall
'';
};
});
overlays.default = final: prev: self.packages.${prev.stdenv.hostPlatform.system} or { };
};
}