Wtf why did it remove everything.
This commit is contained in:
parent
d58b606d90
commit
2144d9ef61
73 changed files with 1077 additions and 0 deletions
10
modules/system/devices/boot/extlinux/default.nix
Normal file
10
modules/system/devices/boot/extlinux/default.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
options.system.extlinux.enable = lib.mkEnableOption "Enable extlinux";
|
||||
|
||||
config.boot.loader = lib.mkIf config.system.extlinux.enable {
|
||||
grub.enable = false;
|
||||
systemd-boot.enable = lib.mkForce false;
|
||||
generic-extlinux-compatible.enable = true;
|
||||
};
|
||||
}
|
6
modules/system/devices/boot/services/default.nix
Normal file
6
modules/system/devices/boot/services/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [ ./root-reset ];
|
||||
|
||||
boot.initrd.systemd.enable = true;
|
||||
}
|
31
modules/system/devices/boot/services/root-reset/default.nix
Normal file
31
modules/system/devices/boot/services/root-reset/default.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
boot.initrd.systemd.services.root-reset = {
|
||||
enable = config.environment.persistence."/persist".enable;
|
||||
description = "Create new and snapshot previous root";
|
||||
wantedBy = [ "initrd.target" ];
|
||||
before = [ "sysroot.mount" ];
|
||||
after = [ "initrd-root-device.target" ];
|
||||
unitConfig.DefaultDependencies = "no";
|
||||
serviceConfig.Type = "oneshot";
|
||||
script = ''
|
||||
mkdir -p /mnt
|
||||
mount -t btrfs /dev/${config.networking.hostName}/root /mnt
|
||||
|
||||
if [[ -e /mnt/prev ]]; then
|
||||
btrfs subvolume delete /mnt/prev
|
||||
fi
|
||||
|
||||
btrfs subvolume snapshot /mnt/root /mnt/prev
|
||||
|
||||
btrfs subvolume list -o /mnt/root | cut -f9 -d' ' | while read subvolume; do
|
||||
btrfs subvolume delete "/mnt/$subvolume"
|
||||
done
|
||||
|
||||
btrfs subvolume delete /mnt/root
|
||||
btrfs subvolume create /mnt/root
|
||||
|
||||
umount /mnt
|
||||
'';
|
||||
};
|
||||
}
|
9
modules/system/devices/disks/default.nix
Normal file
9
modules/system/devices/disks/default.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./filesystems
|
||||
./immutable
|
||||
./impermanence
|
||||
./snapper
|
||||
];
|
||||
}
|
13
modules/system/devices/disks/filesystems/default.nix
Normal file
13
modules/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
modules/system/devices/disks/immutable/default.nix
Normal file
5
modules/system/devices/disks/immutable/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{ ... }:
|
||||
{
|
||||
system.etc.overlay.mutable = false;
|
||||
boot.tmp.cleanOnBoot = true;
|
||||
}
|
8
modules/system/devices/disks/impermanence/default.nix
Normal file
8
modules/system/devices/disks/impermanence/default.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ impermanence, ... }:
|
||||
{
|
||||
imports = [
|
||||
./main
|
||||
./root
|
||||
impermanence.nixosModules.impermanence
|
||||
];
|
||||
}
|
46
modules/system/devices/disks/impermanence/main/default.nix
Normal file
46
modules/system/devices/disks/impermanence/main/default.nix
Normal file
|
@ -0,0 +1,46 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
environment.persistence."/persist" = {
|
||||
hideMounts = true;
|
||||
users.${config.sysusers.main} = {
|
||||
directories = [
|
||||
"Keepers"
|
||||
"Documents"
|
||||
"Pictures"
|
||||
"Videos"
|
||||
"Games"
|
||||
"VMs"
|
||||
|
||||
".snapshots"
|
||||
".mozilla"
|
||||
".thunderbird"
|
||||
|
||||
".config/blender"
|
||||
".config/dconf"
|
||||
".config/vesktop"
|
||||
".config/sunshine"
|
||||
".config/heroic"
|
||||
".config/obs-studio"
|
||||
|
||||
".local/share/mpd"
|
||||
".local/share/nvim/undo"
|
||||
".local/share/PrismLauncher"
|
||||
".local/share/Steam"
|
||||
".local/share/TelegramDesktop"
|
||||
|
||||
".local/state/wireplumber"
|
||||
|
||||
".cache/nix-index"
|
||||
|
||||
{ directory = ".ssh"; mode = "0700"; }
|
||||
{ directory = ".gnupg"; mode = "0700"; }
|
||||
{ directory = ".local/share/keyrings"; mode = "0700"; }
|
||||
];
|
||||
files = [
|
||||
".zsh_history"
|
||||
".local/state/lazygit/state.yml"
|
||||
".local/share/applications" # Create directory so nothing generates inside of it
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
15
modules/system/devices/disks/impermanence/root/default.nix
Normal file
15
modules/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"
|
||||
];
|
||||
};
|
||||
}
|
12
modules/system/devices/disks/snapper/default.nix
Normal file
12
modules/system/devices/disks/snapper/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./main
|
||||
./root
|
||||
];
|
||||
|
||||
services.snapper = {
|
||||
snapshotInterval = "0/6:00:00";
|
||||
persistentTimer = true;
|
||||
};
|
||||
}
|
12
modules/system/devices/disks/snapper/main/default.nix
Normal file
12
modules/system/devices/disks/snapper/main/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
services.snapper.configs.${config.sysusers.main} = lib.mkIf config.environment.persistence."/persist".enable {
|
||||
SUBVOLUME = "/persist/home/${config.sysusers.main}";
|
||||
TIMELINE_CREATE = true;
|
||||
TIMELINE_CLEANUP = true;
|
||||
TIMELINE_LIMIT_DAILY = 1;
|
||||
TIMELINE_LIMIT_WEEKLY = 1;
|
||||
TIMELINE_LIMIT_MONTHLY = 0;
|
||||
TIMELINE_LIMIT_YEARLY = 0;
|
||||
};
|
||||
}
|
12
modules/system/devices/disks/snapper/root/default.nix
Normal file
12
modules/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;
|
||||
};
|
||||
}
|
13
modules/system/devices/networking/wireless/default.nix
Normal file
13
modules/system/devices/networking/wireless/default.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
options.system.wireless.enable = lib.mkEnableOption "Enable wireless stack";
|
||||
|
||||
config = lib.mkIf config.system.wireless.enable {
|
||||
networking.wireless.iwd.enable = true;
|
||||
|
||||
environment = {
|
||||
systemPackages = with pkgs; [ impala ];
|
||||
persistence."/persist".directories = [ "/var/lib/iwd/" ];
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue