mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-07-10 14:42:40 +02:00
feat: encrypted boot partition, fix nix.gc args
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
# Use the EFI boot loader.
|
# Use the EFI boot loader.
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
# depending on how you configured your disk mounts, change this to /boot or /boot/efi.
|
# depending on how you configured your disk mounts, change this to /boot or /boot/efi.
|
||||||
boot.loader.efi.efiSysMountPoint = "/boot";
|
boot.loader.efi.efiSysMountPoint = "/boot/efi";
|
||||||
boot.loader.grub = {
|
boot.loader.grub = {
|
||||||
enable = true;
|
enable = true;
|
||||||
device = "nodev";
|
device = "nodev";
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
# if you use an encrypted /boot partition, you should enable this option.
|
# if you use an encrypted /boot partition, you should enable this option.
|
||||||
# grub 2.12-rc1 support only luks1 and luks2+pbkdf2,
|
# grub 2.12-rc1 support only luks1 and luks2+pbkdf2,
|
||||||
# so the /boot partition can only use those two luks encrypt format.
|
# so the /boot partition can only use those two luks encrypt format.
|
||||||
# enableCryptodisk = true;
|
enableCryptodisk = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
|
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
|
||||||
@@ -28,12 +28,6 @@
|
|||||||
boot.kernelModules = [ "kvm-intel" ];
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
fileSystems."/" =
|
|
||||||
{ device = "/dev/disk/by-uuid/836b93a9-324f-45e6-ac1d-964becd7520c";
|
|
||||||
fsType = "btrfs";
|
|
||||||
options = [ "subvol=@root" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
boot.initrd = {
|
boot.initrd = {
|
||||||
# encrypted-nixos is the root filesystem of nixos
|
# encrypted-nixos is the root filesystem of nixos
|
||||||
# it's unlocked by a keyfile or passphrase.
|
# it's unlocked by a keyfile or passphrase.
|
||||||
@@ -50,6 +44,19 @@
|
|||||||
# it's less secure, but faster.
|
# it's less secure, but faster.
|
||||||
allowDiscards = true;
|
allowDiscards = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
luks.devices."crypted-boot" = {
|
||||||
|
device = "/dev/nvme0n1p3";
|
||||||
|
# the keyfile(or device partition) that should be used as the decryption key for the encrypted device.
|
||||||
|
# if not specified, you will be prompted for a passphrase instead.
|
||||||
|
#keyFile = "/keyfile.bin";
|
||||||
|
|
||||||
|
# whether to allow TRIM requests to the underlying device.
|
||||||
|
# it's less secure, but faster.
|
||||||
|
# boot partition do not require fast speed, so we disable it.
|
||||||
|
allowDiscards = false;
|
||||||
|
};
|
||||||
|
|
||||||
# secrets to append to the initrd.
|
# secrets to append to the initrd.
|
||||||
# the initrd is located in /boot partition, so only enabled this options when you encryped /boot partition!
|
# the initrd is located in /boot partition, so only enabled this options when you encryped /boot partition!
|
||||||
secrets = {
|
secrets = {
|
||||||
@@ -59,6 +66,13 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
fileSystems."/" =
|
||||||
|
{ device = "/dev/disk/by-uuid/836b93a9-324f-45e6-ac1d-964becd7520c";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=@root" ];
|
||||||
|
};
|
||||||
|
|
||||||
fileSystems."/nix" =
|
fileSystems."/nix" =
|
||||||
{ device = "/dev/disk/by-uuid/836b93a9-324f-45e6-ac1d-964becd7520c";
|
{ device = "/dev/disk/by-uuid/836b93a9-324f-45e6-ac1d-964becd7520c";
|
||||||
fsType = "btrfs";
|
fsType = "btrfs";
|
||||||
@@ -78,7 +92,12 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/boot" =
|
fileSystems."/boot" =
|
||||||
{ device = "/dev/disk/by-uuid/B63C-4887";
|
{ device = "/dev/mapper/crypted-boot";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/boot/efi" =
|
||||||
|
{ device = "/dev/nvme0n1p1";
|
||||||
fsType = "vfat";
|
fsType = "vfat";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
# do garbage collection weekly to keep disk usage low
|
# do garbage collection weekly to keep disk usage low
|
||||||
nix.gc = {
|
nix.gc = {
|
||||||
automatic = lib.mkDefault true;
|
automatic = lib.mkDefault true;
|
||||||
options = lib.mkDefault "--delete-older-than 1w";
|
options = lib.mkDefault "--delete-older-than 7d";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Manual optimise storage: nix-store --optimise
|
# Manual optimise storage: nix-store --optimise
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
nix.gc = {
|
nix.gc = {
|
||||||
automatic = lib.mkDefault true;
|
automatic = lib.mkDefault true;
|
||||||
dates = lib.mkDefault "weekly";
|
dates = lib.mkDefault "weekly";
|
||||||
options = lib.mkDefault "--delete-older-than 1w";
|
options = lib.mkDefault "--delete-older-than 7d";
|
||||||
};
|
};
|
||||||
|
|
||||||
nix.settings = {
|
nix.settings = {
|
||||||
|
|||||||
Reference in New Issue
Block a user