-
Notifications
You must be signed in to change notification settings - Fork 4
/
flake.nix
46 lines (39 loc) · 1.33 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
{
inputs = {
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
onix.url = "github:rizo/onix";
onix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, flake-utils, onix }@inputs:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
onix' = onix.packages.${system}.latest;
opamFiles = [ ./gcloud.opam ./gcloud-cli.opam ];
onixEnv = onix'.env {
path = ./.;
roots = opamFiles;
lock = ./onix-lock.json;
deps = { "ocaml-system" = "*"; };
};
onixEnvDev = onix'.env {
path = ./.;
roots = opamFiles ++ [ ./gcloud-melange.opam ];
lock = ./onix-lock-dev.json;
deps = {
"ocaml-system" = "*";
"ocaml-lsp-server" = "*";
};
};
in rec {
# for use by nix fmt
formatter = pkgs.nixfmt-rfc-style;
packages.gcloud-cli = onixEnv.pkgs.gcloud-cli;
devShells.onixLock = pkgs.mkShell { buildInputs = [ onix' ]; };
devShells.default = onixEnvDev.shell.overrideAttrs (final: prev: {
buildInputs = prev.buildInputs ++ [ pkgs.ocamlformat_0_22_4 onix' ];
});
packages.dev-shell = devShells.default.inputDerivation;
});
}