Every Nixy solution I could find or conceive had too many points spread across these various facets: - Flimsy (emacsWithPackagesFromUsePackage) - Inelegant (builtins.exec, manual listings) - Inflexible (emacsWithPackagesFromUsePackage) - Otherwise unergonomic (everything }:D) Straight.el is sufficiently declarative, flexible, and Nix-friendly without blindly bowing down to the imperialist NixOS user. Now, Convenience and ergonomics shan't be forsaken for the dogma that is total Nixation.
56 lines
1.4 KiB
Nix
Executable File
56 lines
1.4 KiB
Nix
Executable File
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.sydnix.impermanence;
|
|
in {
|
|
options = {
|
|
sydnix.impermanence = {
|
|
enable = mkEnableOption "impermanence";
|
|
|
|
directories = mkOption {
|
|
default = [];
|
|
type = types.listOf types.anything;
|
|
};
|
|
|
|
files = mkOption {
|
|
default = [];
|
|
type = types.listOf types.anything;
|
|
};
|
|
|
|
cache = {
|
|
directories = mkOption {
|
|
description = ''
|
|
While functionally identical to `directories` (at the moment),
|
|
`cache.directories` carries additional semantics: these directories
|
|
/can/ be erased, but typically /shouldn't/ be.
|
|
'';
|
|
default = [];
|
|
type = types.listOf types.anything;
|
|
};
|
|
|
|
files = mkOption {
|
|
description = ''
|
|
While functionally identical to `files` (at the moment),
|
|
`cache.files` carries additional semantics: these files /can/ be
|
|
erased, but typically /shouldn't/ be.
|
|
'';
|
|
default = [];
|
|
type = types.listOf types.anything;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
home.persistence = {
|
|
"/persist/home/${config.home.username}" = {
|
|
allowOther = true;
|
|
directories = cfg.directories ++ cfg.cache.directories;
|
|
files = cfg.files ++ cfg.cache.files;
|
|
};
|
|
};
|
|
};
|
|
}
|