From 1f38ed3d8cf19f7ca20f0e639775e4cfb0d1b888 Mon Sep 17 00:00:00 2001 From: beatzaplenty Date: Wed, 15 Jul 2026 07:33:37 +1000 Subject: [PATCH] removed disk actions and updated flake --- flake.lock | 185 +++++++++++++++++++++++++++++++++++++++++++++++--- flake.nix | 16 ++++- installer.nix | 41 +++++++---- 3 files changed, 217 insertions(+), 25 deletions(-) diff --git a/flake.lock b/flake.lock index ba72a76..1a80bcf 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,56 @@ { "nodes": { + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1781152676, + "narHash": "sha256-RxWs5ND31KzTG7wvMM+PMfUjyNpmIEr999lqNARaM5o=", + "owner": "nix-community", + "repo": "disko", + "rev": "ff8702b4de27f72b4c78573dfb89ec74e36abdf1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, + "flake-compat": { + "locked": { + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -18,6 +69,43 @@ "type": "github" } }, + "flake-utils-plus": { + "inputs": { + "flake-utils": "flake-utils_2" + }, + "locked": { + "lastModified": 1715533576, + "narHash": "sha256-fT4ppWeCJ0uR300EH3i7kmgRZnAVxrH+XtK09jQWihk=", + "owner": "gytis-ivaskevicius", + "repo": "flake-utils-plus", + "rev": "3542fe9126dc492e53ddd252bb0260fe035f2c0f", + "type": "github" + }, + "original": { + "owner": "gytis-ivaskevicius", + "repo": "flake-utils-plus", + "rev": "3542fe9126dc492e53ddd252bb0260fe035f2c0f", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -25,15 +113,16 @@ ] }, "locked": { - "lastModified": 1780408569, - "narHash": "sha256-s7Tv6FUQThRAvW8En8XVC6HMb0uiikzVccCcCo9u/Bg=", + "lastModified": 1783740085, + "narHash": "sha256-qajyHfZY29G2oEQk+uHxmsJcRoBUBXP9maTpFlwP/dI=", "owner": "nix-community", "repo": "home-manager", - "rev": "f384af1bec6423a0d4ba1855917ab948f64e5808", + "rev": "3cd22efe6471dc7365c822bd9ad73a21e55f38fb", "type": "github" }, "original": { "owner": "nix-community", + "ref": "release-26.05", "repo": "home-manager", "type": "github" } @@ -53,10 +142,30 @@ "type": "github" } }, + "nixos-conf-editor": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": "nixpkgs", + "snowfall-lib": "snowfall-lib" + }, + "locked": { + "lastModified": 1771149335, + "narHash": "sha256-YPUIwyumbQOE2DUY8NIsHIUTGUQnDVhnTVUZMZDRwi4=", + "owner": "snowfallorg", + "repo": "nixos-conf-editor", + "rev": "9f8b4519a2e0e8919b69b7572bc26dab54274a6f", + "type": "github" + }, + "original": { + "owner": "snowfallorg", + "repo": "nixos-conf-editor", + "type": "github" + } + }, "nixos-generators": { "inputs": { "nixlib": "nixlib", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_2" }, "locked": { "lastModified": 1769813415, @@ -73,6 +182,22 @@ } }, "nixpkgs": { + "locked": { + "lastModified": 1771008912, + "narHash": "sha256-gf2AmWVTs8lEq7z/3ZAsgnZDhWIckkb+ZnAo5RzSxJg=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a82ccc39b39b621151d6732718e3e250109076fa", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1736657626, "narHash": "sha256-FWlPMUzp0lkQBdhKlPqtQdqmp+/C+1MBiEytaYfrCTY=", @@ -88,28 +213,53 @@ "type": "github" } }, - "nixpkgs_2": { + "nixpkgs_3": { "locked": { - "lastModified": 1780243769, - "narHash": "sha256-x5UQuRsH3MqI0U9afaXSNqzTPSeZlRLvFAav2Ux1pNw=", + "lastModified": 1784011430, + "narHash": "sha256-lDebytrYdd47IBLwvNOD+6AGeoqZ78CIKlp70hzW280=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "331800de5053fcebacf6813adb5db9c9dca22a0c", + "rev": "8eeec934ae0dbeca3d7868c059568a65c08b2fc3", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable", + "ref": "nixos-26.05", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { + "disko": "disko", "flake-utils": "flake-utils", "home-manager": "home-manager", + "nixos-conf-editor": "nixos-conf-editor", "nixos-generators": "nixos-generators", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_3" + } + }, + "snowfall-lib": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils-plus": "flake-utils-plus", + "nixpkgs": [ + "nixos-conf-editor", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1765361626, + "narHash": "sha256-kX0Dp/kYSRbQ+yd9e3lmmUWdNbipufvKfL2IzbrSpnY=", + "owner": "snowfallorg", + "repo": "lib", + "rev": "c566ad8b7352c30ec3763435de7c8f1c46ebb357", + "type": "github" + }, + "original": { + "owner": "snowfallorg", + "repo": "lib", + "type": "github" } }, "systems": { @@ -126,6 +276,21 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index bb688bb..e695a4f 100644 --- a/flake.nix +++ b/flake.nix @@ -3,11 +3,21 @@ description = "Auto-install NixOS ISO"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; +# nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05"; + nixos-conf-editor.url = "github:snowfallorg/nixos-conf-editor"; flake-utils.url = "github:numtide/flake-utils"; nixos-generators.url = "github:nix-community/nixos-generators"; - home-manager.url = "github:nix-community/home-manager"; - home-manager.inputs.nixpkgs.follows = "nixpkgs"; + # home-manager.url = "github:nix-community/home-manager"; + # home-manager.inputs.nixpkgs.follows = "nixpkgs"; + home-manager = { + url = "github:nix-community/home-manager/release-26.05"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + disko = { + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { self, nixpkgs, flake-utils, nixos-generators, home-manager, ... }: diff --git a/installer.nix b/installer.nix index 89ece01..5324fd7 100644 --- a/installer.nix +++ b/installer.nix @@ -74,18 +74,35 @@ if [[ ! "$confirm" =~ ^[Yy]$ ]]; then fi - parted -s /dev/sda -- mklabel msdos - parted -s /dev/sda -- mkpart primary 1MB -8GB - parted -s /dev/sda -- set 1 boot on - parted -s /dev/sda -- mkpart primary linux-swap -8GB 100% - mkfs.ext4 -L nixos /dev/sda1 - mkswap -L swap /dev/sda2 - swapon /dev/sda2 - sleep 10 - mount /dev/disk/by-label/nixos /mnt - mkdir -p /mnt/install-tmp - export TMPDIR=/mnt/install-tmp - nixos-install --flake "''${FLAKE_BASE_URL}#''${choice}" --no-root-password --no-write-lock-file + # parted -s /dev/sda -- mklabel msdos + # parted -s /dev/sda -- mkpart primary 1MB -8GB + # parted -s /dev/sda -- set 1 boot on + # parted -s /dev/sda -- mkpart primary linux-swap -8GB 100% + # mkfs.ext4 -L nixos /dev/sda1 + # mkswap -L swap /dev/sda2 + # swapon /dev/sda2 + # sleep 10 + # mount /dev/disk/by-label/nixos /mnt + # mkdir -p /mnt/install-tmp + # export TMPDIR=/mnt/install-tmp + # nixos-install --flake "''${FLAKE_BASE_URL}#''${choice}" --no-root-password --no-write-lock-file + +if nix eval --refresh --json "''${FLAKE_BASE_URL}#nixosConfigurations.''${choice}.config.disko.devices.disk.main.device" >/dev/null 2>&1; then + disko --mode destroy,format,mount \ + --flake "''${FLAKE_BASE_URL}#''${choice}" +else + echo "Selected host has no Disko configuration." + exit 1 +fi + +mkdir -p /mnt/install-tmp +export TMPDIR=/mnt/install-tmp + +nixos-install \ + --flake "''${FLAKE_BASE_URL}#''${choice}" \ + --no-root-password + + rm -rf /mnt/install-tmp sleep 10 reboot