Skip to content

fix home.activation.checkLinkTargets#19

Closed
dermetfan wants to merge 1 commit intonix-community:masterfrom
dermetfan:fix/checkLinkTargets
Closed

fix home.activation.checkLinkTargets#19
dermetfan wants to merge 1 commit intonix-community:masterfrom
dermetfan:fix/checkLinkTargets

Conversation

@dermetfan
Copy link
Collaborator

@dermetfan dermetfan commented Jul 6, 2017

Problem

We resolve symlinks from inside /nix/store/HASH-home-manager-files into the nix store as /nix/store/HASH-DRVNAME which does not match the pattern.

This happened to me because I pull in some repos in via home.file. The home-manager-files derivation links to the repo's derivation in the nix store. For example:

let nanorcs = fetchFromGitHub {
  owner = "scopatz";
  repo = "nanorc";}; in [
  {
    target = ".nano";
    source = nanorcs;
  }
  {
    target = ".nanorc";
    source = "${nanorcs}/nanorc";
  }
]

Solution

Call readlink without -e to obtain only the first redirection from ~ to /nix/store/HASH-home-manager-files.

Why a PR?

I am unsure why you used -e but saw you using it consistently. Is there an edge case I failed to notice?

@dermetfan dermetfan added the bug label Jul 6, 2017
@dermetfan dermetfan force-pushed the fix/checkLinkTargets branch from 39dd63c to b54ad70 Compare July 6, 2017 16:58
======================================

Problem
-------

We resolve symlinks from inside `/nix/store/HASH-home-manager-files` into the nix store as `/nix/store/HASH-DRVNAME` which does not match the pattern.

This happened to me because I pull in some repos in via `home.file`. The `home-manager-files` derivation links to the repo's derivation in the nix store. For example:

    let nanorcs = fetchFromGitHub {
      owner = "scopatz";
      repo = "nanorc";
      …
    }; in [
      {
        target = ".nano";
        source = nanorcs;
      }
      {
        target = ".nanorc";
        source = "${nanorcs}/nanorc";
      }
    ]

Solution
--------

Call `readlink` without `-e` to obtain only the first redirection from `~` to `/nix/store/HASH-home-manager-files`.
@dermetfan dermetfan requested a review from rycee July 6, 2017 17:01
@dermetfan dermetfan force-pushed the fix/checkLinkTargets branch from b54ad70 to ec348e0 Compare July 6, 2017 20:04
@rycee
Copy link
Member

rycee commented Jul 7, 2017

Thanks for reporting :-) I think this might be a copy-paste mistake. I know that -e is required elsewhere but it may not be the case here. I will have a closer look tomorrow (and also your other PR).

@rycee
Copy link
Member

rycee commented Jul 7, 2017

Yeah, in this case it definitely should be without -e. The problem only manifests itself when using home.file.blah.source = ./foo; where ./foo is a directory. Rebased this into master in cb569c5. Many thanks for catching and fixing this bug!

@rycee rycee closed this Jul 7, 2017
@dermetfan dermetfan deleted the fix/checkLinkTargets branch July 10, 2017 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants