On 02/17/2017 06:30 PM, Matthias Beyer wrote:
> 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?

Two things, I think:

The container should have a 'config' attribute:

  containers.hound.config = import ...

And within the container config I think you must configure the systemd service directly (there is no 'serviceConfig' option for 'services.hound'):

  systemd.services.hound.serviceConfig = { ... }

I assume here that the 'services.hound' option generates a 'systemd.services.hound' config. I haven't checked though.


  / Rickard
_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to