added installer config to flake.nix

This commit is contained in:
pagedmov
2024-10-17 20:18:39 -04:00
parent a2f4e74716
commit e6b3c2a495
2 changed files with 101 additions and 89 deletions

View File

@@ -74,7 +74,6 @@
nur.nixosModules.nur
];
};
laptop = nixpkgs.lib.nixosSystem {
specialArgs = {
host = "laptop";
@@ -85,6 +84,16 @@
nur.nixosModules.nur
];
};
installer = nixpkgs.lib.nixosSystem {
specialArgs = {
host = "installer";
inherit self inputs;
};
modules = [
./hosts/installer
inputs.disko.nixosModules.default
];
};
};
};
}

View File

@@ -13,17 +13,20 @@ let
rm -rf ./*
# download disko.nix file for defining partitions
echo "Downloading partition map... "
curl https://raw.githubusercontent.com/vimjoyer/impermanent-setup/main/final/disko.nix > disko.nix
echo -n "Downloading partition plan..."
curl -s https://raw.githubusercontent.com/pagedMov/pagedmov-nix-cfg/refs/heads/master/hosts/installer/disko-ext4-singledisk.nix > disko.nix
echo "Done!"
lsblk -d -o NAME,SIZE
echo
echo "This script is about to format and partition a hard drive."
sleep 2
sleep 2.5
echo -e "\033[4;31mThis process is irreversible and will destroy all data on the drive.\033[0m"
sleep 2
echo "Make absolutely sure that you know which drive you are choosing. Abort with Ctrl+C if you aren't sure which one to use."
sleep 2
sleep 2.5
echo "Make absolutely sure that you know which drive you are choosing."
sleep 2.5
echo
lsblk -d -o NAME,SIZE
echo
echo -n "Which drive do you wish to sacrifice? "
read -r drive
@@ -31,7 +34,6 @@ let
nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /tmp/install_pwd/disko.nix --arg device "\"/dev/$drive\""
# set up home directory in /mnt/persist, create /persist/etc/nixos, cd to /etc/nixos and install my flake config
mkdir -p /mnt/persist/{etc/nixos,home}
mkdir -p /mnt/etc
cd /mnt/etc/
git clone https://github.com/pagedMov/pagedmov-nix-cfg.git ./nixos
@@ -43,18 +45,19 @@ let
echo "Beginning secondary installation phase... "
echo
cp -r /mnt/etc/nixos /mnt/persist/home/.sysflake
rm -rf /mnt/etc/nixos/*
cp -r /mnt/etc/nixos /mnt/home/pagedmov/.sysflake
chown -R pagedmov /mnt/home/pagedmov/.sysflake
rm -rf /mnt/etc/nixos
ln -s /mnt/home/pagedmov/.sysflake /etc/nixos
nixos-enter <<EOF
chmod -R 770 /persist
chown -R :persist /persist
NIXOS_SWITCH_USE_DIRTY_ENV=1 nixos-rebuild boot --flake /persist/home/.sysflake#mercury
EOF
echo "INSTALLATION COMPLETE ! !" | toilet -f 3d -w 120 | lolcat -a -s 180
echo "You can now reboot into your new system."
echo "The system configuration flake will be found in your home folder under .sysflake"
echo "/etc/nixos is a symlink leading to the .sysflake folder"
'';
in
{