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 sudo nixos-generate-config --root /mnt
cp /mnt/etc/nixos/hardware-configuration.nix hosts/$(hostname)/hardware-configuration.nix cp /mnt/etc/nixos/hardware-configuration.nix hosts/$(hostname)/hardware-configuration.nix
sudo nixos-install --root /mnt --no-root-passwd --flake .#$(hostname) sudo nixos-install --root /mnt --no-root-passwd --flake .#$(hostname)
sudo nixos-enter
passwd
passwd muon
exit
sudo reboot
``` ```
# Impermanence # Impermanence

View file

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

View file

@ -4,61 +4,64 @@
{ config, lib, pkgs, modulesPath, ... }: { config, lib, pkgs, modulesPath, ... }:
{ {
imports = imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
[ (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.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/mapper/crypted"; device = "/dev/mapper/crypted";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=root" ]; 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" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/4BD8-A887"; device = "/dev/disk/by-uuid/4BD8-A887";
fsType = "vfat"; fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ]; options = [ "fmask=0077" "dmask=0077" ];
}; };
fileSystems."/home" = fileSystems."/home" = {
{ device = "/dev/mapper/crypted"; device = "/dev/mapper/crypted";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=home" ]; options = [ "subvol=home" "compress=zstd" "noatime" ];
}; };
fileSystems."/nix" = fileSystems."/nix" = {
{ device = "/dev/mapper/crypted"; device = "/dev/mapper/crypted";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=nix" ]; options = [ "subvol=nix" "compress=zstd" "noatime" ];
}; };
fileSystems."/persist" = fileSystems."/persist" = {
{ device = "/dev/mapper/crypted"; device = "/dev/mapper/crypted";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=persist" ]; options = [ "subvol=persist" "compress=zstd" "noatime" ];
neededForBoot = true;
}; };
fileSystems."/swap" = fileSystems."/swap" = {
{ device = "/dev/mapper/crypted"; device = "/dev/mapper/crypted";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=swap" ]; options = [ "subvol=swap" ];
}; };
fileSystems."/var/log" = fileSystems."/var/log" = {
{ device = "/dev/mapper/crypted"; device = "/dev/mapper/crypted";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=log" ]; options = [ "subvol=log" "compress=zstd" "noatime" ];
neededForBoot = true;
}; };
swapDevices = [ ]; swapDevices = [ ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 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; fs-diff = with pkgs;
writeShellApplication { writeShellApplication {
name = "fs-diff"; name = "fs-diff";
runtimeInputs = [ flameshot curl xsel ];
text = '' text = ''
#!/usr/bin/env bash #!/usr/bin/env bash
# fs-diff.sh # fs-diff.sh
@ -36,7 +35,7 @@ let
in with lib; { in with lib; {
config = mkIf osConfig.mods.impermanence.enable { config = mkIf osConfig.mods.impermanence.enable {
home.packages = [ fs-diff ]; home.packages = [ fs-diff ];
# home.persistence."/persistent/home/muon" = { # home.persistence."/persist/home/muon" = {
# directories = [ # directories = [
# "documents" # "documents"
# "downloads" # "downloads"

View file

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