File tree Expand file tree Collapse file tree 2 files changed +29
-24
lines changed Expand file tree Collapse file tree 2 files changed +29
-24
lines changed Original file line number Diff line number Diff line change 343
343
projectOverlays = import ./project-overlays.nix {
344
344
inherit lib haskellLib ;
345
345
} ;
346
-
346
+
347
347
# Use by `prefixFlake` to add a prefix to every attribute
348
348
prefixAttrs = prefix : x :
349
349
__listToAttrs ( map ( n :{
@@ -540,4 +540,28 @@ in {
540
540
devShells
541
541
devShell ; # TODO remove devShell once everyone has nix that supports `devShells.default`
542
542
} ;
543
+
544
+ # Adapt a standard project shell (`project.shell` or `haskell-nix.shellFor`)
545
+ # into a devshell module (https://github.com/numtide/devshell)
546
+ # that should provide the same environnement.
547
+ devshellFor = shell : {
548
+ packages = lib . filter lib . isDerivation ( shell . nativeBuildInputs
549
+ # devshell does not use pkgs.mkShell / pkgs.stdenv.mkDerivation,
550
+ # so we need to explicit required dependencies which
551
+ # are provided implicitely by stdenv when using the normal shell:
552
+ ++ shell . stdenv . defaultNativeBuildInputs )
553
+ ++ [ shell . stdenv . cc . bintools ] ;
554
+ # We need to expose all the necessary env variables:
555
+ env = [
556
+ {
557
+ name = "PKG_CONFIG_PATH" ;
558
+ value = lib . makeSearchPath "lib/pkgconfig" shell . buildInputs ;
559
+ }
560
+ ] ++ lib . mapAttrsToList lib . nameValuePair ( {
561
+ inherit ( shell ) NIX_GHC_LIBDIR ;
562
+ # CABAL_CONFIG is only set if the shell was built with exactDeps=true
563
+ } // lib . optionalAttrs ( final . shell ? CABAL_CONFIG ) {
564
+ inherit ( shell ) CABAL_CONFIG ;
565
+ } ) ;
566
+ } ;
543
567
}
Original file line number Diff line number Diff line change 2
2
lib
3
3
, haskellLib
4
4
} : {
5
- # Provide a devshell profile (https://github.com/numtide/devshell),
6
- # adapted from the project normal shell .
5
+
6
+ # TODO: remove by end of 2022 .
7
7
devshell = final : prev : {
8
- devshell = let
9
- in {
10
- packages = lib . filter lib . isDerivation ( final . shell . nativeBuildInputs
11
- # devshell does not use pkgs.mkShell / pkgs.stdenv.mkDerivation,
12
- # so we need to explicit required dependencies which
13
- # are provided implicitely by stdenv when using the normal shell:
14
- ++ final . shell . stdenv . defaultNativeBuildInputs )
15
- ++ lib . optional final . shell . stdenv . targetPlatform . isGnu final . pkgs . buildPackages . binutils ;
16
- # We need to expose all the necessary env variables:
17
- env = [
18
- {
19
- name = "PKG_CONFIG_PATH" ;
20
- value = lib . makeSearchPath "lib/pkgconfig" final . shell . buildInputs ;
21
- }
22
- ] ++ lib . mapAttrsToList lib . nameValuePair ( {
23
- inherit ( final . shell ) NIX_GHC_LIBDIR ;
24
- # CABAL_CONFIG is only set if the shell was built with exactDeps=true
25
- } // lib . optionalAttrs ( final . shell ? CABAL_CONFIG ) {
26
- inherit ( final . shell ) CABAL_CONFIG ;
27
- } ) ;
28
- } ;
8
+ devshell = builtins . trace "WARNING: `projectOverlays.devshell` is deprecated in favor of `haskellLib.devshellFor`"
9
+ ( haskellLib . devshellFor final . shell ) ;
29
10
} ;
30
11
31
12
# Provides easily accessible attrset for each type of
You can’t perform that action at this time.
0 commit comments