-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
131 lines (110 loc) · 3.32 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
rec {
description = "bibtex2style is a script that takes .bib file as an input and produces an .xlsx file with entries processed by biblatex with an according style (like `gost`). It also respects bold an italics fonts!";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, ... }@inputs:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
# poetry2nix = inputs.poetry2nix.packages.${system}.default;
poetry2nixLib = (inputs.poetry2nix.lib.mkPoetry2Nix { inherit pkgs; });
# mkPoetryApplication
# mkPoetryEnv
# overrides;
tex-with-pkgs = (pkgs.texlive.combine {
inherit (pkgs.texlive)
scheme-basic
biber
biblatex
biblatex-gost
collection-langcyrillic
cm-unicode
latexmk
luatex
luatex85
luatexbase
polyglossia
standalone
varwidth
;
});
buildInputs = [
tex-with-pkgs
];
poetryOverrides = poetry2nixLib.overrides.withDefaults (final: prev: {
pymupdf = pkgs.python311Packages.pymupdf;
# prev.pymupdf.override {
# # preferWheel = true;
# # buildInputs = (prev.buildInputs or [ ]) ++ [ pkgs.mupdf ];
# };
});
devShells.default = pkgs.mkShell {
packages = buildInputs ++ [
pkgs.poetry
(poetry2nixLib.mkPoetryEnv {
projectDir = ./.;
preferWheels = true; # else it fails
# for development;
# TODO: remove runtime dependency
extraPackages = (p: [ p.python-lsp-server ]);
})
];
overrides = poetryOverrides;
shellHook = ''
echo "entering dev shell..."
eval fish || true
'';
};
package-env = poetry2nixLib.mkPoetryApplication {
projectDir = ./.;
preferWheels = true; # else it fails
overrides = poetryOverrides;
};
bibtex2style = pkgs.stdenvNoCC.mkDerivation {
name = "bibtex2style";
src = ./.;
buildInputs = buildInputs ++ [
pkgs.makeWrapper
];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
ln -s "${package-env.dependencyEnv}/bin/bibtex2style" "$out/bin/"
runHook postInstall
'';
postFixup = ''
wrapProgram $out/bin/bibtex2style \
--set PATH ${pkgs.lib.makeBinPath buildInputs}
'';
meta = {
inherit description;
};
};
dockerImage = pkgs.dockerTools.buildImage {
name = "bibtex2style";
tag = "latest";
copyToRoot = pkgs.buildEnv {
name = "image-root";
paths = [ bibtex2style pkgs.bash ];
pathsToLink = [ "/bin" ];
};
config = {
WorkingDir = "/temp";
Cmd = [ "${bibtex2style}/bin/bibtex2style" ];
};
};
in
{
devShells.${system} = devShells;
packages.${system} = {
inherit bibtex2style dockerImage;
default = bibtex2style;
package-env = package-env.dependencyEnv;
};
};
}