create shared niri config, refactor generic feature modules

This commit is contained in:
greyweather committed 2026-09-06 01:59:38 +01:00
1 parent 257654332d
commit e1a08112a7
23 files changed
+353 -410

No files matched your search

@@ -1,9 +1,5 @@
{ inputs, self, lib, ... }: let
featureOptionName = "features.applications.cli.color-converter.enable";
moduleArgs = config: {
inherit config;
optionName = featureOptionName;
};
optionName = "features.applications.cli.color-converter.enable";
color-converter-package = { lib, pkgs }: pkgs.python3Packages.buildPythonApplication rec {
pname = "color-converter";
@@ -35,16 +31,16 @@
};
};
in {
imports = [ (inputs.helpers.mkStandardFeature.flakeModule "global" featureOptionName (lib.mkEnableOption "`color-converter`")) ];
imports = [ (inputs.helpers.mkStandardFeature.flakeModule "global" optionName "`color-converter`") ];
flake.nixosModules.global = { pkgs, lib, config, ... }: {
imports = [ (inputs.helpers.mkStandardFeature.nixosModule (moduleArgs config) {
imports = [ (inputs.helpers.mkStandardFeature.nixosModule { inherit config optionName; } {
environment.systemPackages = [ (pkgs.callPackage color-converter-package {}) ];
}) ];
};
flake.homeModules.global = { pkgs, config, lib, ... }: {
imports = [ (inputs.helpers.mkStandardFeature.homeModule (moduleArgs config) {
imports = [ (inputs.helpers.mkStandardFeature.homeModule { inherit config optionName; } {
home.packages = [ (pkgs.callPackage color-converter-package {}) ];
}) ];
};
@@ -1,20 +1,18 @@
{ inputs, self, ... }: {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "globalOptions" ({ lib, ... }: {
options.features.applications.cli.fastfetch.enable = lib.mkEnableOption "`fastfetch`";
})) ];
{ inputs, self, ... }: let
optionName = "features.applications.cli.fastfetch.enable";
in {
imports = [ (inputs.helpers.mkStandardFeature.flakeModule "global" optionName "`fastfetch`") ];
flake.nixosModules.global = { pkgs, lib, config, ... }: {
config = lib.mkIf (config.features.applications.cli.fastfetch.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
home-manager.users.${config.info.userName}.features.applications.cli.fastfetch.enable = lib.mkDefault true;
} {
imports = [ (inputs.helpers.mkStandardFeature.nixosModule { inherit config optionName; } {
environment.systemPackages = [ pkgs.fastfetch ];
});
}) ];
};
flake.homeModules.global = { pkgs, lib, config, ... }: {
config = lib.mkIf (config.features.applications.cli.fastfetch.enable) ({
imports = [ (inputs.helpers.mkStandardFeature.homeModule { inherit config optionName; } {
programs.zsh.initContent = lib.mkOrder 1500 "fastfetch";
programs.fastfetch.enable = true;
});
}) ];
};
}