2019-01-20 12:22:28 +01:00
|
|
|
/*
|
|
|
|
|
|
|
|
This service-level bind mounts the host store into the container
|
|
|
|
when the service.useHostStore option is set to true.
|
|
|
|
|
|
|
|
*/
|
2019-02-13 18:29:54 +07:00
|
|
|
{ lib, config, pkgs, ... }:
|
2019-02-13 11:04:17 +02:00
|
|
|
|
2018-12-17 19:08:38 +01:00
|
|
|
let
|
|
|
|
inherit (lib) mkOption types mkIf;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
service.useHostStore = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Bind mounts the host store if enabled, avoiding copying.";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
config = mkIf config.service.useHostStore {
|
|
|
|
service.image = "arion-base";
|
2019-02-13 17:33:19 +07:00
|
|
|
service.build.context = "${../../../arion-image}";
|
2018-12-17 19:08:38 +01:00
|
|
|
service.volumes = [
|
2019-02-13 18:29:54 +07:00
|
|
|
"${config.host.nixStorePrefix}/nix/store:/nix/store"
|
|
|
|
"${config.host.nixStorePrefix}${pkgs.buildEnv { name = "container-system-env"; paths = [ pkgs.bashInteractive pkgs.coreutils ]; }}:/run/system"
|
2018-12-17 19:08:38 +01:00
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|