finish smithers setup

auto-flake-update
Yorick van Pelt 2021-10-19 11:16:42 +02:00
parent 7746d1c00d
commit 559ea03060
Signed by: yorick
GPG Key ID: D8D3CC6D951384DE
3 changed files with 14 additions and 12 deletions

View File

@ -6,13 +6,12 @@ then
fi fi
export NIX_PATH=yori-nix=$PWD export NIX_PATH=yori-nix=$PWD
host=$1 host=$1
TARGET_HOST=192.168.178.83 TARGET_HOST=$(nix eval --raw -f vpn.nix ips.$host)
#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=$(ssh $TARGET_HOST ip --json r get 1.1.1.1 | jq -r '.[0].prefsrc') COPY_USER=yorick
#TARGET_HOST=192.168.178.1
case $2 in case $2 in
copy-keys) 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" ./copy-keys/bin/copy-keys "$TARGET_HOST"
# rm ./copy-keys # rm ./copy-keys
;; ;;
@ -32,22 +31,22 @@ case $2 in
nix build -f servers.nix "$host" --show-trace nix build -f servers.nix "$host" --show-trace
;; ;;
copy) 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) test)
outPath=$(nix-build servers.nix -A "$host") 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 ssh root@"$TARGET_HOST" $outPath/bin/switch-to-configuration test
;; ;;
boot) boot)
outPath=$(nix-build servers.nix -A "$host") 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" nix-env -p "/nix/var/nix/profiles/system" --set "$outPath"
ssh root@"$TARGET_HOST" $outPath/bin/switch-to-configuration boot ssh root@"$TARGET_HOST" $outPath/bin/switch-to-configuration boot
;; ;;
switch) switch)
outPath=$(nix-build servers.nix -A "$host") 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" nix-env -p "/nix/var/nix/profiles/system" --set "$outPath"
ssh root@"$TARGET_HOST" $outPath/bin/switch-to-configuration switch ssh root@"$TARGET_HOST" $outPath/bin/switch-to-configuration switch
;; ;;

View File

@ -4,9 +4,11 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ let sources = import ../../nix/sources.nix;
in {
imports = imports =
[ # Include the results of the hardware scan. [ # Include the results of the hardware scan.
"${sources.nixos-hardware}/lenovo/thinkpad/x1"
../physical/x11-hardware-config.nix ../physical/x11-hardware-config.nix
../roles/workstation.nix ../roles/workstation.nix
@ -17,11 +19,11 @@
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
boot.zfs.requestEncryptionCredentials = true; boot.zfs.requestEncryptionCredentials = true;
networking.hostName = "smithers"; # Define your hostname. networking.hostName = "smithers";
networking.wireless.iwd.enable = true; networking.wireless.iwd.enable = true;
networking.hostId = "54a8968e"; networking.hostId = "54a8968e";
system.stateVersion = "21.05"; # Did you read the comment? system.stateVersion = "21.05";
boot.kernelPackages = pkgs.linuxPackages_latest; # new hardware boot.kernelPackages = pkgs.linuxPackages_latest; # new hardware
} }

View File

@ -30,6 +30,7 @@ in {
group = "users"; group = "users";
openssh.authorizedKeys.keys = with (import ../sshkeys.nix); yorick; openssh.authorizedKeys.keys = with (import ../sshkeys.nix); yorick;
hashedPassword = secrets.yorick_hashedPassword; hashedPassword = secrets.yorick_hashedPassword;
createHome = true;
}; };
# Nix # Nix