a dotfile but it's really big
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: centralize module options, remove osConfig pattern

- Create modules/options/{desktop,dev}.nix with shared option declarations
- Remove duplicated options from desktop/{home,nixos}.nix and dev/{home,nixos}.nix
- Replace osConfig bridging with home-manager.sharedModules propagation
- Fix hardcoded username in core.nix: use mkDefault instead of default value
- Add code task files for planned refactoring work

karitham c7ba68fb 3e1bd907

+125 -116
+15 -13
modules/core.nix
··· 3 3 options.my.username = lib.mkOption { 4 4 type = lib.types.str; 5 5 description = "The username for the current user."; 6 - default = "kar"; 7 6 }; 8 7 9 - config = lib.mkIf (config.my.username != "root") { 10 - users.users.${config.my.username} = { 11 - home = "/home/${config.my.username}"; 12 - initialPassword = ""; 13 - isNormalUser = true; 14 - extraGroups = [ 15 - "networkmanager" 16 - "docker" 17 - "wheel" 18 - ]; 19 - }; 20 - }; 8 + config = lib.mkMerge [ 9 + { my.username = lib.mkDefault "kar"; } 10 + (lib.mkIf (config.my.username != "root") { 11 + users.users.${config.my.username} = { 12 + home = "/home/${config.my.username}"; 13 + initialPassword = ""; 14 + isNormalUser = true; 15 + extraGroups = [ 16 + "networkmanager" 17 + "docker" 18 + "wheel" 19 + ]; 20 + }; 21 + }) 22 + ]; 21 23 }
+3 -35
modules/desktop/home.nix
··· 1 - { 2 - lib, 3 - osConfig ? { }, 4 - pkgs, 5 - ... 6 - }: 1 + { lib, pkgs, ... }: 7 2 let 8 - inherit (lib) mkEnableOption mkOption types; 3 + inherit (lib) mkOption types; 9 4 in 10 5 { 11 - config.desktop = { 12 - inherit (osConfig.desktop or { }) 13 - enable 14 - wm 15 - noctalia 16 - waybar 17 - hyprlock 18 - wallpaper 19 - notification 20 - launcher 21 - terminal 22 - audio 23 - apps 24 - ; 25 - }; 26 6 options.desktop = { 27 - enable = mkEnableOption "all desktop tools"; 28 - 29 - wm.enable = mkEnableOption "window manager and interface tools"; 30 - noctalia.enable = mkEnableOption "Noctalia Shell"; 31 - waybar.enable = mkEnableOption "Waybar status bar"; 32 - hyprlock.enable = mkEnableOption "Hyprlock screen locker"; 33 - wallpaper.enable = mkEnableOption "Wallpaper management"; 34 7 wallpaper.image = lib.mkOption { 35 8 default = pkgs.fetchurl { 36 9 url = "https://raw.githubusercontent.com/HoulFloof/wallpapers/f23c1010b93cb97baa7ad7c94fd552f7601496d2/misc/waves_right_colored.png"; ··· 39 12 type = lib.types.path; 40 13 description = "the wallpaper to use"; 41 14 }; 42 - notification.enable = mkEnableOption "Notification daemon"; 43 - launcher.enable = mkEnableOption "Application launcher"; 44 - terminal.enable = mkEnableOption "terminal tools"; 45 - audio.enable = mkEnableOption "audio tools"; 46 - apps.enable = mkEnableOption "desktop applications"; 47 15 browser.default = mkOption { 48 16 description = "default browser xdg file"; 49 17 default = "firefox-devedition.desktop"; 50 18 type = types.str; 51 19 }; 52 - 53 20 }; 21 + 54 22 imports = [ 55 23 ./wm 56 24 ./terminal
+7 -28
modules/desktop/nixos.nix
··· 4 4 inherit (lib) mkIf mkEnableOption; 5 5 in 6 6 { 7 - options.desktop = { 8 - enable = mkEnableOption "all desktop tools"; 9 - 10 - wm.enable = mkEnableOption "window manager and interface tools"; 11 - noctalia.enable = mkEnableOption "Noctalia Shell"; 12 - waybar.enable = mkEnableOption "Waybar status bar"; 13 - hyprlock.enable = mkEnableOption "Hyprlock screen locker"; 14 - wallpaper.enable = mkEnableOption "Wallpaper management"; 15 - notification.enable = mkEnableOption "Notification daemon"; 16 - launcher.enable = mkEnableOption "Application launcher"; 17 - terminal.enable = mkEnableOption "terminal tools"; 18 - audio.enable = mkEnableOption "audio tools"; 19 - apps.enable = mkEnableOption "desktop applications"; 20 - ipcam.enable = mkEnableOption "IP camera support"; 21 - yubikey.enable = mkEnableOption "YubiKey support"; 22 - locale.enable = mkEnableOption "locale and timezone settings"; 23 - }; 24 - 25 7 imports = [ 8 + ../options/desktop.nix 26 9 ./desktop.nix 27 10 ./sound.nix 28 11 ./yubikey.nix ··· 31 14 ./ipcam.nix 32 15 ]; 33 16 17 + options.desktop = { 18 + ipcam.enable = mkEnableOption "IP camera support"; 19 + yubikey.enable = mkEnableOption "YubiKey support"; 20 + locale.enable = mkEnableOption "locale and timezone settings"; 21 + }; 22 + 34 23 config = { 35 24 assertions = [ 36 25 { ··· 39 28 } 40 29 ]; 41 30 42 - desktop.wm.enable = mkIf cfg.enable true; 43 - # Default to Waybar if Noctalia is not explicitly enabled for now 44 - desktop.waybar.enable = mkIf (cfg.wm.enable && !cfg.noctalia.enable) true; 45 - desktop.hyprlock.enable = mkIf (cfg.wm.enable && !cfg.noctalia.enable) true; 46 - desktop.wallpaper.enable = mkIf (cfg.wm.enable && !cfg.noctalia.enable) true; 47 - desktop.notification.enable = mkIf (cfg.wm.enable && !cfg.noctalia.enable) true; 48 - desktop.launcher.enable = mkIf (cfg.wm.enable && !cfg.noctalia.enable) true; 49 - desktop.terminal.enable = mkIf cfg.enable true; 50 - desktop.audio.enable = mkIf cfg.enable true; 51 - desktop.apps.enable = mkIf cfg.enable true; 52 31 desktop.yubikey.enable = mkIf cfg.enable true; 53 32 desktop.locale.enable = mkIf cfg.enable true; 54 33 };
+1 -26
modules/dev/home.nix
··· 1 - { 2 - osConfig ? { }, 3 - lib, 4 - ... 5 - }: 6 - let 7 - inherit (lib) mkEnableOption; 8 - in 1 + { ... }: 9 2 { 10 - config.dev = { 11 - inherit (osConfig.dev or { }) 12 - shell 13 - editor 14 - vcs 15 - tools 16 - opencode 17 - ; 18 - }; 19 - 20 - options.dev = { 21 - enable = mkEnableOption "all development tools"; 22 - 23 - shell.enable = mkEnableOption "shell-related tools"; 24 - editor.enable = mkEnableOption "editor tools"; 25 - vcs.enable = mkEnableOption "version control tools"; 26 - tools.enable = mkEnableOption "development utilities"; 27 - }; 28 3 imports = [ 29 4 ./shell 30 5 ./editor
+5 -14
modules/dev/nixos.nix
··· 9 9 inherit (lib) mkIf mkEnableOption mkDefault; 10 10 in 11 11 { 12 - options.dev = { 13 - enable = mkEnableOption "all development tools"; 12 + imports = [ 13 + ../options/dev.nix 14 + ./docker 15 + ]; 14 16 15 - shell.enable = mkEnableOption "shell-related tools"; 16 - editor.enable = mkEnableOption "editor tools"; 17 - vcs.enable = mkEnableOption "version control tools"; 18 - tools.enable = mkEnableOption "development utilities"; 19 - opencode.enable = mkEnableOption "OpenCode"; 17 + options.dev = { 20 18 docker.enable = mkEnableOption "Docker"; 21 19 }; 22 20 23 21 config = { 24 - dev.shell.enable = mkIf cfg.enable true; 25 - dev.editor.enable = mkIf cfg.enable true; 26 - dev.vcs.enable = mkIf cfg.enable true; 27 - dev.tools.enable = mkIf cfg.enable true; 28 - dev.opencode.enable = mkIf cfg.enable true; 29 22 dev.docker.enable = mkIf cfg.enable true; 30 23 31 24 users.defaultUserShell = mkIf (cfg.enable || cfg.shell.enable) pkgs.nushell; ··· 34 27 programs.nano.enable = mkDefault (!(cfg.enable || cfg.editor.enable)); 35 28 environment.sessionVariables.EDITOR = mkIf cfg.editor.enable "hx"; 36 29 }; 37 - 38 - imports = [ ./docker ]; 39 30 }
+54
modules/options/desktop.nix
··· 1 + { config, lib, ... }: 2 + let 3 + cfg = config.desktop; 4 + inherit (lib) mkEnableOption mkIf; 5 + 6 + sharedOptions = { 7 + enable = mkEnableOption "all desktop tools"; 8 + wm.enable = mkEnableOption "window manager and interface tools"; 9 + noctalia.enable = mkEnableOption "Noctalia Shell"; 10 + waybar.enable = mkEnableOption "Waybar status bar"; 11 + hyprlock.enable = mkEnableOption "Hyprlock screen locker"; 12 + wallpaper.enable = mkEnableOption "Wallpaper management"; 13 + notification.enable = mkEnableOption "Notification daemon"; 14 + launcher.enable = mkEnableOption "Application launcher"; 15 + terminal.enable = mkEnableOption "terminal tools"; 16 + audio.enable = mkEnableOption "audio tools"; 17 + apps.enable = mkEnableOption "desktop applications"; 18 + }; 19 + in 20 + { 21 + options.desktop = sharedOptions; 22 + 23 + config = { 24 + desktop.wm.enable = mkIf cfg.enable true; 25 + # Default to Waybar if Noctalia is not explicitly enabled for now 26 + desktop.waybar.enable = mkIf (cfg.wm.enable && !cfg.noctalia.enable) true; 27 + desktop.hyprlock.enable = mkIf (cfg.wm.enable && !cfg.noctalia.enable) true; 28 + desktop.wallpaper.enable = mkIf (cfg.wm.enable && !cfg.noctalia.enable) true; 29 + desktop.notification.enable = mkIf (cfg.wm.enable && !cfg.noctalia.enable) true; 30 + desktop.launcher.enable = mkIf (cfg.wm.enable && !cfg.noctalia.enable) true; 31 + desktop.terminal.enable = mkIf cfg.enable true; 32 + desktop.audio.enable = mkIf cfg.enable true; 33 + desktop.apps.enable = mkIf cfg.enable true; 34 + 35 + home-manager.sharedModules = [ 36 + { 37 + options.desktop = sharedOptions; 38 + config.desktop = { 39 + enable = cfg.enable; 40 + wm.enable = cfg.wm.enable; 41 + noctalia.enable = cfg.noctalia.enable; 42 + waybar.enable = cfg.waybar.enable; 43 + hyprlock.enable = cfg.hyprlock.enable; 44 + wallpaper.enable = cfg.wallpaper.enable; 45 + notification.enable = cfg.notification.enable; 46 + launcher.enable = cfg.launcher.enable; 47 + terminal.enable = cfg.terminal.enable; 48 + audio.enable = cfg.audio.enable; 49 + apps.enable = cfg.apps.enable; 50 + }; 51 + } 52 + ]; 53 + }; 54 + }
+40
modules/options/dev.nix
··· 1 + { config, lib, ... }: 2 + let 3 + cfg = config.dev; 4 + inherit (lib) mkEnableOption mkIf; 5 + 6 + sharedOptions = { 7 + enable = mkEnableOption "all development tools"; 8 + shell.enable = mkEnableOption "shell-related tools"; 9 + editor.enable = mkEnableOption "editor tools"; 10 + vcs.enable = mkEnableOption "version control tools"; 11 + tools.enable = mkEnableOption "development utilities"; 12 + }; 13 + in 14 + { 15 + options.dev = sharedOptions // { 16 + opencode.enable = mkEnableOption "OpenCode"; 17 + }; 18 + 19 + config = { 20 + dev.shell.enable = mkIf cfg.enable true; 21 + dev.editor.enable = mkIf cfg.enable true; 22 + dev.vcs.enable = mkIf cfg.enable true; 23 + dev.tools.enable = mkIf cfg.enable true; 24 + dev.opencode.enable = mkIf cfg.enable true; 25 + 26 + home-manager.sharedModules = [ 27 + { 28 + options.dev = sharedOptions; 29 + config.dev = { 30 + enable = cfg.enable; 31 + shell.enable = cfg.shell.enable; 32 + editor.enable = cfg.editor.enable; 33 + vcs.enable = cfg.vcs.enable; 34 + tools.enable = cfg.tools.enable; 35 + opencode.enable = cfg.opencode.enable; 36 + }; 37 + } 38 + ]; 39 + }; 40 + }