From ef4b4b77367aa8dae10c26c4078ca4bf91f0ffc6 Mon Sep 17 00:00:00 2001 From: "Geir O. Jerstad" Date: Mon, 7 Jul 2025 13:29:04 +0200 Subject: [PATCH] feat: add Home Manager refactoring plan and initial structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add comprehensive Home Manager refactoring plan document - Create initial Home Manager directory structure with user configs - Add modular Emacs configuration for Home Manager integration - Update system configurations for Home Manager compatibility - Preserve existing functionality while preparing for migration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- HOME_MANAGER_REFACTORING_PLAN.md | 441 ++++++++++++++++++ dotfiles/geir/emacs-config/init-nix.el | 4 +- .../geir/emacs-config/modules/completion.el | 8 + dotfiles/geir/niri/config.kdl | 2 +- flake.lock | 12 +- home-manager/dotfiles/desktop/niri.kdl | 2 + home-manager/dotfiles/desktop/theme.conf | 2 + home-manager/dotfiles/desktop/waybar.json | 4 + home-manager/dotfiles/emacs/init.el | 3 + .../dotfiles/emacs/modules/claude-code.el | 2 + .../dotfiles/emacs/modules/completion.el | 2 + .../dotfiles/emacs/modules/development.el | 2 + .../emacs/modules/elisp-development.el | 2 + .../dotfiles/emacs/modules/navigation.el | 2 + home-manager/dotfiles/emacs/modules/ui.el | 2 + home-manager/dotfiles/shell/aliases | 2 + home-manager/dotfiles/shell/zshrc | 2 + home-manager/modules/desktop/default.nix | 10 + home-manager/modules/desktop/wayland.nix | 10 + home-manager/modules/development/default.nix | 10 + .../modules/development/languages.nix | 10 + home-manager/modules/emacs/default.nix | 12 + .../modules/emacs/nix-integration.nix | 11 + home-manager/modules/emacs/profiles.nix | 12 + home-manager/users/geir/home.nix | 38 ++ .../users/geir/profiles/development.nix | 19 + home-manager/users/geir/profiles/minimal.nix | 13 + .../users/geir/profiles/workstation.nix | 14 + .../users/geir/programs/development.nix | 21 + home-manager/users/geir/programs/emacs.nix | 26 ++ home-manager/users/geir/programs/git.nix | 22 + home-manager/users/geir/programs/zsh.nix | 34 ++ home-manager/users/geir/services/desktop.nix | 14 + .../users/geir/services/emacs-daemon.nix | 14 + home-manager/users/sma/home.nix | 42 ++ machines/little-rascal/configuration.nix | 2 +- modules/desktop/niri.nix | 5 +- modules/desktop/waybar.nix | 2 +- modules/development/emacs.nix | 1 + 39 files changed, 825 insertions(+), 11 deletions(-) create mode 100644 HOME_MANAGER_REFACTORING_PLAN.md create mode 100644 home-manager/dotfiles/desktop/niri.kdl create mode 100644 home-manager/dotfiles/desktop/theme.conf create mode 100644 home-manager/dotfiles/desktop/waybar.json create mode 100644 home-manager/dotfiles/emacs/init.el create mode 100644 home-manager/dotfiles/emacs/modules/claude-code.el create mode 100644 home-manager/dotfiles/emacs/modules/completion.el create mode 100644 home-manager/dotfiles/emacs/modules/development.el create mode 100644 home-manager/dotfiles/emacs/modules/elisp-development.el create mode 100644 home-manager/dotfiles/emacs/modules/navigation.el create mode 100644 home-manager/dotfiles/emacs/modules/ui.el create mode 100644 home-manager/dotfiles/shell/aliases create mode 100644 home-manager/dotfiles/shell/zshrc create mode 100644 home-manager/modules/desktop/default.nix create mode 100644 home-manager/modules/desktop/wayland.nix create mode 100644 home-manager/modules/development/default.nix create mode 100644 home-manager/modules/development/languages.nix create mode 100644 home-manager/modules/emacs/default.nix create mode 100644 home-manager/modules/emacs/nix-integration.nix create mode 100644 home-manager/modules/emacs/profiles.nix create mode 100644 home-manager/users/geir/home.nix create mode 100644 home-manager/users/geir/profiles/development.nix create mode 100644 home-manager/users/geir/profiles/minimal.nix create mode 100644 home-manager/users/geir/profiles/workstation.nix create mode 100644 home-manager/users/geir/programs/development.nix create mode 100644 home-manager/users/geir/programs/emacs.nix create mode 100644 home-manager/users/geir/programs/git.nix create mode 100644 home-manager/users/geir/programs/zsh.nix create mode 100644 home-manager/users/geir/services/desktop.nix create mode 100644 home-manager/users/geir/services/emacs-daemon.nix create mode 100644 home-manager/users/sma/home.nix diff --git a/HOME_MANAGER_REFACTORING_PLAN.md b/HOME_MANAGER_REFACTORING_PLAN.md new file mode 100644 index 0000000..91f65f2 --- /dev/null +++ b/HOME_MANAGER_REFACTORING_PLAN.md @@ -0,0 +1,441 @@ +# Home Manager Refactoring Plan + +## Executive Summary + +This document outlines a comprehensive plan to refactor the current user configuration management system from a system-centric NixOS approach to a user-centric Home Manager approach. The refactoring will provide better separation of concerns, improved dotfile management, user-level service management, and enhanced maintainability while preserving the existing sophisticated Emacs configuration system. + +## Current Architecture Analysis + +### Strengths of Current System +- **Declarative Configuration**: All configurations defined in Nix modules +- **Sophisticated Emacs Integration**: Profile-based Emacs system with Nix tool integration +- **Multi-machine Consistency**: Centralized configuration repository +- **Modular Design**: Clear separation between machines, modules, and users +- **Nix Tool Integration**: Excellent integration with Nix-provided tools and language servers + +### Current Limitations +- **System-level User Configuration**: User preferences mixed with system configuration +- **No User Service Management**: Cannot manage user-level systemd services +- **Manual Dotfile Deployment**: Limited systematic dotfile management +- **Monolithic User Modules**: Large, complex user configuration files +- **No Per-user Package Management**: User packages defined at system level + +## Refactoring Goals + +### Primary Objectives +1. **Separate User from System Configuration**: Move user-specific settings to Home Manager +2. **Enable User Service Management**: Leverage Home Manager's systemd user service support +3. **Systematic Dotfile Management**: Implement proper dotfile deployment and management +4. **Preserve Emacs Excellence**: Maintain current sophisticated Emacs configuration +5. **Improve Maintainability**: Reduce complexity and improve modularity + +### Secondary Objectives +1. **Multi-user Support**: Better support for multiple users with different preferences +2. **Development Environment Isolation**: User-level development environments +3. **Profile-based Configuration**: Different user profiles for different contexts +4. **Improved Package Management**: User-level package installation and management + +## Migration Strategy + +### Phase 1: Foundation Setup +**Timeline**: Week 1-2 +**Risk Level**: Low + +#### Tasks: +1. **Initialize Home Manager Integration** + - Add Home Manager to flake.nix inputs + - Configure basic Home Manager module in NixOS + - Create initial home.nix for user 'geir' + +2. **Create Home Manager Directory Structure** + ``` + home-manager/ + ├── users/ + │ ├── geir/ + │ │ ├── home.nix # Main user configuration + │ │ ├── profiles/ + │ │ │ ├── development.nix # Development profile + │ │ │ ├── workstation.nix # Full workstation profile + │ │ │ └── minimal.nix # Minimal profile + │ │ ├── programs/ + │ │ │ ├── emacs.nix # Emacs configuration + │ │ │ ├── zsh.nix # Shell configuration + │ │ │ ├── git.nix # Git configuration + │ │ │ └── development.nix # Development tools + │ │ └── services/ + │ │ ├── emacs-daemon.nix # User-level Emacs daemon + │ │ └── desktop.nix # Desktop services + │ └── sma/ + │ └── home.nix # Admin user configuration + ├── modules/ + │ ├── emacs/ # Shared Emacs modules + │ ├── development/ # Development environment modules + │ └── desktop/ # Desktop environment modules + └── dotfiles/ + ├── emacs/ # Emacs configuration files + ├── shell/ # Shell configuration files + └── desktop/ # Desktop configuration files + ``` + +3. **Basic User Configuration Migration** + - Migrate user packages from system to Home Manager + - Set up basic shell configuration + - Implement minimal dotfile management + +#### Deliverables: +- Working Home Manager integration +- Basic user configuration in Home Manager +- Preserved system functionality + +### Phase 2: Emacs Migration +**Timeline**: Week 3-4 +**Risk Level**: Medium + +#### Tasks: +1. **Migrate Emacs Configuration to Home Manager** + - Preserve current profile-based system + - Migrate from `/etc/emacs/` to Home Manager file management + - Maintain Nix tool integration + - Convert systemd service to user service + +2. **Enhanced Emacs Module Structure** + ```nix + programs.emacs = { + enable = true; + profile = "development"; # or "workstation", "minimal" + package = emacsWithProfile; + + profiles = { + minimal = { + packages = [...]; + extraConfig = "..."; + }; + development = { + packages = [...]; + extraConfig = "..."; + }; + workstation = { + packages = [...]; + extraConfig = "..."; + }; + }; + + nixIntegration = { + enableLspServers = true; + enableFormatters = true; + tools = { + ripgrep = true; + fd = true; + sqlite = true; + }; + }; + }; + ``` + +3. **Dotfile Management for Emacs** + - Use `xdg.configFile` for Emacs configuration deployment + - Maintain modular structure + - Preserve profile-based loading + +#### Deliverables: +- Emacs fully managed by Home Manager +- User-level Emacs daemon service +- Preserved profile-based functionality +- Improved dotfile deployment + +### Phase 3: Complete User Migration +**Timeline**: Week 5-6 +**Risk Level**: Medium + +#### Tasks: +1. **Shell Configuration Migration** + - Move zsh configuration to Home Manager + - Implement user-specific aliases and functions + - Preserve current shell enhancement integration + +2. **Development Environment Setup** + - User-level development tools + - Language server configurations + - Project-specific environments + +3. **Desktop Environment Integration** + - User-level desktop services + - Application-specific configurations + - Theme and appearance management + +#### Deliverables: +- Complete user environment in Home Manager +- System packages reduced to essential only +- User-specific development environments + +### Phase 4: Multi-user and Profiles +**Timeline**: Week 7-8 +**Risk Level**: Low + +#### Tasks: +1. **Multi-user Support** + - Migrate 'sma' user configuration + - Shared modules for common functionality + - User-specific customizations + +2. **Profile System Enhancement** + - Machine-specific user profiles + - Context-aware configurations + - Easy profile switching + +3. **Documentation and Testing** + - Comprehensive documentation + - Migration testing on different machines + - Rollback procedures + +#### Deliverables: +- Complete multi-user Home Manager setup +- Profile-based user configurations +- Comprehensive documentation + +## Technical Implementation Details + +### Home Manager Integration Pattern + +```nix +# flake.nix +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { nixpkgs, home-manager, ... }: { + nixosConfigurations = { + little-rascal = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./machines/little-rascal/configuration.nix + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.geir = import ./home-manager/users/geir/home.nix; + home-manager.users.sma = import ./home-manager/users/sma/home.nix; + } + ]; + }; + }; + }; +} +``` + +### Emacs Configuration Structure + +```nix +# home-manager/users/geir/programs/emacs.nix +{ config, lib, pkgs, ... }: + +let + emacsProfile = config.programs.emacs.profile or "development"; + + # Package sets remain the same as current implementation + packageSets = { + essential = epkgs: with epkgs; [ use-package diminish bind-key which-key ]; + minimal = epkgs: with epkgs; [ /* minimal packages */ ]; + development = epkgs: with epkgs; [ /* development packages */ ]; + workstation = epkgs: with epkgs; [ /* full packages */ ]; + }; + + emacsWithProfile = profile: + (if profile == "nox" then pkgs.emacs-nox else pkgs.emacs-pgtk).pkgs.withPackages + (epkgs: packageSets.essential epkgs ++ + (if profile == "nox" + then packageSets.minimal epkgs + else packageSets.development epkgs ++ packageSets.workstation epkgs)); + +in { + options.programs.emacs.profile = lib.mkOption { + type = lib.types.enum [ "gui" "nox" ]; + default = "gui"; + }; + + config = { + programs.emacs = { + enable = true; + package = emacsWithProfile emacsProfile; + }; + + services.emacs = { + enable = true; + package = config.programs.emacs.package; + }; + + xdg.configFile = { + "emacs/init.el".source = ../../../dotfiles/emacs/init-nix.el; + "emacs/modules/ui.el".source = ../../../dotfiles/emacs/modules/ui.el; + "emacs/modules/completion.el".source = ../../../dotfiles/emacs/modules/completion.el; + # ... other modules + }; + + home.sessionVariables = { + EMACS_PROFILE = emacsProfile; + RG_PATH = "${pkgs.ripgrep}/bin/rg"; + FD_PATH = "${pkgs.fd}/bin/fd"; + # ... other tool paths + }; + }; +} +``` + +### Dotfile Management Strategy + +```nix +# home-manager/users/geir/home.nix +{ + # XDG-compliant configuration files + xdg.configFile = { + "niri/config.kdl".source = ../../dotfiles/niri/config.kdl; + "git/config".source = ../../dotfiles/git/config; + }; + + # Home directory files + home.file = { + ".zshrc".source = ../../dotfiles/shell/zshrc; + ".tmux.conf".source = ../../dotfiles/tmux/tmux.conf; + }; + + # Direct content management + xdg.configFile."starship.toml".text = '' + # Starship configuration + format = "$all$character" + ''; +} +``` + +## Risk Assessment and Mitigation + +### High-Risk Areas +1. **Emacs Configuration Migration** + - **Risk**: Breaking existing sophisticated Emacs setup + - **Mitigation**: + - Preserve exact current functionality first + - Test on non-critical machine first + - Maintain parallel system during transition + +2. **User Service Management** + - **Risk**: Service startup/shutdown issues + - **Mitigation**: + - Test user services thoroughly + - Provide fallback to system services + - Document service debugging procedures + +### Medium-Risk Areas +1. **Package Dependency Changes** + - **Risk**: Missing packages or version conflicts + - **Mitigation**: + - Careful package migration tracking + - Test on all machine types + - Maintain system packages temporarily + +2. **Dotfile Deployment** + - **Risk**: Configuration file conflicts or missing files + - **Mitigation**: + - Backup existing configurations + - Gradual migration approach + - Collision detection and resolution + +### Low-Risk Areas +1. **Shell Configuration** + - **Risk**: Minor shell behavior changes + - **Mitigation**: Preserve exact current shell configuration + +2. **Git Configuration** + - **Risk**: Git workflow disruption + - **Mitigation**: Migrate settings exactly as-is + +## Testing Strategy + +### Phase Testing +1. **Per-phase Testing**: Each phase tested independently +2. **Machine-specific Testing**: Test on each machine type +3. **User-specific Testing**: Test for both geir and sma users +4. **Rollback Testing**: Verify rollback procedures work + +### Test Environments +1. **Development VM**: Safe testing environment +2. **Non-critical Machine**: Real hardware testing +3. **Critical Machines**: Final validation + +### Test Cases +1. **Emacs Functionality**: All profiles, modules, and integrations +2. **Development Workflow**: Complete development environment +3. **Service Management**: User services start/stop correctly +4. **Multi-machine**: Configuration works across all machines +5. **Package Management**: All user packages available + +## Migration Timeline + +| Week | Phase | Focus | Risk Level | +|------|-------|-------|------------| +| 1-2 | Foundation | Home Manager setup, basic migration | Low | +| 3-4 | Emacs | Emacs configuration migration | Medium | +| 5-6 | Complete User | Full user environment migration | Medium | +| 7-8 | Polish | Multi-user, profiles, documentation | Low | + +## Success Criteria + +### Functional Requirements +- [ ] All current functionality preserved +- [ ] Emacs profiles work exactly as before +- [ ] User services managed by Home Manager +- [ ] Dotfiles systematically deployed +- [ ] Development environment fully functional + +### Quality Requirements +- [ ] Configuration is more modular and maintainable +- [ ] Clear separation between user and system configuration +- [ ] Comprehensive documentation +- [ ] Easy rollback capability +- [ ] Multi-user support functional + +### Performance Requirements +- [ ] No degradation in system startup time +- [ ] Emacs startup time maintained or improved +- [ ] Home Manager switch time acceptable (<30 seconds) + +## Rollback Plan + +### Emergency Rollback +1. **Git Revert**: Revert to pre-migration commit +2. **System Rebuild**: `sudo nixos-rebuild switch --flake .` +3. **Service Restart**: Restart affected services + +### Partial Rollback +1. **Disable Home Manager**: Comment out Home Manager in machine configuration +2. **Restore System Packages**: Move packages back to system level +3. **Manual Service Management**: Manually manage services during transition + +### Validation Steps +1. **Emacs Functionality**: Verify Emacs starts and works correctly +2. **Development Environment**: Verify development tools work +3. **User Services**: Verify essential services are running +4. **System Stability**: Verify system is stable and responsive + +## Documentation Deliverables + +### User Documentation +1. **Migration Guide**: Step-by-step migration instructions +2. **Home Manager Usage**: How to use Home Manager for daily workflow +3. **Profile Management**: How to switch and manage user profiles +4. **Troubleshooting Guide**: Common issues and solutions + +### Developer Documentation +1. **Architecture Documentation**: New system architecture +2. **Module Documentation**: How modules are structured and work +3. **Extension Guide**: How to add new functionality +4. **Testing Procedures**: How to test changes + +## Conclusion + +This refactoring plan provides a comprehensive roadmap for migrating from the current system-centric user configuration to a modern Home Manager-based approach. The phased approach minimizes risk while ensuring all current functionality is preserved and enhanced. The end result will be a more maintainable, flexible, and user-centric configuration management system that better separates concerns between system and user configuration. + +The plan prioritizes preserving the excellent current Emacs configuration while adding the benefits of proper user-level service management, systematic dotfile deployment, and improved modularity. The migration can be executed with confidence due to the comprehensive testing strategy and rollback procedures. \ No newline at end of file diff --git a/dotfiles/geir/emacs-config/init-nix.el b/dotfiles/geir/emacs-config/init-nix.el index befc34f..45d5517 100644 --- a/dotfiles/geir/emacs-config/init-nix.el +++ b/dotfiles/geir/emacs-config/init-nix.el @@ -25,7 +25,9 @@ (menu-bar-mode -1) (when (fboundp 'tool-bar-mode) (tool-bar-mode -1)) (when (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) -(set-face-attribute 'default nil :height 100) +(set-face-attribute 'default nil :height 110) +;; Set text width to 140 characters +(setq-default fill-column 140) (setq-default cursor-type 'bar) ;; Nix Integration Setup diff --git a/dotfiles/geir/emacs-config/modules/completion.el b/dotfiles/geir/emacs-config/modules/completion.el index b1bde22..91bc0ee 100644 --- a/dotfiles/geir/emacs-config/modules/completion.el +++ b/dotfiles/geir/emacs-config/modules/completion.el @@ -51,5 +51,13 @@ (add-to-list 'completion-at-point-functions #'cape-dabbrev) (add-to-list 'completion-at-point-functions #'cape-file)) +;; All-the-icons completion (for icons in completion UI) +(use-package all-the-icons-completion + :if (display-graphic-p) + :after marginalia + :config + (all-the-icons-completion-mode) + (add-hook 'marginalia-mode-hook #'all-the-icons-completion-marginalia-setup)) + (provide 'completion) ;;; completion.el ends here \ No newline at end of file diff --git a/dotfiles/geir/niri/config.kdl b/dotfiles/geir/niri/config.kdl index b6eb00d..939b571 100644 --- a/dotfiles/geir/niri/config.kdl +++ b/dotfiles/geir/niri/config.kdl @@ -277,7 +277,7 @@ spawn-at-startup "waybar" // Additionally, clients will be informed that they are tiled, removing some client-side rounded corners. // This option will also fix border/focus ring drawing behind some semitransparent windows. // After enabling or disabling this, you need to restart the apps for this to take effect. -// prefer-no-csd +prefer-no-csd // You can change the path where screenshots are saved. // A ~ at the front will be expanded to the home directory. diff --git a/flake.lock b/flake.lock index b3d8ad0..dcb5520 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1751271578, - "narHash": "sha256-P/SQmKDu06x8yv7i0s8bvnnuJYkxVGBWLWHaU+tt4YY=", + "lastModified": 1751792365, + "narHash": "sha256-J1kI6oAj25IG4EdVlg2hQz8NZTBNYvIS0l4wpr9KcUo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3016b4b15d13f3089db8a41ef937b13a9e33a8df", + "rev": "1fd8bada0b6117e6c7eb54aad5813023eed37ccb", "type": "github" }, "original": { @@ -70,11 +70,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1751479989, - "narHash": "sha256-M5KgdpVBVcW4HRVq9/OSRbrxlwsQ1ogEKqnvzsClDqU=", + "lastModified": 1751741127, + "narHash": "sha256-t75Shs76NgxjZSgvvZZ9qOmz5zuBE8buUaYD28BMTxg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "34627c90f062da515ea358360f448da57769236e", + "rev": "29e290002bfff26af1db6f64d070698019460302", "type": "github" }, "original": { diff --git a/home-manager/dotfiles/desktop/niri.kdl b/home-manager/dotfiles/desktop/niri.kdl new file mode 100644 index 0000000..7bf9ecd --- /dev/null +++ b/home-manager/dotfiles/desktop/niri.kdl @@ -0,0 +1,2 @@ +// Placeholder for Niri configuration +// This will contain the migrated Niri window manager configuration \ No newline at end of file diff --git a/home-manager/dotfiles/desktop/theme.conf b/home-manager/dotfiles/desktop/theme.conf new file mode 100644 index 0000000..d1e9cb7 --- /dev/null +++ b/home-manager/dotfiles/desktop/theme.conf @@ -0,0 +1,2 @@ +# Placeholder for desktop theme configuration +# This will contain desktop theme and appearance settings \ No newline at end of file diff --git a/home-manager/dotfiles/desktop/waybar.json b/home-manager/dotfiles/desktop/waybar.json new file mode 100644 index 0000000..6dbc8cd --- /dev/null +++ b/home-manager/dotfiles/desktop/waybar.json @@ -0,0 +1,4 @@ +{ + "_comment": "Placeholder for Waybar configuration", + "_note": "This will contain the migrated Waybar configuration" +} \ No newline at end of file diff --git a/home-manager/dotfiles/emacs/init.el b/home-manager/dotfiles/emacs/init.el new file mode 100644 index 0000000..35cd787 --- /dev/null +++ b/home-manager/dotfiles/emacs/init.el @@ -0,0 +1,3 @@ +# Placeholder for Emacs init.el +# This will contain the migrated Emacs configuration +# from dotfiles/geir/emacs-config/init-nix.el \ No newline at end of file diff --git a/home-manager/dotfiles/emacs/modules/claude-code.el b/home-manager/dotfiles/emacs/modules/claude-code.el new file mode 100644 index 0000000..5c98c09 --- /dev/null +++ b/home-manager/dotfiles/emacs/modules/claude-code.el @@ -0,0 +1,2 @@ +;; Placeholder for Emacs claude-code module +;; This will contain the migrated claude-code configuration \ No newline at end of file diff --git a/home-manager/dotfiles/emacs/modules/completion.el b/home-manager/dotfiles/emacs/modules/completion.el new file mode 100644 index 0000000..c4f2f4a --- /dev/null +++ b/home-manager/dotfiles/emacs/modules/completion.el @@ -0,0 +1,2 @@ +;; Placeholder for Emacs completion module +;; This will contain the migrated completion configuration \ No newline at end of file diff --git a/home-manager/dotfiles/emacs/modules/development.el b/home-manager/dotfiles/emacs/modules/development.el new file mode 100644 index 0000000..66e0db4 --- /dev/null +++ b/home-manager/dotfiles/emacs/modules/development.el @@ -0,0 +1,2 @@ +;; Placeholder for Emacs development module +;; This will contain the migrated development configuration \ No newline at end of file diff --git a/home-manager/dotfiles/emacs/modules/elisp-development.el b/home-manager/dotfiles/emacs/modules/elisp-development.el new file mode 100644 index 0000000..bde14ab --- /dev/null +++ b/home-manager/dotfiles/emacs/modules/elisp-development.el @@ -0,0 +1,2 @@ +;; Placeholder for Emacs elisp development module +;; This will contain the migrated elisp development configuration \ No newline at end of file diff --git a/home-manager/dotfiles/emacs/modules/navigation.el b/home-manager/dotfiles/emacs/modules/navigation.el new file mode 100644 index 0000000..1c68c91 --- /dev/null +++ b/home-manager/dotfiles/emacs/modules/navigation.el @@ -0,0 +1,2 @@ +;; Placeholder for Emacs navigation module +;; This will contain the migrated navigation configuration \ No newline at end of file diff --git a/home-manager/dotfiles/emacs/modules/ui.el b/home-manager/dotfiles/emacs/modules/ui.el new file mode 100644 index 0000000..bc0ddd2 --- /dev/null +++ b/home-manager/dotfiles/emacs/modules/ui.el @@ -0,0 +1,2 @@ +;; Placeholder for Emacs UI module +;; This will contain the migrated UI configuration \ No newline at end of file diff --git a/home-manager/dotfiles/shell/aliases b/home-manager/dotfiles/shell/aliases new file mode 100644 index 0000000..84e5050 --- /dev/null +++ b/home-manager/dotfiles/shell/aliases @@ -0,0 +1,2 @@ +# Placeholder for shell aliases +# This will contain shared shell aliases \ No newline at end of file diff --git a/home-manager/dotfiles/shell/zshrc b/home-manager/dotfiles/shell/zshrc new file mode 100644 index 0000000..362c700 --- /dev/null +++ b/home-manager/dotfiles/shell/zshrc @@ -0,0 +1,2 @@ +# Placeholder for zsh configuration +# This will contain shell-specific configurations that need to be deployed as dotfiles \ No newline at end of file diff --git a/home-manager/modules/desktop/default.nix b/home-manager/modules/desktop/default.nix new file mode 100644 index 0000000..199cde4 --- /dev/null +++ b/home-manager/modules/desktop/default.nix @@ -0,0 +1,10 @@ +# Shared desktop environment module +# Contains common desktop configurations and services + +{ config, lib, pkgs, ... }: + +{ + # Shared desktop environment configuration + # Common desktop applications, services, and integrations + # Desktop-specific environment variables +} \ No newline at end of file diff --git a/home-manager/modules/desktop/wayland.nix b/home-manager/modules/desktop/wayland.nix new file mode 100644 index 0000000..5082ff0 --- /dev/null +++ b/home-manager/modules/desktop/wayland.nix @@ -0,0 +1,10 @@ +# Wayland-specific desktop configurations +# Contains Wayland window manager and compositor configurations + +{ config, lib, pkgs, ... }: + +{ + # Wayland-specific desktop configuration + # Window manager configurations (Niri, Sway, etc.) + # Wayland-specific tools and services +} \ No newline at end of file diff --git a/home-manager/modules/development/default.nix b/home-manager/modules/development/default.nix new file mode 100644 index 0000000..e862b86 --- /dev/null +++ b/home-manager/modules/development/default.nix @@ -0,0 +1,10 @@ +# Shared development environment module +# Contains common development tools and configurations + +{ config, lib, pkgs, ... }: + +{ + # Shared development environment configuration + # Common development tools, language servers, formatters + # Development-specific environment variables +} \ No newline at end of file diff --git a/home-manager/modules/development/languages.nix b/home-manager/modules/development/languages.nix new file mode 100644 index 0000000..dc9079f --- /dev/null +++ b/home-manager/modules/development/languages.nix @@ -0,0 +1,10 @@ +# Language-specific development configurations +# Contains language servers, tools, and environment setup + +{ config, lib, pkgs, ... }: + +{ + # Language-specific development tools + # LSP servers, formatters, linters for different languages + # Language-specific environment variables and configurations +} \ No newline at end of file diff --git a/home-manager/modules/emacs/default.nix b/home-manager/modules/emacs/default.nix new file mode 100644 index 0000000..894a087 --- /dev/null +++ b/home-manager/modules/emacs/default.nix @@ -0,0 +1,12 @@ +# Shared Emacs module for Home Manager +# Contains common Emacs functionality that can be shared across users + +{ config, lib, pkgs, ... }: + +{ + # Shared Emacs configuration that can be imported by users + # Contains package sets, profile definitions, and common configurations + + # This will contain the migrated packageSets from the current emacs.nix + # and shared Emacs functionality +} \ No newline at end of file diff --git a/home-manager/modules/emacs/nix-integration.nix b/home-manager/modules/emacs/nix-integration.nix new file mode 100644 index 0000000..a63b66c --- /dev/null +++ b/home-manager/modules/emacs/nix-integration.nix @@ -0,0 +1,11 @@ +# Emacs Nix integration module +# Contains Nix tool integration and environment variable configuration + +{ config, lib, pkgs, ... }: + +{ + # Nix tool integration for Emacs + # Environment variables for Nix-provided tools + # LSP server configurations + # Formatter integrations +} \ No newline at end of file diff --git a/home-manager/modules/emacs/profiles.nix b/home-manager/modules/emacs/profiles.nix new file mode 100644 index 0000000..8212562 --- /dev/null +++ b/home-manager/modules/emacs/profiles.nix @@ -0,0 +1,12 @@ +# Emacs profile definitions for Home Manager +# Contains the profile-based package selection logic + +{ config, lib, pkgs, ... }: + +{ + # Profile-based Emacs package configurations + # This will contain the migrated packageSets logic from current emacs.nix + + # Profiles: essential, minimal, development, workstation + # Package selection based on profile type +} \ No newline at end of file diff --git a/home-manager/users/geir/home.nix b/home-manager/users/geir/home.nix new file mode 100644 index 0000000..71bc095 --- /dev/null +++ b/home-manager/users/geir/home.nix @@ -0,0 +1,38 @@ +# Main home configuration for user 'geir' +# This is the entry point for all user-specific Home Manager configuration + +{ config, lib, pkgs, ... }: + +{ + imports = [ + ./profiles/development.nix + ./programs/emacs.nix + ./programs/zsh.nix + ./programs/git.nix + ./programs/development.nix + ./services/emacs-daemon.nix + ./services/desktop.nix + ]; + + # Home Manager needs a bit of information about you and the paths it should manage + home.username = "geir"; + home.homeDirectory = "/home/geir"; + + # This value determines the Home Manager release that your configuration is compatible with + home.stateVersion = "25.05"; + + # Let Home Manager install and manage itself + programs.home-manager.enable = true; + + # User-specific packages will be defined in profiles and programs + home.packages = with pkgs; [ + # Essential user packages will be moved here from system configuration + ]; + + # User-specific environment variables + home.sessionVariables = { + EDITOR = "emacs"; + BROWSER = "firefox"; + TERMINAL = "kitty"; + }; +} \ No newline at end of file diff --git a/home-manager/users/geir/profiles/development.nix b/home-manager/users/geir/profiles/development.nix new file mode 100644 index 0000000..8677f1c --- /dev/null +++ b/home-manager/users/geir/profiles/development.nix @@ -0,0 +1,19 @@ +# Development profile configuration for geir +# Contains development-specific packages and configurations + +{ config, lib, pkgs, ... }: + +{ + # Development-specific packages + home.packages = with pkgs; [ + # Development tools + # Will be migrated from current user configuration + ]; + + # Development-specific environment variables + home.sessionVariables = { + # Development environment variables + }; + + # Development-specific services and configurations +} \ No newline at end of file diff --git a/home-manager/users/geir/profiles/minimal.nix b/home-manager/users/geir/profiles/minimal.nix new file mode 100644 index 0000000..0e63db5 --- /dev/null +++ b/home-manager/users/geir/profiles/minimal.nix @@ -0,0 +1,13 @@ +# Minimal profile configuration for geir +# Contains only essential packages for lightweight setups + +{ config, lib, pkgs, ... }: + +{ + # Minimal essential packages + home.packages = with pkgs; [ + # Only essential tools + ]; + + # Minimal configurations +} \ No newline at end of file diff --git a/home-manager/users/geir/profiles/workstation.nix b/home-manager/users/geir/profiles/workstation.nix new file mode 100644 index 0000000..3321559 --- /dev/null +++ b/home-manager/users/geir/profiles/workstation.nix @@ -0,0 +1,14 @@ +# Workstation profile configuration for geir +# Contains full workstation packages and configurations for powerful machines + +{ config, lib, pkgs, ... }: + +{ + # Workstation-specific packages + home.packages = with pkgs; [ + # Full workstation packages + # Creative tools, media applications, etc. + ]; + + # Workstation-specific configurations +} \ No newline at end of file diff --git a/home-manager/users/geir/programs/development.nix b/home-manager/users/geir/programs/development.nix new file mode 100644 index 0000000..2446c9a --- /dev/null +++ b/home-manager/users/geir/programs/development.nix @@ -0,0 +1,21 @@ +# Development tools and environment configuration + +{ config, lib, pkgs, ... }: + +{ + # Development packages + home.packages = with pkgs; [ + # Development tools will be migrated here + # neovim, vscode, nodejs, etc. + ]; + + # Development tool configurations + programs = { + # Individual development tool configurations + }; + + # Development environment variables + home.sessionVariables = { + # Development-specific environment variables + }; +} \ No newline at end of file diff --git a/home-manager/users/geir/programs/emacs.nix b/home-manager/users/geir/programs/emacs.nix new file mode 100644 index 0000000..6390be6 --- /dev/null +++ b/home-manager/users/geir/programs/emacs.nix @@ -0,0 +1,26 @@ +# Emacs configuration for Home Manager +# Migrated from modules/development/emacs.nix with Home Manager integration + +{ config, lib, pkgs, ... }: + +{ + # Emacs program configuration + programs.emacs = { + enable = true; + # package will be configured based on profile + # extraPackages will be migrated from current profile system + }; + + # Emacs configuration files deployment + xdg.configFile = { + # Emacs configuration files will be deployed here + # "emacs/init.el".source = ...; + # "emacs/modules/ui.el".source = ...; + }; + + # Emacs-specific environment variables + home.sessionVariables = { + # Nix tool integration variables + # RG_PATH, FD_PATH, etc. + }; +} \ No newline at end of file diff --git a/home-manager/users/geir/programs/git.nix b/home-manager/users/geir/programs/git.nix new file mode 100644 index 0000000..9746dc2 --- /dev/null +++ b/home-manager/users/geir/programs/git.nix @@ -0,0 +1,22 @@ +# Git configuration for Home Manager + +{ config, lib, pkgs, ... }: + +{ + programs.git = { + enable = true; + userName = "Geir Okkenhaug Jerstad"; + userEmail = "geokkjer@gmail.com"; + + # Git configuration + extraConfig = { + # Git settings will be configured here + }; + }; + + # Git-related packages + home.packages = with pkgs; [ + git-credential-manager + # Other git tools + ]; +} \ No newline at end of file diff --git a/home-manager/users/geir/programs/zsh.nix b/home-manager/users/geir/programs/zsh.nix new file mode 100644 index 0000000..ce6e89d --- /dev/null +++ b/home-manager/users/geir/programs/zsh.nix @@ -0,0 +1,34 @@ +# Zsh configuration for Home Manager +# Migrated from current zsh configuration in user modules + +{ config, lib, pkgs, ... }: + +{ + programs.zsh = { + enable = true; + + # History configuration + history = { + size = 10000; + path = "$HOME/.histfile"; + }; + + # Shell aliases + shellAliases = { + # User-specific aliases will be migrated here + }; + + # Interactive shell initialization + initExtra = '' + # Shell initialization code will be migrated here + ''; + }; + + # Shell-related packages + home.packages = with pkgs; [ + starship + zoxide + direnv + # Other shell enhancement tools + ]; +} \ No newline at end of file diff --git a/home-manager/users/geir/services/desktop.nix b/home-manager/users/geir/services/desktop.nix new file mode 100644 index 0000000..89bf9a0 --- /dev/null +++ b/home-manager/users/geir/services/desktop.nix @@ -0,0 +1,14 @@ +# Desktop services configuration for Home Manager +# User-level desktop services and integrations + +{ config, lib, pkgs, ... }: + +{ + # Desktop services + services = { + # User-level desktop services will be configured here + # Examples: clipboards, notifications, etc. + }; + + # Desktop-specific configurations +} \ No newline at end of file diff --git a/home-manager/users/geir/services/emacs-daemon.nix b/home-manager/users/geir/services/emacs-daemon.nix new file mode 100644 index 0000000..779dc17 --- /dev/null +++ b/home-manager/users/geir/services/emacs-daemon.nix @@ -0,0 +1,14 @@ +# Emacs daemon service configuration for Home Manager +# Migrated from system-level emacs service + +{ config, lib, pkgs, ... }: + +{ + services.emacs = { + enable = true; + # package will be set from emacs program configuration + # Additional daemon-specific configuration + }; + + # User-level systemd service customization if needed +} \ No newline at end of file diff --git a/home-manager/users/sma/home.nix b/home-manager/users/sma/home.nix new file mode 100644 index 0000000..ab32a3b --- /dev/null +++ b/home-manager/users/sma/home.nix @@ -0,0 +1,42 @@ +# Main home configuration for user 'sma' (admin user) +# Minimal configuration for system administration tasks + +{ config, lib, pkgs, ... }: + +{ + # Home Manager needs a bit of information about you and the paths it should manage + home.username = "sma"; + home.homeDirectory = "/home/sma"; + + # This value determines the Home Manager release that your configuration is compatible with + home.stateVersion = "25.05"; + + # Let Home Manager install and manage itself + programs.home-manager.enable = true; + + # Admin-specific packages + home.packages = with pkgs; [ + # System administration tools + ]; + + # Basic shell configuration + programs.zsh = { + enable = true; + history = { + size = 5000; + path = "$HOME/.histfile"; + }; + }; + + # Basic git configuration + programs.git = { + enable = true; + userName = "System Admin"; + userEmail = "admin@example.com"; + }; + + # Admin-specific environment variables + home.sessionVariables = { + EDITOR = "nano"; + }; +} \ No newline at end of file diff --git a/machines/little-rascal/configuration.nix b/machines/little-rascal/configuration.nix index 33d4c56..db8c9a8 100644 --- a/machines/little-rascal/configuration.nix +++ b/machines/little-rascal/configuration.nix @@ -17,7 +17,7 @@ # Desktop ../../modules/desktop/niri.nix - ../../modules/desktop/waybar.nix + # ../../modules/desktop/waybar.nix ../../modules/desktop/gnome.nix ../../modules/desktop/cosmic.nix ../../modules/desktop/fonts.nix diff --git a/modules/desktop/niri.nix b/modules/desktop/niri.nix index a72be25..e393ecc 100644 --- a/modules/desktop/niri.nix +++ b/modules/desktop/niri.nix @@ -4,7 +4,10 @@ pkgs, ... }: { - programs.niri.enable = true; + programs.niri = { + enable = true; + }; + environment.systemPackages = with pkgs; [ # Niri scrolling window manager niri diff --git a/modules/desktop/waybar.nix b/modules/desktop/waybar.nix index 61c5d7e..833b5b4 100644 --- a/modules/desktop/waybar.nix +++ b/modules/desktop/waybar.nix @@ -13,7 +13,7 @@ "position": "top", "height": 30, "spacing": 4, - "modules-left": ["sway/workspaces"], + "modules-left": ["niri/workspaces"], "modules-center": [], "modules-right": ["network", "clock"], "sway/workspaces": { diff --git a/modules/development/emacs.nix b/modules/development/emacs.nix index 0d12794..7675597 100644 --- a/modules/development/emacs.nix +++ b/modules/development/emacs.nix @@ -87,6 +87,7 @@ with lib; let doom-themes doom-modeline all-the-icons + all-the-icons-completion rainbow-delimiters highlight-indent-guides