[Nix-dev] Cannot override MemoryLimit and CPUShares in service?

Matthias Beyer mail at beyermatthias.de
Fri Feb 17 18:30:00 CET 2017


Hi,

I try to build a container for gitit, searx and hound (each service one) to play
around. I fail to override the memory limit and the cpu shares. Here is my
service configuration for hound, as an example:


    { port, MemoryHighMB, CPUShares, ... }:
    {
      autoStart = false;
      config = { config, pkgs, ... }: rec {
        nixpkgs.config.allowUnfree = false;

        services.hound = {
          enable = true;
          home =  "/var/lib/hound";
          config = ''
            {
              "max-concurrent-indexers" : 2,
              "dbpath" : "${services.hound.home}/data",
              "repos" : {
                "nixpkgs": { "url" : "https://www.github.com/NixOS/nixpkgs.git" },
                "imag": { "url" : "https://www.github.com/matthiasbeyer/imag.git" }
              }
            }
          '';
          listen = ":${toString port}";

          serviceConfig = {
            MemoryHigh = MemoryHighMB * 1024 * 1024;
            CPUShares  = CPUShares;
          };
        };
      };
    }

I import it like so into my system configuration:

  containers = {
    hound = import ./containers/hound.nix {
      port = 8082;
      MemoryHighMB = 512;
      CPUShares = 512;
    };
  };

And it fails with:

    error: The option `containers.gitit.services.gitit.serviceConfig' defined in
    `<unknown-file>' does not exist.

Can someone tell what's wrong here?

-- 
Mit freundlichen Grüßen,
Kind regards,
Matthias Beyer

Consider switching to free software.
It adds value to your life.
https://www.gnu.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20170217/1233d201/attachment.sig>


More information about the nix-dev mailing list