nixos/mathics: New service and test

authored by Benjamin Staffin and committed by Benjamin Staffin fe8498f6 92a0140f

+78
+2
nixos/modules/misc/ids.nix
··· 239 bepasty = 215; 240 pumpio = 216; 241 nm-openvpn = 217; 242 243 # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399! 244 ··· 455 bepasty = 215; 456 pumpio = 216; 457 nm-openvpn = 217; 458 459 # When adding a gid, make sure it doesn't match an existing 460 # uid. Users and groups with the same name should have equal
··· 239 bepasty = 215; 240 pumpio = 216; 241 nm-openvpn = 217; 242 + mathics = 218; 243 244 # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399! 245 ··· 456 bepasty = 215; 457 pumpio = 216; 458 nm-openvpn = 217; 459 + mathics = 218; 460 461 # When adding a gid, make sure it doesn't match an existing 462 # uid. Users and groups with the same name should have equal
+1
nixos/modules/module-list.nix
··· 209 ./services/misc/gitolite.nix 210 ./services/misc/gpsd.nix 211 ./services/misc/ihaskell.nix 212 ./services/misc/mbpfan.nix 213 ./services/misc/mediatomb.nix 214 ./services/misc/mesos-master.nix
··· 209 ./services/misc/gitolite.nix 210 ./services/misc/gpsd.nix 211 ./services/misc/ihaskell.nix 212 + ./services/misc/mathics.nix 213 ./services/misc/mbpfan.nix 214 ./services/misc/mediatomb.nix 215 ./services/misc/mesos-master.nix
+54
nixos/modules/services/misc/mathics.nix
···
··· 1 + { pkgs, lib, config, ... }: 2 + 3 + with lib; 4 + 5 + let 6 + cfg = config.services.mathics; 7 + 8 + in { 9 + options = { 10 + services.mathics = { 11 + enable = mkEnableOption "Mathics notebook service"; 12 + 13 + external = mkOption { 14 + type = types.bool; 15 + default = false; 16 + description = "Listen on all interfaces, rather than just localhost?"; 17 + }; 18 + 19 + port = mkOption { 20 + type = types.int; 21 + default = 8000; 22 + description = "TCP port to listen on."; 23 + }; 24 + }; 25 + }; 26 + 27 + config = mkIf cfg.enable { 28 + 29 + users.extraUsers.mathics = { 30 + group = config.users.extraGroups.mathics.name; 31 + description = "Mathics user"; 32 + home = "/var/lib/mathics"; 33 + createHome = true; 34 + uid = config.ids.uids.mathics; 35 + }; 36 + 37 + users.extraGroups.mathics.gid = config.ids.gids.mathics; 38 + 39 + systemd.services.mathics = { 40 + description = "Mathics notebook server"; 41 + wantedBy = [ "multi-user.target" ]; 42 + after = [ "network.target" ]; 43 + serviceConfig = { 44 + User = config.users.extraUsers.mathics.name; 45 + Group = config.users.extraGroups.mathics.name; 46 + ExecStart = concatStringsSep " " [ 47 + "${pkgs.mathics}/bin/mathicsserver" 48 + "--port" (toString cfg.port) 49 + (if cfg.external then "--external" else "") 50 + ]; 51 + }; 52 + }; 53 + }; 54 + }
+1
nixos/release.nix
··· 252 #tests.lightdm = callTest tests/lightdm.nix {}; 253 tests.login = callTest tests/login.nix {}; 254 #tests.logstash = callTest tests/logstash.nix {}; 255 tests.misc = callTest tests/misc.nix {}; 256 tests.mumble = callTest tests/mumble.nix {}; 257 tests.munin = callTest tests/munin.nix {};
··· 252 #tests.lightdm = callTest tests/lightdm.nix {}; 253 tests.login = callTest tests/login.nix {}; 254 #tests.logstash = callTest tests/logstash.nix {}; 255 + tests.mathics = callTest tests/mathics.nix {}; 256 tests.misc = callTest tests/misc.nix {}; 257 tests.mumble = callTest tests/mumble.nix {}; 258 tests.munin = callTest tests/munin.nix {};
+20
nixos/tests/mathics.nix
···
··· 1 + import ./make-test.nix ({ pkgs, ... }: { 2 + name = "mathics"; 3 + meta = with pkgs.stdenv.lib.maintainers; { 4 + maintainers = [ benley ]; 5 + }; 6 + 7 + nodes = { 8 + machine = { config, pkgs, ... }: { 9 + services.mathics.enable = true; 10 + services.mathics.port = 8888; 11 + }; 12 + }; 13 + 14 + testScript = '' 15 + startAll; 16 + $machine->waitForUnit("mathics.service"); 17 + $machine->waitForOpenPort(8888); 18 + $machine->succeed("curl http://localhost:8888/"); 19 + ''; 20 + })