3
0
Fork 0
forked from mirrors/nixpkgs

nixos: add ihaskell service

This commit is contained in:
Edward Tjörnhammar 2015-04-11 00:09:31 +02:00
parent f13d9f28e8
commit 7d0ddbd154
3 changed files with 80 additions and 0 deletions

View file

@ -214,6 +214,7 @@
ripple-data-api = 186;
mediatomb = 187;
rdnssd = 188;
ihaskell = 189;
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
@ -405,6 +406,7 @@
#ripple-data-api = 186; #unused
mediatomb = 187;
#rdnssd = 188; # unused
ihaskell = 189;
# When adding a gid, make sure it doesn't match an existing
# uid. Users and groups with the same name should have equal

View file

@ -193,6 +193,7 @@
./services/misc/gitlab.nix
./services/misc/gitolite.nix
./services/misc/gpsd.nix
./services/misc/ihaskell.nix
./services/misc/mediatomb.nix
./services/misc/mesos-master.nix
./services/misc/mesos-slave.nix

View file

@ -0,0 +1,77 @@
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.services.ihaskell;
ihaskell = pkgs.ihaskell.override {
inherit (cfg.haskellPackages) ihaskell ghcWithPackages;
packages = self: cfg.extraPackages self;
};
in
{
options = {
services.ihaskell = {
enable = mkOption {
default = false;
example = true;
description = "Autostart an IHaskell notebook service.";
};
haskellPackages = mkOption {
default = pkgs.haskellngPackages;
defaultText = "pkgs.haskellngPackages";
example = literalExample "pkgs.haskell-ng.packages.ghc784";
description = ''
haskellPackages used to build IHaskell and other packages.
This can be used to change the GHC version used to build
IHaskell and the packages listed in
<varname>extraPackages</varname>.
'';
};
extraPackages = mkOption {
default = self: [];
example = literalExample ''
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 <varname>haskellPackages</varname> as the sole argument.
'';
};
};
};
config = mkIf cfg.enable {
users.extraUsers.ihaskell = {
group = config.users.extraGroups.ihaskell.name;
description = "IHaskell user";
home = "/var/lib/ihaskell";
createHome = true;
uid = config.ids.uids.ihaskell;
};
users.extraGroups.ihaskell.gid = config.ids.gids.ihaskell;
systemd.services.ihaskell = {
description = "IHaskell notebook instance";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
User = config.users.extraUsers.ihaskell.name;
Group = config.users.extraUsers.ihaskell.name;
Restart = "always";
ExecStart = "${ihaskell}/bin/IHaskell notebook";
};
};
};
}