-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathflake.nix
More file actions
57 lines (53 loc) · 1.93 KB
/
flake.nix
File metadata and controls
57 lines (53 loc) · 1.93 KB
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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
opam-nix.url = "github:tweag/opam-nix";
flake-utils.url = "github:numtide/flake-utils";
# we pin opam-nix's nixpkgs to follow the flakes, avoiding using two different instances
opam-nix.inputs.nixpkgs.follows = "nixpkgs";
# maintain a different opam-repository to those pinned upstream
# opam-repository = {
# url = "github:ocaml/opam-repository";
# flake = false;
# };
# opam-nix.inputs.opam-repository.follows = "opam-repository";
# deduplicate flakes
opam-nix.inputs.flake-utils.follows = "flake-utils";
};
outputs = { self, nixpkgs, flake-utils, opam-nix, ... }@inputs:
# create outputs for each default system
flake-utils.lib.eachDefaultSystem (system:
let
package = "eon";
pkgs = nixpkgs.legacyPackages.${system};
opam-nix-lib = opam-nix.lib.${system};
devPackagesQuery = {
ocaml-lsp-server = "*";
ocamlformat = "*";
utop = "*";
};
query = {
ocaml-base-compiler = "*";
};
scope =
# recursive finds vendored dependancies in duniverse
opam-nix-lib.buildOpamProject' { recursive = true; } ./. (query // devPackagesQuery);
in {
packages.default = scope.${package};
defaultPackage = scope.${package};
devShells.default = let
devPackages = builtins.attrValues
(pkgs.lib.getAttrs (builtins.attrNames devPackagesQuery) scope);
in pkgs.mkShell {
inputsFrom = [ scope.${package} ];
buildInputs = devPackages;
};
}) // {
nixosModules = {
default.imports = [ (import ./module.nix self.packages) ];
acme.imports = [ (import ./acme.nix self.packages) ];
};
formatter = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed
(system: nixpkgs.legacyPackages.${system}.nixfmt);
};
}