Live data from Hacker News

Tips on how to structure your home directory (2023)

unixdigest.com

71–80 of 172 posts

Re: Tips on how to structure your home directory (2023)

#72

Earlier quoted context omitted.

Can you expand on this a bit please? What does $host mean? Why would I need that for a purely local project that is only created for my own use? And what about grouping projects? E.g. "personal", "work", etc. And where in the structure are languages? Is that the overarching directory?

> What does $host mean? In Go parlance, it would be the remote host where the repository is hosted, e.g. github.com, dev.azure.com, golang.org, etc. > Why would I need that for a purely local project that is only created for my own use? If nobody else is using your purely local project, and you're sure nobody will ever use it until the end of time, then I guess you could just use "~/src/$HOSTNAME/$USERNAME/$PROJECTNA…

> No need for pom.xml, requirements.txt, cmake.txt, or any other kind of dependency configuration. It just works.

...until the project decides to switch to another hosting provider. Which has happened more than once in the past; it used to be common to host projects in Sourceforge, for a while Google Code was common, now many projects are on GitHub, and it won't surprise me at all when another forge becomes the popular one. Individually, projects might switch between being self-hosted (in their own domain name) and hosted on a shared forge (using the forge's domain name).

IMO, it's a bad design. It forces the project's repository's location to become the project's official "name", that is, it mixes up location and naming. It's better to have an indirection layer to map the project name to the project location, like most other languages do.

Re: Tips on how to structure your home directory (2023)

#73
post #44
post #35

I hate having a polluted home directory, especially when an application thinks it should get a non hidden directory in my home! The one that upsets me the most is the default directory for go modules `~/go`. This frustrates me so much. I refused to install any go apps or use it for development for years. I've unfortunately had to give in, and it can at least be overridden by setting `GOPATH`, but it is a terrible, te…

The worst offenders are CLI tools written by people on Macs that do not respect XDG, because it's not a thing over there. So every tool gets to pollute your dotfiles with its own stupid directory. .rustup, .mix, .npm, .yarn, etc. But polluting your home directory like ~/go, without even the decency to hide it, is extremely rude and offensive.

[flagged]

Re: Tips on how to structure your home directory (2023)

#74
post #19

One major complaint I have with file systems is that too many directories start with the letter “D”. Desktop, Dev, Downloads, Documents, Dropbox etc. I thought about taking action about this, but as the author points about, many applications are quite opinionated on the matter.

I use `/src` to avoid this problem

I use “/Code”.

Re: Tips on how to structure your home directory (2023)

#75
I also have similar data structure for dotfiles... I've been using ~/bin, ~/dotfiles, ~/data, ~/enc (for encrypted files), etc. However, for projects and documents, I use Johnny Decimal system (https://johnnydecimal.com), which works perfectly for my use case. It helps me reduce the decision fatigue of deciding what to name the folder and filenames.

Re: Tips on how to structure your home directory (2023)

#77
post #19

Earlier quoted context omitted.

I use `/src` to avoid this problem

I use “/Code”.

I once accidentally did an `rm -rf ~/` on a machine without backups and it removed everything alphabetically up until `~/Coding` (everything else being unimportant). So I fixed that by setting up backups and renaming it `~/Zoding` lol. Haven't been foolish enough to make that same mistake again, though.

Re: Tips on how to structure your home directory (2023)

#79
post #72

Earlier quoted context omitted.

> What does $host mean? In Go parlance, it would be the remote host where the repository is hosted, e.g. github.com, dev.azure.com, golang.org, etc. > Why would I need that for a purely local project that is only created for my own use? If nobody else is using your purely local project, and you're sure nobody will ever use it until the end of time, then I guess you could just use "~/src/$HOSTNAME/$USERNAME/$PROJECTNA…

> No need for pom.xml, requirements.txt, cmake.txt, or any other kind of dependency configuration. It just works. ...until the project decides to switch to another hosting provider. Which has happened more than once in the past; it used to be common to host projects in Sourceforge, for a while Google Code was common, now many projects are on GitHub, and it won't surprise me at all when another forge becomes the popul…

> It's better to have an indirection layer to map the project name to the project location, like most other languages do.

Who takes care of the indirection layer when the upstream decides to switch to another hosting provider?

Re: Tips on how to structure your home directory (2023)

#80
Instead of having a dotfiles git repository, I find it more useful to have my entire `.config` directory be in a git repository, and by default ignore everything. My .gitignore then looks like

    /*
    !.gitignore
    !/dotfiles
    !/i3
    !/git
and so on. Inside the `dotfiles` directory is non-hidden versions of all the home directory dotfiles, and a script to symlink from ~/.bashrc to ~/.config/dotfiles/bashrc.

I also make the .config directory visible; I use ~/config and symlink ~/.config to it.

Post reply on HN