Home-manager: don't know how to build these paths

Hello! I’m getting the following output for sudo systemctl status home-manager.service:

× home-manager-tornax.service - Home Manager environment for tornax
     Loaded: loaded (/etc/systemd/system/home-manager-tornax.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Tue 2023-06-13 01:41:16 CEST; 3min 42s ago
    Process: 3093 ExecStart=/nix/store/0yiywc863z3ipsmm3aj3k9y2k8cf6s7i-hm-setup-env /nix/store/fnx8g82cg35g3iv69ckl25svq3is8p7p-home-manager-generation (code=exited, status=1/FAILURE)
   Main PID: 3093 (code=exited, status=1/FAILURE)
         IP: 0B in, 0B out
        CPU: 137ms

Jun 13 01:41:16 pc hm-activate-tornax[3093]: Activating writeBoundary
Jun 13 01:41:16 pc hm-activate-tornax[3093]: Activating installPackages
Jun 13 01:41:16 pc hm-activate-tornax[3093]: Activating linkGeneration
Jun 13 01:41:16 pc hm-activate-tornax[3093]: Creating profile generation 1
Jun 13 01:41:16 pc hm-activate-tornax[3121]: don't know how to build these paths:
Jun 13 01:41:16 pc hm-activate-tornax[3121]:   /nix/store/fnx8g82cg35g3iv69ckl25svq3is8p7p-home-manager-generation
Jun 13 01:41:16 pc hm-activate-tornax[3121]: error: build of '/nix/store/fnx8g82cg35g3iv69ckl25svq3is8p7p-home-manager-generation' failed
Jun 13 01:41:16 pc systemd[1]: home-manager-tornax.service: Main process exited, code=exited, status=1/FAILURE
Jun 13 01:41:16 pc systemd[1]: home-manager-tornax.service: Failed with result 'exit-code'.
Jun 13 01:41:16 pc systemd[1]: Failed to start Home Manager environment for tornax.

I think the important lines are:

Jun 13 01:41:16 pc hm-activate-tornax[3121]: don't know how to build these paths:
Jun 13 01:41:16 pc hm-activate-tornax[3121]:   /nix/store/fnx8g82cg35g3iv69ckl25svq3is8p7p-home-manager-generation
Jun 13 01:41:16 pc hm-activate-tornax[3121]: error: build of '/nix/store/fnx8g82cg35g3iv69ckl25svq3is8p7p-home-manager-generation' failed

May I ask what I need to do, to fix this?

1 Like

I would expect that path being built already when you build your system. Maybe you missed something when setting HM up. Can you please share your configuration?

Can you please share your configuration?

Sure!
flake.nix

{
  description = "NixOS configuration";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    home-manager.url = "github:nix-community/home-manager";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = { nixpkgs, home-manager, ... }: {
    nixosConfigurations = {
      pc = nixpkgs.lib.nixosSystem {
        system = "x86_64-linux";
        modules = [
          ./nixos-configurations/pc
          home-manager.nixosModules.home-manager
          {
            home-manager = {
              useGlobalPkgs = true;
              useUserPackages = true;
              users.tornax = import ./home/default.nix;
            };
          }
        ];
      };
    };
  };
}

nixos-configurations/pc/default.nix

{config, pkgs, lib, ...}:
{
  environment.systemPackages = with pkgs; [
    i3
    neovim
    alacritty
    git
    google-chrome
  ];

  nix.settings.experimental-features = ["nix-command" "flakes"];

  nixpkgs.config.allowUnfree = true;

  imports = [
    ./hardware-configuration.nix
  ];

  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.loader.efi.efiSysMountPoint = "/boot/efi";

  networking.hostName = "pc";
  time.timeZone = "Europe/Berlin";

  i18n = {
    defaultLocale = "en_US.UTF-8";
    extraLocaleSettings = {
      LC_ADDRESS = "de_DE.UTF-8";
      LC_IDENTIFICATION = "de_DE.UTF-8";
      LC_MEASUREMENT = "de_DE.UTF-8";
      LC_MONETARY = "de_DE.UTF-8";
      LC_NAME = "de_DE.UTF-8";
      LC_NUMERIC = "de_DE.UTF-8";
      LC_PAPER = "de_DE.UTF-8";
      LC_TELEPHONE = "de_DE.UTF-8";
      LC_TIME = "de_DE.UTF-8";
    };
  };

  # Enable the X11 windowing system.
  services.xserver = {
    enable = true;

    desktopManager = {
      xterm.enable = false;
    };

    displayManager = {
      defaultSession = "none+i3";
    };

    windowManager.i3 = {
      enable = true;
      extraPackages = with pkgs; [
        dmenu
      ];
    };
  };

  # Configure keymap in X11
  services.xserver = {
    layout = "de";
    xkbVariant = "bone";
  };

  # Configure console keymap
  console.keyMap = "bone";

  # Enable CUPS to print documents.
  services.printing.enable = true;

  # Enable sound with pipewire.
  sound.enable = true;
  hardware.pulseaudio.enable = false;
  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
  };

  users.defaultUserShell = pkgs.zsh;
  programs.zsh.enable = true;
  users.users.tornax = {
    isNormalUser = true;
    description = "tornax";
    extraGroups = [ "wheel" "audio" "lp" "video"];
  };

  services.xserver.displayManager.autoLogin.enable = true;
  services.xserver.displayManager.autoLogin.user = "tornax";

  services.openssh.enable = true;

  system.stateVersion = "22.11"; # Did you read the comment?
}

home/default.nix

{ config, pkgs, lib, ... }:
{
  home = {
    # packages = import ./packages.nix {
    #   inherit pkgs;
    # };
    # sessionPath = import ./session_paths.nix;

    keyboard = {
      layout = "de";
      variant = "bone";
    };

    language.base = "en";
    stateVersion = "23.05";
  };

  # programs = import ./programs.nix {inherit lib;};
  # services = import ./services.nix;
}

This home-manager.service doesn’t fail, if I comment out the following line in flake.nix:

# users.tornax = import ./home/default.nix;

As this is a flake, can you just link to a repo that we can clone? As this is now, this is not buildable, as the hardware configuration is missing.

Of course not, as you removed the necessity to run the service…

I quickly created a repository:

After having built your configuration, I can’t find a reference to that string in it.

All I can find is the user activation service refering to /nix/store/dinnl5sa8bml8vb6hzzhbvjn838kvrf3-home-manager-generation, if searching for the name rather than the hash.

That path does exist after the build of the system generation for me.

Can you still reproduce the problem with the repository and does the error messages path mentioned change?

I just cloned my repository again and executed sudo nixos-rebuild switch --flake .#pc but with a different hash(?) now (like yours):

Jun 13 09:49:07 pc hm-activate-tornax[15400]: don't know how to build these paths:
Jun 13 09:49:07 pc hm-activate-tornax[15400]:   /nix/store/dinnl5sa8bml8vb6hzzhbvjn838kvrf3-home-manager-generation
Jun 13 09:49:07 pc hm-activate-tornax[15400]: error: build of '/nix/store/dinnl5sa8bml8vb6hzzhbvjn838kvrf3-home-manager-generation' failed

The path /nix/store/dinnl5sa8bml8vb6hzzhbvjn838kvrf3-home-manager-generation also exists on my machine. At least I can cd into it.

Okay, based on the output, it seems as if you are already running the activation script, which lives in the path from the error…

This is basically already from $thatPath/activate…

So my guess here is, that either nix profile or nix-env are somehow misbehaving here.

Should I try to reinstall nixos from scratch again?

Check other things first.

May I ask how I can find that out?

nix (Nix) 2.15.1

That’s the whole output with home-manager.nixosModules.home-manager.home-manager.verbose = true and sudo nixos-rebuild switch --flake .#pc:

warning: Git tree '/home/tornax/Programming/projects/dotfiles' is dirty
building the system configuration...
warning: Git tree '/home/tornax/Programming/projects/dotfiles' is dirty
activating the configuration...
setting up /etc...
reloading user units for tornax...
setting up tmpfiles
warning: the following units failed: home-manager-tornax.service

× home-manager-tornax.service - Home Manager environment for tornax
     Loaded: loaded (/etc/systemd/system/home-manager-tornax.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Tue 2023-06-13 10:05:09 CEST; 59ms ago
    Process: 21093 ExecStart=/nix/store/0yiywc863z3ipsmm3aj3k9y2k8cf6s7i-hm-setup-env /nix/store/dinnl5sa8bml8vb6hzzhbvjn838kvrf3-home-manager-generation (code=exited, status=1/FAILURE)
   Main PID: 21093 (code=exited, status=1/FAILURE)
         IP: 0B in, 0B out
        CPU: 132ms

Jun 13 10:05:09 pc hm-activate-tornax[21093]: Activating writeBoundary
Jun 13 10:05:09 pc hm-activate-tornax[21093]: Activating installPackages
Jun 13 10:05:09 pc hm-activate-tornax[21093]: Activating linkGeneration
Jun 13 10:05:09 pc hm-activate-tornax[21093]: Creating profile generation 1
Jun 13 10:05:09 pc hm-activate-tornax[21130]: don't know how to build these paths:
Jun 13 10:05:09 pc hm-activate-tornax[21130]:   /nix/store/dinnl5sa8bml8vb6hzzhbvjn838kvrf3-home-manager-generation
Jun 13 10:05:09 pc hm-activate-tornax[21130]: error: build of '/nix/store/dinnl5sa8bml8vb6hzzhbvjn838kvrf3-home-manager-generation' failed
Jun 13 10:05:09 pc systemd[1]: home-manager-tornax.service: Main process exited, code=exited, status=1/FAILURE
Jun 13 10:05:09 pc systemd[1]: home-manager-tornax.service: Failed with result 'exit-code'.
Jun 13 10:05:09 pc systemd[1]: Failed to start Home Manager environment for tornax.
warning: error(s) occurred while switching to the new configuration

I don’t know if that helps, but as you can see from my hardware-configuration.nix, I have an extra home partition for my /home/tornax. I was using Arch before I tried out NixOS and I had nix on my arch system installed (and also used it a bit). So maybe there are some directories in my home-directory which were set up by nix from my arch-system which are maybe causing this issue?

As I have seen weird profile related bugs with 2.14 or newer, can you please try to rebuild using nix.package = pkgs.nixVersions.nix_2_13;?

With nix.package = pkgs.nixVersions.nix_2_13; in my nixos-configurations/pc/default.nix and the output

nix (Nix) 2.13.3

with nix --version, home-manager keeps failing to start.

ok, I think that I’ll try to reinstall everything. Like with a fresh home directory as well. If it still doesn’t work, then I’ll have to drop nixos then I think…

however, I’m really appreciating for your time and help! Thank you! c(^-^)c

yay! I don’t get any errors anymore with the new-install!