nixos/mathics: New service and test
This commit is contained in:
parent
92a0140ff8
commit
fe8498f609
@ -239,6 +239,7 @@
|
||||
bepasty = 215;
|
||||
pumpio = 216;
|
||||
nm-openvpn = 217;
|
||||
mathics = 218;
|
||||
|
||||
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
|
||||
|
||||
@ -455,6 +456,7 @@
|
||||
bepasty = 215;
|
||||
pumpio = 216;
|
||||
nm-openvpn = 217;
|
||||
mathics = 218;
|
||||
|
||||
# When adding a gid, make sure it doesn't match an existing
|
||||
# uid. Users and groups with the same name should have equal
|
||||
|
@ -209,6 +209,7 @@
|
||||
./services/misc/gitolite.nix
|
||||
./services/misc/gpsd.nix
|
||||
./services/misc/ihaskell.nix
|
||||
./services/misc/mathics.nix
|
||||
./services/misc/mbpfan.nix
|
||||
./services/misc/mediatomb.nix
|
||||
./services/misc/mesos-master.nix
|
||||
|
54
nixos/modules/services/misc/mathics.nix
Normal file
54
nixos/modules/services/misc/mathics.nix
Normal file
@ -0,0 +1,54 @@
|
||||
{ pkgs, lib, config, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.mathics;
|
||||
|
||||
in {
|
||||
options = {
|
||||
services.mathics = {
|
||||
enable = mkEnableOption "Mathics notebook service";
|
||||
|
||||
external = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Listen on all interfaces, rather than just localhost?";
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.int;
|
||||
default = 8000;
|
||||
description = "TCP port to listen on.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
users.extraUsers.mathics = {
|
||||
group = config.users.extraGroups.mathics.name;
|
||||
description = "Mathics user";
|
||||
home = "/var/lib/mathics";
|
||||
createHome = true;
|
||||
uid = config.ids.uids.mathics;
|
||||
};
|
||||
|
||||
users.extraGroups.mathics.gid = config.ids.gids.mathics;
|
||||
|
||||
systemd.services.mathics = {
|
||||
description = "Mathics notebook server";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
serviceConfig = {
|
||||
User = config.users.extraUsers.mathics.name;
|
||||
Group = config.users.extraGroups.mathics.name;
|
||||
ExecStart = concatStringsSep " " [
|
||||
"${pkgs.mathics}/bin/mathicsserver"
|
||||
"--port" (toString cfg.port)
|
||||
(if cfg.external then "--external" else "")
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -252,6 +252,7 @@ in rec {
|
||||
#tests.lightdm = callTest tests/lightdm.nix {};
|
||||
tests.login = callTest tests/login.nix {};
|
||||
#tests.logstash = callTest tests/logstash.nix {};
|
||||
tests.mathics = callTest tests/mathics.nix {};
|
||||
tests.misc = callTest tests/misc.nix {};
|
||||
tests.mumble = callTest tests/mumble.nix {};
|
||||
tests.munin = callTest tests/munin.nix {};
|
||||
|
20
nixos/tests/mathics.nix
Normal file
20
nixos/tests/mathics.nix
Normal file
@ -0,0 +1,20 @@
|
||||
import ./make-test.nix ({ pkgs, ... }: {
|
||||
name = "mathics";
|
||||
meta = with pkgs.stdenv.lib.maintainers; {
|
||||
maintainers = [ benley ];
|
||||
};
|
||||
|
||||
nodes = {
|
||||
machine = { config, pkgs, ... }: {
|
||||
services.mathics.enable = true;
|
||||
services.mathics.port = 8888;
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
startAll;
|
||||
$machine->waitForUnit("mathics.service");
|
||||
$machine->waitForOpenPort(8888);
|
||||
$machine->succeed("curl http://localhost:8888/");
|
||||
'';
|
||||
})
|
Loading…
Reference in New Issue
Block a user