Setting up home-manager as an arch user

Hello guys,
I’m fresh out of Arch Linux and just installed NixOS from a live graphical iso a few hours ago.

It all went well until I tried to install and configure Sway wm. Once I had followed the official nixos documentation to install sway, I tried to configure it using the default config file sway usually uses at .config/sway/config. The problem is, nixos apparently doesn’t take into account that config file. and as far as I understand, I have to set up home manager for that. So I tried following the wiki to install home-manager, and I get this:
[thomas@nixos:~]$home-manager switch
The program 'home-manager' is not in your PATH. You can make it available in an
ephemeral shell by typing:
nix-shell -p home-manager
which I don’t understand. I tried following the wiki AGAIN but after 2 hours of trying, I finally give up. Please help me. This is how I tried setting up home-manager in my configuration.nix:

{ config, pkgs, lib, ... }:

let
home-manager = builtins.fetchTarball https://github.com/nix-community/home-manager/archive/release-26.05.tar.gz;
in

{
imports =
[
./hardware-configuration.nix
(import "${home-manager}/nixos")
];
and
home-manager.users.thomas = { pkgs, ... }: {
home.packages = [ pkgs.fastfetch ];
home.stateVersion = "26.05";
};
sway was simply setup like this:
programs.sway = {
enable =true;
wrapperFeatures.gtk =true;
};

At this hour, I have no more energy to RTFM. and I have work I need to do tomorrow so I’d like to make my setup work.

Thank you!

Don’t run the home-manager command. Just rebuild your NixOS config.

already did that multiple times

(fixed formatting)

I don’t see any HM config for sway, you need to set that under wayland.windowManager.sway in your home-manager.users.thomas block. Or you can write config without HM in .config/sway/config by hand, that should work.

thx but it didn’t work. I don’t think I’m ready for NixOS just yet. Too new for me. Gonna go back to Arch for the time being.
Thanks anyways !

1 Like