diff --git a/combinators.nix b/combinators.nix index e2ddb92..b773579 100644 --- a/combinators.nix +++ b/combinators.nix @@ -78,8 +78,17 @@ in rec { path (pkgs.writeText "jail-write-text-${lib.strings.sanitizeDerivationName (escape path)}" contents); - persisthome = name: compose [ - (add-runtime "mkdir -p ~/.local/share/jails/${lib.escapeShellArg name}") - (rw-bind (noescape "~/.local/share/jails/${lib.escapeShellArg name}") (noescape "~")) + persist-home = name: compose [ + (add-runtime "mkdir -p ${helpers.dataDirSubPath "home/${name}"}") + (rw-bind (noescape (helpers.dataDirSubPath "home/${name}")) (noescape "~")) ]; + + ############################################ + # deprecated + persisthome = name: helpers.deprecatedCombinator + "persisthome is deprecated, use persist-home instead. When doing so, rename ~/.local/share/jails/${name} to ${helpers.dataDirSubPath "home/${name}"}" + (compose [ + (add-runtime "mkdir -p ~/.local/share/jails/${lib.escapeShellArg name}") + (rw-bind (noescape "~/.local/share/jails/${lib.escapeShellArg name}") (noescape "~")) + ]); } diff --git a/lib.nix b/lib.nix index 6c82a9d..ec6dadc 100644 --- a/lib.nix +++ b/lib.nix @@ -8,6 +8,7 @@ noescape = value: { raw = value; }; dataDir = "~/.local/share/jail.nix"; dataDirSubPath = subPath: "${dataDir}/${escape subPath}"; + deprecatedCombinator = message: combinator: lib.warn "jail ${name}: ${message}" combinator; }; combinators = import ./combinators.nix {