update installation script, passwords
This commit is contained in:
parent
9dfddbcb4c
commit
5b3bebe963
8
flake.lock
generated
8
flake.lock
generated
@ -117,17 +117,17 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-old": {
|
"nixpkgs-old": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1596265691,
|
"lastModified": 1605220118,
|
||||||
"narHash": "sha256-9ofCzFqttTsGrvTaS4RrDSTNQO9PFOz5uyn8V+2eA5M=",
|
"narHash": "sha256-Und10ixH1WuW0XHYMxxuHRohKYb45R/T8CwZuLd2D2Q=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "840c782d507d60aaa49aa9e3f6d0b0e780912742",
|
"rev": "3090c65041104931adda7625d37fa874b2b5c124",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-20.09",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "840c782d507d60aaa49aa9e3f6d0b0e780912742",
|
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = github:nixos/nixpkgs/nixos-unstable;
|
nixpkgs.url = github:nixos/nixpkgs/nixos-unstable;
|
||||||
nixpkgs-old.url = github:nixos/nixpkgs/840c782d507d60aaa49aa9e3f6d0b0e780912742;
|
nixpkgs-old.url = github:nixos/nixpkgs/nixos-20.09;
|
||||||
# nix.url = github:nixos/nix/6ff9aa8df7ce8266147f74c65e2cc529a1e72ce0;
|
# nix.url = github:nixos/nix/6ff9aa8df7ce8266147f74c65e2cc529a1e72ce0;
|
||||||
home-manager.url = github:nix-community/home-manager;
|
home-manager.url = github:nix-community/home-manager;
|
||||||
base16.url = github:alukardbf/base16-nix;
|
base16.url = github:alukardbf/base16-nix;
|
||||||
|
@ -39,21 +39,20 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/boot" =
|
fileSystems."/boot" =
|
||||||
{ device = "/dev/disk/by-uuid/A4E5-0229";
|
{ device = "/dev/disk/by-uuid/2FA1-8DA6";
|
||||||
fsType = "vfat";
|
fsType = "vfat";
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices = [
|
swapDevices = [
|
||||||
{
|
{
|
||||||
device = "/dev/disk/by-partuuid/18c50c59-26f4-4181-944b-cdeabbd731b0";
|
device = "/dev/disk/by-partuuid/96ef04e6-4537-453c-a75d-f4184fe9a54e";
|
||||||
randomEncryption.enable = true;
|
randomEncryption.enable = true;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
||||||
networking.hostId = "60f0b8d8";
|
networking.hostId = "7c725ef4";
|
||||||
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-partuuid/af053f01-4e3d-4163-af49-bfea01bb3dfe";
|
boot.zfs.devNodes = "/dev/disk/by-partuuid/69b0df60-36a2-4aa3-864b-d17cf95e6387";
|
||||||
boot.zfs.devNodes = "/dev/mapper/cryptroot";
|
|
||||||
boot.supportedFilesystems = [ "zfs" ];
|
boot.supportedFilesystems = [ "zfs" ];
|
||||||
boot.kernelParams = [ "zfs.zfs_arc_max=4294967296" ];
|
boot.kernelParams = [ "zfs.zfs_arc_max=4294967296" ];
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,9 @@ set -e
|
|||||||
CONFIG_FOLDER="$(dirname "$(pwd)")"
|
CONFIG_FOLDER="$(dirname "$(pwd)")"
|
||||||
DEVICE_NAME=Dell-Laptop
|
DEVICE_NAME=Dell-Laptop
|
||||||
MAX_JOBS=8
|
MAX_JOBS=8
|
||||||
NIXOS_COMMIT="c59ea8b8a0e7f927e7291c14ea6cd1bd3a16ff38"
|
SWAP_SIZE=8GiB
|
||||||
|
NIXOS_COMMIT="1dc37370c489b610f8b91d7fdd40633163ffbafd"
|
||||||
|
USE_ECNRYPTION=true
|
||||||
ZFS_ARC_MAX=4294967296 # Max ARC cache size. default = 4GiB
|
ZFS_ARC_MAX=4294967296 # Max ARC cache size. default = 4GiB
|
||||||
ZFS_ASHIFT=12 # recommended=12 which 1<<12 (4096)
|
ZFS_ASHIFT=12 # recommended=12 which 1<<12 (4096)
|
||||||
|
|
||||||
@ -44,11 +46,17 @@ create_new_part_table() {
|
|||||||
BOOT="$DISK-part1"
|
BOOT="$DISK-part1"
|
||||||
|
|
||||||
pprint "Creating SWAP partition"
|
pprint "Creating SWAP partition"
|
||||||
sgdisk -n 2::+8GiB -t 2:8200 "$DISK"
|
sgdisk -n 2::+$SWAP_SIZE -t 2:8200 "$DISK"
|
||||||
SWAP="$DISK-part2"
|
SWAP="$DISK-part2"
|
||||||
|
|
||||||
|
if [[ "$USE_ECNRYPTION" = true ]]
|
||||||
|
then
|
||||||
pprint "Creating LUKS partition"
|
pprint "Creating LUKS partition"
|
||||||
sgdisk -n 3 -t 3:8309 "$DISK"
|
sgdisk -n 3 -t 3:8309 "$DISK"
|
||||||
|
else
|
||||||
|
pprint "Creating ROOT partition"
|
||||||
|
sgdisk -n 3 -t 3:8300 "$DISK"
|
||||||
|
fi
|
||||||
LINUX="$DISK-part3"
|
LINUX="$DISK-part3"
|
||||||
|
|
||||||
partprobe "$DISK"
|
partprobe "$DISK"
|
||||||
@ -71,7 +79,12 @@ use_old_part_table() {
|
|||||||
break
|
break
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ "$USE_ECNRYPTION" = true ]]
|
||||||
|
then
|
||||||
pprint "Select the partition on which LUKS will be created"
|
pprint "Select the partition on which LUKS will be created"
|
||||||
|
else
|
||||||
|
pprint "Select the partition on which ROOT will be created"
|
||||||
|
fi
|
||||||
|
|
||||||
select ENTRY in $(lsblk -o path,size,type | grep part | awk '{print $1}');
|
select ENTRY in $(lsblk -o path,size,type | grep part | awk '{print $1}');
|
||||||
do
|
do
|
||||||
@ -100,6 +113,15 @@ use_old_part_table() {
|
|||||||
|
|
||||||
### INSTALLATION BEGIN ###
|
### INSTALLATION BEGIN ###
|
||||||
|
|
||||||
|
read -p "> Do you want to encrypt your disk with LUKS?" -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ "$REPLY" =~ ^[Yy]$ ]]
|
||||||
|
then
|
||||||
|
USE_ECNRYPTION=true
|
||||||
|
else
|
||||||
|
USE_ECNRYPTION=false
|
||||||
|
fi
|
||||||
|
|
||||||
read -p "> Do you want to partition the disk (new gpt table)?" -n 1 -r
|
read -p "> Do you want to partition the disk (new gpt table)?" -n 1 -r
|
||||||
echo
|
echo
|
||||||
if [[ "$REPLY" =~ ^[Yy]$ ]]
|
if [[ "$REPLY" =~ ^[Yy]$ ]]
|
||||||
@ -109,6 +131,8 @@ else
|
|||||||
use_old_part_table
|
use_old_part_table
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$USE_ECNRYPTION" = true ]]
|
||||||
|
then
|
||||||
pprint "Creating LUKS container on $LINUX"
|
pprint "Creating LUKS container on $LINUX"
|
||||||
clean_stdin
|
clean_stdin
|
||||||
cryptsetup --type luks2 --cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 5000 --use-random luksFormat "$LINUX"
|
cryptsetup --type luks2 --cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 5000 --use-random luksFormat "$LINUX"
|
||||||
@ -122,6 +146,10 @@ LUKS_DISK="/dev/mapper/$LUKS_DEVICE_NAME"
|
|||||||
|
|
||||||
pprint "Create ZFS partition on $LUKS_DISK"
|
pprint "Create ZFS partition on $LUKS_DISK"
|
||||||
ZFS="${LUKS_DISK}"
|
ZFS="${LUKS_DISK}"
|
||||||
|
else
|
||||||
|
LINUX_PARTUUID=$(blkid --match-tag PARTUUID --output value "$LINUX")
|
||||||
|
ZFS="/dev/disk/by-partuuid/$LINUX_PARTUUID"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$SWAP" != "NONE" ]]; then
|
if [[ "$SWAP" != "NONE" ]]; then
|
||||||
pprint "Create SWAP partition on $SWAP"
|
pprint "Create SWAP partition on $SWAP"
|
||||||
@ -133,10 +161,10 @@ zpool create -f -m none -o ashift=$ZFS_ASHIFT -O compression=lz4 -O normalizatio
|
|||||||
|
|
||||||
pprint "Create ZFS datasets"
|
pprint "Create ZFS datasets"
|
||||||
|
|
||||||
zfs create -o mountpoint=none -o com.sun.auto-snapshot=false rpool/local
|
zfs create -o mountpoint=none rpool/local
|
||||||
zfs create -o mountpoint=legacy -o atime=off -o recordsize=16K rpool/local/bittorrent
|
zfs create -o mountpoint=legacy -o com.sun:auto-snapshot=false -o atime=off -o recordsize=16K rpool/local/bittorrent
|
||||||
zfs create -o mountpoint=legacy -o atime=off rpool/local/nix
|
zfs create -o mountpoint=legacy -o com.sun:auto-snapshot:frequent=false -o com.sun:auto-snapshot:monthly=false -o atime=off rpool/local/nix
|
||||||
zfs create -o mountpoint=none -o com.sun.auto-snapshot:frequent=false rpool/system
|
zfs create -o mountpoint=none -o com.sun:auto-snapshot:frequent=false rpool/system
|
||||||
zfs create -o mountpoint=legacy rpool/system/root
|
zfs create -o mountpoint=legacy rpool/system/root
|
||||||
zfs create -o mountpoint=legacy -o xattr=sa -o acltype=posixacl rpool/system/var
|
zfs create -o mountpoint=legacy -o xattr=sa -o acltype=posixacl rpool/system/var
|
||||||
zfs create -o mountpoint=none rpool/user
|
zfs create -o mountpoint=none rpool/user
|
||||||
@ -174,6 +202,8 @@ if [[ "$SWAP" != "NONE" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
HARDWARE_CONFIG=$(mktemp)
|
HARDWARE_CONFIG=$(mktemp)
|
||||||
|
if [[ "$USE_ECNRYPTION" = true ]]
|
||||||
|
then
|
||||||
cat <<CONFIG > "$HARDWARE_CONFIG"
|
cat <<CONFIG > "$HARDWARE_CONFIG"
|
||||||
networking.hostId = "$HOSTID";
|
networking.hostId = "$HOSTID";
|
||||||
boot.initrd.luks.devices."$LUKS_DEVICE_NAME".device = "/dev/disk/by-partuuid/$LINUX_DISK_UUID";
|
boot.initrd.luks.devices."$LUKS_DEVICE_NAME".device = "/dev/disk/by-partuuid/$LINUX_DISK_UUID";
|
||||||
@ -181,6 +211,14 @@ cat <<CONFIG > "$HARDWARE_CONFIG"
|
|||||||
boot.supportedFilesystems = [ "zfs" ];
|
boot.supportedFilesystems = [ "zfs" ];
|
||||||
boot.kernelParams = [ "zfs.zfs_arc_max=$ZFS_ARC_MAX" ];
|
boot.kernelParams = [ "zfs.zfs_arc_max=$ZFS_ARC_MAX" ];
|
||||||
CONFIG
|
CONFIG
|
||||||
|
else
|
||||||
|
cat <<CONFIG > "$HARDWARE_CONFIG"
|
||||||
|
networking.hostId = "$HOSTID";
|
||||||
|
boot.zfs.devNodes = "$ZFS";
|
||||||
|
boot.supportedFilesystems = [ "zfs" ];
|
||||||
|
boot.kernelParams = [ "zfs.zfs_arc_max=$ZFS_ARC_MAX" ];
|
||||||
|
CONFIG
|
||||||
|
fi
|
||||||
|
|
||||||
pprint "Append ZFS configuration to hardware-configuration.nix"
|
pprint "Append ZFS 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
|
||||||
@ -189,7 +227,7 @@ 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
|
||||||
|
|
||||||
pprint "Copy minimal config to destiination system"
|
pprint "Copy minimal config to destination system"
|
||||||
cp /mnt/etc/nixos/hardware-configuration.nix $CONFIG_FOLDER/hardware-configuration/$DEVICE_NAME.nix
|
cp /mnt/etc/nixos/hardware-configuration.nix $CONFIG_FOLDER/hardware-configuration/$DEVICE_NAME.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/hardware-configuration/$DEVICE_NAME.nix
|
sed -i 's#<nixpkgs/nixos/modules/installer/scan/not-detected.nix>#"${inputs.nixpkgs}/nixos/modules/installer/scan/not-detected.nix"#' $CONFIG_FOLDER/hardware-configuration/$DEVICE_NAME.nix
|
||||||
@ -201,7 +239,7 @@ read -p "> Do you want to execute nixos-install command?" -n 1 -r
|
|||||||
echo
|
echo
|
||||||
if [[ "$REPLY" =~ ^[Yy]$ ]]
|
if [[ "$REPLY" =~ ^[Yy]$ ]]
|
||||||
then
|
then
|
||||||
nixos-install -I nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/$NIXOS_COMMIT.tar.gz --max-jobs $MAX_JOBS --no-root-passwd
|
nixos-install -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/$NIXOS_COMMIT.tar.gz --max-jobs $MAX_JOBS --no-root-passwd
|
||||||
mkdir -p /mnt/home/alukard/nixos-config
|
mkdir -p /mnt/home/alukard/nixos-config
|
||||||
cp -aT $CONFIG_FOLDER /mnt/home/alukard/nixos-config
|
cp -aT $CONFIG_FOLDER /mnt/home/alukard/nixos-config
|
||||||
fi
|
fi
|
||||||
|
@ -72,6 +72,6 @@
|
|||||||
hashedPassword = "$6$kDBGyd99tto$9LjQwixa7NYB9Kaey002MD94zHob1MmNbVz9kx3yX6Q4AmVgsFMGUyNuHozXprxyuXHIbOlTcf8nd4rK8MWfI/";
|
hashedPassword = "$6$kDBGyd99tto$9LjQwixa7NYB9Kaey002MD94zHob1MmNbVz9kx3yX6Q4AmVgsFMGUyNuHozXprxyuXHIbOlTcf8nd4rK8MWfI/";
|
||||||
};
|
};
|
||||||
|
|
||||||
system.stateVersion = "20.03";
|
system.stateVersion = "20.09";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -46,6 +46,7 @@ with config.deviceSpecific;
|
|||||||
color19 = "#${thm.base02-hex}";
|
color19 = "#${thm.base02-hex}";
|
||||||
color20 = "#${thm.base04-hex}";
|
color20 = "#${thm.base04-hex}";
|
||||||
color21 = "#${thm.base06-hex}";
|
color21 = "#${thm.base06-hex}";
|
||||||
|
enable_audio_bell = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user