Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Error installing file '.config/micro/settings.json' outside $HOME #5175

Open
2 tasks done
terxw opened this issue Mar 24, 2024 · 0 comments
Open
2 tasks done

bug: Error installing file '.config/micro/settings.json' outside $HOME #5175

terxw opened this issue Mar 24, 2024 · 0 comments
Assignees
Labels
bug triage Issues or feature request that have not been triaged yet

Comments

@terxw
Copy link

terxw commented Mar 24, 2024

Are you following the right branch?

  • My Nixpkgs and Home Manager versions are in sync

Is there an existing issue for this?

  • I have searched the existing issues

Issue description

I am trying to symlink my dotfiles to ~/.config folder, but I cannot get any combination of paths, strings, relative string path, absolute string path to workt with mkOutOfStoreSymlink.

I am using 23.11, flakes, impure

Example config:

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

    {
    home = {
      file = {
        "./config/micro".source = config.lib.file.mkOutOfStoreSymlink "/home/kangus/.dotfiles/.config/micro";
      };
    };
}

Invoking command:

home-manager --show-trace switch --flake ~/nixos-config/flake_wimpy#kangus@nixos_vm  --impure'```

I get error:

error: builder for '/nix/store/5qqm9gyw7b5m35087wg31kdadgkyady1-home-manager-files.drv' failed with exit code 1;
last 1 log lines:

   > Error installing file '.config/micro/settings.json' outside $HOME

   For full logs, run 'nix log /nix/store/5qqm9gyw7b5m35087wg31kdadgkyady1-home-manager-files.drv'.error: 1 dependencies of derivation '/nix/store/jm5pghaxg8lvyn032ibhsgjx9ky9dyib-home-manager-generation.drv' failed to build```

Troubleshooting I tried:

https://www.reddit.com/r/NixOS/comments/197wnuy/help_making_a_direct_symlink_from_config_repo_to/

#2085

Here are variants I tried:

    enable = true;
    configFile."micro".source  = config.lib.file.mkOutOfStoreSymlink "/home/kangus/.dotfiles/.config";
  };
home = {
  file.".config/micro" = {
    source = config.lib.file.mkOutOfStoreSymlink "/home/kangus/.dotfiles/.config/micro";
    recursive = true;
  };
# according to reddit forum its wrong because it translates to /home/kangus/home/kangus/.config/micro
home = {
  file."${config.home.homeDirectory}/.config/micro" = {
    source = config.lib.file.mkOutOfStoreSymlink ""${config.home.homeDirectory}/.dotfiles/.config/micro";
    recursive = true;
  };
# in flakes the target cannot be nix path type, but string, but probably same error as above, e.g.  /home/kangus/home/kangus/.config/micro

home = {
    file.".config/micro" = {
      source = config.lib.file.mkOutOfStoreSymlink  "${builtins.toString config.xdg.configHome}/.dotfiles/.config/micro";
      recursive = true;
    };
};

EDIT:
This variant doesnt throw error, but creates read only link to store with two levels of indirection

home = {
    file.".config/micro" = {
      source = "/home/kangus/.dotfiles/.config/micro";
      recursive = true;
    };
};
lt ~/.config/micro
settings.json -> /nix/store/k1gx5nvlwc9b724aqyiv0y30vhv5n9yr-home-manager-files/.config/micro/settings.json
lt /nix/store/k1gx5nvlwc9b724aqyiv0y30vhv5n9yr-home-manager-files/.config/micro/settings.json
lrwxrwxrwx     - root  1 jan  1970   /nix/store/k1gx5nvlwc9b724aqyiv0y30vhv5n9yr-home-manager-files/.config/micro/settings.json -> /nix/store/fsw43b48qhqdkm363qdpnkrbp8wzr0b4-hm_micro/settings.json
lt /nix/store/fsw43b48qhqdkm363qdpnkrbp8wzr0b4-hm_micro/settings.json
Permissions Size User Date Modified Name
.r--r--r--   664 root  1 jan  1970   /nix/store/fsw43b48qhqdkm363qdpnkrbp8wzr0b4-hm_micro/settings.json    

Maintainer CC

No response

System information

- system: `"x86_64-linux"`
 - host os: `Linux 6.6.18, NixOS, 23.11 (Tapir), 23.11.20240301.79baff8`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - nixpkgs: `/nix/store/3i3rncs75fid9hwai5p2nvwc4ngdnia7-source`
@terxw terxw added bug triage Issues or feature request that have not been triaged yet labels Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triage Issues or feature request that have not been triaged yet
Projects
None yet
Development

No branches or pull requests

4 participants