aboutsummaryrefslogtreecommitdiff
path: root/home-manager/install.nix
diff options
context:
space:
mode:
authorRobert Helgesson <robert@rycee.net>2020-05-24 18:08:49 +0200
committerRobert Helgesson <robert@rycee.net>2020-05-26 00:28:59 +0200
commitb95ad632010bf1d135f7585c590f51f6c3dc2896 (patch)
treec7f7090407e18759912e7f4372976bc31d96151d /home-manager/install.nix
parent2ed978eb79af72a7696ea61df07102d38134517f (diff)
Deprecate use of `builtins.getEnv`
This removes the use of the non-deterministic function `builtins.getEnv` for state version ≥ 20.09. PR #1269
Diffstat (limited to '')
-rw-r--r--home-manager/install.nix19
1 files changed, 18 insertions, 1 deletions
diff --git a/home-manager/install.nix b/home-manager/install.nix
index 92de17bd6bf..87252730e6f 100644
--- a/home-manager/install.nix
+++ b/home-manager/install.nix
@@ -12,6 +12,18 @@ runCommand "home-manager-install" {
echo
echo "Creating initial Home Manager configuration..."
+ nl=$'\n'
+ xdgVars=""
+ if [[ -v XDG_CACHE_HOME && $XDG_CACHE_HOME != "$HOME/.cache" ]]; then
+ xdgVars="$xdgVars xdg.cacheHome = \"$XDG_CACHE_HOME\";$nl"
+ fi
+ if [[ -v XDG_CONFIG_HOME && $XDG_CONFIG_HOME != "$HOME/.config" ]]; then
+ xdgVars="$xdgVars xdg.configHome = \"$XDG_CONFIG_HOME\";$nl"
+ fi
+ if [[ -v XDG_DATA_HOME && $XDG_DATA_HOME != "$HOME/.local/share" ]]; then
+ xdgVars="$xdgVars xdg.dataHome = \"$XDG_DATA_HOME\";$nl"
+ fi
+
mkdir -p "$(dirname "$confFile")"
cat > $confFile <<EOF
{ config, pkgs, ... }:
@@ -20,6 +32,11 @@ runCommand "home-manager-install" {
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
+ # Home Manager needs a bit of information about you and the
+ # paths it should manage.
+ home.username = "$USER";
+ home.homeDirectory = "$HOME";
+ $xdgVars
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
@@ -28,7 +45,7 @@ runCommand "home-manager-install" {
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
- home.stateVersion = "20.03";
+ home.stateVersion = "20.09";
}
EOF
fi