forked from federico-terzi/espanso-package-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
55 lines (52 loc) · 1.72 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
{
description =
"An espanso package to convert LaTeX symbol commands to Unicode symbols.";
inputs = {
unicode-math = {
url = "github:wspr/unicode-math";
flake = false;
};
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, unicode-math, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
version = "0.2.1";
pkgs = import nixpkgs { inherit system; };
name = "espanso-latex";
in rec {
defaultPackage = packages.name;
packages.name = pkgs.stdenvNoCC.mkDerivation rec {
inherit name;
src = [ self unicode-math ];
buildInputs = with pkgs; [
coreutils
python39
python39Packages.pyaml
];
phases = [ "buildPhase" "installPhase" ];
buildPhase = ''
export PATH="${pkgs.lib.makeBinPath buildInputs}";
python3 ${self.outPath}/convert.py ${unicode-math.outPath}/unicode-math-table.tex package.yml
'';
installPhase = ''
mkdir -p $out/${version}
cp package.yml $out/${version}/
cp ${self.outPath}/README.md $out/${version}/
cp ${self.outPath}/_manifest.yml $out/${version}/
'';
};
devShell = pkgs.mkShell {
src = [ self unicode-math ];
buildInputs = with pkgs; [
pkgs.coreutils
python39
python39Packages.pyaml
];
buildPhase = ''
python3 ${self.outPath}/convert.py ${unicode-math.outPath}/unicode-math-table.tex espanso-latex/${version}/package.yml
'';
};
});
}