From 59f97876e31e52156ac933edd9a4f2d41312502c Mon Sep 17 00:00:00 2001 From: Serhii Khoma Date: Wed, 13 Feb 2019 11:04:17 +0200 Subject: [PATCH] feat: custom nix store --- src/nix/docker-compose-module.nix | 3 ++- src/nix/eval-composition.nix | 3 ++- src/nix/service-host-store.nix | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/nix/docker-compose-module.nix b/src/nix/docker-compose-module.nix index 159ff26..c76e36f 100644 --- a/src/nix/docker-compose-module.nix +++ b/src/nix/docker-compose-module.nix @@ -9,7 +9,7 @@ - docker-compose.services */ -{ pkgs, uid, lib, config, ... }: +{ pkgs, uid, lib, config, customNixRootPath, ... }: let evalService = name: modules: @@ -30,6 +30,7 @@ let key = ./docker-compose-module.nix; config._module.args.pkgs = lib.mkForce pkgs; config._module.args.uid = uid; + config._module.args.customNixRootPath = customNixRootPath; }; in diff --git a/src/nix/eval-composition.nix b/src/nix/eval-composition.nix index c6cf620..d8bb6f2 100644 --- a/src/nix/eval-composition.nix +++ b/src/nix/eval-composition.nix @@ -1,4 +1,4 @@ -{ modules ? [], uid ? 0, pkgs }: +{ modules ? [], uid ? 0, pkgs, customNixRootPath ? "", }: let _pkgs = pkgs; in @@ -26,6 +26,7 @@ let key = ./eval-composition.nix; config._module.args.pkgs = lib.mkIf (pkgs != null) (lib.mkForce pkgs); config._module.args.uid = uid; + config._module.args.customNixRootPath = customNixRootPath; }; in diff --git a/src/nix/service-host-store.nix b/src/nix/service-host-store.nix index e650d78..5a06bdb 100644 --- a/src/nix/service-host-store.nix +++ b/src/nix/service-host-store.nix @@ -4,7 +4,8 @@ when the service.useHostStore option is set to true. */ -{ lib, config, pkgs, ... }: +{ lib, config, pkgs, customNixRootPath, ... }: + let inherit (lib) mkOption types mkIf; in @@ -20,8 +21,8 @@ in service.image = "arion-base"; service.build.context = "${../arion-image}"; service.volumes = [ - "/nix/store:/nix/store" - "${pkgs.buildEnv { name = "container-system-env"; paths = [ pkgs.bashInteractive pkgs.coreutils ]; }}:/run/system" + "${customNixRootPath}/nix/store:/nix/store" + "${customNixRootPath}${pkgs.buildEnv { name = "container-system-env"; paths = [ pkgs.bashInteractive pkgs.coreutils ]; }}:/run/system" ]; }; }