Skip to content

Commit

Permalink
Add flake.lock and flake.nix for package management and configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
joaosreis committed Jan 12, 2025
1 parent b3e41d0 commit 3da14b2
Show file tree
Hide file tree
Showing 2 changed files with 260 additions and 0 deletions.
207 changes: 207 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions flake.nix
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
];
};
});
}

0 comments on commit 3da14b2

Please sign in to comment.