Skip to content

Commit

Permalink
minimize diff
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Feb 7, 2023
1 parent db192a0 commit e31967b
Showing 1 changed file with 68 additions and 69 deletions.
137 changes: 68 additions & 69 deletions flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -71,85 +71,84 @@ in
};
};
};
projectSubmodule = types.submoduleWith {
modules = lib.toList (args@{ name, config, lib, ... }: {
options = {
haskellPackages = mkOption {
type = types.attrsOf raw;
description = ''
Which Haskell package set / compiler to use.
submoduleWithImports = mod: types.submoduleWith { modules = lib.toList mod; };
projectSubmodule = submoduleWithImports (args@{ name, config, lib, ... }: {
options = {
haskellPackages = mkOption {
type = types.attrsOf raw;
description = ''
Which Haskell package set / compiler to use.
You can effectively select the GHC version here.
You can effectively select the GHC version here.
To get the appropriate value, run:
To get the appropriate value, run:
nix-env -f "<nixpkgs>" -qaP -A haskell.compiler
nix-env -f "<nixpkgs>" -qaP -A haskell.compiler
And then, use that in `pkgs.haskell.packages.ghc<version>`
'';
example = "pkgs.haskell.packages.ghc924";
default = pkgs.haskellPackages;
defaultText = lib.literalExpression "pkgs.haskellPackages";
};
source-overrides = mkOption {
type = types.attrsOf types.path;
description = ''Package overrides given new source path'';
default = { };
};
overrides =
let
haskellOverlay = types.mkOptionType {
name = "haskellOverlay";
description = "Haskell overlay function";
descriptionClass = "noun";
check = lib.isFunction;
merge = loc: defs:
# TODO: What to do with loc?
lib.composeManyExtensions (map (x: x.value) defs);
};
in
mkOption {
type = haskellOverlay;
description = ''
Overrides for the Cabal project
For handy functions, see <https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib/compose.nix>
'';
default = self: super: { };
defaultText = lib.literalExpression "self: super: { }";
And then, use that in `pkgs.haskell.packages.ghc<version>`
'';
example = "pkgs.haskell.packages.ghc924";
default = pkgs.haskellPackages;
defaultText = lib.literalExpression "pkgs.haskellPackages";
};
source-overrides = mkOption {
type = types.attrsOf types.path;
description = ''Package overrides given new source path'';
default = { };
};
overrides =
let
haskellOverlay = types.mkOptionType {
name = "haskellOverlay";
description = "Haskell overlay function";
descriptionClass = "noun";
check = lib.isFunction;
merge = loc: defs:
# TODO: What to do with loc?
lib.composeManyExtensions (map (x: x.value) defs);
};
packages = mkOption {
type = types.lazyAttrsOf packageSubmodule;
description = ''
Attrset of local packages in the project repository.
Autodetected by default by looking for `.cabal` files in sub-directories.
'';
default =
lib.mapAttrs
(_: value: { root = value; })
(lib.filesystem.haskellPathsInDir self);
defaultText = lib.literalMD "autodiscovered by reading `self` files.";
};
devShell = mkOption {
type = devShellSubmodule;
in
mkOption {
type = haskellOverlay;
description = ''
Development shell configuration
Overrides for the Cabal project
For handy functions, see <https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib/compose.nix>
'';
default = { };
default = self: super: { };
defaultText = lib.literalExpression "self: super: { }";
};
outputs = mkOption {
type = types.attrsOf types.raw;
description = ''
The flake outputs generated for this project.
packages = mkOption {
type = types.lazyAttrsOf packageSubmodule;
description = ''
Attrset of local packages in the project repository.
This is an internal option, not meant to be set by the user.
'';
};
Autodetected by default by looking for `.cabal` files in sub-directories.
'';
default =
lib.mapAttrs
(_: value: { root = value; })
(lib.filesystem.haskellPathsInDir self);
defaultText = lib.literalMD "autodiscovered by reading `self` files.";
};
config = import ./haskell-project.nix (args // { inherit self pkgs; });
});
};
devShell = mkOption {
type = devShellSubmodule;
description = ''
Development shell configuration
'';
default = { };
};
outputs = mkOption {
type = types.attrsOf types.raw;
description = ''
The flake outputs generated for this project.
This is an internal option, not meant to be set by the user.
'';
};
};
config = import ./haskell-project.nix (args // { inherit self pkgs; });
});
in
{
options.haskellProjects = mkOption {
Expand Down

0 comments on commit e31967b

Please sign in to comment.