summaryrefslogtreecommitdiffstats
path: root/krebs/3modules/build.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2016-02-01 03:00:48 +0100
committertv <tv@krebsco.de>2016-02-01 03:32:30 +0100
commitc3c4aac670cf0ac26340061cef1527b3d7f64386 (patch)
tree6d504709b7f1fa2274d2867b4cdbad4966f0c622 /krebs/3modules/build.nix
parent1a4437cb26a29400d33486d6c8a220a9e88f4132 (diff)
make deploy2: deploy using nixos-rebuild switch
Diffstat (limited to 'krebs/3modules/build.nix')
-rw-r--r--krebs/3modules/build.nix109
1 files changed, 72 insertions, 37 deletions
diff --git a/krebs/3modules/build.nix b/krebs/3modules/build.nix
index 7f004cd8..0f8aec89 100644
--- a/krebs/3modules/build.nix
+++ b/krebs/3modules/build.nix
@@ -28,48 +28,83 @@ let
type = types.user;
};
- options.krebs.build.source.dir = mkOption {
- type = let
- default-host = config.krebs.current.host;
- in types.attrsOf (types.submodule ({ config, ... }: {
- options = {
- host = mkOption {
- type = types.host;
- default = default-host;
- };
- path = mkOption {
- type = types.str;
- };
- target-path = mkOption {
- type = types.str;
- default = "/root/${config._module.args.name}";
- };
- url = mkOption {
- type = types.str;
- default = "file://${config.host.name}${config.path}";
- };
- };
- }));
- default = {};
+ options.krebs.build.source-version = mkOption {
+ type = types.enum [ 1 2 ];
+ default = 1;
};
- options.krebs.build.source.git = mkOption {
- type = with types; attrsOf (submodule ({ config, ... }: {
- options = {
- url = mkOption {
- type = types.str; # TODO must be shell safe
- };
- rev = mkOption {
- type = types.str;
- };
- target-path = mkOption {
- type = types.str;
- default = "/root/${config._module.args.name}";
+ options.krebs.build.source = getAttr "v${toString config.krebs.build.source-version}" {
+ v1 = {
+ dir = mkOption {
+ type = let
+ default-host = config.krebs.current.host;
+ in types.attrsOf (types.submodule ({ config, ... }: {
+ options = {
+ host = mkOption {
+ type = types.host;
+ default = default-host;
+ };
+ path = mkOption {
+ type = types.str;
+ };
+ target-path = mkOption {
+ type = types.str;
+ default = "/root/${config._module.args.name}";
+ };
+ url = mkOption {
+ type = types.str;
+ default = "file://${config.host.name}${config.path}";
+ };
+ };
+ }));
+ default = {};
+ };
+
+ git = mkOption {
+ type = with types; attrsOf (submodule ({ config, ... }: {
+ options = {
+ url = mkOption {
+ type = types.str; # TODO must be shell safe
+ };
+ rev = mkOption {
+ type = types.str;
+ };
+ target-path = mkOption {
+ type = types.str;
+ default = "/root/${config._module.args.name}";
+ };
+ };
+ }));
+ default = {};
+ };
+ };
+
+ v2 = let
+ raw = types.either types.str types.path;
+ url = types.submodule {
+ options = {
+ url = mkOption {
+ type = types.str;
+ };
+ rev = mkOption {
+ type = types.str;
+ };
+ dev = mkOption {
+ type = types.str;
+ };
};
};
- }));
- default = {};
+ in mkOption {
+ type = types.attrsOf (types.either types.str url);
+ apply = let f = mapAttrs (_: value: {
+ string = value;
+ path = toString value;
+ set = f value;
+ }.${typeOf value}); in f;
+ default = {};
+ };
};
+
};
in out