-
Add the Flake URL to Inputs in Your
flake.nix
: To use theagda-algebras
overlay, you need to reference the flake in your project'sflake.nix
file. This allows Nix to fetch the overlay from your GitHub repository (or another location where the flake is hosted).Here's an example
flake.nix
for a user project:{ description = "Example project using the agda-algebras overlay"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs"; agda-algebras.url = "github:yourusername/agda-algebras"; # Replace with your actual GitHub username and repository name }; outputs = { self, nixpkgs, agda-algebras }: let # Import Nixpkgs with the agda-algebras overlay applied. pkgs = import nixpkgs { overlays = [ agda-algebras.overlay ]; }; in { # Define a development shell environment that includes agda-algebras. devShells.default = pkgs.mkShell { buildInputs = [ pkgs.haskellPackages.agda-algebras ]; }; # Optional: Define other outputs such as packages, apps, etc. packages.default = pkgs.stdenv.mkDerivation { name = "example-package"; src = ./.; buildInputs = [ pkgs.haskellPackages.agda-algebras ]; }; }; }
-
Use the Overlay in Your Nixpkgs Configuration: The above example already includes the necessary configuration to use the overlay. By adding
agda-algebras.overlay
to theoverlays
list when importingnixpkgs
, you ensure thatagda-algebras
is available as part ofhaskellPackages
. -
Install the Library via
haskellPackages.agda-algebras
: With the overlay applied, you can referencehaskellPackages.agda-algebras
in yourbuildInputs
. This makes the library available in your development environment or for use in building other packages.To enter a development shell that includes the
agda-algebras
library, simply run:nix develop
This command will drop you into a shell environment where
haskellPackages.agda-algebras
is available, along with all other dependencies specified in thedevShell
section.
-
Add the Flake URL: In your project's
flake.nix
, add the URL of theagda-algebras
flake to theinputs
section.inputs.agda-algebras.url = "github:yourusername/agda-algebras";
-
Use the Overlay: Apply the
agda-algebras
overlay by adding it to theoverlays
list when importingnixpkgs
.pkgs = import nixpkgs { overlays = [ agda-algebras.overlay ]; };
-
Install the Library: Reference the library in your
buildInputs
to include it in your environment.buildInputs = [ pkgs.haskellPackages.agda-algebras ];
Here's the complete flake.nix
file for a hypothetical user project using the agda-algebras
overlay:
{
description = "Example project using the agda-algebras overlay";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
agda-algebras.url = "github:yourusername/agda-algebras"; # Replace with your actual GitHub username and repository name
};
outputs = { self, nixpkgs, agda-algebras }:
let
# Import Nixpkgs with the agda-algebras overlay applied.
pkgs = import nixpkgs { overlays = [ agda-algebras.overlay ]; };
in
{
# Define a development shell environment that includes agda-algebras.
devShells.default = pkgs.mkShell {
buildInputs = [ pkgs.haskellPackages.agda-algebras ];
};
# Optional: Define other outputs such as packages, apps, etc.
packages.default = pkgs.stdenv.mkDerivation {
name = "example-package";
src = ./.;
buildInputs = [ pkgs.haskellPackages.agda-algebras ];
};
};
}
By following these detailed instructions, users can easily integrate the agda-algebras
library into their Nix-based projects using the overlay mechanism.