1 { pkgs, lib, config, ... }:
7 cfg = config.services.ihaskell;
8 ihaskell = pkgs.ihaskell.override {
9 packages = cfg.extraPackages;
20 description = lib.mdDoc "Autostart an IHaskell notebook service.";
23 extraPackages = mkOption {
24 type = types.functionTo (types.listOf types.package);
25 default = haskellPackages: [];
26 defaultText = literalExpression "haskellPackages: []";
27 example = literalExpression ''
33 description = lib.mdDoc ''
34 Extra packages available to ghc when running ihaskell. The
35 value must be a function which receives the attrset defined
36 in {var}`haskellPackages` as the sole argument.
42 config = mkIf cfg.enable {
44 users.users.ihaskell = {
45 group = config.users.groups.ihaskell.name;
46 description = "IHaskell user";
47 home = "/var/lib/ihaskell";
49 uid = config.ids.uids.ihaskell;
52 users.groups.ihaskell.gid = config.ids.gids.ihaskell;
54 systemd.services.ihaskell = {
55 description = "IHaskell notebook instance";
56 wantedBy = [ "multi-user.target" ];
57 after = [ "network.target" ];
59 User = config.users.users.ihaskell.name;
60 Group = config.users.groups.ihaskell.name;
61 ExecStart = "${pkgs.runtimeShell} -c \"cd $HOME;${ihaskell}/bin/ihaskell-notebook\"";