fix install script
This commit is contained in:
parent
ada928b3ff
commit
81828f5acc
36
install/install-btrfs.sh
Normal file → Executable file
36
install/install-btrfs.sh
Normal file → Executable file
@ -1,14 +1,14 @@
|
|||||||
#! /usr/bin/env nix-shell
|
#! /usr/bin/env nix-shell
|
||||||
#! nix-shell -i bash -p perl -p gptfdisk -p parted
|
#! nix-shell -i bash -p perl -p gptfdisk -p parted -p git
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
CONFIG_FOLDER="$(dirname "$(pwd)")"
|
CONFIG_FOLDER="$(dirname "$(pwd)")"
|
||||||
DEVICE_NAME=AMD-Workstation
|
DEVICE_NAME=Packard-Server
|
||||||
MAX_JOBS=12
|
MAX_JOBS=4
|
||||||
SWAP_SIZE=16GiB
|
SWAP_SIZE=12GiB
|
||||||
NIXOS_COMMIT="364b5555ee04bf61ee0075a3adab4c9351a8d38c"
|
#NIXOS_COMMIT="364b5555ee04bf61ee0075a3adab4c9351a8d38c"
|
||||||
USE_ECNRYPTION=false
|
USE_ECNRYPTION=true
|
||||||
|
|
||||||
clean_stdin() {
|
clean_stdin() {
|
||||||
while read -r -t 0; do read -r; done
|
while read -r -t 0; do read -r; done
|
||||||
@ -198,21 +198,11 @@ if [[ "$SWAP" != "NONE" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
HARDWARE_CONFIG=$(mktemp)
|
HARDWARE_CONFIG=$(mktemp)
|
||||||
if [[ "$USE_ECNRYPTION" = true ]]
|
|
||||||
then
|
|
||||||
cat <<CONFIG > "$HARDWARE_CONFIG"
|
|
||||||
networking.hostId = "$HOSTID";
|
|
||||||
boot.initrd.luks.devices."$LUKS_DEVICE_NAME".device = "/dev/disk/by-partuuid/$LINUX_DISK_UUID";
|
|
||||||
boot.initrd.supportedFilesystems = [ "btrfs" ];
|
|
||||||
boot.supportedFilesystems = [ "btrfs" ];
|
|
||||||
CONFIG
|
|
||||||
else
|
|
||||||
cat <<CONFIG > "$HARDWARE_CONFIG"
|
cat <<CONFIG > "$HARDWARE_CONFIG"
|
||||||
networking.hostId = "$HOSTID";
|
networking.hostId = "$HOSTID";
|
||||||
boot.initrd.supportedFilesystems = [ "btrfs" ];
|
boot.initrd.supportedFilesystems = [ "btrfs" ];
|
||||||
boot.supportedFilesystems = [ "btrfs" ];
|
boot.supportedFilesystems = [ "btrfs" ];
|
||||||
CONFIG
|
CONFIG
|
||||||
fi
|
|
||||||
|
|
||||||
pprint "Append BTRFS configuration to hardware-configuration.nix"
|
pprint "Append BTRFS configuration to hardware-configuration.nix"
|
||||||
sed -i "\$e cat $HARDWARE_CONFIG" /mnt/etc/nixos/hardware-configuration.nix
|
sed -i "\$e cat $HARDWARE_CONFIG" /mnt/etc/nixos/hardware-configuration.nix
|
||||||
@ -221,16 +211,18 @@ if [[ "$SWAP" != "NONE" ]]; then
|
|||||||
perl -0777 -pi -e "s#swapDevices.+#swapDevices = [\n {\n device = \"/dev/disk/by-partuuid/$SWAP_UUID\";\n randomEncryption.enable = true;\n }\n ];#" /mnt/etc/nixos/hardware-configuration.nix
|
perl -0777 -pi -e "s#swapDevices.+#swapDevices = [\n {\n device = \"/dev/disk/by-partuuid/$SWAP_UUID\";\n randomEncryption.enable = true;\n }\n ];#" /mnt/etc/nixos/hardware-configuration.nix
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed -i "s#\"subvol=nixos\"#\"subvol=nixos\" \"compress-force=zstd\" \"noatime\" \"autodefrag\" \"ssd\"#" /mnt/etc/nixos/hardware-configuration.nix
|
sed -i "s#\"subvol=nixos\"#\"subvol=nixos\" \"compress-force=zstd\" \"noatime\" \"autodefrag\"#" /mnt/etc/nixos/hardware-configuration.nix
|
||||||
sed -i "s#\"subvol=home\"#\"subvol=home\" \"compress-force=zstd\" \"noatime\" \"autodefrag\" \"ssd\"#" /mnt/etc/nixos/hardware-configuration.nix
|
sed -i "s#\"subvol=home\"#\"subvol=home\" \"compress-force=zstd\" \"noatime\" \"autodefrag\"#" /mnt/etc/nixos/hardware-configuration.nix
|
||||||
sed -i "s#\"subvol=nix\"#\"subvol=nix\" \"compress-force=zstd\" \"noatime\" \"autodefrag\" \"ssd\"#" /mnt/etc/nixos/hardware-configuration.nix
|
sed -i "s#\"subvol=nix\"#\"subvol=nix\" \"compress-force=zstd\" \"noatime\" \"autodefrag\"#" /mnt/etc/nixos/hardware-configuration.nix
|
||||||
sed -i "s#\"subvol=var\"#\"subvol=var\" \"compress-force=zstd\" \"noatime\" \"autodefrag\" \"ssd\"#" /mnt/etc/nixos/hardware-configuration.nix
|
sed -i "s#\"subvol=var\"#\"subvol=var\" \"compress-force=zstd\" \"noatime\" \"autodefrag\"#" /mnt/etc/nixos/hardware-configuration.nix
|
||||||
sed -i "s# \"subvol=bittorrent\" #\n \"subvol=bittorrent\" \"nodatacow\" \"ssd\"\n \"uid=\${toString config.users.users.alukard.uid}\"\n \"gid=\${toString config.users.groups.users.gid}\"\n #" /mnt/etc/nixos/hardware-configuration.nix
|
sed -i "s# \"subvol=bittorrent\" #\n \"subvol=bittorrent\" \"nodatacow\"\n \"uid=\${toString config.users.users.alukard.uid}\"\n \"gid=\${toString config.users.groups.users.gid}\"\n #" /mnt/etc/nixos/hardware-configuration.nix
|
||||||
sed -i "s# \"subvol=libvirt\" #\n \"subvol=libvirt\" \"nodatacow\" \"ssd\"\n \"uid=\${toString config.users.users.alukard.uid}\"\n \"gid=\${toString config.users.groups.users.gid}\"\n #" /mnt/etc/nixos/hardware-configuration.nix
|
sed -i "s# \"subvol=libvirt\" #\n \"subvol=libvirt\" \"nodatacow\"\n \"uid=\${toString config.users.users.alukard.uid}\"\n \"gid=\${toString config.users.groups.users.gid}\"\n #" /mnt/etc/nixos/hardware-configuration.nix
|
||||||
|
|
||||||
cp /mnt/etc/nixos/hardware-configuration.nix $CONFIG_FOLDER/machines/$DEVICE_NAME/hardware-configuration.nix
|
cp /mnt/etc/nixos/hardware-configuration.nix $CONFIG_FOLDER/machines/$DEVICE_NAME/hardware-configuration.nix
|
||||||
|
chown 1000:users ../machines/$DEVICE_NAME/hardware-configuration.nix
|
||||||
# Change <not-detected> for flakes
|
# Change <not-detected> for flakes
|
||||||
sed -i "s#<nixpkgs/nixos/modules/installer/scan/not-detected.nix>#\"\${inputs.nixpkgs}/nixos/modules/installer/scan/not-detected.nix\"#" $CONFIG_FOLDER/machines/$DEVICE_NAME/hardware-configuration.nix
|
sed -i "s#<nixpkgs/nixos/modules/installer/scan/not-detected.nix>#\"\${inputs.nixpkgs}/nixos/modules/installer/scan/not-detected.nix\"#" $CONFIG_FOLDER/machines/$DEVICE_NAME/hardware-configuration.nix
|
||||||
|
git add -A
|
||||||
|
|
||||||
clean_stdin
|
clean_stdin
|
||||||
read -p "> Do you want to execute nixos-install command?" -n 1 -r
|
read -p "> Do you want to execute nixos-install command?" -n 1 -r
|
||||||
|
@ -31,4 +31,9 @@
|
|||||||
deviceSpecific.isLaptop = lib.mkForce true;
|
deviceSpecific.isLaptop = lib.mkForce true;
|
||||||
|
|
||||||
boot.cleanTmpDir = true;
|
boot.cleanTmpDir = true;
|
||||||
|
boot.loader = {
|
||||||
|
timeout = lib.mkForce 4;
|
||||||
|
systemd-boot.enable = true;
|
||||||
|
efi.canTouchEfiVariables = true;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
78
machines/Packard-Server/hardware-configuration.nix
Normal file
78
machines/Packard-Server/hardware-configuration.nix
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
|
# and may be overwritten by future invocations. Please make changes
|
||||||
|
# to /etc/nixos/configuration.nix instead.
|
||||||
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports =
|
||||||
|
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sr_mod" "sdhci_pci" ];
|
||||||
|
boot.initrd.kernelModules = [ ];
|
||||||
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
|
fileSystems."/" =
|
||||||
|
{ device = "/dev/disk/by-uuid/50aa73b9-114b-450b-8f87-391bc9d877f1";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=nixos" "compress-force=zstd" "noatime" "autodefrag" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/03696b4c-5edb-43b7-b323-58e01d6c811f";
|
||||||
|
|
||||||
|
fileSystems."/nix" =
|
||||||
|
{ device = "/dev/disk/by-uuid/50aa73b9-114b-450b-8f87-391bc9d877f1";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=nix" "compress-force=zstd" "noatime" "autodefrag" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/home" =
|
||||||
|
{ device = "/dev/disk/by-uuid/50aa73b9-114b-450b-8f87-391bc9d877f1";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=home" "compress-force=zstd" "noatime" "autodefrag" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/var" =
|
||||||
|
{ device = "/dev/disk/by-uuid/50aa73b9-114b-450b-8f87-391bc9d877f1";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=var" "compress-force=zstd" "noatime" "autodefrag" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/media/bittorrent" =
|
||||||
|
{ device = "/dev/disk/by-uuid/50aa73b9-114b-450b-8f87-391bc9d877f1";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [
|
||||||
|
"subvol=bittorrent" "nodatacow"
|
||||||
|
"uid=${toString config.users.users.alukard.uid}"
|
||||||
|
"gid=${toString config.users.groups.users.gid}"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/media/libvirt" =
|
||||||
|
{ device = "/dev/disk/by-uuid/50aa73b9-114b-450b-8f87-391bc9d877f1";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [
|
||||||
|
"subvol=libvirt" "nodatacow"
|
||||||
|
"uid=${toString config.users.users.alukard.uid}"
|
||||||
|
"gid=${toString config.users.groups.users.gid}"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/boot" =
|
||||||
|
{ device = "/dev/disk/by-uuid/F872-88F3";
|
||||||
|
fsType = "vfat";
|
||||||
|
};
|
||||||
|
|
||||||
|
swapDevices = [
|
||||||
|
{
|
||||||
|
device = "/dev/disk/by-partuuid/0c913e15-8990-44f2-aced-24edc7114f93";
|
||||||
|
randomEncryption.enable = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
|
networking.hostId = "ecd4e08e";
|
||||||
|
boot.initrd.supportedFilesystems = [ "btrfs" ];
|
||||||
|
boot.supportedFilesystems = [ "btrfs" ];
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user