Change lithium to ZFS+impermanence
This commit is contained in:
parent
80b3e52c0c
commit
ae425fcd72
4 changed files with 117 additions and 46 deletions
80
disko/luks-zfs-impermanence.nix
Normal file
80
disko/luks-zfs-impermanence.nix
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
{
|
||||||
|
disko.devices = {
|
||||||
|
disk = {
|
||||||
|
main = {
|
||||||
|
device = "/dev/sda";
|
||||||
|
type = "disk";
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
ESP = {
|
||||||
|
name = "boot";
|
||||||
|
type = "EF00";
|
||||||
|
size = "512M";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
mountOptions = [ "umask=0077" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
swap = {
|
||||||
|
size = "4G";
|
||||||
|
content = {
|
||||||
|
type = "swap";
|
||||||
|
discardPolicy = "both";
|
||||||
|
randomEncryption = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
luks = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "luks";
|
||||||
|
name = "crypted";
|
||||||
|
settings = {
|
||||||
|
bypassWorkqueues = true;
|
||||||
|
allowDiscards = true;
|
||||||
|
};
|
||||||
|
extraFormatArgs = [ "-i 5000" ];
|
||||||
|
content = {
|
||||||
|
type = "zfs";
|
||||||
|
pool = "zroot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
zpool = {
|
||||||
|
zroot = {
|
||||||
|
type = "zpool";
|
||||||
|
rootFsOptions = {
|
||||||
|
canmount = "off";
|
||||||
|
compression = "zstd";
|
||||||
|
};
|
||||||
|
datasets = {
|
||||||
|
nix = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/nix";
|
||||||
|
options.mountpoint = "legacy";
|
||||||
|
};
|
||||||
|
persist = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
options = {
|
||||||
|
mountpoint = "legacy";
|
||||||
|
"com.sun:auto-snapshot" = "true";
|
||||||
|
};
|
||||||
|
mountpoint = "/persist";
|
||||||
|
};
|
||||||
|
root = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/";
|
||||||
|
options.mountpoint = "legacy";
|
||||||
|
postCreateHook = "zfs snapshot zroot/root@blank";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
|
imports = [ ../../disko/luks-zfs-impermanence.nix ];
|
||||||
|
|
||||||
custom = {
|
custom = {
|
||||||
roles = {
|
roles = {
|
||||||
desktop.enable = true;
|
desktop.enable = true;
|
||||||
|
@ -19,31 +21,13 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
hardware.intelLaptop.enable = true;
|
hardware.intelLaptop.enable = true;
|
||||||
platform.hibernate.enable = true;
|
|
||||||
services = {
|
services = {
|
||||||
syncthing.enable = true;
|
|
||||||
nixCacheClient = {
|
nixCacheClient = {
|
||||||
enable = true;
|
enable = true;
|
||||||
remoteBuilds.additional = true;
|
remoteBuilds.additional = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
system.stateVersion = "24.05";
|
networking.hostId = "ca94a90c";
|
||||||
|
system.stateVersion = "25.05";
|
||||||
boot.kernelParams = [ "resume_offset=39292928" ];
|
|
||||||
fileSystems."/" = {
|
|
||||||
device = "/dev/disk/by-uuid/b43fe465-80e9-48d4-a4be-1113c917330e";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
boot.initrd.luks.devices."nixos".device = "/dev/disk/by-uuid/4dc2fd8c-71da-4b95-91d5-7a118387172b";
|
|
||||||
|
|
||||||
fileSystems."/boot" = {
|
|
||||||
device = "/dev/disk/by-uuid/D8BB-B91A";
|
|
||||||
fsType = "vfat";
|
|
||||||
options = [
|
|
||||||
"fmask=0077"
|
|
||||||
"dmask=0077"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,7 @@ let
|
||||||
cfg = config.custom.platform.impermanence;
|
cfg = config.custom.platform.impermanence;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.custom.platform.impermanence.enable = lib.mkOption {
|
options.custom.platform.impermanence.enable = lib.mkEnableOption "custom impermanence setup";
|
||||||
type = lib.types.bool;
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
# Default set of directories we always want to persist
|
# Default set of directories we always want to persist
|
||||||
|
|
|
@ -7,28 +7,38 @@ let
|
||||||
cfg = config.custom.roles.personalMachine;
|
cfg = config.custom.roles.personalMachine;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.custom.roles.personalMachine.enable = lib.mkOption {
|
options.custom.roles.personalMachine.enable =
|
||||||
type = lib.types.bool;
|
lib.mkEnableOption "role for personal machines (desktop/laptop)";
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config =
|
||||||
custom = {
|
(lib.mkIf cfg.enable {
|
||||||
hardware = {
|
custom = {
|
||||||
keychron.enable = true;
|
hardware = {
|
||||||
onlykey.enable = true;
|
keychron.enable = true;
|
||||||
trackball.enable = true;
|
onlykey.enable = true;
|
||||||
|
trackball.enable = true;
|
||||||
|
};
|
||||||
|
programs = {
|
||||||
|
bitwarden.enable = true;
|
||||||
|
communication.enable = true;
|
||||||
|
firefox.enable = true;
|
||||||
|
i3.enable = true;
|
||||||
|
moonlight.enable = true;
|
||||||
|
redshift.enable = true;
|
||||||
|
usbAutoMount.enable = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
programs = {
|
system.autoUpgrade.allowReboot = lib.mkForce false;
|
||||||
bitwarden.enable = true;
|
})
|
||||||
communication.enable = true;
|
// (lib.mkIf config.custom.platform.impermanence.enable {
|
||||||
firefox.enable = true;
|
# TODO Remove this temporary impermanence setup in favor of a more detailed one
|
||||||
i3.enable = true;
|
environment.persistence."/persist".directories = [
|
||||||
moonlight.enable = true;
|
{
|
||||||
redshift.enable = true;
|
directory = config.users.users.vili.home;
|
||||||
usbAutoMount.enable = true;
|
user = config.users.users.vili.name;
|
||||||
};
|
group = config.users.users.vili.group;
|
||||||
};
|
mode = "u=rwx,g=,o=";
|
||||||
system.autoUpgrade.allowReboot = lib.mkForce false;
|
}
|
||||||
};
|
];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue