refactor(wisdom): decentralize module defaults and update conventions
Move Home Manager module defaults from a centralized `desktop-home-defaults.nix` file into their respective `wisdom` slices. This change aligns with the updated documentation regarding module ownership, where defaults live with the option that owns them rather than in a shared defaults file. Additionally, update `docs/conventions.md` to reflect this new pattern for defining `mkEnableOption` defaults and move base git/encryption configurations into the core `wisdom` module. - Delete `modules/hosts/desktop-home-defaults.nix` - Update `modules/wisdom/default.nix` to include shared git and package defaults - Add `default = ...` to `mkEnableOption` in various `wisdom` modules - Update `docs/conventions.md` with new HM slice guidelines
This commit is contained in:
+1
-1
@@ -172,7 +172,7 @@ The integration block at the bottom of `modules/system/users.nix` turns the cata
|
||||
|
||||
**New NixOS leaf:** export `flake.nixosModules.whatever`, wire from `system/default.nix` or `desktop/default.nix` if it's global, or only from a host `configuration.nix` if it's not. `nix flake check`. Git-add new paths if eval uses the git tree.
|
||||
|
||||
**New HM slice:** add `modules/wisdom/.../foo.nix` exporting `flake.homeManagerModules.wisdomFoo` (import-tree picks it up; `wisdomCatalogExtraModules` includes every `wisdom*` export except `wisdom` / `wisdomShellBash`). Gate packages on `chiasson.home.*.enable`, set `mkDefault true` in `desktop-home-base.nix` if shared, or `enable = true` in a host `home.nix`. Upstream HM deps stay imported unconditionally — use `mkIf` on `cfg.enable` for config (never `config`-dependent `imports`; that recurses).
|
||||
**New HM slice:** add `modules/wisdom/.../foo.nix` exporting `flake.homeManagerModules.wisdomFoo` (import-tree picks it up; `wisdomCatalogExtraModules` includes every `wisdom*` export except `wisdom` / `wisdomShellBash`). Gate packages on `chiasson.home.*.enable`, and set the slice's own `enable` default (`mkEnableOption "…" // { default = true/false }`) in that same module — defaults live with the option that owns them, not in a shared defaults file. Hosts flip toggles in `home.nix`. Upstream HM deps stay imported unconditionally — use `mkIf` on `cfg.enable` for config (never `config`-dependent `imports`; that recurses).
|
||||
|
||||
**Derivations:** `let` inside a fragment, or `flake.packages` / `flake.lib` — not a bare `mkDerivation` file import-tree will try to load.
|
||||
|
||||
|
||||
@@ -17,10 +17,6 @@
|
||||
userCli.enable = true;
|
||||
};
|
||||
|
||||
chiasson.users.extraModules.olivier =
|
||||
self.lib.wisdomCatalogExtraModules self
|
||||
++ [
|
||||
self.homeManagerModules.desktopHomeDefaults
|
||||
];
|
||||
chiasson.users.extraModules.olivier = self.lib.wisdomCatalogExtraModules self;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
# Shared HM defaults for desktop hosts (git identity, wisdom catalog toggles).
|
||||
{ ... }: {
|
||||
flake.homeManagerModules.desktopHomeDefaults =
|
||||
{ lib, pkgs, ... }:
|
||||
let
|
||||
aarch64 = pkgs.stdenv.hostPlatform.isAarch64;
|
||||
in
|
||||
{
|
||||
programs.git = {
|
||||
enable = lib.mkDefault true;
|
||||
settings.user = {
|
||||
name = "OlivierChiasson";
|
||||
email = "olivierchiasson@hotmail.fr";
|
||||
};
|
||||
};
|
||||
|
||||
#TODO[epic=Moderate] Check if git-crypt should belong in desktop-home-base.
|
||||
home.packages = [ pkgs.git-crypt pkgs.feishin ];
|
||||
|
||||
chiasson.home = {
|
||||
shell = {
|
||||
fish.enable = lib.mkDefault true;
|
||||
ohMyPosh.enable = lib.mkDefault true;
|
||||
yazi.enable = lib.mkDefault true;
|
||||
};
|
||||
|
||||
terminals.kitty.enable = lib.mkDefault true;
|
||||
|
||||
filebrowsers.nemo.enable = lib.mkDefault true;
|
||||
|
||||
browsers = {
|
||||
chrome.enable = lib.mkDefault false;
|
||||
chromiumHevc = {
|
||||
enable = lib.mkDefault true;
|
||||
packages = lib.mkDefault (
|
||||
if aarch64 then
|
||||
[ "chromium" ]
|
||||
else
|
||||
[ "google-chrome" ]
|
||||
);
|
||||
} // lib.optionalAttrs (!aarch64) {
|
||||
vaapi.gpu = lib.mkDefault "intel";
|
||||
};
|
||||
edge.enable = lib.mkDefault false;
|
||||
flow.enable = lib.mkDefault false;
|
||||
orion.enable = lib.mkDefault false;
|
||||
zen.enable = lib.mkDefault false;
|
||||
};
|
||||
|
||||
editors = {
|
||||
cursor.enable = lib.mkDefault true;
|
||||
kate.enable = lib.mkDefault false;
|
||||
obsidian.enable = lib.mkDefault true;
|
||||
};
|
||||
|
||||
apps = {
|
||||
discord.enable = lib.mkDefault false;
|
||||
localsend.enable = lib.mkDefault true;
|
||||
pokeclicker.enable = lib.mkDefault false;
|
||||
spotify = {
|
||||
enable = lib.mkDefault false;
|
||||
openDiscoveryFirewall = lib.mkDefault false;
|
||||
};
|
||||
};
|
||||
|
||||
desktop = {
|
||||
screenshot = {
|
||||
enable = lib.mkDefault true;
|
||||
swiftshareApiKeyFile = "/run/secrets/swiftshare/API_KEY"; #TODO[epic=sops] redo this by passing sops file output directly
|
||||
};
|
||||
theming.enable = lib.mkDefault true;
|
||||
};
|
||||
|
||||
hardware.uconsoleGamepad.enable = lib.mkDefault false;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -12,7 +12,9 @@
|
||||
|
||||
options.chiasson.home.apps.discord.enable = lib.mkEnableOption ''
|
||||
Vesktop (nixcord). Needs nixpkgs `discord` — breaks on e.g. aarch64-linux.
|
||||
'';
|
||||
'' // {
|
||||
default = false;
|
||||
};
|
||||
|
||||
config = lib.mkIf root.enable (lib.mkMerge [
|
||||
{
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
options.chiasson.home.apps.localsend = {
|
||||
enable = lib.mkEnableOption ''
|
||||
LocalSend client; open the firewall on NixOS with `system.localsend` if you want inbound.
|
||||
'';
|
||||
'' // {
|
||||
default = true;
|
||||
};
|
||||
|
||||
package = lib.mkPackageOption pkgs "localsend" { };
|
||||
};
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
pokeclickerPkg = pkgs.callPackage ./package { };
|
||||
in
|
||||
{
|
||||
options.chiasson.home.apps.pokeclicker.enable = lib.mkEnableOption "PokéClicker desktop (Farigh fork .deb → nix).";
|
||||
options.chiasson.home.apps.pokeclicker.enable = lib.mkEnableOption "PokéClicker desktop (Farigh fork .deb → nix)." // {
|
||||
default = false;
|
||||
};
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
home.packages = [ pokeclickerPkg ];
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
{
|
||||
options.chiasson.home.browsers.chrome.enable = lib.mkEnableOption ''
|
||||
Chrome (unfree, needs `allowUnfree`); skipped if nixpkgs has no build for this platform.
|
||||
'';
|
||||
'' // {
|
||||
default = false;
|
||||
};
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
home.packages = lib.optional (
|
||||
|
||||
@@ -155,13 +155,15 @@
|
||||
`failed Initialize()ing the frame pool` in Jellyfin.
|
||||
|
||||
Requires `chiasson.system.chromiumHevc.enable` on NixOS.
|
||||
'';
|
||||
'' // {
|
||||
default = true;
|
||||
};
|
||||
|
||||
packages = lib.mkOption {
|
||||
type = lib.types.listOf (
|
||||
lib.types.enum (lib.attrNames browserCatalog)
|
||||
);
|
||||
default = [ "google-chrome" ];
|
||||
default = if pkgs.stdenv.hostPlatform.isAarch64 then [ "chromium" ] else [ "google-chrome" ];
|
||||
description = "Chromium-based browsers to wrap.";
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
cfg = config.chiasson.home.browsers.edge;
|
||||
in
|
||||
{
|
||||
options.chiasson.home.browsers.edge.enable = lib.mkEnableOption "Edge (unfree); skipped if unavailable on this platform.";
|
||||
options.chiasson.home.browsers.edge.enable = lib.mkEnableOption "Edge (unfree); skipped if unavailable on this platform." // {
|
||||
default = false;
|
||||
};
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
home.packages = lib.optional (
|
||||
|
||||
@@ -56,7 +56,9 @@
|
||||
{
|
||||
options.chiasson.home.browsers.flow.enable = lib.mkEnableOption ''
|
||||
[Flow](https://github.com/MultiboxLabs/flow-browser) — upstream AppImage wrapped for NixOS.
|
||||
'';
|
||||
'' // {
|
||||
default = false;
|
||||
};
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
home.packages = lib.optional (
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
{
|
||||
options.chiasson.home.browsers.orion.enable = lib.mkEnableOption ''
|
||||
[Orion](https://orionbrowser.com/) (Kagi) — installs the upstream Flatpak bundle and provides `oriongtk`.
|
||||
'';
|
||||
'' // {
|
||||
default = false;
|
||||
};
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
home.packages = [ oriongtk ];
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
{
|
||||
imports = [ inputs.zen-browser.homeModules.beta ];
|
||||
|
||||
options.chiasson.home.browsers.zen.enable = lib.mkEnableOption "Zen Browser + locked-down policies / extensions.";
|
||||
options.chiasson.home.browsers.zen.enable = lib.mkEnableOption "Zen Browser + locked-down policies / extensions." // {
|
||||
default = false;
|
||||
};
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
programs.zen-browser = {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Root module: chiasson.home.enable + bash. Other `wisdom*` slices auto-wire via
|
||||
# `lib.wisdomCatalogExtraModules`; hosts flip `chiasson.home.*.enable` rather than re-importing.
|
||||
flake.homeManagerModules.wisdom =
|
||||
{ config, lib, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.chiasson.home;
|
||||
in
|
||||
@@ -29,6 +29,20 @@
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable { home.packages = cfg.extraPackages; };
|
||||
config = lib.mkIf cfg.enable (lib.mkMerge [
|
||||
{ home.packages = cfg.extraPackages; }
|
||||
|
||||
# Base git identity + encryption/player tools shared by every HM user.
|
||||
{
|
||||
programs.git = {
|
||||
enable = true;
|
||||
settings.user = {
|
||||
name = "OlivierChiasson";
|
||||
email = "olivierchiasson@hotmail.fr";
|
||||
};
|
||||
};
|
||||
home.packages = [ pkgs.git-crypt pkgs.feishin ];
|
||||
}
|
||||
]);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
enable = lib.mkEnableOption ''
|
||||
WhiteSur GTK + icon themes, Phinger cursor, and Qt via qt6ct (DMS) or KDE platform theme.
|
||||
Matugen accent colors load via gtk3/gtk4 extraCss when matugenGtkColors is enabled.
|
||||
'';
|
||||
'' // {
|
||||
default = true;
|
||||
};
|
||||
|
||||
matugenGtkColors = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
|
||||
@@ -13,11 +13,13 @@
|
||||
{
|
||||
options.chiasson.home.desktop.screenshot.enable = lib.mkEnableOption ''
|
||||
grim/slurp/swappy + SwiftShare helpers; Hyprland binds if HM Hyprland is on.
|
||||
'';
|
||||
'' // {
|
||||
default = true;
|
||||
};
|
||||
|
||||
options.chiasson.home.desktop.screenshot.swiftshareApiKeyFile = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
default = "/run/secrets/swiftshare/API_KEY";
|
||||
description = ''
|
||||
File with SwiftShare API key (sops path is fine). Required when screenshot module is on.
|
||||
'';
|
||||
|
||||
@@ -33,7 +33,9 @@
|
||||
in
|
||||
{
|
||||
options.chiasson.home.editors.cursor = {
|
||||
enable = lib.mkEnableOption "Cursor editor from the `cursor` flake input.";
|
||||
enable = lib.mkEnableOption "Cursor editor from the `cursor` flake input." // {
|
||||
default = true;
|
||||
};
|
||||
setAsDefaultEditor = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
cfg = config.chiasson.home.editors.kate;
|
||||
in
|
||||
{
|
||||
options.chiasson.home.editors.kate.enable = lib.mkEnableOption "Kate.";
|
||||
options.chiasson.home.editors.kate.enable = lib.mkEnableOption "Kate." // {
|
||||
default = false;
|
||||
};
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
home.packages = lib.optional (
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
{
|
||||
options.chiasson.home.editors.obsidian.enable = lib.mkEnableOption ''
|
||||
Obsidian (unfree); skipped if unavailable here.
|
||||
'';
|
||||
'' // {
|
||||
default = true;
|
||||
};
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
home.packages = lib.optional (
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
{
|
||||
options.chiasson.home.filebrowsers.nemo.enable = lib.mkEnableOption ''
|
||||
Nemo file manager (GTK). Colors come from DMS matugen via GTK settings — no KDE/Qt bridge needed.
|
||||
'';
|
||||
'' // {
|
||||
default = true;
|
||||
};
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
home.packages = [pkgs.nemo];
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
{
|
||||
options.chiasson.home.hardware.uconsoleGamepad.enable = lib.mkEnableOption ''
|
||||
uConsole gamepad antimicrox profile + Hyprland exec-once when HM Hyprland is on.
|
||||
'';
|
||||
'' // {
|
||||
default = false;
|
||||
};
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) (lib.mkMerge [
|
||||
{
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
in
|
||||
{
|
||||
options.chiasson.home.shell.fish = {
|
||||
enable = lib.mkEnableOption "Fish + grc, quiet greeting, rbw SSH socket defaults.";
|
||||
enable = lib.mkEnableOption "Fish + grc, quiet greeting, rbw SSH socket defaults." // {
|
||||
default = true;
|
||||
};
|
||||
|
||||
nixYourShell = {
|
||||
enable = lib.mkEnableOption ''
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
in
|
||||
{
|
||||
options.chiasson.home.shell.ohMyPosh = {
|
||||
enable = lib.mkEnableOption "[Oh My Posh](https://ohmyposh.dev/) prompt.";
|
||||
enable = lib.mkEnableOption "[Oh My Posh](https://ohmyposh.dev/) prompt." // {
|
||||
default = true;
|
||||
};
|
||||
|
||||
builtinTheme = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
cfg = config.chiasson.home.shell.yazi;
|
||||
in
|
||||
{
|
||||
options.chiasson.home.shell.yazi.enable = lib.mkEnableOption "Yazi as `y` + 7zz with rar.";
|
||||
options.chiasson.home.shell.yazi.enable = lib.mkEnableOption "Yazi as `y` + 7zz with rar." // {
|
||||
default = true;
|
||||
};
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
programs.yazi = {
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
{
|
||||
options.chiasson.home.terminals.kitty.enable = lib.mkEnableOption ''
|
||||
Kitty + DMS includes; activation strips `*-theme.auto.conf` so matugen colors stick.
|
||||
'';
|
||||
'' // {
|
||||
default = true;
|
||||
};
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
programs.kitty = {
|
||||
|
||||
Reference in New Issue
Block a user