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

Use of environment.sessionVariables.PATH interferes with system rebuild #472

Open
alrunner4 opened this issue May 10, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@alrunner4
Copy link

alrunner4 commented May 10, 2024

Bug description

Use of environment.sessionVariables to set PATH causes system reconfiguration to fail.

Maybe this isn't the right way to configure PATH any more and this isn't really a bug, but it's not listed in the configuration documentation.

To Reproduce

$ cat /etc/nixos/configuration.nix
{ lib, pkgs, config, modulesPath, ... }:

with lib;
{
  imports = [
    "${modulesPath}/profiles/minimal.nix"
    <nixos-wsl/modules>
  ];

  wsl = {
    enable = true;
    wslConf.automount.root = "/mnt";
    defaultUser = "nixos";
    startMenuLaunchers = true;
  };

  # Enable nix flakes
  nix.package = pkgs.nixFlakes;
  nix.extraOptions = ''
    experimental-features = nix-command flakes
  '';

  system.stateVersion = "22.05";

  environment.sessionVariables = rec {
    HOME = "/mnt/c/users/alexca14";
    PATH = ["${HOME}/bin"];
  };
}
sudo nixos-rebuild switch

Logs

$ sudo nixos-rebuild switch
building Nix...
building the system configuration...
error: The option `environment.variables.PATH' is defined multiple times while it's expected to be unique.

       Definition values:
       - In `/nix/var/nix/profiles/per-user/root/channels/nixos-wsl/modules/systemd/native':
           [
             "$PATH"
           ]
       - In `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/config/shells-environment.nix': "/mnt/c/users/alexca14/bin"
       Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions.
(use '--show-trace' to show detailed location information)

WSL version

WSL version: 2.1.5.0
Kernel version: 5.15.146.1-2
WSLg version: 1.0.60
MSRDC version: 1.2.5105
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.4291
shasum -a 256 nixos-wsl.tar.gz
3893395087de58cc68ed1181ecf8cdaa06aac677c9665c2ff696901ab2096898
@alrunner4 alrunner4 added the bug Something isn't working label May 10, 2024
@alrunner4 alrunner4 changed the title Use of wsl.environment.sessionVariables.PATH interferes with system rebuild Use of lib.environment.sessionVariables.PATH interferes with system rebuild May 10, 2024
@alrunner4 alrunner4 changed the title Use of lib.environment.sessionVariables.PATH interferes with system rebuild Use of environment.sessionVariables.PATH interferes with system rebuild May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant