auto: bootstrapping sparky

This commit is contained in:
Sam 2024-05-27 16:19:00 +01:00
parent 34cf736bea
commit 2910b2d267
4 changed files with 22 additions and 8 deletions

View File

@ -255,11 +255,11 @@
"nix-secrets": { "nix-secrets": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1716822214, "lastModified": 1716823135,
"narHash": "sha256-nzzfVOIWi/BM0n/1iEcEejvnaH5XeSxKavWjUG+jzrU=", "narHash": "sha256-2+nqAgrQ11TRNKsMR3eTRrBWfRKBSxEl500g8fL5WgI=",
"ref": "refs/heads/master", "ref": "refs/heads/master",
"rev": "4667b20b9504b01c3c6de4f32a89b78bf88416a9", "rev": "3685717aaa6091e50eb2018b9375b07cf33780a6",
"revCount": 63, "revCount": 64,
"type": "git", "type": "git",
"url": "ssh://git@git.bitlab21.com/sam/nix-secrets.git" "url": "ssh://git@git.bitlab21.com/sam/nix-secrets.git"
}, },

View File

@ -6,7 +6,6 @@ in
imports = [ imports = [
./sops.nix ./sops.nix
./locale.nix ./locale.nix
inputs.impermanence.nixosModules.impermanence
]; ];
nixpkgs = { nixpkgs = {

View File

@ -1,10 +1,25 @@
{ inputs, config, lib, pkgs, outputs,... }: { 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 = imports =
[ [
# Create users for this host # Create users for this host
../common/users/media ../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 # Import core options
./hardware-configuration.nix ./hardware-configuration.nix
../common/core ../common/core

View File

@ -12,9 +12,9 @@ for the root user.
read -p "Confirm host had been setup using the above steps...(yes|no): " confirm read -p "Confirm host had been setup using the above steps...(yes|no): " confirm
[ "$confirm" != "yes" ] && echo "Exiting" && exit 0 [ "$confirm" != "yes" ] && echo "Exiting" && exit 0
hostname="sparky" read -p "Enter hostname of target: " hostname
ip="192.168.122.193" read -p "Enter IP of target: " ip
config="bootstrap" read -p "Enter config to install on target: " config
# Delete key in known hosts if exists # Delete key in known hosts if exists
sed -i "/$ip/d" ~/.ssh/known_hosts sed -i "/$ip/d" ~/.ssh/known_hosts