From 02ffcdb55ec95d2ef3e15dc802378026fdfe8589 Mon Sep 17 00:00:00 2001 From: Thierry Pouplier Date: Sun, 14 Jun 2026 19:22:27 -0400 Subject: [PATCH] feat: add dotfiles submodule and home-manager config - Add dotfiles repo as submodule in assets/dotfiles/ - Rewrite home.nix with direct file references instead of stow service - Remove old custom dotfiles.nix service (replaced by home-manager) - Clean up services/default.nix import --- .gitmodules | 1 + assets/dotfiles | 1 + modules/nixos/services/default.nix | 1 - modules/nixos/services/dotfiles.nix | 69 ----------------------------- users/gortium/home.nix | 65 ++++++++++++++++++++++++--- 5 files changed, 60 insertions(+), 77 deletions(-) create mode 160000 assets/dotfiles delete mode 100644 modules/nixos/services/dotfiles.nix diff --git a/.gitmodules b/.gitmodules index 684b242..66f7a80 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,4 @@ [submodule "assets/dotfiles"] path = assets/dotfiles url = ssh://git@code.lazyworkhorse.net:2222/gortium/dotfiles.git + branch = master diff --git a/assets/dotfiles b/assets/dotfiles new file mode 160000 index 0000000..8e9204b --- /dev/null +++ b/assets/dotfiles @@ -0,0 +1 @@ +Subproject commit 8e9204bc21c488f3c7a1e60f238bce8c2e4abb06 diff --git a/modules/nixos/services/default.nix b/modules/nixos/services/default.nix index c0d569a..f741778 100644 --- a/modules/nixos/services/default.nix +++ b/modules/nixos/services/default.nix @@ -1,6 +1,5 @@ { imports = [ - ./dotfiles.nix ./systemd ]; } diff --git a/modules/nixos/services/dotfiles.nix b/modules/nixos/services/dotfiles.nix deleted file mode 100644 index b05fbe0..0000000 --- a/modules/nixos/services/dotfiles.nix +++ /dev/null @@ -1,69 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - cfg = config.services.dotfiles; - stowDir = cfg.stowDir; - - # Function to recursively find all files in a directory - findFiles = dir: - let - files = builtins.attrNames (builtins.readDir dir); - in - concatMap (name: - let - path = dir + "/${name}"; - in - if (builtins.typeOf (builtins.readDir path) == "set") - then findFiles path - else [ path ] - ) files; - - # Get a list of all packages (directories) in the stow directory - stowPackages = builtins.attrNames (builtins.readDir stowDir); - - # Create an attribute set where each attribute is a package name - # and the value is a list of files to be linked. - homeManagerLinks = listToAttrs (map (pkg: - let - pkgPath = stowDir + "/${pkg}"; - files = findFiles pkgPath; - in - nameValuePair pkg (map (file: { - source = file; - target = removePrefix (pkgPath + "/") file; - }) files) - ) stowPackages); - -in -{ - options.services.dotfiles = { - enable = mkEnableOption "Enable dotfiles management"; - - stowDir = mkOption { - type = types.path; - description = "The directory where your stow packages are located."; - }; - - user = mkOption { - type = types.str; - description = "The user to manage dotfiles for."; - }; - }; - - config = mkIf cfg.enable { - home-manager.users.${cfg.user} = { - home.file = - let - allFiles = concatLists (attrValues homeManagerLinks); - in - listToAttrs (map (file: - nameValuePair file.target { - source = file.source; - } - ) allFiles); - }; - }; -} - diff --git a/users/gortium/home.nix b/users/gortium/home.nix index 608f95f..affc2e7 100644 --- a/users/gortium/home.nix +++ b/users/gortium/home.nix @@ -1,12 +1,63 @@ -{ pkgs, ... }: { - services.dotfiles = { - enable = true; - stowDir = ../../../assets/dotfiles; - user = "gortium"; - }; +{ pkgs, lib, config, inputs, ... }: +let + dotfiles = ./assets/dotfiles; +in { home.username = "gortium"; home.homeDirectory = "/home/gortium"; - home.stateVersion = "23.11"; # Please change this to your version. + home.stateVersion = "23.11"; programs.home-manager.enable = true; + + home.file = { + # zsh + ".zshrc".source = "${dotfiles}/zsh/.zshrc"; + + # tmux + ".tmux.conf".source = "${dotfiles}/tmux/.tmux.conf"; + + # kitty + ".config/kitty/kitty.conf".source = "${dotfiles}/kitty/.config/kitty/kitty.conf"; + + # nvim + ".config/nvim/init.lua".source = "${dotfiles}/nvim/.config/nvim/init.lua"; + + # starship + ".config/starship.toml".source = "${dotfiles}/starship/.config/starship.toml"; + + # btop + ".config/btop/btop.conf".source = "${dotfiles}/btop/.config/btop/btop.conf"; + + # waybar + ".config/waybar/style.css".source = "${dotfiles}/waybar/.config/waybar/style.css"; + ".config/waybar/config.jsonc".source = "${dotfiles}/waybar/.config/waybar/config.jsonc"; + + # wofi + ".config/wofi/style.css".source = "${dotfiles}/wofi/.config/wofi/style.css"; + ".config/wofi/config".source = "${dotfiles}/wofi/.config/wofi/config"; + + # yazi + ".config/yazi/yazi.toml".source = "${dotfiles}/yazi/.config/yazi/yazi.toml"; + + # hyprland + ".config/hypr/hyprland.conf".source = "${dotfiles}/hypr/.config/hypr/hyprland.conf"; + + # doom emacs + ".config/doom/config.el".source = "${dotfiles}/doom/.config/doom/config.el"; + ".config/doom/init.el".source = "${dotfiles}/doom/.config/doom/init.el"; + ".config/doom/packages.el".source = "${dotfiles}/doom/.config/doom/packages.el"; + }; + + home.packages = with pkgs; [ + # core + git zsh tmux starship + # editors + neovim kitty + # tools + btop yazi ripgrep fd fzf + # wayland + waybar wofi + ]; + + programs.zsh.enable = true; + programs.starship.enable = true; }