-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathflake.nix
58 lines (56 loc) · 1.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
{
inputs = {
systems = {
url = "github:nix-systems/default";
flake = false;
};
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
systems,
nixpkgs,
crane,
}: let
inherit (nixpkgs) lib;
eachSystem = f:
lib.genAttrs (import systems) (system:
f {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
});
in {
packages = eachSystem ({
system,
pkgs,
}: let
craneLib = crane.lib.${system};
cargoSource = lib.cleanSourceWith {
src = craneLib.path ./.;
filter = path: type:
(craneLib.filterCargoSources path type)
|| (builtins.match ".*\\.html" path != null);
};
in {
default = craneLib.buildPackage {
src = cargoSource;
buildInputs = with pkgs;
[iconv]
++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.CoreServices;
};
});
checks = eachSystem ({
system,
pkgs,
}: {
default = pkgs.runCommand "typst-live-check" {} ''
${self.packages.${system}.default}/bin/typst-live --help > $out
${pkgs.gnugrep}/bin/grep typst-live $out
'';
});
};
}