From 2910b2d267583b4dd1c43bbdb7d2fcf5c8cfcd7d Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 27 May 2024 16:19:00 +0100 Subject: [PATCH] auto: bootstrapping sparky --- flake.lock | 8 ++++---- hosts/common/core/default.nix | 1 - hosts/sparky/default.nix | 15 +++++++++++++++ scripts/bootstrap.sh | 6 +++--- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/flake.lock b/flake.lock index a1d735f..da2fac3 100644 --- a/flake.lock +++ b/flake.lock @@ -255,11 +255,11 @@ "nix-secrets": { "flake": false, "locked": { - "lastModified": 1716822214, - "narHash": "sha256-nzzfVOIWi/BM0n/1iEcEejvnaH5XeSxKavWjUG+jzrU=", + "lastModified": 1716823135, + "narHash": "sha256-2+nqAgrQ11TRNKsMR3eTRrBWfRKBSxEl500g8fL5WgI=", "ref": "refs/heads/master", - "rev": "4667b20b9504b01c3c6de4f32a89b78bf88416a9", - "revCount": 63, + "rev": "3685717aaa6091e50eb2018b9375b07cf33780a6", + "revCount": 64, "type": "git", "url": "ssh://git@git.bitlab21.com/sam/nix-secrets.git" }, diff --git a/hosts/common/core/default.nix b/hosts/common/core/default.nix index c3bca2f..1b554d3 100644 --- a/hosts/common/core/default.nix +++ b/hosts/common/core/default.nix @@ -6,7 +6,6 @@ in imports = [ ./sops.nix ./locale.nix - inputs.impermanence.nixosModules.impermanence ]; nixpkgs = { diff --git a/hosts/sparky/default.nix b/hosts/sparky/default.nix index 41f52f4..6156f91 100644 --- a/hosts/sparky/default.nix +++ b/hosts/sparky/default.nix @@ -1,10 +1,25 @@ { inputs, config, lib, pkgs, outputs,... }: +let + # Disko setup + fsType = "btrfs"; # one of ext4 or btrfs. Use btrfs if using impermanence + dev = "/dev/vda"; # depends on target hardware + encrypted = false; # currrently only applies to btrfs + btrfsMountDevice = if encrypted then "/dev/mapper/crypted" else "/dev/root_vg/root"; +in { imports = [ # Create users for this host ../common/users/media + # Disk configuration + inputs.disko.nixosModules.disko + (import ../common/disks { device = dev; fsType = fsType; encrypted = encrypted; }) + + # Impermanence + inputs.impermanence.nixosModules.impermanence + (import ../common/disks/btrfs-impermanence.nix { btrfsMountDevice = btrfsMountDevice; lib = lib; }) + # Import core options ./hardware-configuration.nix ../common/core diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index ce85882..1c581a0 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -12,9 +12,9 @@ for the root user. read -p "Confirm host had been setup using the above steps...(yes|no): " confirm [ "$confirm" != "yes" ] && echo "Exiting" && exit 0 -hostname="sparky" -ip="192.168.122.193" -config="bootstrap" +read -p "Enter hostname of target: " hostname +read -p "Enter IP of target: " ip +read -p "Enter config to install on target: " config # Delete key in known hosts if exists sed -i "/$ip/d" ~/.ssh/known_hosts