Home-manager: `home.file.<name>.source` cannot begin with a dot

Created on 21 Feb 2017  Ā·  2Comments  Ā·  Source: nix-community/home-manager

To reproduce:

# ~/.nixpkgs/home.nix
home.file.test.source = ./.test;
āÆ home-manager build
error: while evaluating the attribute ā€˜installPhase’ of the derivation ā€˜home-manager-generation’ at /home/dermetfan/.nixpkgs/home-manager/modules/home-environment.nix:333:11:
while evaluating the attribute ā€˜installPhase’ of the derivation ā€˜home-manager-files’ at /home/dermetfan/.nixpkgs/home-manager/modules/home-environment.nix:319:11:
while evaluating anonymous function at /nix/store/7k3jyxd0y4c6hnl4ixs1yz1d1pvplgf1-nixos-17.03pre101636.183eeb3/nixos/lib/attrsets.nix:224:10, called from undefined position:
while evaluating anonymous function at /home/dermetfan/.nixpkgs/home-manager/modules/home-environment.nix:326:37, called from /nix/store/7k3jyxd0y4c6hnl4ixs1yz1d1pvplgf1-nixos-17.03pre101636.183eeb3/nixos/lib/attrsets.nix:224:16:
illegal name: ā€˜.test’

The evaluation error occurs when ${value.source} is accessed.

My workaround for now is home.file.".<name>" = ./dotfiles/<name>;.

Most helpful comment

@rycee @dermetfan check out this workaround: https://github.com/NixOS/nix/issues/912#issuecomment-412244869

All 2 comments

Interesting discovery! Unfortunately there is not much I can do to allow files whose name start with ., this is a hard limit within Nix itself.

The message can, however, be a bit more intuitive. With the commit above the configuration

{
  home.file.".test".source = ./.test;
}

will now yield the error message

rycee@beta:~$ home-manager -f .nixpkgs/beta.nix -I nixpkgs=/home/rycee/devel/nixpkgs-stable-rycee build
error: 
Failed assertions:
- Source file names must not start with '.': /home/rycee/devel/nixos-config/user/.test
(use ā€˜--show-trace’ to show detailed location information)
rycee@beta (āœ— 1):~$

Thank you for the report!

@rycee @dermetfan check out this workaround: https://github.com/NixOS/nix/issues/912#issuecomment-412244869

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stites picture stites  Ā·  3Comments

wedens picture wedens  Ā·  6Comments

lovesegfault picture lovesegfault  Ā·  6Comments

pmiddend picture pmiddend  Ā·  3Comments

sigwinch28 picture sigwinch28  Ā·  7Comments