nix-community / home-manager

Manage a user environment using Nix [maintainer=@rycee]
https://nix-community.github.io/home-manager/
MIT License
6.72k stars 1.76k forks source link

bug: unexpected '@' #5279

Open MAHDTech opened 5 months ago

MAHDTech commented 5 months ago

Are you following the right branch?

Is there an existing issue for this?

Issue description

Hi,

How can I escape the '@' symbol in the home directory? I've tried single quote and backslash already, is there another character to use?

I'm using home-manager in an environment where the home directories are like this

/home/<username>@<domain>

The error I receive is this

error: syntax error, unexpected '@', expecting end of file

       at «string»:1:14:

            1| /home/<username>@<domain>

The only location I see to have it configured with the '@' is the homeDirectory field.

    configHomeManager = {
      system,
      username,
      ...
    }:
      home-manager.lib.homeManagerConfiguration {
        pkgs = pkgsImportSystem system;

        extraSpecialArgs = {
          inherit inputs;
          inherit system;
        };

        modules = [
          ./home/<username>
          {
            home = {
              homeDirectory = "/home/<username>@<domain>";
              stateVersion = "23.11";
            };
          }
        ];
      };

Maintainer CC

No response

System information

nix-shell -p nix-info --run "nix-info -m"
this path will be fetched (0.00 MiB download, 0.00 MiB unpacked):
  /nix/store/88hr9j7a1r9qrvv7xnfyjmd1ww459krl-nix-info
copying path '/nix/store/88hr9j7a1r9qrvv7xnfyjmd1ww459krl-nix-info' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 6.5.0-27-generic, Ubuntu, 22.04.4 LTS (Jammy Jellyfish), nobuild`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"nixpkgs"`
 - channels(mduncan): `"nixos-23.05-23.05, nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs
IldenH commented 4 months ago

Try adding lib.literalExpression? homeDirectory = lib.literalExpression "/home/<username>@<domain>" It might be preferable to do: homeDirectory = ''/home/<username>@<domain>'' but I don't know if that works.

stale[bot] commented 1 month ago

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

If you are not the original author of the issue

* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

ianepreston commented 1 month ago

@IldenH - not OP but I have the same issue I've tried the following:

Happy to test other approaches if there are other suggestions

ianepreston commented 1 month ago

My error is a little different than the one in the original posting:

error: syntax error, unexpected '@', expecting end of file
       at «string»:1:14:
            1| /home/<user>@<domain>/.local/share/home-manager/news-read-ids
             |              ^

That file's generated as part of a bash script here I believe, so I assume it's something to do about how nix path objects are getting turned into bash string variables that's causing the issue, but I'm out of my depth beyond that.