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;
});
}) ];
};
}
+1 -1
View File
@@ -14,7 +14,7 @@
flake.homeModules.graphics = { pkgs, lib, config, ... }: {
config = lib.mkIf (config.features.applications.gui.floorp.enable) (
let
firefox-addons = with pkgs; inputs.firefox-addons.packages.${pkgs.stdenv.hostPlatform.system};
firefox-addons = inputs.firefox-addons.packages.${pkgs.stdenv.hostPlatform.system};
in {
programs.floorp = {
enable = true;
+30 -28
View File
@@ -63,39 +63,41 @@
platforms = [ "x86_64-linux" ];
};
};
optionName = "features.applications.gui.fluxer.enable";
optionNameCanary = "features.applications.gui.fluxer-canary.enable";
in {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "graphicsOptions" ({ lib, ... }: {
options.features.applications.gui = {
fluxer.enable = lib.mkEnableOption "Fluxer";
fluxer-canary.enable = lib.mkEnableOption "Fluxer Canary";
};
})) ];
imports = [
(inputs.helpers.mkStandardFeature.flakeModule "graphics" optionName "Fluxer")
(inputs.helpers.mkStandardFeature.flakeModule "graphics" optionNameCanary "Fluxer Canary")
];
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.${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.${config.info.userName}.features.applications.gui.fluxer-canary.enable = lib.mkDefault true;
} {
environment.systemPackages = [
(pkgs.callPackage (fluxer-canary-package) {})
];
});
imports = [
(inputs.helpers.mkStandardFeature.nixosModule { inherit config optionName; } {
environment.systemPackages = [
(pkgs.callPackage (fluxer-package) {})
];
})
(inputs.helpers.mkStandardFeature.nixosModule { inherit config; optionName = optionNameCanary; } {
environment.systemPackages = [
(pkgs.callPackage (fluxer-canary-package) {})
];
})
];
};
flake.homeModules.graphics = { pkgs, config, lib, ... }: {
config = lib.mkIf (config.features.applications.gui.fluxer.enable) {
home.packages = [
(pkgs.callPackage (fluxer-package) {})
];
} // lib.mkIf (config.features.applications.gui.fluxer-canary.enable) {
home.packages = [
(pkgs.callPackage (fluxer-canary-package) {})
];
};
imports = [
(inputs.helpers.mkStandardFeature.homeModule { inherit config optionName; } {
home.packages = [
(pkgs.callPackage (fluxer-package) {})
];
})
(inputs.helpers.mkStandardFeature.homeModule { inherit config; optionName = optionNameCanary; } {
home.packages = [
(pkgs.callPackage (fluxer-canary-package) {})
];
})
];
};
}
+8 -12
View File
@@ -1,25 +1,21 @@
{ inputs, self, ... }: {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "graphicsOptions" ({ lib, ... }: {
options.features.applications.gui.kitty.enable = lib.mkEnableOption "Kitty Terminal";
}))];
{ inputs, self, ... }: let
optionName = "features.applications.gui.kitty.enable";
in {
imports = [ (inputs.helpers.mkStandardFeature.flakeModule "graphics" optionName "Kitty Terminal") ];
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.${config.info.userName}.features.applications.gui.kitty.enable = lib.mkDefault true;
} {
imports = [ (inputs.helpers.mkStandardFeature.nixosModule { inherit config optionName; } {
environment.systemPackages = [ pkgs.kitty ];
});
}) ];
};
flake.homeModules.graphics = { pkgs, config, lib, ... }: {
config = lib.mkIf (config.features.applications.gui.kitty.enable) {
imports = [ (inputs.helpers.mkStandardFeature.homeModule { inherit config optionName; } {
programs.kitty = {
enable = true;
shellIntegration.enableBashIntegration = true;
enableGitIntegration = true;
};
};
}) ];
};
}
+9 -11
View File
@@ -1,21 +1,19 @@
{ inputs, self, ... }: {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "graphicsOptions" ({ lib, ... }: {
options.features.applications.gui.remmina.enable = lib.mkEnableOption "Remmina";
})) ];
{ inputs, self, ... }: let
optionName = "features.applications.gui.remmina.enable";
in {
imports = [ (inputs.helpers.mkStandardFeature.flakeModule "graphics" optionName "Remmina") ];
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.${config.info.userName}.features.applications.gui.remmina.enable = lib.mkDefault true;
} {
flake.nixosModules.graphics = { pkgs, config, lib, ... }: {
imports = [ (inputs.helpers.mkStandardFeature.nixosModule { inherit config optionName; } {
environment.systemPackages = with pkgs; [
remmina
freerdp
];
});
}) ];
};
flake.homeModules.graphics = { pkgs, config, lib, ... }: {
config = lib.mkIf (config.features.applications.gui.remmina.enable) {
imports = [ (inputs.helpers.mkStandardFeature.homeModule { inherit config optionName; } {
home.packages = with pkgs; [
remmina
freerdp
@@ -25,6 +23,6 @@
target = "${config.home.homeDirectory}/.local/share/remmina";
source = "${config.info.rootPath}/dotfiles/${config.info.hostName}/remmina";
});
};
}) ];
};
}
@@ -0,0 +1,45 @@
{ inputs, self, ... }: let
optionName = "features.applications.gui.thunderbird.enable";
in {
imports = [
(inputs.helpers.mkStandardFeature.flakeModule "graphics" optionName "Thunderbird")
];
flake.nixosModules.graphics = { pkgs, config, ... }: {
imports = [ (inputs.helpers.mkStandardFeature.nixosModule { inherit config optionName; } {
environment.systemPackages = [ pkgs.thunderbird ];
}) ];
};
flake.homeModules.graphicsOptions = { lib, ... }: {
options.features.applications.gui.thunderbird.autostart = lib.mkOption {
type = lib.types.bool;
description = "Whether to add thunderbird.desktop to `$XDG_CONFIG_HOME/autostart`.";
default = false;
};
};
flake.homeModules.graphics = { pkgs, config, lib, ... }: {
imports = [ (inputs.helpers.mkStandardFeature.homeModule { inherit config optionName; } {
home.packages = [ pkgs.thunderbird ];
xdg.configFile."autostart/thunderbird.desktop" = lib.mkIf (config.features.applications.gui.thunderbird.autostart) {
text = ''
[Desktop Entry]
Categories=Network;Chat;Email;Feed;GTK;News
Comment=Read and write e-mails or RSS feeds, or manage tasks on calendars.
Exec=${pkgs.thunderbird}/bin/thunderbird --name thunderbird %U
GenericName=Email Client
Icon=thunderbird
MimeType=message/rfc822;x-scheme-handler/mailto;text/calendar;text/x-vcard
Name=Thunderbird
StartupNotify=true
StartupWMClass=thunderbird
Terminal=false
Type=Application
Version=1.5
'';
force = true;
};
}) ];
};
}
+10 -12
View File
@@ -1,31 +1,29 @@
{ inputs, self, ... }: {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "graphicsOptions" ({ lib, ... }: {
options.features.applications.gui.vscode.enable = lib.mkEnableOption "VS Code";
})) ];
{ inputs, self, ... }: let
optionName = "features.applications.gui.vscode.enable";
in {
imports = [ (inputs.helpers.mkStandardFeature.flakeModule "graphics" optionName "VS Code") ];
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.${config.info.userName}.features.applications.gui.vscode.enable = lib.mkDefault true;
} {
imports = [ (inputs.helpers.mkStandardFeature.nixosModule { inherit config optionName; } {
environment.systemPackages = [ pkgs.vscode ];
});
}) ];
};
flake.homeModules.graphics = { config, pkgs, lib, ... }: {
config = lib.mkIf (config.features.applications.gui.vscode.enable) {
imports = [ (inputs.helpers.mkStandardFeature.homeModule { inherit config optionName; } {
home.packages = [ pkgs.vscode ];
home.activation = {
linkVsCodeConfigSettings = lib.hm.dag.entryAfter ["writeBoundary"] (inputs.helpers.mkSymlinkActivationScript {
target = "${config.xdg.configHome}/Code/User/settings.json";
source = "${config.info.rootPath}/dotfiles/global/vscode/settings.json";
source = "${config.info.rootPath}/dotfiles/shared/vscode/settings.json";
});
linkVsCodeConfigKeybindings = lib.hm.dag.entryAfter ["writeBoundary"] (inputs.helpers.mkSymlinkActivationScript {
target = "${config.xdg.configHome}/Code/User/keybindings.json";
source = "${config.info.rootPath}/dotfiles/global/vscode/keybindings.json";
source = "${config.info.rootPath}/dotfiles/shared/vscode/keybindings.json";
});
};
};
}) ];
};
}