XDG Base Directory Specification

opal hart opal at wowana.me
Fri Feb 12 06:04:53 UTC 2021


> As I understand XDG_CONFIG_DIR should contain configuration files.
> Password store is data, not configuration - so it should go to
> XDG_DATA_HOME.  

I'd consider the .gpg-id file to be configuration, and the rest to be
data. However, I'm not behind this idea since many people use pass' git
integration, including myself. And I have a directory '~/git/private/'
where I stuff private git repos. My password store lives in a repo
there.

I'm a big fan of XDG basedir support since it cleans up my home
directory when programs implement it, but this is one of those cases I
cannot really see the justification for it. If the storage format was
reworked to flow better with the specification, sure, but as it stands
I don't see much benefit.

> I know you already can set PASSWORD_STORE_DIR but I already have to way many
> environment variable

I wrote a script `envenv` available at <git://wowana.me/scripts.git>
(stuffed in with some politically-incorrect scripts and such, so
exercise caution if you are easily offended) which I actually use along
with pass among other things. It's a bit manual to set up still, since
essentially it's a giant hack to scratch my own itch, but basically it
goes:

1. Configuration for envenv in "$XDG_CONFIG_DIR/envenv/", with a
   'profiles' subdirectory housing shell scripts that `envenv` sources
   depending on the arg0 it is called by. So in my case it lives at
   ~/etc/envenv/profiles/pass and contains:

   export PASSWORD_STORE_DIR="$HOME/git/private/password-store"
   . ~/etc/envenv/profiles/gnupg.profile

   which sets both pass-specific and my usual gpg environment.

2. Link in PATH that points from the program being wrapped, to
   `envenv`. In my case `ln -s $(which envenv) ~/bin/pass`.

3. Now when I run `pass`, as long as it's in the PATH that calling
   programs see (sh, dmenu, whatever) then `envenv` will first source
   the environment as I described in the config, then execute it.

It has already helped to clean up my environment a lot with a bunch of
environment-controlled utilities, and for me it's simpler than just
writing a bunch of wrapper scripts, repeating myself a bunch across
each script -- I've done it before and it's definitely more tedious
than what I ended up with. I had design plans to make it more
extensible than it currently is, but so far I haven't needed anything
more than what I already have, so I've left it alone for now, but of
course feel free to add whatever pleases your fancy if you do wish to
use it.

-- 
wowaname <https://wowana.me/pgp.xht>


More information about the Password-Store mailing list