Fix persist

This commit is contained in:
muon 2025-07-31 20:20:55 +00:00
parent aba1da6c1f
commit 41ae205f6a
5 changed files with 72 additions and 53 deletions

View file

@ -10,6 +10,11 @@ sudo umount /tmp/mnt
sudo nixos-generate-config --root /mnt
cp /mnt/etc/nixos/hardware-configuration.nix hosts/$(hostname)/hardware-configuration.nix
sudo nixos-install --root /mnt --no-root-passwd --flake .#$(hostname)
sudo nixos-enter
passwd
passwd muon
exit
sudo reboot
```
# Impermanence

View file

@ -6,6 +6,11 @@ in {
imports = [
./hardware-configuration.nix
inputs.impermanence.nixosModules.impermanence
"${
builtins.fetchTarball
"https://github.com/nix-community/disko/archive/master.tar.gz"
}/module.nix"
./disk-config.nix
# (inputs.nixpkgs
# + "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix")
];
@ -19,9 +24,12 @@ in {
networking.hostId = "a2309090";
mods.home.file = ./home.nix;
boot.loader.grub.enable = true;
boot.loader.grub.efiSupport = true;
boot.loader.grub.efiInstallAsRemovable = true;
# Modules
mods.desktop.enable = true;
mods.boot.enable = true;
mods.theme.enable = true;
mods.theme.scheme = "woodland";

View file

@ -4,61 +4,64 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.availableKernelModules =
[ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/mapper/crypted";
fileSystems."/" = {
device = "/dev/mapper/crypted";
fsType = "btrfs";
options = [ "subvol=root" ];
};
boot.initrd.luks.devices."crypted".device = "/dev/disk/by-uuid/1ca0c5f6-3cb3-4f86-94a5-4376461da227";
boot.initrd.luks.devices."crypted".device =
"/dev/disk/by-uuid/1ca0c5f6-3cb3-4f86-94a5-4376461da227";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/4BD8-A887";
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/4BD8-A887";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
fileSystems."/home" =
{ device = "/dev/mapper/crypted";
fileSystems."/home" = {
device = "/dev/mapper/crypted";
fsType = "btrfs";
options = [ "subvol=home" ];
options = [ "subvol=home" "compress=zstd" "noatime" ];
};
fileSystems."/nix" =
{ device = "/dev/mapper/crypted";
fileSystems."/nix" = {
device = "/dev/mapper/crypted";
fsType = "btrfs";
options = [ "subvol=nix" ];
options = [ "subvol=nix" "compress=zstd" "noatime" ];
};
fileSystems."/persist" =
{ device = "/dev/mapper/crypted";
fileSystems."/persist" = {
device = "/dev/mapper/crypted";
fsType = "btrfs";
options = [ "subvol=persist" ];
options = [ "subvol=persist" "compress=zstd" "noatime" ];
neededForBoot = true;
};
fileSystems."/swap" =
{ device = "/dev/mapper/crypted";
fileSystems."/swap" = {
device = "/dev/mapper/crypted";
fsType = "btrfs";
options = [ "subvol=swap" ];
};
fileSystems."/var/log" =
{ device = "/dev/mapper/crypted";
fileSystems."/var/log" = {
device = "/dev/mapper/crypted";
fsType = "btrfs";
options = [ "subvol=log" ];
options = [ "subvol=log" "compress=zstd" "noatime" ];
neededForBoot = true;
};
swapDevices = [ ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
hardware.cpu.intel.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -3,7 +3,6 @@ let
fs-diff = with pkgs;
writeShellApplication {
name = "fs-diff";
runtimeInputs = [ flameshot curl xsel ];
text = ''
#!/usr/bin/env bash
# fs-diff.sh
@ -36,7 +35,7 @@ let
in with lib; {
config = mkIf osConfig.mods.impermanence.enable {
home.packages = [ fs-diff ];
# home.persistence."/persistent/home/muon" = {
# home.persistence."/persist/home/muon" = {
# directories = [
# "documents"
# "downloads"

View file

@ -3,15 +3,19 @@ with lib; {
options.mods.impermanence.enable = mkEnableOption "enables impermanence";
config = mkIf config.mods.impermanence.enable {
# environment.persistence."/persistent" = {
# directories = [
# "/var/lib/bluetooth"
# "/var/lib/nixos"
# "/var/lib/systemd/coredump"
# "/etc/NetworkManager/system-connections"
# ];
# files = [ "/etc/machine-id" ];
# };
environment.persistence."/persist" = {
directories =
[ "/var/lib/nixos" "/var/lib/systemd/coredump" "/etc/nixos" ];
files = [
"/etc/machine-id"
"/etc/passwd"
"/etc/group"
"/etc/shadow"
"/etc/subgid"
"/etc/subuid"
"/etc/sudoers"
];
};
boot.initrd.postResumeCommands = lib.mkAfter ''
mkdir /btrfs_tmp