-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add flake.lock and flake.nix for package management and configuration
- Loading branch information
Showing
2 changed files
with
260 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
inputs = { | ||
opam-nix.url = "github:tweag/opam-nix"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
nixpkgs.follows = "opam-nix/nixpkgs"; | ||
}; | ||
outputs = { self, flake-utils, opam-nix, nixpkgs }@inputs: | ||
# Don't forget to put the package name instead of `throw': | ||
let package = "tezla"; | ||
in flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
on = opam-nix.lib.${system}; | ||
devPackagesQuery = { | ||
# You can add "development" packages here. They will get added to the devShell automatically. | ||
ocaml-lsp-server = "*"; | ||
ocamlformat = "*"; | ||
}; | ||
query = devPackagesQuery // { | ||
## You can force versions of certain packages here, e.g: | ||
## - force the ocaml compiler to be taken from opam-repository: | ||
ocaml-base-compiler = "*"; | ||
## - or force the compiler to be taken from nixpkgs and be a certain version: | ||
# ocaml-system = "4.14.0"; | ||
## - or force ocamlfind to be a certain version: | ||
# ocamlfind = "1.9.2"; | ||
}; | ||
scope = on.buildOpamProject { } package ./. query; | ||
overlay = final: prev: | ||
{ | ||
# Your overrides go here | ||
}; | ||
scope' = scope.overrideScope overlay; | ||
# The main package containing the executable | ||
main = scope'.${package}; | ||
# Packages from devPackagesQuery | ||
devPackages = builtins.attrValues | ||
(pkgs.lib.getAttrs (builtins.attrNames devPackagesQuery) scope'); | ||
in | ||
{ | ||
legacyPackages = scope'; | ||
|
||
packages.default = self.legacyPackages.${system}.${package}; | ||
|
||
devShells.default = pkgs.mkShell { | ||
inputsFrom = [ main ]; | ||
buildInputs = devPackages ++ [ | ||
pkgs.nixd | ||
# You can add packages from nixpkgs here | ||
]; | ||
}; | ||
}); | ||
} |