diff --git a/On_Remote_Building.md b/On_Remote_Building.md deleted file mode 100644 index 50200c2..0000000 --- a/On_Remote_Building.md +++ /dev/null @@ -1,31 +0,0 @@ -Yes, that's a good approach! You can test the build without actually applying it in a few ways: - -1. Build without applying using `nixos-rebuild`: - -```bash -# Build only, don't switch -nixos-rebuild build --flake .#steamdeck - -# Build for a remote system -nixos-rebuild build --flake .#steamdeck --target-host root@remote-ip -``` - -2. Check evaluation: -```bash -# Check if the configuration evaluates without building -nix flake check - -# More detailed evaluation -nix eval .#nixosConfigurations.steamdeck.config.system.build.toplevel -``` - -Since there's no sensitive data yet, it's a good time to test the basic structure. Secret management can be added later when needed. - -Would you like help setting up the remote build testing? We would need to: -1. Ensure SSH access to the remote machine -2. Configure the remote builder -3. Set up necessary permissions/access - -Also, there's a feature in nixos-rebuild called `--build-host` that could be useful - it lets you build on a more powerful machine while targeting another system. - -Would you like me to provide the specific commands and configurations for any of these testing approaches? \ No newline at end of file diff --git a/hosts/steamdeck/configuration.nix b/hosts/steamdeck/configuration.nix index 2acb245..11cd28d 100644 --- a/hosts/steamdeck/configuration.nix +++ b/hosts/steamdeck/configuration.nix @@ -9,8 +9,6 @@ in { imports = [ ./hardware-configuration.nix - ../../modules/system - ../../modules/desktop (jovianNixos + "/modules") ]; @@ -74,7 +72,7 @@ in sddm = { enable = true; wayland = { - enable = true; # Fixed: proper wayland config + enable = true; # Fixed: proper wayland config }; }; sessionCommands = '' @@ -114,4 +112,4 @@ in dmidecode binutils ]; -} \ No newline at end of file +} diff --git a/lib/utilMods.nix b/lib/utilMods.nix index f7f99f3..5bae280 100644 --- a/lib/utilMods.nix +++ b/lib/utilMods.nix @@ -1,56 +1,42 @@ -{ lib, ... }: let - internals = { - # Helper for creating modules - mkModuleWithOptions = { - config, - name, - moduleConfig, - default ? false, - extraOptions ? {}, - extraCondition ? true, - }: { config, lib, pkgs, ... }: let - namePathList = lib.splitString "." name; - modulePath = ["modules"] ++ namePathList; - enableOptionPath = modulePath ++ ["enable"]; - - moduleOptions = { - enable = lib.mkOption { - inherit default; - type = lib.types.bool; - description = "Enable [${name}] module"; - }; - } // extraOptions; - - # Get the module configuration path - cfg = lib.getAttrFromPath modulePath config; - in { - options = lib.setAttrByPath modulePath moduleOptions; - config = lib.mkIf - (lib.getAttrFromPath enableOptionPath config && extraCondition) - (if builtins.isFunction moduleConfig - then moduleConfig { inherit config lib pkgs cfg; } - else moduleConfig); - }; +{ lib, ... }: +let + # Helper for creating home-manager modules + mkHmModule = name: module: { config, lib, pkgs, ... }: { + config = lib.mkIf (config.modules.${name}.enable or false) + (if builtins.isFunction module + then module { inherit config lib pkgs; } + else { + home-manager.users.${config.user.name} = module; + }); }; + # Helper for creating desktop/user modules + mkUserModule = category: name: module: + mkHmModule "${category}.${name}" module; + exports = { - # Function for creating modules.NAME modules, with extra options - mkModule' = config: name: extraOptions: moduleConfig: - internals.mkModuleWithOptions {inherit config name extraOptions moduleConfig;}; + # Main module creation helper + mkModule = category: name: module: + mkUserModule category name ( + if builtins.isAttrs module + then { home.packages = module.packages or [ ]; } + else module + ); - # Function for creating modules.NAME modules, without extra options - mkModule = config: name: moduleConfig: - exports.mkModule' config name {} moduleConfig; + # Helpers for enabling/disabling modules + enable = elems: builtins.listToAttrs (map + (name: { + inherit name; + value.enable = true; + }) + elems); - # Function for creating modules.NAME modules that are enabled by default, with extra options - mkEnabledModule' = config: name: extraOptions: moduleConfig: - internals.mkModuleWithOptions { - inherit config name extraOptions moduleConfig; - default = true; - }; - - # Function for creating modules.NAME modules that are enabled by default, without extra options - mkEnabledModule = config: name: moduleConfig: - exports.mkEnabledModule' config name {} moduleConfig; + disable = elems: builtins.listToAttrs (map + (name: { + inherit name; + value.enable = false; + }) + elems); }; -in exports \ No newline at end of file +in +exports diff --git a/modules/desktop/browsers/default.nix b/modules/desktop/browsers/default.nix index 45922cf..1f98364 100644 --- a/modules/desktop/browsers/default.nix +++ b/modules/desktop/browsers/default.nix @@ -1,20 +1,21 @@ +# modules/desktop/browsers/default.nix { config, lib, pkgs, ... }: -{ - options.modules.desktop.browsers = { - home-manager.users.${config.user.name} = { # Use home-manager.users path +let + inherit (lib.utilMods) mkModule; +in +mkModule "desktop" "browsers" { + packages = with pkgs; [ + (lib.mkIf config.modules.desktop.browsers.floorp.enable floorp) + (lib.mkIf config.modules.desktop.browsers.chromium.enable ungoogled-chromium) + ]; +}; - enable = lib.mkEnableOption "browser support"; - - floorp.enable = lib.mkEnableOption "Floorp browser"; - chromium.enable = lib.mkEnableOption "Chromium browser"; - }; +# modules/desktop/productivity/obsidian.nix +{ config, lib, pkgs, ... }: - config = lib.mkIf config.modules.desktop.browsers.enable { - home.packages = with pkgs; [ - (lib.mkIf config.modules.desktop.browsers.floorp.enable floorp) - (lib.mkIf config.modules.desktop.browsers.chromium.enable ungoogled-chromium) - ]; - }; - }; -} \ No newline at end of file +let +inherit (lib.utilMods) mkModule; +in mkModule "desktop" "productivity.obsidian" { +packages = [ pkgs.obsidian ]; +}; diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 45eeb67..2fdbfd3 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -1,19 +1,27 @@ { config, lib, pkgs, ... }: +let + inherit (lib.utilMods) mkModule; +in { imports = [ ./browsers ./communication ./development - # ./gaming + ./gaming ./multiplexers ./productivity ./terminals ./plasma6 - # ./appimage.nix + ./appimage.nix ]; options.modules.desktop = { enable = lib.mkEnableOption "desktop environment"; }; + + # All desktop modules will automatically be wrapped in home-manager configuration + config = lib.mkIf config.modules.desktop.enable { + home-manager.enable = true; + }; }