mirror of
https://github.com/srid/haskell-flake.git
synced 2024-10-26 06:58:36 +03:00
Add otherOverlays
option (#277)
This commit is contained in:
parent
786aca6c82
commit
5dcb739e9c
@ -3,6 +3,7 @@
|
||||
## Unreleased
|
||||
|
||||
- #210: Add `extraLibraries` to `settings` module.
|
||||
- #277: Add `otherOverlays` option to add custom Haskell package overlays.
|
||||
- #225: settings: add `removeReferencesTo`
|
||||
- #215: Improved debug logging.
|
||||
- #216: Remove `debug` option (pass `--trace-verbose` to nix instead)
|
||||
|
@ -64,6 +64,13 @@
|
||||
inherit nixpkgs flake-parts haskell-flake;
|
||||
};
|
||||
};
|
||||
|
||||
test-otherOverlays = {
|
||||
dir = "test/otherOverlays";
|
||||
overrideInputs = {
|
||||
inherit nixpkgs flake-parts haskell-flake;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -68,6 +68,17 @@ in
|
||||
default = pkgs.haskellPackages;
|
||||
defaultText = lib.literalExpression "pkgs.haskellPackages";
|
||||
};
|
||||
otherOverlays = lib.mkOption {
|
||||
type = types.listOf (import ../../types/haskell-overlay-type.nix { inherit lib; });
|
||||
description = ''
|
||||
Extra overlays to apply.
|
||||
|
||||
Normally, you would only use `packages.*` and `settings.*` (which
|
||||
translate to overlays), but you can use this option if you want control
|
||||
over the final overlay.
|
||||
'';
|
||||
default = [ ];
|
||||
};
|
||||
autoWire =
|
||||
let
|
||||
outputTypes = [ "packages" "checks" "apps" "devShells" ];
|
||||
|
@ -83,10 +83,10 @@ in
|
||||
localPackages =
|
||||
lib.filterAttrs (_: cfg: cfg.local.toCurrentProject) config.packages;
|
||||
|
||||
finalOverlay = lib.composeManyExtensions [
|
||||
finalOverlay = lib.composeManyExtensions ([
|
||||
config.packagesOverlay
|
||||
config.settingsOverlay
|
||||
];
|
||||
] ++ config.otherOverlays);
|
||||
|
||||
finalPackages = config.basePackages.extend finalOverlay;
|
||||
|
||||
|
32
test/otherOverlays/flake.nix
Normal file
32
test/otherOverlays/flake.nix
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
# Since there is no flake.lock file (to avoid incongruent haskell-flake
|
||||
# pinning), we must specify revisions for *all* inputs to ensure
|
||||
# reproducibility.
|
||||
inputs = {
|
||||
nixpkgs = { };
|
||||
flake-parts = { };
|
||||
haskell-flake = { };
|
||||
|
||||
haskell-multi-nix.url = "github:srid/haskell-multi-nix/d6ac6ccab559f886d1fc7da8cab44b99cb0c2c3d";
|
||||
haskell-multi-nix.inputs.haskell-flake.follows = "haskell-flake";
|
||||
haskell-multi-nix.inputs.nixpkgs.follows = "nixpkgs";
|
||||
haskell-multi-nix.inputs.flake-parts.follows = "flake-parts";
|
||||
};
|
||||
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
systems = nixpkgs.lib.systems.flakeExposed;
|
||||
imports = [
|
||||
inputs.haskell-flake.flakeModule
|
||||
];
|
||||
perSystem = { self', pkgs, ... }: {
|
||||
haskellProjects.default = {
|
||||
otherOverlays = [
|
||||
(self: super: {
|
||||
foo = super.callCabal2nix "foo" "${inputs.haskell-multi-nix}/foo" { };
|
||||
})
|
||||
];
|
||||
};
|
||||
packages.default = self'.packages.haskell-flake-test;
|
||||
};
|
||||
};
|
||||
}
|
19
test/otherOverlays/haskell-flake-test.cabal
Normal file
19
test/otherOverlays/haskell-flake-test.cabal
Normal file
@ -0,0 +1,19 @@
|
||||
cabal-version: 3.0
|
||||
name: haskell-flake-test
|
||||
version: 0.1.0.0
|
||||
license: NONE
|
||||
author: Joe
|
||||
maintainer: joe@example.com
|
||||
build-type: Simple
|
||||
|
||||
common warnings
|
||||
ghc-options: -Wall
|
||||
|
||||
executable haskell-flake-test
|
||||
import: warnings
|
||||
main-is: Main.hs
|
||||
build-depends:
|
||||
base,
|
||||
foo
|
||||
hs-source-dirs: src
|
||||
default-language: Haskell2010
|
7
test/otherOverlays/src/Main.hs
Normal file
7
test/otherOverlays/src/Main.hs
Normal file
@ -0,0 +1,7 @@
|
||||
module Main where
|
||||
|
||||
import Foo
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
fooFunc
|
Loading…
Reference in New Issue
Block a user