Skip to content

Commit

Permalink
user at home
Browse files Browse the repository at this point in the history
  • Loading branch information
bketelsen committed Apr 13, 2023
1 parent b87b1fd commit 35f0e1c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion examples/home/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
let
# TODO: Change username
myUserName = "john";
myHostname = "myhost";
in
{
legacyPackages.homeConfigurations.${myUserName} =
legacyPackages.homeConfigurations."${myUserName}@${myHostname}" =
self.nixos-flake.lib.mkHomeConfiguration
pkgs
({ pkgs, ... }: {
Expand Down
5 changes: 3 additions & 2 deletions examples/home/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
set -euo pipefail

USER="john"
HOSTNAME="myhost"

set -x
nix build \
Expand All @@ -11,13 +12,13 @@ nix build \
.#update
nix build \
--override-input nixos-flake ../.. \
.#homeConfigurations.${USER}.activationPackage
.#homeConfigurations.${USER}@${HOSTNAME}.activationPackage
ls result/
rm -f result

# Actually run 'home-manager switch' and look for installed programs.
mkdir tmp
HOME=$(pwd)/tmp/home USER=john nix run \
HOME=$(pwd)/tmp/home USER=john HOSTNAME=myhost nix run \
--override-input nixos-flake ../.. \
.#activate-home
ls -la ./tmp/home
Expand Down
2 changes: 1 addition & 1 deletion flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ in
''
set -x
nix run \
.#homeConfigurations."\"''${USER}\"".activationPackage \
.#homeConfigurations."\"''${USER}@''${HOSTNAME}\"".activationPackage \
"$@"
'';
}
Expand Down

0 comments on commit 35f0e1c

Please sign in to comment.