some updates
This commit is contained in:
parent
b408364148
commit
fa08060cf4
@ -1,4 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
CONFIG_FOLDER=$(pwd)/..
|
||||
|
||||
ENCRYPT_ROOT=true
|
||||
ENCRYPT_SWAP=false
|
||||
FORMAT_BOOT_PARTITION=false
|
||||
@ -20,7 +22,7 @@ fi
|
||||
# Create luks partition
|
||||
if [[ "$ENCRYPT_ROOT" == true ]]; then
|
||||
cryptsetup --type luks2 --cipher aes-xts-plain64 --key-size 256 --hash sha512 luksFormat $ROOT_PARTITION
|
||||
cryptsetup luksOpen $ROOT_PARTITION $ROOT_NAME
|
||||
cryptsetup luksOpen --type luks2 $ROOT_PARTITION $ROOT_NAME
|
||||
ROOT_NAME=/dev/mapper/$ROOT_NAME
|
||||
mkfs.btrfs -f -L root $ROOT_NAME
|
||||
mount -t btrfs -o compress=zstd,noatime,ssd $ROOT_NAME /mnt
|
||||
@ -51,6 +53,7 @@ mount $BOOT_PARTITION /mnt/boot
|
||||
# read -p "Press enter to continue"
|
||||
# Create swap
|
||||
if [[ "$ENCRYPT_SWAP" == true ]]; then
|
||||
mkdir -p /mnt/root
|
||||
dd count=1 bs=256 if=/dev/urandom of=/mnt/root/swap.key
|
||||
cryptsetup --type luks2 --cipher aes-xts-plain64 --key-size 256 --hash sha512 --key-file /mnt/root/swap.key luksFormat $SWAP_PARTITION
|
||||
cryptsetup --key-file /mnt/root/swap.key luksOpen $SWAP_PARTITION $SWAP_NAME
|
||||
@ -61,15 +64,17 @@ fi
|
||||
# Generate config (hardware)
|
||||
nixos-generate-config --root /mnt/
|
||||
# Copy config to new system
|
||||
mkdir -p /mnt/root/nixos-config
|
||||
cp -r $(pwd)/.. /mnt/root/nixos-config
|
||||
echo "import /mnt/root/nixos-config \"$DEVICE_NAME\"" > /mnt/etc/nixos/configuration.nix
|
||||
read -p "Debug"
|
||||
# nano /mnt/etc/nixos/configuration.nix
|
||||
# mkdir -p /mnt/root/nixos-config
|
||||
# cp -r $(pwd)/.. /mnt/root/nixos-config
|
||||
echo "import $CONFIG_FOLDER \"$DEVICE_NAME\"" > /mnt/etc/nixos/configuration.nix
|
||||
nano /mnt/etc/nixos/configuration.nix
|
||||
sed -i 's/\/etc\/nixos/\/mnt\/etc\/nixos/g' /mnt/root/nixos-config/default.nix
|
||||
read -p "Please, add swap device into nixos-config/modules/filesystems.nix before continue"
|
||||
read -p "Press enter to continue"
|
||||
nixos-install -I nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz
|
||||
sed -i 's/\/mnt\/etc\/nixos/\/etc\/nixos/g' /mnt/root/nixos-config/default.nix
|
||||
sed -i 's/\/mnt\/root/\/root/g' /mnt/etc/nixos/configuration.nix
|
||||
read -p "Installation complete!"
|
||||
mkdir -p /mnt/home/alukard/nixos-config
|
||||
cp -r $CONFIG_FOLDER /mnt/home/alukard/nixos-config
|
||||
chown -R alukard:users /mnt/home/alukard/nixos-config
|
||||
# sed -i 's/\/mnt\/root/\/root/g' /mnt/etc/nixos/configuration.nix
|
||||
# read -p "Installation complete!"
|
||||
|
@ -120,7 +120,7 @@ with deviceSpecific; {
|
||||
device = if device == "AMD-Workstation" then
|
||||
"/dev/disk/by-partuuid/3c4f9305-ad40-4ed3-b568-f1559f1c845a"
|
||||
else if device == "Dell-Laptop" then
|
||||
"/dev/disk/by-partuuid/2de40bc4-a91c-4c89-a2cd-cbf34a0adf01"
|
||||
"/dev/disk/by-partuuid/e979f198-37c4-4a86-8138-e148c3d78447"
|
||||
else if device == "NixOS-VM" then
|
||||
"/dev/disk/by-partuuid/4caf1e45-2f1c-4cb2-a914-f2e90961503a"
|
||||
else
|
||||
|
@ -8,7 +8,7 @@ with deviceSpecific; {
|
||||
enable = isLaptop;
|
||||
extraConfig = ''
|
||||
# To avoid filesystem corruption on btrfs formatted partitions
|
||||
SATA_LINKPWR_ON_BAT=max_performance
|
||||
# SATA_LINKPWR_ON_BAT=max_performance
|
||||
# Recommended
|
||||
CPU_SCALING_GOVERNOR_ON_AC=powersave
|
||||
CPU_SCALING_GOVERNOR_ON_BAT=powersave
|
||||
@ -16,7 +16,7 @@ with deviceSpecific; {
|
||||
CPU_HWP_ON_BAT=balance_power
|
||||
CPU_BOOST_ON_AC=1
|
||||
CPU_BOOST_ON_BAT=0
|
||||
DISK_DEVICES="sda"
|
||||
DISK_DEVICES="sda nvme0n1"
|
||||
DISK_APM_LEVEL_ON_AC="255 254"
|
||||
DISK_APM_LEVEL_ON_BAT="128 128"
|
||||
'';
|
||||
|
@ -8,7 +8,7 @@
|
||||
];
|
||||
};
|
||||
services.mopidy = {
|
||||
enable = true;
|
||||
enable = false;
|
||||
extensionPackages = with pkgs; [ mopidy-local-sqlite ];
|
||||
configuration = ''
|
||||
[local]
|
||||
|
Loading…
x
Reference in New Issue
Block a user