different-name / nix-files

My NixOS configuration files
GNU General Public License v3.0
9 stars 0 forks source link

Ephemeral Tools #54

Closed different-name closed 2 months ago

different-name commented 2 months ago

Implement commands that perform the following:

For listing ephemeral files - persisted files/directories should be parsed from the impermanence config to be ignored when searching for ephemeral files, along with a list of ephemeral directories to manually exclude (directories known & desired to be ephemeral)

The excluded directories should be what's currently persisted by the current system, so it isn't viable to read the config from $FLAKE, it's also not viable to use an environmental variable to list the excluded directories, as this wouldn't update until the user logs back in. Could generate the script as part of building the configuration, but I can't think of a clean way to do this

Blocked until I can figure out a clean way to:

different-name commented 2 months ago

Might be best to do something like this, where a script is generated using writeShellApplication with the excluded paths

users.users.different.packages = [
  (pkgs.writeShellApplication {
    text = "";
    name = "ephtools";
  })
];
different-name commented 2 months ago

Could add an option to search from a directory, instead of having separate commands for root and home directories

different-name commented 2 months ago
Usage: ephtools <command> [search paths...]

Commands:
  new   - List new files & directories that are not yet persisted
  stray - List stray files & directories that are in persistent storage, but are not in the persistence config

Arguments:
  search paths - Override the search directories with one or more absolute paths

Example:

$ ephtools new /home/different
/home/different/.mozilla/firefox/profiles.ini
/home/different/.mozilla/firefox/Crash Reports/InstallTime20240812083845
/home/different/.mozilla/firefox/zplh5wi6.default/key4.db
/home/different/.mozilla/firefox/zplh5wi6.default/webappsstore.sqlite
/home/different/.mozilla/firefox/zplh5wi6.default/protections.sqlite
/home/different/.mozilla/firefox/zplh5wi6.default/cookies.sqlite
/home/different/.mozilla/firefox/zplh5wi6.default/SiteSecurityServiceState.bin
/home/different/.mozilla/firefox/zplh5wi6.default/times.json
/home/different/.mozilla/firefox/zplh5wi6.default/bounce-tracking-protection.sqlite
/home/different/.mozilla/firefox/zplh5wi6.default/compatibility.ini
/home/different/.mozilla/firefox/zplh5wi6.default/favicons.sqlite
/home/different/.mozilla/firefox/zplh5wi6.default/storage/default/https+++www.mozilla.org/ls/usage
/home/different/.mozilla/firefox/zplh5wi6.default/storage/default/https+++www.mozilla.org/ls/data.sqlite
/home/different/.mozilla/firefox/zplh5wi6.default/storage/default/https+++www.mozilla.org/.metadata-v2
/home/different/.mozilla/firefox/zplh5wi6.default/storage/ls-archive.sqlite
/home/different/.mozilla/firefox/zplh5wi6.default/storage/permanent/chrome/idb/1451318868ntouromlalnodry--epcr.sqlite-wal
/home/different/.mozilla/firefox/zplh5wi6.default/storage/permanent/chrome/idb/1451318868ntouromlalnodry--epcr.sqlite
/home/different/.mozilla/firefox/zplh5wi6.default/storage/permanent/chrome/idb/3870112724rsegmnoittet-es.sqlite-wal
/home/different/.mozilla/firefox/zplh5wi6.default/storage/permanent/chrome/idb/2823318777ntouromlalnodry--naod.sqlite
/home/different/.mozilla/firefox/zplh5wi6.default/storage/permanent/chrome/idb/1657114595AmcateirvtiSty.sqlite
/home/different/.mozilla/firefox/zplh5wi6.default/storage/permanent/chrome/idb/3561288849sdhlie.sqlite
/home/different/.mozilla/firefox/zplh5wi6.default/storage/permanent/chrome/idb/2918063365piupsah.sqlite
/home/different/.mozilla/firefox/zplh5wi6.default/storage/permanent/chrome/idb/2918063365piupsah.sqlite-wal
/home/different/.mozilla/firefox/zplh5wi6.default/storage/permanent/chrome/idb/2823318777ntouromlalnodry--naod.sqlite-wal
/home/different/.mozilla/firefox/zplh5wi6.default/storage/permanent/chrome/idb/3561288849sdhlie.sqlite-wal
/home/different/.mozilla/firefox/zplh5wi6.default/storage/permanent/chrome/idb/1657114595AmcateirvtiSty.sqlite-wal
/home/different/.mozilla/firefox/zplh5wi6.default/storage/permanent/chrome/idb/3870112724rsegmnoittet-es.sqlite
/home/different/.mozilla/firefox/zplh5wi6.default/storage/permanent/chrome/.metadata-v2
/home/different/.mozilla/firefox/zplh5wi6.default/pkcs11.txt
/home/different/.mozilla/firefox/zplh5wi6.default/cert9.db
/home/different/.mozilla/firefox/zplh5wi6.default/shield-preference-experiments.json
/home/different/.mozilla/firefox/zplh5wi6.default/content-prefs.sqlite
/home/different/.mozilla/firefox/zplh5wi6.default/prefs.js
/home/different/.mozilla/firefox/zplh5wi6.default/storage.sqlite
/home/different/.mozilla/firefox/zplh5wi6.default/sessionstore-backups/recovery.jsonlz4
/home/different/.mozilla/firefox/zplh5wi6.default/favicons.sqlite-wal
/home/different/.mozilla/firefox/zplh5wi6.default/.parentlock
/home/different/.mozilla/firefox/zplh5wi6.default/search.json.mozlz4
/home/different/.mozilla/firefox/zplh5wi6.default/extensions.json
/home/different/.mozilla/firefox/zplh5wi6.default/cookies.sqlite-wal
/home/different/.mozilla/firefox/zplh5wi6.default/datareporting/glean/db/data.safe.bin
/home/different/.mozilla/firefox/zplh5wi6.default/datareporting/glean/events/prototype-no-code-events
/home/different/.mozilla/firefox/zplh5wi6.default/datareporting/glean/events/pageload
/home/different/.mozilla/firefox/zplh5wi6.default/datareporting/glean/events/events
/home/different/.mozilla/firefox/zplh5wi6.default/datareporting/glean/events/background-update
/home/different/.mozilla/firefox/zplh5wi6.default/datareporting/state.json
/home/different/.mozilla/firefox/zplh5wi6.default/formhistory.sqlite
/home/different/.mozilla/firefox/zplh5wi6.default/permissions.sqlite
/home/different/.mozilla/firefox/zplh5wi6.default/AlternateServices.bin
/home/different/.mozilla/firefox/zplh5wi6.default/containers.json
/home/different/.mozilla/firefox/zplh5wi6.default/webappsstore.sqlite-wal
/home/different/.mozilla/firefox/zplh5wi6.default/addons.json
/home/different/.mozilla/firefox/zplh5wi6.default/addonStartup.json.lz4
/home/different/.mozilla/firefox/zplh5wi6.default/extension-preferences.json
/home/different/.mozilla/firefox/zplh5wi6.default/handlers.json
/home/different/.mozilla/firefox/zplh5wi6.default/places.sqlite
/home/different/.mozilla/firefox/zplh5wi6.default/places.sqlite-wal
/home/different/.mozilla/firefox/zplh5wi6.default/sessionCheckpoints.json
/home/different/.mozilla/firefox/zplh5wi6.default/ExperimentStoreData.json
/home/different/.config/dconf/user
/home/different/.config/Thunar/uca.xml
/home/different/.config/pulse/cookie
/home/different/.config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml
/home/different/.local/share/aspyr-media/borderlands 2/willowgame/savedata/76561198836163955/profile.bin
/home/different/.local/share/aspyr-media/borderlands 2/willowgame/savedata/76561198836163955/steam_autocloud.vdf
/home/different/.local/share/nix/repl-history
/home/different/.local/share/mimeapps.list
/home/different/.local/share/recently-used.xbel
/home/different/.local/state/lesshst