update installer with gum, add more charm stuff

This commit is contained in:
Noah Masur 2022-09-25 04:19:46 +00:00
parent 0ac3aec208
commit ddd517e0dd
3 changed files with 22 additions and 14 deletions

View File

@ -13,10 +13,12 @@
PARTITION_PREFIX="" PARTITION_PREFIX=""
if [ -z "$DISK" ] || [ -z "$FLAKE" ]; then if [ -z "$DISK" ] || [ -z "$FLAKE" ]; then
echo "Missing required parameter." ${pkgs.gum}/bin/gum style --width 50 --margin "1 2" --padding "2 4" \
echo "Usage: installer -- <disk> <host>" --foreground "#fb4934" \
echo "Example: installer -- nvme0n1 desktop" "Missing required parameter." \
echo "Flake example: nix run github:nmasur/dotfiles#installer -- nvme0n1 desktop" "Usage: installer -- <disk> <host>" \
"Example: installer -- nvme0n1 desktop" \
"Flake example: nix run github:nmasur/dotfiles#installer -- nvme0n1 desktop"
echo "(exiting)" echo "(exiting)"
exit 1 exit 1
fi fi
@ -25,10 +27,14 @@
PARTITION_PREFIX="p" PARTITION_PREFIX="p"
esac esac
parted /dev/''${DISK} -- mklabel gpt ${pkgs.gum}/bin/gum confirm \
parted /dev/''${DISK} -- mkpart primary 512MiB 100% "This will ERASE ALL DATA on the disk /dev/''${DISK}. Are you sure you want to continue?" \
parted /dev/''${DISK} -- mkpart ESP fat32 1MiB 512MiB --default=false
parted /dev/''${DISK} -- set 3 esp on
${pkgs.parted}/bin/parted /dev/''${DISK} -- mklabel gpt
${pkgs.parted}/bin/parted /dev/''${DISK} -- mkpart primary 512MiB 100%
${pkgs.parted}/bin/parted /dev/''${DISK} -- mkpart ESP fat32 1MiB 512MiB
${pkgs.parted}/bin/parted /dev/''${DISK} -- set 3 esp on
mkfs.ext4 -L nixos /dev/''${DISK}''${PARTITION_PREFIX}1 mkfs.ext4 -L nixos /dev/''${DISK}''${PARTITION_PREFIX}1
mkfs.fat -F 32 -n boot /dev/''${DISK}''${PARTITION_PREFIX}2 mkfs.fat -F 32 -n boot /dev/''${DISK}''${PARTITION_PREFIX}2
@ -36,7 +42,7 @@
mkdir --parents /mnt/boot mkdir --parents /mnt/boot
mount /dev/disk/by-label/boot /mnt/boot mount /dev/disk/by-label/boot /mnt/boot
nixos-install --flake github:nmasur/dotfiles#''${FLAKE} ${pkgs.nixos-install-tools}/bin/nixos-install --flake github:nmasur/dotfiles#''${FLAKE}
''); '');
} }

View File

@ -2,10 +2,11 @@
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; home.packages = with pkgs; [
[ glow # Markdown previews
skate # Key-value store skate # Key-value store
]; charm # Manage account and filesystem
];
}; };

View File

@ -4,7 +4,8 @@
programs.fish = { programs.fish = {
shellAbbrs = { shellAbbrs = {
n = "nix"; n = "nix";
ns = "nix-shell --run fish -p"; ns = "nix-shell -p";
nsf = "nix-shell --run fish -p";
nsr = "nix-shell-run"; nsr = "nix-shell-run";
nps = "nix repl '<nixpkgs>'"; nps = "nix repl '<nixpkgs>'";
nixo = "man configuration.nix"; nixo = "man configuration.nix";