Compare commits

..
13 Commits
+23 -2
View File
@@ -15,7 +15,7 @@
mkSymlinkActivationScript = {target, source}: ''
if [ -e ${source} ]; then
if [ -e ${target} ]; then
if [ -L ${target} ] || [ -e ${target} ]; then
rm -rf ${target}
fi
ln -s ${source} ${target}
@@ -51,11 +51,32 @@
flake.homeModules.${moduleName} = func;
};
mkStandardFeature = {
flakeModule = moduleName: optionName: optionString: (mkMirroredModulesFlakeModule "${moduleName}Options" ({ lib, ... }: {
options = setAttrByStrPath optionName (lib.mkEnableOption optionString);
}));
nixosModule = { config, optionName }: systemConfig: {
config = lib.mkIf (attrByStrPath optionName config) (mkIfElse (config.features.nixos.home-manager.enable) {
home-manager.users.${config.info.userName} = setAttrByStrPath optionName (lib.mkDefault true);
} systemConfig);
};
homeModule = { config, optionName }: homeConfig: {
config = lib.mkIf (attrByStrPath optionName config) homeConfig;
};
};
mkRedundantOptionDescription = name: value: "The functionality of this option completely depends on `${name}` being `${value}`, and will not be evaluated otherwise.";
mkRedundantOption = name: value: attrs: lib.mkOption {
inherit (attrs) type default;
description = "${attrs.description}\n\n<div class=admonition-warning><p class=admonition-title>::before\nRedundant</p><p>${mkRedundantOptionDescription name value}</p></div>";
description = ''
${attrs.description}
${mkRedundantOptionDescription name value}
'';
};
};
}