1 { pkgs, lib, config, ... }:
4 cfg = config.services.ihaskell;
5 ihaskell = pkgs.ihaskell.override {
6 packages = cfg.extraPackages;
14 enable = lib.mkOption {
15 type = lib.types.bool;
17 description = "Autostart an IHaskell notebook service.";
20 extraPackages = lib.mkOption {
21 type = lib.types.functionTo (lib.types.listOf lib.types.package);
22 default = haskellPackages: [];
23 defaultText = lib.literalExpression "haskellPackages: []";
24 example = lib.literalExpression ''
31 Extra packages available to ghc when running ihaskell. The
32 value must be a function which receives the attrset defined
33 in {var}`haskellPackages` as the sole argument.
39 config = lib.mkIf cfg.enable {
41 users.users.ihaskell = {
42 group = config.users.groups.ihaskell.name;
43 description = "IHaskell user";
44 home = "/var/lib/ihaskell";
46 uid = config.ids.uids.ihaskell;
49 users.groups.ihaskell.gid = config.ids.gids.ihaskell;
51 systemd.services.ihaskell = {
52 description = "IHaskell notebook instance";
53 wantedBy = [ "multi-user.target" ];
54 after = [ "network.target" ];
56 User = config.users.users.ihaskell.name;
57 Group = config.users.groups.ihaskell.name;
58 ExecStart = "${pkgs.runtimeShell} -c \"cd $HOME;${ihaskell}/bin/ihaskell-notebook\"";