-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathflake.nix
83 lines (67 loc) · 1.98 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
{
description = "Deterministic Typst compilation with Nix";
nixConfig = {
extra-substituters = ["https://typst-nix.cachix.org"];
extra-trusted-public-keys = ["typst-nix.cachix.org-1:OzDUMt0nd4wlI1AHucBPnchl4utWXeFTtUFt8XZ3DbA="];
};
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = {nixpkgs, ...}: let
inherit (nixpkgs) lib;
linux32BitSystems = ["i686-linux"];
linux64BitSystems = ["x86_64-linux" "aarch64-linux"];
linuxSystems = linux32BitSystems ++ linux64BitSystems;
darwinSystems = ["x86_64-darwin" "aarch64-darwin"];
systems = linuxSystems ++ darwinSystems;
forAllSystems = lib.genAttrs systems;
pkgsFor = lib.genAttrs systems (system: nixpkgs.legacyPackages.${system});
mkLib = pkgs:
import ./lib {
inherit (pkgs) lib newScope;
};
mkReleaseScript = pkgs:
import ./release.nix {
inherit pkgs;
};
in {
inherit mkLib;
overlays.default = _final: _prev: {};
templates = rec {
default = quick-start;
quick-start = {
description = "A Typst project";
path = ./examples/quick-start;
};
};
checks = forAllSystems (system: let
pkgs = pkgsFor.${system};
in (pkgs.callPackages ./checks {
inherit pkgs;
myLib = mkLib pkgs;
}));
lib = forAllSystems (system: mkLib pkgsFor.${system});
packages = forAllSystems (system: (
import ./pkgs.nix {pkgs = pkgsFor.${system};}
));
apps = forAllSystems (system: {
release = {
type = "app";
program = lib.getExe (mkReleaseScript pkgsFor.${system});
};
});
formatter = forAllSystems (system: pkgsFor.${system}.alejandra);
devShells = forAllSystems (system: let
pkgs = pkgsFor.${system};
in {
default = pkgs.mkShellNoCC {
nativeBuildInputs = with pkgs; [
alejandra
markdownlint-cli
mdbook
nodePackages.prettier
];
};
});
};
}