home-manager: add target to generated configuration

When we detect that the installation is on a non-NixOS GNU/Linux
distribution then we enable the generic Linux module.
This commit is contained in:
Robert Helgesson 2022-09-23 10:16:23 +02:00
parent f17819f4f1
commit f2f010e8ab
No known key found for this signature in database
GPG Key ID: 36BDAA14C2797E89
1 changed files with 7 additions and 1 deletions

View File

@ -36,6 +36,12 @@ in runCommand "home-manager-install" {
xdgVars="$xdgVars xdg.stateHome = \"$XDG_STATE_HOME\";$nl"
fi
if [[ $OSTYPE == linux-* && ! -e /etc/NIXOS ]]; then
target=$'\n targets.genericLinux.enable = true;\n'
else
target=""
fi
mkdir -p "$(dirname "$confFile")"
cat > $confFile <<EOF
{ config, pkgs, ... }:
@ -58,7 +64,7 @@ in runCommand "home-manager-install" {
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}
$target}
EOF
fi