stitch
Note taking for messy minimalists
git clone git://mccd.space/stitch| Log | Files | Refs | README | LICENSE | Mail |
flake.nix (2094B)
1 {
2 inputs = {
3 nixpkgs.url = "github:NixOS/nixpkgs";
4 opam-nix.url = "github:tweag/opam-nix";
5 flake-utils.url = "github:numtide/flake-utils";
6 nixpkgs.follows = "opam-nix/nixpkgs";
7 };
8 outputs = { self, flake-utils, opam-nix, nixpkgs }:
9 let package = "stitch";
10 in flake-utils.lib.eachDefaultSystem (system:
11 let
12 pkgs = nixpkgs.legacyPackages.${system};
13 on = opam-nix.lib.${system};
14 devPackagesQuery = {
15 # You can add "development" packages here. They will get added to the devShell automatically.
16 ocaml-lsp-server = "*";
17 ocamlformat = "*";
18 ocamlfind = "*";
19 utop = "*";
20 odoc = "*";
21 };
22 query = devPackagesQuery // {
23 ## You can force versions of certain packages here, e.g:
24 ## - force the ocaml compiler to be taken from opam-repository:
25 ocaml-base-compiler = "*";
26 ## - or force the compiler to be taken from nixpkgs and be a certain version:
27 # ocaml-system = "4.14.0";
28 ## - or force ocamlfind to be a certain version:
29 };
30 scope = on.buildOpamProject' { } ./. query;
31 overlay = final: prev: {
32 # You can add overrides here
33 ${package} = prev.${package}.overrideAttrs (_: {
34 # Prevent the ocaml dependencies from leaking into dependent environments
35 doNixSupport = false;
36 buildInputs = [];
37 });
38 };
39 scope' = scope.overrideScope' overlay;
40 # The main package containing the executable
41 main = scope'.${package};
42 # Packages from devPackagesQuery
43 devPackages = builtins.attrValues
44 (pkgs.lib.getAttrs (builtins.attrNames devPackagesQuery) scope');
45 in {
46 legacyPackages = scope';
47
48 packages.default = main;
49
50 apps.stitch.default = {
51 type = "app";
52 program = "${main}/bin/stitch";
53 };
54
55 devShells.default = pkgs.mkShell {
56 inputsFrom = [ main ];
57 buildInputs = devPackages;
58 };
59 });
60 }
61