From ee9aa9ea4b9f597ad897d0b883111f0c99268118 Mon Sep 17 00:00:00 2001 From: tzlil Date: Mon, 2 Oct 2023 02:25:33 +0300 Subject: initial commit --- flake.nix | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 flake.nix (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..e8c1464 --- /dev/null +++ b/flake.nix @@ -0,0 +1,60 @@ + +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + flake-utils = { + url = "github:numtide/flake-utils"; + }; + }; + + outputs = { flake-utils, nixpkgs, self }: + flake-utils.lib.eachDefaultSystem + (system: + let + config = {}; + + overlays = [ + # This is an overlay we apply on top of Nixpkgs with some of our + # own packages defined. + (final: prev: { + # A Haskell package set with our own overrides and packages defined. + myHaskellPackages = final.haskellPackages.override { + overrides = hfinal: hprev: { + # This is our local Haskell package. + package = + hfinal.callCabal2nix "package" ./. {}; + }; + }; + + # This is just a convenient shortcut to our package from the + # top-level of Nixpkgs. We're also applying the + # justStaticExecutables function to our package in order to + # reduce the size of the output derivation. + package = + final.haskell.lib.compose.justStaticExecutables + final.myHaskellPackages.package; + + # A Haskell development shell for our package that includes + # things like cabal and HLS. + myDevShell = final.myHaskellPackages.shellFor { + packages = p: [ p.package ]; + + nativeBuildInputs = [ + final.cabal-install + final.haskellPackages.haskell-language-server + ]; + }; + }) + ]; + + # Our full Nixpkgs with the above overlay applied. + pkgs = import nixpkgs { inherit config overlays system; }; + in + { + packages.default = pkgs.package; + + devShells.default = pkgs.myDevShell; + } + ); +} -- cgit 1.4.1