Live data from Hacker News

Show HN: boxxy – Control where Linux programs put files, without symlinks

github.com

241–250 of 250 posts

Re: Show HN: boxxy – Control where Linux programs put files, without symlinks

#241

Earlier quoted context omitted.

As a defence of hardcoded paths might go, I could've done better myself. What else from your OS 30 years ago might you keep just because it's 30+ years old?

I keep it because it's worked for 30 years without issues and it's still working. Must you always replace something, just because a newer thing is "out there"? On the other hand, this is hackernews, and rewriting everything, from a text editor to a file browser, into a (ruby, go, rust,...) is a thing.

Or perhaps Bash for 30 years was using a sub-optimal solution and now when a better approach has emerged it just stubbornly refuses to adapt?

Re: Show HN: boxxy – Control where Linux programs put files, without symlinks

#242

Earlier quoted context omitted.

Personally I see a lot of young people use emacs and BSD licences, but because I'm an older engineer and have the wisdom and experience of time, I use vim and GPL.

I'm also a Vim user; in my Vim wisdom and experience I made it follow the damn XDG spec; if hidden files are a feature, I want it to be a feature for my use-cases, not program clutter.

I use nvim like the user (backers.md baby!) so I get to use `master` with `~/.config/nvim/init.vim`. Of course, I also donated to Bram's Ugandas or wherever, so I think you are a wise and attractive person. Your choice of actions reveals that your soul is deep and beautiful.

Re: Show HN: boxxy – Control where Linux programs put files, without symlinks

#243

Earlier quoted context omitted.

If, as you say > most all of the Linux software dumping dotfiles in my homedir then is it really true, that the standard is in fact "well established"?

Right now I have in my home folder 4 undesirable dot something which should be somewhere else and I can't change it. Meanwhile, I have 63 folders in my .config which means most of the applications I'm using do respect the XDG base directory specification, only a few entitled or extremely legacy ones don't.

Out of curiosity, what are the misbehaving ones?

Re: Show HN: boxxy – Control where Linux programs put files, without symlinks

#244
post #168

This is neat! What's so bad about symlinks though?

i was using a similar bind-mount trick as Boxxy for a good 6 months or so, and then reworked it to prefer symlinks a couple months ago. nearly everything behaves as you’d expect with symlinks if you’re just symlinking within ~, and it’s easier to tell what’s going on or debug stuff. notably, at some point i decided to encrypt my valuables: password store, PII, etc, and have them unlocked on login via PAM. i also want…

> have them unlocked on login via PAM

Could you please share a general outline for configuring something like this?

Re: Show HN: boxxy – Control where Linux programs put files, without symlinks

#245
post #244

Earlier quoted context omitted.

i was using a similar bind-mount trick as Boxxy for a good 6 months or so, and then reworked it to prefer symlinks a couple months ago. nearly everything behaves as you’d expect with symlinks if you’re just symlinking within ~, and it’s easier to tell what’s going on or debug stuff. notably, at some point i decided to encrypt my valuables: password store, PII, etc, and have them unlocked on login via PAM. i also want…

> have them unlocked on login via PAM Could you please share a general outline for configuring something like this?

the Arch Wiki is gonna be your best bet here: https://wiki.archlinux.org/title/ECryptfs

if you can make a /etc/fstab entry for your filesystem, then you can configure pam_mount using the same options as the fstab entry and it should work.

for the actual encrypted filestore, i’m using gocryptfs. it’s a more actively developed alternative to eCryptfs: mostly a drop-in replacement. there’s a lot of options here: dm-crypt over a dedicated partition is probably what a cryptographer would recommend, everything else is making tradeoffs (e.g. leaking metadata like file size/directory entry count) for better UX elsewhere. read the wiki to pick the best for your needs :)

on the off-chance you’re using NixOS, i configure these parts here:

- https://git.uninsane.org/colin/nix-files/src/commit/bcfd8e17... - https://git.uninsane.org/colin/nix-files/src/commit/bcfd8e17...

Re: Show HN: boxxy – Control where Linux programs put files, without symlinks

#246

Earlier quoted context omitted.

Right now I have in my home folder 4 undesirable dot something which should be somewhere else and I can't change it. Meanwhile, I have 63 folders in my .config which means most of the applications I'm using do respect the XDG base directory specification, only a few entitled or extremely legacy ones don't.

Out of curiosity, what are the misbehaving ones?

.mozilla - Firefox

.npm - NPM

.pki - Chromium-based software

.SpaceVim.d - My fault, I should write my own vimrc but I'm lazy

.steam and .steampath and .steampid - Steam

.vscode-oss - VS Codium

.w3m - w3m cli browser

These are the ones I couldn't change the behavior of, in my dotfiles I've managed to fix at least a dozen of programs that were previously misbehaving but offered environment variables to change their behaviors.

The thing that bothers me most about these is that most of these folders are simply cache and logs, I can always delete them and the application will keep working, but of course the folders will be recreated. It's truly mind-numbing.

Re: Show HN: boxxy – Control where Linux programs put files, without symlinks

#247

Earlier quoted context omitted.

Out of curiosity, what are the misbehaving ones?

.mozilla - Firefox .npm - NPM .pki - Chromium-based software .SpaceVim.d - My fault, I should write my own vimrc but I'm lazy .steam and .steampath and .steampid - Steam .vscode-oss - VS Codium .w3m - w3m cli browser These are the ones I couldn't change the behavior of, in my dotfiles I've managed to fix at least a dozen of programs that were previously misbehaving but offered environment variables to change their be…

Firefox

  # Save shell wrapper as '~/.local/bin/firefox'

  { while kill -0 $$ 2> /dev/null; do rm -rf $HOME/.mozilla; done; } &
  /bin/firefox --profile $XDG_DATA_HOME/firefox $@

NPM

  # set env variable
  export NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npm/npmrc

  # and in npmrc:
  prefix=${XDG_DATA_HOME}/npm
  cache=${XDG_CACHE_HOME}/npm
  tmp=${XDG_RUNTIME_DIR}/npm
  init-module=${XDG_CONFIG_HOME}/npm/config/npm-init.js
Steam

  Steam actually creates only symlinks for backward
  compatibility as some games (may) expect them in $HOME.
  You can safely launch it with modified HOME variable:
    $ HOME="$XDG_DATA_HOME/Steam" steam
  (and/or put it into a wrapper script like with Firefox)
Vim

  I don't know how it's with SpaceVim,
  but with regular vimrc you can make it follow the spec:
    https://blog.joren.ga/vim-xdg
w3m

  export W3M_DIR="$XDG_DATA_HOME/w3m"

Re: Show HN: boxxy – Control where Linux programs put files, without symlinks

#248

Earlier quoted context omitted.

.mozilla - Firefox .npm - NPM .pki - Chromium-based software .SpaceVim.d - My fault, I should write my own vimrc but I'm lazy .steam and .steampath and .steampid - Steam .vscode-oss - VS Codium .w3m - w3m cli browser These are the ones I couldn't change the behavior of, in my dotfiles I've managed to fix at least a dozen of programs that were previously misbehaving but offered environment variables to change their be…

Firefox # Save shell wrapper as '~/.local/bin/firefox' { while kill -0 $$ 2> /dev/null; do rm -rf $HOME/.mozilla; done; } & /bin/firefox --profile $XDG_DATA_HOME/firefox $@ NPM # set env variable export NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npm/npmrc # and in npmrc: prefix=${XDG_DATA_HOME}/npm cache=${XDG_CACHE_HOME}/npm tmp=${XDG_RUNTIME_DIR}/npm init-module=${XDG_CONFIG_HOME}/npm/config/npm-init.js Steam Steam act…

What the hell you may have just changed my life. The NPM one I was aware of through xdg-ninja but last time I tried it didn't work because I also use nvm which doesn't support that, honestly not an issue with NPM, I should've noted in the comment. The Steam one however is a total life-changer, if I ever find you in the street someday remember me I owe you a beer (or some non-alcoholic beverage of your preference).

Re: Show HN: boxxy – Control where Linux programs put files, without symlinks

#249
post #49
post #28

Earlier quoted context omitted.

Fun fact, one layer of App Engine's sandbox from a couple years ago was implemented using ptrace. It will redirect filesystem IO to in-memory files.

Interesting! That makes perfect sense, I just don't think I'm smart enough to use ptrace properly right now :P

Try checking out proot?

Re: Show HN: boxxy – Control where Linux programs put files, without symlinks

#250
post #211
post #168

This is neat! What's so bad about symlinks though?

> What's so bad about symlinks though? I am not smart and will regularly forget the syntax to ln(1)

Easy solution for that is what I do, just cd to the directory you want the symlink placed in, and then create it with one path instead of two. No need to think about whether or not the order is correct. It's really obnoxious that Windows chose the opposite syntax. (Yes. I have an unnecessary number of junction points and hard links on my system. When I reinstall next, I'll have a bad time dealing with it)

`mklink [[/d] | [/h] | [/j]] ` `ln [OPTION]... [-T] TARGET LINK_NAME`

Post reply on HN