feat(modules): set default namespace from parent module namespace

This commit is contained in:
Jaka Hudoklin 2018-04-06 19:54:46 +02:00
parent db196666d4
commit df2f00a729
2 changed files with 7 additions and 2 deletions

View file

@ -18,6 +18,7 @@ let
inherit pkgs; inherit pkgs;
inherit (pkgs) lib; inherit (pkgs) lib;
}; };
module = null;
}; };
}; };

View file

@ -1,10 +1,11 @@
{ config, lib, pkgs, k8s, ... }: { config, lib, pkgs, k8s, module ? null, ... }:
with lib; with lib;
with import ./lib.nix { inherit pkgs lib; }; with import ./lib.nix { inherit pkgs lib; };
let let
globalConfig = config; globalConfig = config;
parentModule = module;
# A submodule (like typed attribute set). See NixOS manual. # A submodule (like typed attribute set). See NixOS manual.
submodule = opts: submodule = opts:
@ -138,7 +139,10 @@ in {
namespace = mkOption { namespace = mkOption {
description = "Namespace where to deploy module"; description = "Namespace where to deploy module";
type = types.str; type = types.str;
default = "default"; default =
if parentModule != null
then parentModule.namespace
else "default";
}; };
labels = mkOption { labels = mkOption {