various temporary testing changes

This commit is contained in:
pagedmov
2024-10-17 22:51:52 -04:00
parent 11f97cf4f3
commit b53c14bf77
5 changed files with 85 additions and 35 deletions

21
flake.lock generated
View File

@@ -119,26 +119,6 @@
"type": "github"
}
},
"disko": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1729099656,
"narHash": "sha256-VftVIg7UXTy1bq+tzi1aVYOWl7PQ35IpjW88yMYjjpc=",
"owner": "nix-community",
"repo": "disko",
"rev": "d7d57edb72e54891fa67a6f058a46b2bb405663b",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "disko",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
@@ -926,7 +906,6 @@
"catppuccin-cava": "catppuccin-cava",
"catppuccin-starship": "catppuccin-starship",
"catppuccin-yazi": "catppuccin-yazi",
"disko": "disko",
"home-manager": "home-manager",
"hypr-contrib": "hypr-contrib",
"hyprland": "hyprland",

View File

@@ -4,7 +4,7 @@ let
nvim = inputs.nvim.packages."x86_64-linux".default;
toilet = inputs.toilet.packages."x86_64-linux".default;
install-script = pkgs.writeShellScriptBin "movcfg-install" ''
#!/bin/bash
#!/run/current-system/sw/bin/bash
set -e
trap 'echo "Aborting installation."; exit 1' INT
@@ -30,12 +30,17 @@ let
echo -n "Which drive do you wish to sacrifice? "
read -r drive
size=$(lsblk -b -d -o NAME,SIZE | grep "$drive" | awk '{ printf "%.0f\n", $2 / 1024 / 1024 / 1024 }') 1024 / 1024 / 1024 }')
root_end=$(echo "scale=0;$size * 0.10 / 1" | bc)
nix_end=$(echo "scale=0;$size * 0.35 / 1" | bc)
size=$(lsblk -b -d -o NAME,SIZE | grep "$drive" | awk '{ printf "%.0f\n", $2 / 1024 / 1024 / 1024 }')
root_size=$(echo "scale=0;$size * 0.10 / 1" | bc)
nix_size=$(echo "scale=0;$size * 0.35 / 1" | bc)
# commence formatting
nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /tmp/install_pwd/disko.nix --arg device "\"/dev/$drive\"" --arg root_end "\"$root_end\G\"" --arg nix_end "\"$nix_end\G\""
nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /tmp/install_pwd/disko.nix --arg device "\"/dev/$drive\"" --arg root_size "\"$root_size\G\"" --arg nix_size "\"$nix_size\G\""
mount /dev/disk/by-partlabel/disk-main-root /mnt
mkdir -p /mnt/nix && mount /dev/disk/by-partlabel/disk-main-nix /mnt/nix
mkdir -p /mnt/boot && mount /dev/disk/by-partlabel/disk-main-boot /mnt/boot
mkdir -p /mnt/home && mount /dev/disk/by-partlabel/disk-main-home /mnt/home
# set up home directory in /mnt/persist, create /persist/etc/nixos, cd to /etc/nixos and install my flake config
mkdir -p /mnt/etc
@@ -55,7 +60,7 @@ let
ln -s /mnt/home/pagedmov/.sysflake /etc/nixos
nixos-enter <<EOF
NIXOS_SWITCH_USE_DIRTY_ENV=1 nixos-rebuild boot --flake /persist/home/.sysflake#mercury
NIXOS_SWITCH_USE_DIRTY_ENV=1 nixos-rebuild boot --flake /home/pagedmov/.sysflake#mercury
EOF
echo "INSTALLATION COMPLETE ! !" | toilet -f 3d -w 120 | lolcat -a -s 180
@@ -98,6 +103,7 @@ in
btrfs-progs
dosfstools
parted
bc
pciutils
usbutils
toilet

View File

@@ -2,6 +2,8 @@
# Update devices to match your hardware.
{
device ? throw "Set this to your disk device, e.g. /dev/sda",
root_size,
nix_size,
...
}:
@@ -29,7 +31,7 @@
};
};
nix = {
size = "35%";
size = "${nix_size}";
content = {
type = "filesystem";
format = "ext4";
@@ -37,7 +39,7 @@
};
};
root = {
size = "15%";
size = "${root_size}";
content = {
type = "filesystem";
format = "ext4";
@@ -45,7 +47,7 @@
};
};
home = {
size = "50% - 500MB";
size = "100%";
content = {
type = "filesystem";
format = "ext4";

63
hosts/installer/movcfg.sh Normal file
View File

@@ -0,0 +1,63 @@
#!/run/current-system/sw/bin/bash
set -e
trap 'echo "Aborting installation."; exit 1' INT
# set up working directory
mkdir -p /tmp/install_pwd && cd /tmp/install_pwd
rm -rf ./*
# download disko.nix file for defining partitions
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!"
echo
echo "This script is about to format and partition a hard drive."
sleep 2.5
echo -e "\033[4;31mThis process is irreversible and will destroy all data on the drive.\033[0m"
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
size=$(lsblk -b -d -o NAME,SIZE | grep "$drive" | awk '{ printf "%.0f\n", $2 / 1024 / 1024 / 1024 }')
root_size=$(echo "scale=0;$size * 0.10 / 1" | bc)
nix_size=$(echo "scale=0;$size * 0.35 / 1" | bc)
# commence formatting
nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /tmp/install_pwd/disko.nix --arg device "\"/dev/$drive\"" --arg root_size "\"$root_size\G\"" --arg nix_size "\"$nix_size\G\""
mount /dev/disk/by-partlabel/disk-main-root /mnt
mkdir -p /mnt/nix && mount /dev/disk/by-partlabel/disk-main-nix /mnt/nix
mkdir -p /mnt/boot && mount /dev/disk/by-partlabel/disk-main-boot /mnt/boot
mkdir -p /mnt/home && mount /dev/disk/by-partlabel/disk-main-home /mnt/home
# set up home directory in /mnt/persist, create /persist/etc/nixos, cd to /etc/nixos and install my flake config
mkdir -p /mnt/etc
cd /mnt/etc/
git clone https://github.com/pagedMov/pagedmov-nix-cfg.git ./nixos
nixos-install --root /mnt --flake /mnt/etc/nixos#mercury --no-root-password
echo
echo "Preliminary installation successful!"
echo "Beginning secondary installation phase... "
echo
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
NIXOS_SWITCH_USE_DIRTY_ENV=1 nixos-rebuild boot --flake /home/pagedmov/.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"

View File

@@ -11,7 +11,8 @@
let
desktop_modules = if (host == "onagesson") then
[(import ./programs/steam.nix)] else
[(import ./programs/steam.nix)]
++ [(import ./waybar)] else
[];
in
{
@@ -36,6 +37,5 @@ in
++ [(import ./hyprland)]
++ [(import ./scripts)]
++ [(import ./swaync/swaync.nix)]
++ [(import ./waybar)]
++ desktop_modules;
}