Fix everything.
This commit is contained in:
parent
11075719cb
commit
3d25d316fe
118 changed files with 180 additions and 244 deletions
10
system/devices/disks/default.nix
Normal file
10
system/devices/disks/default.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./disko
|
||||
./filesystems
|
||||
./immutable
|
||||
./impermanence
|
||||
./snapper
|
||||
];
|
||||
}
|
94
system/devices/disks/disko/default.nix
Normal file
94
system/devices/disks/disko/default.nix
Normal file
|
@ -0,0 +1,94 @@
|
|||
{ config, disko, ... }:
|
||||
{
|
||||
imports = [ disko.nixosModules.disko ];
|
||||
|
||||
disko.devices = {
|
||||
disk = {
|
||||
"${config.networking.hostName}" = {
|
||||
type = "disk";
|
||||
device = "/dev/mmcblk1";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
priority = 1;
|
||||
size = "2G";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
luks = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "luks";
|
||||
name = "${config.networking.hostName}-disk";
|
||||
settings.allowDiscards = true;
|
||||
passwordFile = "/tmp/secret.key";
|
||||
content = {
|
||||
type = "lvm_pv";
|
||||
vg = "${config.networking.hostName}";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
lvm_vg = {
|
||||
"${config.networking.hostName}" = {
|
||||
type = "lvm_vg";
|
||||
lvs = {
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = [ "-f" ];
|
||||
subvolumes = {
|
||||
"/root" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = [ "compress=zstd" "noatime" "ssd" ];
|
||||
};
|
||||
"/prev" = {
|
||||
mountpoint = "/prev";
|
||||
mountOptions = [ "compress=zstd" "noatime" "ssd" "noexec" ];
|
||||
};
|
||||
"/nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = [ "compress=zstd" "noatime" "ssd" ];
|
||||
};
|
||||
|
||||
# Impermanence
|
||||
"/persist" = {
|
||||
mountpoint = "/persist";
|
||||
mountOptions = [ "compress=zstd" "noatime" "ssd" ];
|
||||
};
|
||||
"/persist/.snapshots" = { };
|
||||
|
||||
"/persist/home/jules" = { };
|
||||
"/persist/home/jules/.snapshots" = { };
|
||||
|
||||
"/persist/home/jimbo" = { };
|
||||
"/persist/home/jimbo/.snapshots" = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
swap = {
|
||||
size = "4G";
|
||||
content = {
|
||||
type = "swap";
|
||||
discardPolicy = "both";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Needed for impermanence
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
}
|
13
system/devices/disks/filesystems/default.nix
Normal file
13
system/devices/disks/filesystems/default.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
boot.supportedFilesystems = {
|
||||
btrfs = true;
|
||||
ntfs = true;
|
||||
zfs = true;
|
||||
};
|
||||
|
||||
services = {
|
||||
btrfs.autoScrub.enable = true;
|
||||
fstrim.enable = true;
|
||||
};
|
||||
}
|
5
system/devices/disks/immutable/default.nix
Normal file
5
system/devices/disks/immutable/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{ ... }:
|
||||
{
|
||||
system.etc.overlay.mutable = false;
|
||||
boot.tmp.cleanOnBoot = true;
|
||||
}
|
10
system/devices/disks/impermanence/default.nix
Normal file
10
system/devices/disks/impermanence/default.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ impermanence, ... }:
|
||||
{
|
||||
imports = [
|
||||
./jules
|
||||
./jimbo
|
||||
./root
|
||||
|
||||
impermanence.nixosModules.impermanence
|
||||
];
|
||||
}
|
26
system/devices/disks/impermanence/jimbo/default.nix
Normal file
26
system/devices/disks/impermanence/jimbo/default.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
environment.persistence."/persist" = {
|
||||
hideMounts = true;
|
||||
users.jimbo = {
|
||||
directories = [
|
||||
"Keepers"
|
||||
"Documents"
|
||||
"Pictures"
|
||||
"Videos"
|
||||
"Games"
|
||||
"VMs"
|
||||
|
||||
".snapshots"
|
||||
".cache/nix-index"
|
||||
|
||||
{ directory = ".ssh"; mode = "0700"; }
|
||||
{ directory = ".gnupg"; mode = "0700"; }
|
||||
];
|
||||
files = [
|
||||
".zsh_history"
|
||||
".local/state/lazygit/state.yml"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
26
system/devices/disks/impermanence/jules/default.nix
Normal file
26
system/devices/disks/impermanence/jules/default.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
environment.persistence."/persist" = {
|
||||
hideMounts = true;
|
||||
users.jules = {
|
||||
directories = [
|
||||
"Keepers"
|
||||
"Documents"
|
||||
"Pictures"
|
||||
"Videos"
|
||||
"Games"
|
||||
"VMs"
|
||||
|
||||
".snapshots"
|
||||
".cache/nix-index"
|
||||
|
||||
{ directory = ".ssh"; mode = "0700"; }
|
||||
{ directory = ".gnupg"; mode = "0700"; }
|
||||
];
|
||||
files = [
|
||||
".zsh_history"
|
||||
".local/state/lazygit/state.yml"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
15
system/devices/disks/impermanence/root/default.nix
Normal file
15
system/devices/disks/impermanence/root/default.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ ... }:
|
||||
{
|
||||
environment.persistence."/persist" = {
|
||||
hideMounts = true;
|
||||
directories = [
|
||||
"/etc/nixos"
|
||||
"/etc/secureboot"
|
||||
"/var/lib/nixos"
|
||||
];
|
||||
files = [
|
||||
"/etc/machine-id"
|
||||
"/root/.gitconfig"
|
||||
];
|
||||
};
|
||||
}
|
13
system/devices/disks/snapper/default.nix
Normal file
13
system/devices/disks/snapper/default.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./jules
|
||||
./jimbo
|
||||
./root
|
||||
];
|
||||
|
||||
services.snapper = {
|
||||
snapshotInterval = "0/6:00:00";
|
||||
persistentTimer = true;
|
||||
};
|
||||
}
|
12
system/devices/disks/snapper/jimbo/default.nix
Normal file
12
system/devices/disks/snapper/jimbo/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
services.snapper.configs.jimbo = lib.mkIf config.environment.persistence."/persist".enable {
|
||||
SUBVOLUME = "/persist/home/jimbo";
|
||||
TIMELINE_CREATE = true;
|
||||
TIMELINE_CLEANUP = true;
|
||||
TIMELINE_LIMIT_DAILY = 1;
|
||||
TIMELINE_LIMIT_WEEKLY = 1;
|
||||
TIMELINE_LIMIT_MONTHLY = 0;
|
||||
TIMELINE_LIMIT_YEARLY = 0;
|
||||
};
|
||||
}
|
12
system/devices/disks/snapper/jules/default.nix
Normal file
12
system/devices/disks/snapper/jules/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
services.snapper.configs.jules = lib.mkIf config.environment.persistence."/persist".enable {
|
||||
SUBVOLUME = "/persist/home/jules";
|
||||
TIMELINE_CREATE = true;
|
||||
TIMELINE_CLEANUP = true;
|
||||
TIMELINE_LIMIT_DAILY = 1;
|
||||
TIMELINE_LIMIT_WEEKLY = 1;
|
||||
TIMELINE_LIMIT_MONTHLY = 0;
|
||||
TIMELINE_LIMIT_YEARLY = 0;
|
||||
};
|
||||
}
|
12
system/devices/disks/snapper/root/default.nix
Normal file
12
system/devices/disks/snapper/root/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
services.snapper.configs.root = lib.mkIf config.environment.persistence."/persist".enable {
|
||||
SUBVOLUME = "/persist";
|
||||
TIMELINE_CREATE = true;
|
||||
TIMELINE_CLEANUP = true;
|
||||
TIMELINE_LIMIT_DAILY = 1;
|
||||
TIMELINE_LIMIT_WEEKLY = 0;
|
||||
TIMELINE_LIMIT_MONTHLY = 0;
|
||||
TIMELINE_LIMIT_YEARLY = 0;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue