Convert home-manager to flakes

Instead of calling the home manager directly in the user's list, we add
a command for the user to invoke "hms" and have their environment setup
in the way that Greg likes.
This commit is contained in:
Greg Hellings
2022-08-02 01:50:50 -05:00
parent 8c69ccd3b2
commit 78704b5c88
10 changed files with 95 additions and 19 deletions
+4
View File
@@ -8,4 +8,8 @@ self: super:
xonsh = super.xonsh.overridePythonAttrs (old: rec{
propagatedBuildInputs = old.propagatedBuildInputs ++ [ self.xonsh-direnv ];
});
hms = super.callPackage ./hms.nix {
pkgs = self.pkgs;
};
}
+20
View File
@@ -0,0 +1,20 @@
{ pkgs, ... }:
pkgs.writeShellScriptBin "hms" ''
set -eo pipefail
# Build different targets with GUI or not
if [ -z "$DISPLAY" ]; then
target="nogui"
else
target="gui"
fi
# Build and switch
echo "Building $(uname -m)-$target"
dest=$(mktemp -d)
pushd "$dest" > /dev/null
nix build --impure /etc/nixos#homeConfigurations.$(uname -m)-$target.activationPackage
./result/activate
popd > /dev/null
rm -r "$dest"
''