mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-17 07:13:23 +01:00
ef176dcf7e
conversions were done using https://github.com/pennae/nix-doc-munge using (probably) rev f34e145 running nix-doc-munge nixos/**/*.nix nix-doc-munge --import nixos/**/*.nix the tool ensures that only changes that could affect the generated manual *but don't* are committed, other changes require manual review and are discarded.
65 lines
1.7 KiB
Nix
65 lines
1.7 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 = lib.mdDoc "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 = lib.mdDoc ''
|
|
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\"";
|
|
};
|
|
};
|
|
};
|
|
}
|