From 1f6207ae963d8f3ef41ff99ed7afd7098ebc2d40 Mon Sep 17 00:00:00 2001 From: Myned Date: Sun, 8 Sep 2024 20:42:02 -0500 Subject: [PATCH] nixos: remove support for script install Signed-off-by: Myned --- README.md | 38 -------------------------- install.fish | 76 ---------------------------------------------------- 2 files changed, 114 deletions(-) delete mode 100644 install.fish diff --git a/README.md b/README.md index 5506d6d..3327bfa 100644 --- a/README.md +++ b/README.md @@ -74,41 +74,3 @@ ``` 9. Shutdown, detach ISO, and reboot - -## Local (with script) - -1. Clone repository using personal access token - - ```sh - git clone https://TOKEN@github.com/Myned/nixos /tmp/nixos - ``` - -2. Go to repository directory - - ```sh - cd /tmp/nixos - ``` - -3. Check disk layout - - ```sh - lsblk - ``` - -4. Modify disko layout to match hardware - - ```sh - nano machine/MACHINE/disko.nix - ``` - -5. Execute install script - - ```sh - sudo nix --experimental-features 'nix-command flakes' run nixpkgs#fish -- install.fish - ``` - -6. Optionally shred personal access token - - ```sh - shred -zu github.token - ``` diff --git a/install.fish b/install.fish deleted file mode 100644 index 7d576ee..0000000 --- a/install.fish +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env fish -# sudo nix --experimental-features 'nix-command flakes' run nixpkgs#fish -- install.fish - -# Wrap command execution in log output with error handling -function execute - if $argv &>>install.log - echo " done." - else - echo " error." - exit 1 - end -end - -# Alias nix to enable flakes -alias nix "nix --experimental-features 'nix-command flakes'" - -# Gather variables -set -l machine (read -P "Enter machine hostname: ") -set -l secret (read -P "Enter encryption secret: ") - -# Clear logfile -echo "Logging to install.log..." -rm install.log &>/dev/null - -# Create keyfile -echo -n "Creating secret.key..." -execute nix run nixpkgs#fish -- -c "echo -n $secret > /tmp/secret.key" - -# Format disks -echo -n "Formatting disks..." -execute nix run disko -- -m disko machines/$machine/disko.nix - -# Shred keyfile -echo -n "Shredding secret.key..." -execute shred -zu /tmp/secret.key - -# Generate hardware configuration -echo -n "Generating hardware-configuration.nix..." -execute nixos-generate-config --no-filesystems --root /mnt --dir . - -# Move hardware configuration -echo -n "Moving hardware-configuration.nix to machines/$machine/..." -execute mv hardware-configuration.nix machines/$machine/ - -# Stage files in git tree for flake to access -git add . - -# Update flake -echo -n "Updating flake.lock..." -execute nix flake update - -# Confirm installation of NixOS -while true - switch (read -P "Install NixOS? [Y/N] ") - case Y y - break - case N n - exit - end -end - -# Install NixOS -echo -n "Installing..." -execute nixos-install --no-root-password --flake .#$machine - -# Update git remote to remove personal access token -echo -n "Updating git remotes..." -git remote rm origin -execute git remote add git@github.com/Myned/nixos.git - -# Copy NixOS configuration to system -echo -n "Copying NixOS configuration to /mnt/etc/nixos/..." -execute cp -r . /mnt/etc/nixos/ - -# Finish -echo "Installation finished. Reboot when ready."