diff --git a/nixos/conf b/nixos/conf index 8b6da81..611a17e 100755 --- a/nixos/conf +++ b/nixos/conf @@ -6,13 +6,12 @@ then fi export NIX_PATH=yori-nix=$PWD host=$1 -TARGET_HOST=192.168.178.83 -#TARGET_HOST=$(nix eval --raw -f vpn.nix ips.$host) -#TARGET_HOST=$(ssh $TARGET_HOST ip --json r get 1.1.1.1 | jq -r '.[0].prefsrc') -#TARGET_HOST=192.168.178.1 +TARGET_HOST=$(nix eval --raw -f vpn.nix ips.$host) +TARGET_HOST=$(ssh $TARGET_HOST ip --json r get 1.1.1.1 | jq -r '.[0].prefsrc') +COPY_USER=yorick case $2 in copy-keys) - nix build -f servers.nix "$host".config.deployment.keys-copy --out-link copy-keys + nix build -f ../. yorick.machine."$host".config.deployment.keys-copy --out-link copy-keys ./copy-keys/bin/copy-keys "$TARGET_HOST" # rm ./copy-keys ;; @@ -32,22 +31,22 @@ case $2 in nix build -f servers.nix "$host" --show-trace ;; copy) - nix copy -f servers.nix "$host" --show-trace --to "ssh://$TARGET_HOST" + nix copy -f servers.nix "$host" --show-trace --to "ssh://$COPY_USER@$TARGET_HOST" ;; test) outPath=$(nix-build servers.nix -A "$host") - nix copy -f servers.nix "$host" --show-trace --to "ssh://$TARGET_HOST" + nix copy -f servers.nix "$host" --show-trace --to "ssh://$COPY_USER@$TARGET_HOST" ssh root@"$TARGET_HOST" $outPath/bin/switch-to-configuration test ;; boot) outPath=$(nix-build servers.nix -A "$host") - nix copy "$outPath" --show-trace --to "ssh://$TARGET_HOST" + nix copy "$outPath" --show-trace --to "ssh://$COPY_USER@$TARGET_HOST" ssh root@"$TARGET_HOST" nix-env -p "/nix/var/nix/profiles/system" --set "$outPath" ssh root@"$TARGET_HOST" $outPath/bin/switch-to-configuration boot ;; switch) outPath=$(nix-build servers.nix -A "$host") - nix copy "$outPath" --show-trace --to "ssh://$TARGET_HOST" + nix copy "$outPath" --show-trace --to "ssh://$COPY_USER@$TARGET_HOST" ssh root@"$TARGET_HOST" nix-env -p "/nix/var/nix/profiles/system" --set "$outPath" ssh root@"$TARGET_HOST" $outPath/bin/switch-to-configuration switch ;; diff --git a/nixos/logical/smithers.nix b/nixos/logical/smithers.nix index 32c0c41..39d41ce 100644 --- a/nixos/logical/smithers.nix +++ b/nixos/logical/smithers.nix @@ -4,9 +4,11 @@ { config, pkgs, lib, ... }: -{ +let sources = import ../../nix/sources.nix; +in { imports = [ # Include the results of the hardware scan. + "${sources.nixos-hardware}/lenovo/thinkpad/x1" ../physical/x11-hardware-config.nix ../roles/workstation.nix @@ -17,11 +19,11 @@ boot.loader.efi.canTouchEfiVariables = true; boot.zfs.requestEncryptionCredentials = true; - networking.hostName = "smithers"; # Define your hostname. + networking.hostName = "smithers"; networking.wireless.iwd.enable = true; networking.hostId = "54a8968e"; - system.stateVersion = "21.05"; # Did you read the comment? + system.stateVersion = "21.05"; boot.kernelPackages = pkgs.linuxPackages_latest; # new hardware } diff --git a/nixos/roles/default.nix b/nixos/roles/default.nix index 729715a..1d51d9a 100644 --- a/nixos/roles/default.nix +++ b/nixos/roles/default.nix @@ -30,6 +30,7 @@ in { group = "users"; openssh.authorizedKeys.keys = with (import ../sshkeys.nix); yorick; hashedPassword = secrets.yorick_hashedPassword; + createHome = true; }; # Nix