Skip to content

Commit

Permalink
fix: make nixos.hostDefaults.channelName required
Browse files Browse the repository at this point in the history
In several places `mkFlake` assumes an valid value is set, here.

fixes: #76
  • Loading branch information
blaggacao authored and Pacman99 committed Feb 23, 2022
1 parent 0a5325d commit a2411ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/mkFlake/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ lib.systemFlake (lib.mergeAny
};
};

profilesTests =
profilesTests =
# only for hosts that also are the same system as the current check attribute
if (hostConfigsOnThisSystem != [ ])
then lib.mapAttrs' createProfilesTestOp hostConfigsOnThisSystemWithSuites
Expand Down
19 changes: 13 additions & 6 deletions src/mkFlake/evalArgs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,21 @@ let
};
};

channelNameOpt = {
channelNameOpt = required: {
channelName = mkOption {
type = with types; nullOr channelType;
default = null;
description = ''
Channel this host should follow
'';
};
}
//
(
if required then {
type = with types; channelType;
} else {
type = with types; nullOr channelType;
default = null;
}
);
};

modulesOpt = {
Expand Down Expand Up @@ -286,13 +293,13 @@ let
hostType = with types; attrsOf (submoduleWith {
modules = [
# per-host modules not exported, no external modules
{ options = systemOpt // channelNameOpt // modulesOpt; }
{ options = systemOpt // (channelNameOpt false) // modulesOpt; }
];
});

hostDefaultsType = name: with types; submoduleWith {
modules = [
{ options = systemOpt // channelNameOpt // externalModulesOpt // (exportedModulesOpt name); }
{ options = systemOpt // (channelNameOpt true) // externalModulesOpt // (exportedModulesOpt name); }
];
};

Expand Down

0 comments on commit a2411ee

Please sign in to comment.