misc improvements to modularity

This commit is contained in:
greyweather committed 2026-09-02 15:50:37 +01:00
1 parent 9c13923c2e
commit 6d8673ea1e
29 files changed
+111 -108

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@
programs.noctalia.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) {
components.shells = [ "noctalia" ];
};
};
+1 -1
View File
@@ -35,7 +35,7 @@
}));
};
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) {
components.windowManagers = [ "niri" ];
};
};
@@ -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 ];
});
+1 -1
View File
@@ -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;
};
};
+2 -10
View File
@@ -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 ];
};
+1 -1
View File
@@ -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 ];
});
+2 -2
View File
@@ -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) {})
+1 -1
View File
@@ -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; });
+1 -1
View File
@@ -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;
};
};
+1 -1
View File
@@ -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}";
};
};
}
+1 -1
View File
@@ -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;
};
};
+1 -1
View File
@@ -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};
};
}
+1 -1
View File
@@ -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;
};
+6 -7
View File
@@ -53,8 +53,6 @@
extraGroups = [ "networkmanager" "wheel" ];
};
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
git
fzf
@@ -84,12 +82,13 @@
powerOnBoot = false;
};
home-manager.users.grey = lib.mkIf (config.features.nixos.home-manager.enable) {
nixpkgs.config.allowUnfree = true;
home-manager.users.${config.info.userName} = lib.mkIf (config.features.nixos.home-manager.enable) {
info = {
rootPath = lib.mkDefault config.info.rootPath;
hostName = lib.mkDefault config.info.hostName;
stateVersion = lib.mkDefault config.info.stateVersion;
isStandalone = lib.mkDefault false;
inherit (config.info) rootPath userName hostName stateVersion;
hostPlatform = config.nixpkgs.hostPlatform.system;
isStandalone = false;
};
};
+1 -1
View File
@@ -1,5 +1,5 @@
{ inputs, self, ... }: {
flake.homeModules.kitagawa = { pkgs, lib, config, ... }: {
flake.homeModules."grey@kitagawa" = { pkgs, lib, config, ... }: {
config = lib.mkIf (config.features.applications.cli.fastfetch.enable) ({
programs.fastfetch = {
settings = {
+1 -1
View File
@@ -1,5 +1,5 @@
{ inputs, self, ... }: {
flake.homeModules.kitagawa = { pkgs, config, lib, ... }: {
flake.homeModules."grey@kitagawa" = { pkgs, config, lib, ... }: {
programs.kitty = {
font = lib.mkForce {
name = "Iosevka Comfy";
+1 -1
View File
@@ -1,5 +1,5 @@
{ inputs, self, ... }: {
flake.homeModules.kitagawa = { config, pkgs, ... }: let
flake.homeModules."grey@kitagawa" = { config, pkgs, ... }: let
mkConfigCommand = args: "zsh -c 'cd ${config.info.rootPath}; git add .; nh os switch ${args}'";
in {
programs.zsh.shellAliases = {
+1 -1
View File
@@ -86,7 +86,7 @@
};
};
flake.homeModules.kitagawa = { config, pkgs, inputs, lib, ... }: {
flake.homeModules."grey@kitagawa" = { config, pkgs, inputs, lib, ... }: {
imports = with self.homeModules; [
global
audio
+28 -9
View File
@@ -5,20 +5,19 @@ in {
options.info = {
rootPath = lib.mkOption {
type = lib.types.str;
description = "This option is used to tell the config the global path to the flake's root directory, in order to perform impure actions (in a Nix sense, not morally impure, I promise).";
description = "Used to tell the config the global path to the flake's root directory, in order to perform direct symlinking (not in `/nix/store`).";
default = "/home/grey/nixos";
};
userName = lib.mkOption {
type = lib.types.str;
description = "Used to tell the config the name of the primary user (the user that this flake should focus on for things like Home Manager configurations, etc).";
default = "grey";
};
hostName = lib.mkOption {
type = lib.types.str;
description = "This option is used to tell the config the hostname of the current machine, mostly for symlinking the right dotfiles.";
default = "";
};
stateVersion = lib.mkOption {
type = lib.types.str;
description = "This option is used to set the stateVersion value.";
example = "26.11";
description = "Used to tell the config the hostname of the current machine, mostly for symlinking the right dotfiles.";
default = "";
};
};
@@ -26,6 +25,13 @@ in {
flake.nixosModules.globalOptions = { lib, ... }: {
options = {
info.stateVersion = lib.mkOption {
type = lib.types.str;
description = "Used to set the `system.stateVersion` value.";
example = "26.11";
default = "";
};
components = {
bootLoader = {
selection = lib.mkOption {
@@ -59,6 +65,19 @@ in {
flake.homeModules.globalOptions = { lib, ... }: {
options = {
info = {
/* hostPlatform = lib.mkOption {
type = lib.types.str;
description = "Tells the config the platform string that should be used to generate `pkgs`, since `nixpkgs.hostPlatform` does not exist in a standalone Home Manager setup.";
default = "x86_64-linux";
}; */
stateVersion = lib.mkOption {
type = lib.types.str;
description = "Used to set the `home.stateVersion` value.";
example = "26.11";
default = "";
};
isStandalone = lib.mkOption {
type = lib.types.bool;
description = "This option tells the config whether this home-manager config is part of a larger NixOS config or not, and is read-only.";