nixpkgs
nixpkgs copied to clipboard
nixos/system-environment: additional environments generation fails
Describe the bug
Some environments are not added to /etc/set-environment
file
Steps To Reproduce
Steps to reproduce the behavior: Add to configuration:
programs.ssh.startAgent = true;
or
programs.gnupg.agent = {
enable = true;
pinentryFlavor = "tty";
enableSSHSupport = true;
};
Expected behavior
The following content is added to the /etc/set-environment
file:
if [ -z "$SSH_AUTH_SOCK" -a -n "$XDG_RUNTIME_DIR" ]; then
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent"
fi
or
if [ -z "$SSH_AUTH_SOCK" ]; then
export SSH_AUTH_SOCK=$(/nix/store/rwgxk8ayk7qadzlcx4pry4bq5pb81yxw-gnupg-2.3.6/bin/gpgconf --list-dirs agent-ssh-socket)
fi
Current behavior
Only these variables are written:
...
# Wrappers override other bin directories.
export PATH="/run/wrappers/bin:$PATH"
unset ASPELL_CONF
for i in /run/current-system/sw /nix/var/nix/profiles/default /etc/profiles/per-user/$USER $HOME/.nix-profile ; do
if [ -d "$i/lib/aspell" ]; then
export ASPELL_CONF="dict-dir $i/lib/aspell"
fi
done
export NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/$USER"
export NIX_PROFILES="/run/current-system/sw /nix/var/nix/profiles/default /etc/profiles/per-user/$USER $HOME/.nix-profile"
...
Temporary solution
Apply this patch:
diff --cc nixos/modules/programs/environment.nix
index a448727be77,a448727be77..33edce7b104
--- a/nixos/modules/programs/environment.nix
+++ b/nixos/modules/programs/environment.nix
@@@ -49,18 -49,18 +49,17 @@@ i
environment.pathsToLink = [ "/lib/gtk-2.0" "/lib/gtk-3.0" "/lib/gtk-4.0" ];
-- environment.extraInit =
-- ''
-- unset ASPELL_CONF
-- for i in ${concatStringsSep " " (reverseList cfg.profiles)} ; do
-- if [ -d "$i/lib/aspell" ]; then
-- export ASPELL_CONF="dict-dir $i/lib/aspell"
-- fi
-- done
--
-- export NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/$USER"
-- export NIX_PROFILES="${concatStringsSep " " (reverseList cfg.profiles)}"
-- '';
++ environment.extraInit = ''
++ unset ASPELL_CONF
++ for i in ${concatStringsSep " " (reverseList cfg.profiles)} ; do
++ if [ -d "$i/lib/aspell" ]; then
++ export ASPELL_CONF="dict-dir $i/lib/aspell"
++ fi
++ done
++
++ export NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/$USER"
++ export NIX_PROFILES="${concatStringsSep " " (reverseList cfg.profiles)}"
++ '';
};
It is possible that string conversion does not work correctly and some of the content is removing.
cc @SuperSandro2000 @andir @Kreyren
Are you sure you're booting into the right generation?
Might be running into one of the bugs where /boot fills up and adding new boot entries fails without being very obvious in the log. If that's it you can use nix-collect-garbage
then switch again to free up space.
Yes, I forgot to mount the boot partition. Thanks for the help.