rest of the split migration
This commit is contained in:
23
modules/dev/haskell/common.nix
Normal file
23
modules/dev/haskell/common.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{ pkgs }:
|
||||
let
|
||||
packages = builtins.attrValues {
|
||||
inherit (pkgs)
|
||||
haskell-language-server
|
||||
cabal-install
|
||||
hlint
|
||||
;
|
||||
inherit (pkgs.haskellPackages)
|
||||
hoogle
|
||||
;
|
||||
};
|
||||
in
|
||||
{
|
||||
inherit packages;
|
||||
devShell = pkgs.mkShell {
|
||||
inherit packages;
|
||||
name = "haskell-dev-shell";
|
||||
shellHook = ''
|
||||
echo "λ Haskell dev environment"
|
||||
'';
|
||||
};
|
||||
}
|
||||
39
modules/dev/haskell/home.nix
Normal file
39
modules/dev/haskell/home.nix
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
osConfig ? null,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hm = inputs.self.lib.hmModule {
|
||||
inherit
|
||||
config
|
||||
inputs
|
||||
osConfig
|
||||
;
|
||||
optionPath = [
|
||||
"dev"
|
||||
"haskell"
|
||||
];
|
||||
};
|
||||
cfg = config.my.dev.haskell;
|
||||
feature = import ./common.nix { inherit pkgs; };
|
||||
in
|
||||
{
|
||||
options.my.dev.haskell.enable = lib.mkEnableOption "Install Haskell tooling globally";
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
my.dev.haskell.enable = lib.mkDefault hm.enabledByDefault;
|
||||
}
|
||||
(lib.mkIf cfg.enable {
|
||||
home.packages = feature.packages;
|
||||
home.sessionVariables = {
|
||||
CABAL_DIR = "${config.xdg.cacheHome}/cabal";
|
||||
STACK_ROOT = "${config.xdg.dataHome}/stack";
|
||||
GHCUP_USE_XDG_DIRS = "true";
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
27
modules/dev/haskell/nixos.nix
Normal file
27
modules/dev/haskell/nixos.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
feature = import ./common.nix { inherit pkgs; };
|
||||
in
|
||||
{
|
||||
options = {
|
||||
my.dev.haskell = {
|
||||
enable = lib.mkEnableOption "Install Haskell tooling globally";
|
||||
users = lib.mkOption {
|
||||
type = inputs.self.lib.usersOptionType lib;
|
||||
default = config.my.toggleUsers.dev;
|
||||
description = "Users to install Haskell packages for";
|
||||
};
|
||||
};
|
||||
devShells.haskell = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = feature.devShell;
|
||||
description = "Haskell development shell";
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user