this repo has no description
1--- 2title: "Stop Spreading C\\*\\*p at My `$HOME`" 3date: 2020-04-15T12:00:19+02:00 4tags: 5 - programming 6 - culture 7--- 8 9**Disclaimer:** Yes, this is a rant. Yes, I am displeased with state of 10software. And yes, I can use some harsh words. You were warned. 11 12For a some time now we have [Filesystem Hierarchy Standard][fhs] which describes 13which data goes where in your \*nix installation. In fact we have that for 28 14years, which is almost as long as I live. This is quite some time. But for 15whatever reason we apply that only for the system hierarchy and we cannot have 16the same for something much closer to our heart - our dear `$HOME`. 17 18Common practice for storing all the stuff for different applications is to use 19dot files stored in `$HOME`. These are files or directories starting with dot in 20their name which makes such files "hidden" on Unix systems. There is problem 21though. First let me show you all the files starting with dot in my `$HOME`: 22 23``` 24-r-------- 1 hauleth staff 9 Mar 30 2019 .CFUserTextEncoding 25-rw-r--r-- 1 hauleth staff 16388 Apr 9 11:46 .DS_Store 26drwx------ 2 hauleth staff 64 Apr 13 20:54 .Trash 27-rw------- 1 hauleth staff 17835 Apr 10 21:17 .bash_history 28drwx------ 12 hauleth staff 384 Mar 30 2019 .bash_sessions 29drwxr-xr-x 13 hauleth staff 416 Mar 26 14:02 .cache 30lrwxr-xr-x 1 hauleth staff 40 Aug 21 2019 .chunkwmrc 31drwxr-xr-x 20 hauleth staff 640 Apr 15 21:59 .config 32drwx------ 3 hauleth staff 96 Apr 20 2019 .cups 33lrwxr-xr-x 1 hauleth staff 39 Aug 21 2019 .curlrc 34lrwxr-xr-x 1 hauleth staff 43 Aug 21 2019 .dir_colors 35-rw-r--r-- 1 hauleth staff 2587 Sep 10 2019 .direnvrc 36drwxr-xr-x 6 hauleth staff 192 Apr 14 18:27 .docker 37drwx------ 14 hauleth staff 448 Oct 1 2019 .dropbox 38-r-------- 1 hauleth staff 20 Apr 1 2019 .erlang.cookie 39drwxr-xr-x 3 hauleth staff 96 Jul 1 2019 .gem 40-rw-r--r-- 1 hauleth staff 518 Mar 25 22:44 .gitconfig 41drwx------ 14 hauleth staff 448 Apr 15 22:03 .gnupg 42drwxr-xr-x 4 hauleth staff 128 Apr 2 2019 .hammerspoon 43drwxr-xr-x 5 hauleth staff 160 Apr 14 19:39 .hex 44drwx------ 3 hauleth staff 96 Apr 26 2019 .httpie 45-rw-r--r-- 1 hauleth staff 165 Feb 22 13:50 .jlassetregistry.json 46drwxr-xr-x 3 hauleth staff 96 Nov 29 22:13 .jssc 47drwxr-xr-x 9 hauleth staff 288 Feb 21 17:46 .julia 48drwx------ 14 hauleth staff 448 Oct 2 2019 .keychain 49drwxr-x--- 5 hauleth staff 160 Jan 24 12:20 .kube 50-rw------- 1 hauleth staff 720 Apr 15 16:29 .lesshst 51drwxr-x--- 3 root staff 96 Apr 3 2019 .lldb 52drwx------ 4 hauleth staff 128 Dec 18 14:16 .local 53drwxr-xr-x 8 hauleth staff 256 Mar 20 12:29 .mitmproxy 54drwxr-xr-x 18 hauleth staff 576 Apr 13 14:36 .mix 55-rw-r--r-- 1 hauleth staff 116 Apr 13 20:59 .nix-channels 56drwxr-xr-x 4 hauleth staff 128 Apr 14 13:47 .nix-defexpr 57lrwxr-xr-x 1 hauleth staff 46 Feb 1 22:13 .nix-profile 58drwxr-xr-x 3 hauleth staff 96 Sep 27 2019 .npm 59drwxr-xr-x 3 hauleth staff 96 Dec 19 14:05 .pex 60-rw-r--r-- 1 hauleth staff 183 May 2 2019 .profile 61drwxr-xr-x 5 hauleth staff 160 Mar 20 16:27 .proxyman 62drwxr-xr-x 2 hauleth staff 64 Feb 17 14:09 .proxyman-data 63-rw------- 1 hauleth staff 1391 Jan 22 11:46 .psql_history 64-rw------- 1 hauleth staff 1950 Feb 19 12:42 .python_history 65lrwxr-xr-x 1 hauleth staff 37 Aug 21 2019 .skhdrc 66drwx------ 11 hauleth staff 352 Oct 2 2019 .ssh 67drwxr-xr-x 4 hauleth staff 128 May 8 2019 .terraform.d 68drwxr-xr-x 4 hauleth staff 128 Dec 1 21:52 .thumbnails 69drwxr-xr-x 9 hauleth staff 288 Mar 9 17:14 .vagrant.d 70-rw------- 1 hauleth staff 11124 Apr 13 20:21 .viminfo 71lrwxr-xr-x 1 hauleth staff 37 Aug 21 2019 .vimrc 72drwx------ 4 hauleth staff 128 Nov 8 16:51 .w3m 73drwxr-xr-x 37 hauleth staff 1184 Apr 13 21:21 .weechat 74``` 75 76As you can see, there is bunch of them, some are linked to my dotfiles 77repository, but most are not. What is the problem there? 78 79The spread. 80 81All of the data is smeared between gazillion of different filed with different 82types of data. This causes headaches because: 83 84- I cannot easily backup all the configuration as I need to check each file 85 independently to check if this is configuration file or it is data 86- I cannot exclude data from my backups in a uniform way. I need to check each 87 file independently and exclude it, remembering to do that for each new tool 88 that I add. Alternatively I can use whitelist instead of blacklist of paths 89 that I want to backup, but that pretty much defies the idea of having 90 automatic backup. 91- Cleaning up the old caches and data is troublesome as user need to review all 92 the folders and know what data they see mean. 93 94But what We can do? Well, the macOS and Windows got it somewhat right, these 95OSes provide special paths for storing all configuration, caches, user-data, 96etc. in special, dedicated, and well known locations within user directories. It 97is like mentioned earlier FHS but for `$HOME`. 98 99Unfortunately no other OS out there had: 100 1011. Power to force developers to behave reasonably 1022. Standard to which developers should adhere to 103 104Unfortunately the 1st point is still true, but the 2nd one is somewhat resolved 105in form of [XDG Base Directory Specification][xdg]. This is pretty short, 106simple, and straightforward spec where which data should go. 107 108This makes life so much easier: 109 110- Want to have backup your configuration? Just copy `$HOME/.config` where you 111 want. 112- Want to reset your configuration to base one? Just delete `$HOME/.config`. 113- Want to cleanup caches? Remove `$HOME/.cache`. 114- Etc. 115 116It makes your `$HOME` much cleaner, much more manageable, much more like your 117place, where you are the ruler, not as a manager of the bulletin board or the 118storage house. 119 120At one point I was even considering to have approach similar to [one taken by 121Graham Christensen][delete-your-darlings], but that would make my life even more 122miserable instead of forcing developers to fix their software. 123 124Just in case, this is not only mine view on the state of configuration files, 125just see [old Google+ post by Rob Pike][pike] where he states exactly the same 126thing that FreeDesktop team try to address. I may not agree on all the concepts 127with Commander, but this one I vote all-fours. 128 129For these who want to stop that madness and fix at least some software out there 130that is broken, you can check out [my script][xdg-please] that tries to fix 131(at least partially) non-conforming software. 132 133--- 134 135**TL;DR** 136 137Please, stop leaving your c\*\*p in my `$HOME` and call it "installation". If 138you want that, then I think you should find nearest Modern Art Gallery. 139 140--- 141 142You can comment it on [Lobste.rs](https://lobste.rs/s/va7gic/stop_spreading_c_p_at_my_home) 143or [Hacker News](https://news.ycombinator.com/item?id=22882590) or @ me on 144Twitter. 145 146[fhs]: https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard 147[xdg]: https://specifications.freedesktop.org/basedir-spec/latest/index.html 148[delete-your-darlings]: https://grahamc.com/blog/erase-your-darlings 149[pike]: https://web.archive.org/web/20180827160401/plus.google.com/+RobPikeTheHuman/posts/R58WgWwN9jp 150[xdg-please]: https://github.com/hauleth/xdg-rlz