misc improvements to modularity
This commit is contained in:
29 files changed
+111
-108
No files matched your search
@@ -1,4 +1,10 @@
|
||||
{ inputs, self, ... }: let
|
||||
{ inputs, self, lib, ... }: let
|
||||
featureOptionName = "features.applications.cli.color-converter.enable";
|
||||
moduleArgs = config: {
|
||||
inherit config;
|
||||
optionName = featureOptionName;
|
||||
};
|
||||
|
||||
color-converter-package = { lib, pkgs }: pkgs.python3Packages.buildPythonApplication rec {
|
||||
pname = "color-converter";
|
||||
version = "1.0.0";
|
||||
@@ -29,21 +35,17 @@
|
||||
};
|
||||
};
|
||||
in {
|
||||
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "globalOptions" ({ lib, ... }: {
|
||||
options.features.applications.cli.color-converter.enable = lib.mkEnableOption "`color-converter`";
|
||||
})) ];
|
||||
imports = [ (inputs.helpers.mkStandardFeature.flakeModule "global" featureOptionName (lib.mkEnableOption "`color-converter`")) ];
|
||||
|
||||
flake.nixosModules.global = { pkgs, lib, config, ... }: {
|
||||
config = lib.mkIf (config.features.applications.cli.color-converter.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.grey.features.applications.cli.color-converter.enable = lib.mkDefault true;
|
||||
} {
|
||||
imports = [ (inputs.helpers.mkStandardFeature.nixosModule (moduleArgs config) {
|
||||
environment.systemPackages = [ (pkgs.callPackage color-converter-package {}) ];
|
||||
});
|
||||
}) ];
|
||||
};
|
||||
|
||||
flake.homeModules.global = { pkgs, config, lib, ... }: {
|
||||
config = lib.mkIf (config.features.applications.cli.color-converter.enable) {
|
||||
imports = [ (inputs.helpers.mkStandardFeature.homeModule (moduleArgs config) {
|
||||
home.packages = [ (pkgs.callPackage color-converter-package {}) ];
|
||||
};
|
||||
}) ];
|
||||
};
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
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.grey.features.applications.cli.fastfetch.enable = lib.mkDefault true;
|
||||
home-manager.users.${config.info.userName}.features.applications.cli.fastfetch.enable = lib.mkDefault true;
|
||||
} {
|
||||
environment.systemPackages = [ pkgs.fastfetch ];
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ in {
|
||||
config = lib.mkIf (config.features.applications.cli.nh.enable) {
|
||||
programs.nh = mkNhAttrs config;
|
||||
|
||||
home-manager.users.grey = lib.mkIf (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.${config.info.userName} = lib.mkIf (config.features.nixos.home-manager.enable) {
|
||||
features.applications.cli.nh = lib.mkDefault config.features.applications.cli.nh;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -10,20 +10,12 @@ in {
|
||||
})) ];
|
||||
|
||||
flake.nixosModules.graphicsOption = { lib, ... }: {
|
||||
options.features.applications.gui.equibop.autostart = let
|
||||
attrs = autostartOptionAttrs { inherit lib; };
|
||||
in lib.mkOption {
|
||||
inherit (attrs) type default;
|
||||
description = ''
|
||||
${attrs.description}
|
||||
${inputs.helpers.mkRedundantOptionDescription "features.nixos.home-manager.enable" "true"}
|
||||
'';
|
||||
};
|
||||
options.features.applications.gui.equibop.autostart = inputs.helpers.mkRedundantOption "features.nixos.home-manager.enable" "true" (autostartOptionAttrs { inherit lib; });
|
||||
};
|
||||
|
||||
flake.nixosModules.graphics = { pkgs, lib, config, ...}: {
|
||||
config = inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.grey.features.applications.gui.equibop = lib.mkDefault config.features.applications.gui.equibop;
|
||||
home-manager.users.${config.info.userName}.features.applications.gui.equibop = lib.mkDefault config.features.applications.gui.equibop;
|
||||
} {
|
||||
environment.systemPackages = [ pkgs.equibop ];
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
flake.nixosModules.graphics = { pkgs, lib, config, ... }: {
|
||||
config = lib.mkIf (config.features.applications.gui.floorp.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.grey.features.applications.gui.floorp.enable = lib.mkDefault true;
|
||||
home-manager.users.${config.info.userName}.features.applications.gui.floorp.enable = lib.mkDefault true;
|
||||
} {
|
||||
environment.systemPackages = [ pkgs.floorp-bin ];
|
||||
});
|
||||
|
||||
@@ -73,13 +73,13 @@ in {
|
||||
|
||||
flake.nixosModules.graphics = { pkgs, config, lib, ... }: {
|
||||
config = lib.mkIf (config.features.applications.gui.fluxer.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.grey.features.applications.gui.fluxer.enable = lib.mkDefault true;
|
||||
home-manager.users.${config.info.userName}.features.applications.gui.fluxer.enable = lib.mkDefault true;
|
||||
} {
|
||||
environment.systemPackages = [
|
||||
(pkgs.callPackage (fluxer-package) {})
|
||||
];
|
||||
}) // lib.mkIf (config.features.applications.gui.fluxer-canary.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.grey.features.applications.gui.fluxer-canary.enable = lib.mkDefault true;
|
||||
home-manager.users.${config.info.userName}.features.applications.gui.fluxer-canary.enable = lib.mkDefault true;
|
||||
} {
|
||||
environment.systemPackages = [
|
||||
(pkgs.callPackage (fluxer-canary-package) {})
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
flake.nixosModules.graphics = { pkgs, config, lib, ... }: {
|
||||
config = let
|
||||
in lib.mkIf (config.features.applications.gui.kitty.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.grey.features.applications.gui.kitty.enable = lib.mkDefault true;
|
||||
home-manager.users.${config.info.userName}.features.applications.gui.kitty.enable = lib.mkDefault true;
|
||||
} {
|
||||
environment.systemPackages = [ pkgs.kitty ];
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
terminal = "kitty";
|
||||
};
|
||||
|
||||
home-manager.users.grey = lib.mkIf (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.${config.info.userName} = lib.mkIf (config.features.nixos.home-manager.enable) {
|
||||
features.applications.gui.nautilus.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
flake.nixosModules.graphics = { pkgs, config, lib, ... }: {
|
||||
config = lib.mkIf (config.features.applications.gui.remmina.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.grey.features.applications.gui.remmina.enable = lib.mkDefault true;
|
||||
home-manager.users.${config.info.userName}.features.applications.gui.remmina.enable = lib.mkDefault true;
|
||||
} {
|
||||
environment.systemPackages = with pkgs; [
|
||||
remmina
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ inputs, self, ... }: let
|
||||
{ inputs, self, lib, ... }: let
|
||||
spicetifyEnableOptionAttrs = { lib }: {
|
||||
type = lib.types.bool;
|
||||
description = "Whether to enable Spicetify, a modified version of Spotify that supports plugins and themes.";
|
||||
@@ -6,7 +6,7 @@
|
||||
};
|
||||
|
||||
spicetifyThemeOptionAttrs = { pkgs, lib }: {
|
||||
type = inputs.nixpkgs.lib.types.nullOr (inputs.nixpkgs.lib.types.enum (builtins.attrNames inputs.spicetify.legacyPackages.${pkgs.stdenv.hostPlatform.system}.themes));
|
||||
type = lib.types.nullOr (lib.types.enum (builtins.attrNames inputs.spicetify.legacyPackages.${pkgs.stdenv.hostPlatform.system}.themes));
|
||||
description = "This option is used to select a theme for Spicetify to use, from the list of available packages themes.";
|
||||
default = null;
|
||||
};
|
||||
@@ -15,7 +15,7 @@ in {
|
||||
options.features.applications.gui.spotify.enable = lib.mkEnableOption "Spotify";
|
||||
})) ];
|
||||
|
||||
flake.nixosModules.graphicsOptions = { lib, pkgs, ... }: {
|
||||
flake.nixosModules.graphicsOptions = { pkgs, lib, ... }: {
|
||||
options.features.applications.gui.spotify.spicetify = {
|
||||
enable = inputs.helpers.mkRedundantOption "features.nixos.home-manager.enable" "true" (spicetifyEnableOptionAttrs { inherit lib; });
|
||||
theme = inputs.helpers.mkRedundantOption "features.nixos.home-manager.enable" "true" (spicetifyThemeOptionAttrs { inherit pkgs lib; });
|
||||
@@ -26,7 +26,7 @@ in {
|
||||
spicePkgs = inputs.spicetify.legacyPackages.${pkgs.stdenv.hostPlatform.system};
|
||||
in {
|
||||
config = lib.mkIf (config.features.applications.gui.spotify.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.grey.features.applications.gui.spotify = {
|
||||
home-manager.users.${config.info.userName}.features.applications.gui.spotify = {
|
||||
enable = lib.mkDefault true;
|
||||
spicetify = lib.mkDefault config.features.applications.gui.spotify.spicetify;
|
||||
};
|
||||
@@ -35,7 +35,7 @@ in {
|
||||
});
|
||||
};
|
||||
|
||||
flake.homeModules.graphicsOptions = { lib, pkgs, ... }: {
|
||||
flake.homeModules.graphicsOptions = { pkgs, lib, ... }: {
|
||||
options.features.applications.gui.spotify.spicetify = {
|
||||
enable = lib.mkOption (spicetifyEnableOptionAttrs { inherit lib; });
|
||||
theme = lib.mkOption (spicetifyThemeOptionAttrs { inherit pkgs lib; });
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
flake.nixosModules.graphics = { config, pkgs, lib, ... }: {
|
||||
config = lib.mkIf (config.features.applications.gui.vscode.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.grey.features.applications.gui.vscode.enable = lib.mkDefault true;
|
||||
home-manager.users.${config.info.userName}.features.applications.gui.vscode.enable = lib.mkDefault true;
|
||||
} {
|
||||
environment.systemPackages = [ pkgs.vscode ];
|
||||
});
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
flake.nixosModules.gaming = { pkgs, config, lib, ... }: {
|
||||
config = lib.mkIf (config.features.hardware.steam-controller.enable) {
|
||||
home-manager.users.grey = lib.mkIf (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.${config.info.userName} = lib.mkIf (config.features.nixos.home-manager.enable) {
|
||||
features.hardware.steam-controller.enable = lib.mkDefault true;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
inherit inputs;
|
||||
};
|
||||
|
||||
users.grey = self.homeModules.${config.info.hostName};
|
||||
users.${config.info.userName} = self.homeModules."${config.info.userName}@${config.info.hostName}";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
stylix.image = builtins.path { path = "${self}/modules/hosts/${config.info.hostName}/wallpaper.jpg"; };
|
||||
stylix.polarity = "dark";
|
||||
|
||||
home-manager.users.grey = lib.mkIf (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.${config.info.userName} = lib.mkIf (config.features.nixos.home-manager.enable) {
|
||||
features.nixos.stylix.enable = lib.mkDefault config.features.nixos.stylix.enable;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -11,6 +11,6 @@
|
||||
programs.${config.features.shells.defaultShell}.enable = true;
|
||||
|
||||
users.defaultUserShell = pkgs.${config.features.shells.defaultShell};
|
||||
users.users."grey".shell = pkgs.${config.features.shells.defaultShell};
|
||||
users.users."${config.info.userName}".shell = pkgs.${config.features.shells.defaultShell};
|
||||
};
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
config = lib.mkIf (config.features.shells.zsh.enable || config.features.shells.defaultShell == "zsh") {
|
||||
programs.zsh.enable = true;
|
||||
|
||||
home-manager.users.grey = lib.mkIf (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.${config.info.userName} = lib.mkIf (config.features.nixos.home-manager.enable) {
|
||||
features.shells.zsh.enable = lib.mkDefault true;
|
||||
features.shells.zsh.antidote.enable = lib.mkDefault config.features.shells.zsh.antidote.enable;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user