mirror of
https://codeberg.org/muon/home.git
synced 2025-12-06 08:07:45 +00:00
Add murk and impermanence
This commit is contained in:
parent
a8668c1a44
commit
b4f998d455
17 changed files with 354 additions and 6 deletions
50
modules/home/impermanence.nix
Normal file
50
modules/home/impermanence.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{ pkgs, lib, config, osConfig, ... }:
|
||||
let
|
||||
fs-diff = with pkgs;
|
||||
writeShellApplication {
|
||||
name = "fs-diff";
|
||||
runtimeInputs = [ flameshot curl xsel ];
|
||||
text = ''
|
||||
#!/usr/bin/env bash
|
||||
# fs-diff.sh
|
||||
set -euo pipefail
|
||||
|
||||
OLD_TRANSID=$(sudo btrfs subvolume find-new /mnt/root-blank 9999999)
|
||||
OLD_TRANSID=${OLD_TRANSID}
|
||||
|
||||
sudo mkdir /mnt
|
||||
sudo mount -o subvol=/ /dev/mapper/crypted /mnt
|
||||
sudo btrfs subvolume find-new "/mnt/root" "$OLD_TRANSID" |
|
||||
sed \'$d\' |
|
||||
cut -f17- -d' ' |
|
||||
sort |
|
||||
uniq |
|
||||
while read path; do
|
||||
path="/$path"
|
||||
if [ -L "$path" ]; then
|
||||
: # The path is a symbolic link, so is probably handled by NixOS already
|
||||
elif [ -d "$path" ]; then
|
||||
: # The path is a directory, ignore
|
||||
else
|
||||
echo "$path"
|
||||
fi
|
||||
done
|
||||
sudo umount /mnt
|
||||
'';
|
||||
};
|
||||
in with lib; {
|
||||
config = mkIf osConfig.mods.impermanence.enable {
|
||||
home.packages = [ fs-diff ];
|
||||
home.persistence."/persistent/home/muon" = {
|
||||
directories = [
|
||||
"documents"
|
||||
"downloads"
|
||||
"src"
|
||||
".gnupg"
|
||||
".ssh"
|
||||
".config/sops"
|
||||
".local/share/direnv"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue