start work on encryption

This commit is contained in:
ChaotiCryptidz 2022-01-29 19:55:58 +00:00
parent 9ba0a4679f
commit db9c488f17
6 changed files with 92 additions and 26 deletions

View file

@ -1,7 +1,27 @@
# Lappy Setup Guide # Lappy Setup Guide
## Filesystems ## Filesystems
- Ext4 with label nixos ```
- Fat32 EFI with label nixboot export DEVICE_ROOT=/dev/nvme0n1
export DEVICE_BOOT_PART=${DEVICE_ROOT}p1
export DEVICE_ENCRYPTED_ROOT_PART=${DEVICE_ROOT}p2
export DEVICE_UNENCRYPTED_ROOT_NAME=cryptroot
export DEVICE_UNENCRYPTED_ROOT=/dev/mapper/${DEVICE_UNENCRYPTED_ROOT_NAME}
export ENCRYPTION_KEY_PATH=mount/encryption-keys/lappy.key
parted /dev/${DEVICE_ROOT} -- mklabel gpt
parted /dev/${DEVICE_ROOT} -- mkpart primary 512MiB -8GiB
parted /dev/${DEVICE_ROOT} -- mkpart ESP fat32 1MiB 500MiB
parted /dev/${DEVICE_ROOT} -- set 3 esp on
mkfs.fat -n nixboot ${DEVICE_BOOT_PART}
cryptsetup luksFormat ${DEVICE_ENCRYPTED_ROOT_PART}
cryptsetup luksAddKey ${DEVICE_ENCRYPTED_ROOT_PART} ${ENCRYPTION_KEY_PATH}
cryptsetup luksOpen ${DEVICE_ENCRYPTED_ROOT_PART} ${DEVICE_UNENCRYPTED_ROOT_NAME}
mkfs.ext4 -L nixos ${DEVICE_UNENCRYPTED_ROOT}
```
## NetworkManager
Grab passwords from Vault
## Browser (vivaldi) ## Browser (vivaldi)
Open up browser and install the following extensions: Open up browser and install the following extensions:
- - Stylus - - Stylus
@ -43,4 +63,3 @@ Other: #00dda6
- Amount: 500 - Amount: 500
- Method: Fixed - Method: Fixed
- Initial: 2000 - Initial: 2000

63
hosts/lappy/hardware.nix Normal file
View file

@ -0,0 +1,63 @@
{ ... }:
let
usb_label = "my_usb";
encrypted_root_uuid = "";
unencrypted_root_uuid = "";
in {
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"nvme"
"usb_storage"
"sd_mod"
"rtsx_pci_sdmmc"
"uas"
"usbcore"
"usb_storage"
"vfat"
"nls_cp437"
"nls_iso8859_1"
"aesni_intel"
"cryptd"
];
kernelModules = [ "kvm-intel" ];
};
# TODO: encrypted storage
#initrd.postDeviceCommands = pkgs.lib.mkBefore ''
# mkdir -m 0755 -p /key
# sleep 3
# mount -n -t vfat -o ro `findfs LABEL=${usb_label}` /key
#'';
#boot.initrd.luks.devices."cryptroot".device =
# "/dev/disk/by-uuid/${encrypted_root_uuid}";
#initrd.luks.devices."cryptroot" = {
# keyFile = "/key/encryption-keys/lappy.key";
# preLVM = false;
# allowDiscards = true;
#};
fileSystems = {
"/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
};
#"/" = {
# device = "/dev/mapper/cryptroot";
# fsType = "ext4";
#};
"/boot" = {
device = "/dev/disk/by-label/nixboot";
fsType = "vfat";
};
};
}

View file

@ -2,6 +2,8 @@
{ {
imports = with tree; [ imports = with tree; [
./hardware.nix
users.root users.root
users.chaoticryptidz users.chaoticryptidz
profiles.tailscale profiles.tailscale
@ -80,27 +82,6 @@
services.fstrim.enable = true; services.fstrim.enable = true;
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
initrd.availableKernelModules =
[ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
kernelModules = [ "kvm-intel" ];
};
fileSystems = {
"/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
};
"/boot" = {
device = "/dev/disk/by-label/nixboot";
fsType = "vfat";
};
};
system.stateVersion = "21.11"; system.stateVersion = "21.11";
} }

View file

@ -29,8 +29,10 @@
]; ];
}; };
users.users.root.initialPassword = ""; isoImage.squashfsCompression = "zstd -Xcompression-level 1";
users.users.chaoticryptidz.initialPassword = "";
users.users.root.initialPassword = "password";
users.users.chaoticryptidz.initialPassword = "password";
# let vscode, vivaldi, etc work. # let vscode, vivaldi, etc work.
security.unprivilegedUsernsClone = true; security.unprivilegedUsernsClone = true;

0
shell.nix Normal file
View file

View file

@ -1,5 +1,6 @@
{ config, ... }: { { config, ... }: {
users.users.chaoticryptidz = { users.users.chaoticryptidz = {
uid = 1000;
isNormalUser = true; isNormalUser = true;
extraGroups = [ extraGroups = [
"wheel" "wheel"