Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config optimizations #7

Open
florian-sanders opened this issue Nov 1, 2024 · 0 comments
Open

Config optimizations #7

florian-sanders opened this issue Nov 1, 2024 · 0 comments
Assignees

Comments

@florian-sanders
Copy link
Collaborator

Suggested by Claude, these are fairly good actually:

Looking at your configuration, here are several potential improvements:

  1. Options Organization: In modules/default.nix, you could move the options to a separate options.nix file since they're becoming quite substantial. This would make the module structure cleaner.

  2. Desktop Environment Specialisations: Instead of using lib.mkIf for each desktop environment, you could use specialisations like you did for nvidia/intel. This would make switching between desktop environments more efficient.

  3. Hardware Configuration: The hardware configurations for pro and perso are very similar. You could create a common base hardware configuration and only keep the specific differences in the individual files.

  4. Shell Aliases: In user/shell-aliases.nix, you could create a function to generate the update/rebuild aliases based on the user specs, as mentioned in your TODO comment:

let
  mkUpdateAliases = username: {
    "upd-${username}" = "nix flake update --flake '${nixosConfigPath}'; nixos-rebuild switch --upgrade --flake '${nixosConfigPath}#${username}' --use-remote-sudo";
    "rebuild-${username}" = "nixos-rebuild switch --flake '${nixosConfigPath}#${username}' --use-remote-sudo";
  };
in
  1. Types for User Configuration: Your user configuration could benefit from more structured types:
types.submodule {
  options = {
    name = lib.mkOption {
      type = types.str;
      description = "Username";
    };
    email = lib.mkOption {
      type = types.str;
      description = "User email";
    };
    homeDirectory = lib.mkOption {
      type = types.path;
      description = "User home directory";
    };
  };
}
  1. Development Environment: The dev-env.nix could be split into separate modules for different development environments (web, system, etc.).

  2. Security Module: Your security settings could be organized by concern (ssh, gpg, clamav, etc.) in separate files.

  3. Editor Configurations: The editor configurations (neovim, helix, zed) could be moved to a separate editors subdirectory in packages.

  4. Package Categories: In packages/default.nix, you could organize packages into more specific categories using separate files:

{
  imports = [
    ./browsers.nix
    ./development.nix
    ./communication.nix
    ./utilities.nix
    ./editors.nix
    # etc.
  ];
}
  1. System Configuration: The system configuration could be organized into more specific domains, similar to the packages suggestion above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants