mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 16:03:23 +00:00
6afb255d97
these changes were generated with nixq 0.0.2, by running nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix two mentions of the mdDoc function remain in nixos/, both of which are inside of comments. Since lib.mdDoc is already defined as just id, this commit is a no-op as far as Nix (and the built manual) is concerned.
66 lines
1.6 KiB
Nix
66 lines
1.6 KiB
Nix
{ pkgs, lib, config, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.services.ihaskell;
|
|
ihaskell = pkgs.ihaskell.override {
|
|
packages = cfg.extraPackages;
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
options = {
|
|
services.ihaskell = {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = "Autostart an IHaskell notebook service.";
|
|
};
|
|
|
|
extraPackages = mkOption {
|
|
type = types.functionTo (types.listOf types.package);
|
|
default = haskellPackages: [];
|
|
defaultText = literalExpression "haskellPackages: []";
|
|
example = literalExpression ''
|
|
haskellPackages: [
|
|
haskellPackages.wreq
|
|
haskellPackages.lens
|
|
]
|
|
'';
|
|
description = ''
|
|
Extra packages available to ghc when running ihaskell. The
|
|
value must be a function which receives the attrset defined
|
|
in {var}`haskellPackages` as the sole argument.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
users.users.ihaskell = {
|
|
group = config.users.groups.ihaskell.name;
|
|
description = "IHaskell user";
|
|
home = "/var/lib/ihaskell";
|
|
createHome = true;
|
|
uid = config.ids.uids.ihaskell;
|
|
};
|
|
|
|
users.groups.ihaskell.gid = config.ids.gids.ihaskell;
|
|
|
|
systemd.services.ihaskell = {
|
|
description = "IHaskell notebook instance";
|
|
wantedBy = [ "multi-user.target" ];
|
|
after = [ "network.target" ];
|
|
serviceConfig = {
|
|
User = config.users.users.ihaskell.name;
|
|
Group = config.users.groups.ihaskell.name;
|
|
ExecStart = "${pkgs.runtimeShell} -c \"cd $HOME;${ihaskell}/bin/ihaskell-notebook\"";
|
|
};
|
|
};
|
|
};
|
|
}
|