Noob question home-manager dotfiles

Hello, i would like to know if it’s possible to install this dotfiles : GitHub - nabakdev/dotfiles: My ArchLinux setup during the system installation ? So i don’t need to config nothing I added every packages he listed into my .nix file like this :

environment.systemPackages = with pkgs; [
#Hyperland
ranger
sweet
swaylock-effects
capitaine-cursors
wofi
waybar
wayland-protocols
wayland-utils
wl-clipboard
wlroots
wlogout
xdg-desktop-portal-hyprland
];

Now i don’t know if it’s possible to install dotfiles during system installation maybe with home-manager ?

Thanks you in advance for any help :slight_smile:

Hello. A newbie here. I use the following using home-manager:
I have my dotfiles stored in a folder hierarchy that exactly copies the home folder hierarchy (~/.config/program/config_file etc.). Therefore, I can just include the whole folder hierarchy like this (apparently referencing ~ path directly does not work, so I use ~/.config/../ instead):

  home = {
    file = {
      ".config/../" = {
        source = ./dotfiles/home;
        recursive = true;
      };
    };

If you have different folder structure or you need to pick only selected configs, you can do the same for each individual folders or files, too.

However, you will have to copy the dotfiles folder to a folder inside your config folder, since it cannot be added as a git submodule, for example (to ensure reproducibility).

2 Likes

Thanks for your help i will do that tomorrow and give some feedback :slight_smile:

I missunderstanding something on your instructions because when my system is booting i have the yellow warning "You’re using an autogenerated config ! (config file : /home/retzx/.config/hypr/hyprland.conf ) so something is wrong on my side

So far i understand i have to copy the dotfiles folder inside the /mnt/etc/nixos right ? So what i do is : sudo cp -r dotfiles /mnt/etc/nixos/ before installing the system

Here is the content of my home.nix :

{ pkgs, config, …}:

{
home.username = “retzx”; #replace user by your username !
home.homeDirectory = “/home/retzx”; # replace user by your username !
home.enableNixpkgsReleaseCheck = false;
home.stateVersion = “23.11”; # To figure this out you can comment out the line and see what version it expected.

programs.home-manager.enable = true;

wayland.windowManager.hyprland = {
systemd.enable = true;
};

home = {
file = {
“.config/…/” = {
source = /mnt/etc/nixos;
recursive = true;
};
“.local/…/” = {
source = /mnt/etc/nixos;
recursive = true;
};
“.screenshots/…/” = {
source = /mnt/etc/nixos;
recursive = true;
};
“.wallpapers/…/” = {
source = /mnt/etc/nixos;
recursive = true;
};
};
};
}

What i’m missing ?

check this issue: Allow populating home.file root with recursive dotfiles source · Issue #3849 · nix-community/home-manager · GitHub

If this workaround does not help I would try to write a systemActivationsScript with a recursive copy comand as a quick and dirty solution…

1 Like

Thanks you !! It worked the solution was to do the same thing as the user “bonsairobo” from Github : home.file.“.config” = {
source = ./home/.config;
recursive = true;
};
home.file.“.gitconfig” = {
source = ./home/.gitconfig;
};
home.file.“.wezterm.lua” = {
source = ./home/.wezterm.lua;
};

Thanks you @Adda for your help :slight_smile:

For those who would like to see the whole config from this user : MyNixOs/configuration.nix at f3fff2969131350966c8c2def7283829c98ddbdd · bonsairobo/MyNixOs · GitHub