starting to simplify

This commit is contained in:
jeirmeister 2024-11-07 10:19:34 -08:00
parent d946126e63
commit 85c474701d
Signed by: jeirmeister
GPG Key ID: 33A40DF62D35C4A7
5 changed files with 65 additions and 103 deletions

View File

@ -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?

View File

@ -9,8 +9,6 @@ in
{ {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
../../modules/system
../../modules/desktop
(jovianNixos + "/modules") (jovianNixos + "/modules")
]; ];
@ -74,7 +72,7 @@ in
sddm = { sddm = {
enable = true; enable = true;
wayland = { wayland = {
enable = true; # Fixed: proper wayland config enable = true; # Fixed: proper wayland config
}; };
}; };
sessionCommands = '' sessionCommands = ''
@ -114,4 +112,4 @@ in
dmidecode dmidecode
binutils binutils
]; ];
} }

View File

@ -1,56 +1,42 @@
{ lib, ... }: let { lib, ... }:
internals = { let
# Helper for creating modules # Helper for creating home-manager modules
mkModuleWithOptions = { mkHmModule = name: module: { config, lib, pkgs, ... }: {
config, config = lib.mkIf (config.modules.${name}.enable or false)
name, (if builtins.isFunction module
moduleConfig, then module { inherit config lib pkgs; }
default ? false, else {
extraOptions ? {}, home-manager.users.${config.user.name} = module;
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);
};
}; };
# Helper for creating desktop/user modules
mkUserModule = category: name: module:
mkHmModule "${category}.${name}" module;
exports = { exports = {
# Function for creating modules.NAME modules, with extra options # Main module creation helper
mkModule' = config: name: extraOptions: moduleConfig: mkModule = category: name: module:
internals.mkModuleWithOptions {inherit config name extraOptions moduleConfig;}; mkUserModule category name (
if builtins.isAttrs module
then { home.packages = module.packages or [ ]; }
else module
);
# Function for creating modules.NAME modules, without extra options # Helpers for enabling/disabling modules
mkModule = config: name: moduleConfig: enable = elems: builtins.listToAttrs (map
exports.mkModule' config name {} moduleConfig; (name: {
inherit name;
value.enable = true;
})
elems);
# Function for creating modules.NAME modules that are enabled by default, with extra options disable = elems: builtins.listToAttrs (map
mkEnabledModule' = config: name: extraOptions: moduleConfig: (name: {
internals.mkModuleWithOptions { inherit name;
inherit config name extraOptions moduleConfig; value.enable = false;
default = true; })
}; elems);
# Function for creating modules.NAME modules that are enabled by default, without extra options
mkEnabledModule = config: name: moduleConfig:
exports.mkEnabledModule' config name {} moduleConfig;
}; };
in exports in
exports

View File

@ -1,20 +1,21 @@
# modules/desktop/browsers/default.nix
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ let
options.modules.desktop.browsers = { inherit (lib.utilMods) mkModule;
home-manager.users.${config.user.name} = { # Use home-manager.users path 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"; # modules/desktop/productivity/obsidian.nix
{ config, lib, pkgs, ... }:
floorp.enable = lib.mkEnableOption "Floorp browser";
chromium.enable = lib.mkEnableOption "Chromium browser";
};
config = lib.mkIf config.modules.desktop.browsers.enable { let
home.packages = with pkgs; [ inherit (lib.utilMods) mkModule;
(lib.mkIf config.modules.desktop.browsers.floorp.enable floorp) in mkModule "desktop" "productivity.obsidian" {
(lib.mkIf config.modules.desktop.browsers.chromium.enable ungoogled-chromium) packages = [ pkgs.obsidian ];
]; };
};
};
}

View File

@ -1,19 +1,27 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let
inherit (lib.utilMods) mkModule;
in
{ {
imports = [ imports = [
./browsers ./browsers
./communication ./communication
./development ./development
# ./gaming ./gaming
./multiplexers ./multiplexers
./productivity ./productivity
./terminals ./terminals
./plasma6 ./plasma6
# ./appimage.nix ./appimage.nix
]; ];
options.modules.desktop = { options.modules.desktop = {
enable = lib.mkEnableOption "desktop environment"; 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;
};
} }