this post was submitted on 17 Jul 2024
37 points (100.0% liked)

Linux

47923 readers
1055 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Once again I try to get a handle of my various dotfiles and configs. This time I take another stab at gnu stow as it is often recommended. I do not understand it.

Here's how I understand it: I'm supposed to manually move all my files into a new directory where the original are. So for ~ I make like this:

~
  - dotfiles
      - bash
         dot-bashrc
         dot-bash_profile
      - xdg
            - dot-config
                user-dirs.dirs
      - tealdeer
            - dot-config
                - tealdeer
                       config.toml

then cd ~/dotfiles && stow --dotfiles .

Then (if I very carefully created each directory tree) it will symlink those files back to where they came from like this:

~
  .bashrc
  .bash_profile
   - .config
        user-dirs.dirs
      - tealdeer
          config.toml

I don't really understand what this application is doing because setting up the dotfiles directory is a lot more work than making symlinks afterwards. Every instructions tells me to make up this directory structure by hand but that seems to tedious with so many configs; isn't there some kind of automation to it?

Once the symlinks are created then what?

  • Tutorials don't really mention it but the actual manual gives me the impression this is a packager manager in some way and that's confusing. Lots of stuff about compiling

  • I see about how to combine it with git. Tried git-oriented dotfile systems before and they just aren't practical for me. And again I don't see what stow contributing; git would be doing all the work there.

  • Is there anything here about sharing configs between non-identical devices? Not everything can be copy/pasted exactly. Are you supposed to be making git branches or something?

The manual is not gentle enough to learn from scratch. OTOH there are very very short tutorials which offer little information.

I feel that I'm really missing the magic that's obvious to everyone else.

top 9 comments
sorted by: hot top controversial new old
[–] traches@sh.itjust.works 8 points 3 months ago (1 children)

There are other dotfile managers out there, personally I use yadm. It’s just a shell wrapper around a bare git repository, no symlinks or other magic needed

[–] linuxPIPEpower@discuss.tchncs.de 3 points 3 months ago (1 children)

yadm is the one I liked the best and tried it a few times. fact is that I am unlikely to keep a repo like this even part way up to date. New files are created all the time and not added, old ones don't get updated or removed. There's not even a good way to notice in any file manager what is included and what's not as far as I know. yadm doesn't work with tools like eza which can display the git status of files in repos. (and it probably wouldn't be feasible.)

Plus I have some specific config collections already in change tracking and it makes more sense to keep it that way. Having so many unrelated files together in one project is too chaotic and distracting.

It's not realistic for me to manage merges, modules, cherry picking, branches all that for so many files that change constantly without direct intervention. Quickly enough git will tie itself into some knot and I won't be able to pick it apart.

[–] traches@sh.itjust.works 1 points 3 months ago

Sounds like your use case is significantly more complicated than mine, I usually just commit, push, and pull.

Yadm does have the “enter” command which lets other tools work. I have an alias I use all the time:

alias lazyadm="yadm enter lazygit --work-tree ~/"
[–] muxelplexer@programming.dev 5 points 3 months ago

personally i always found stow to be annoying to use and switched to a bare git-repo approach. you can read up on it over here: https://www.atlassian.com/git/tutorials/dotfiles. Like this your dotfiles just rest where they should and it's rather minimal overhead.

[–] lelgenio@lemmy.ml 5 points 3 months ago* (last edited 3 months ago)

That's.... all stow does, there's nothing more to it. If you need some other feature don't waste your time trying to make it work with stow, It's just a meme in my opinion.

About the "package manager" functionality, stow was originally supposed to be a development tool for the Perl programming language, you download a bunch of libraries into a directory, then use stow to merge those files into the root of your project (like a caveman), as it turned out some people started using it to manage dotfiles, and here we are.

When I started trying to organize my dotfiles, I started with stow, but quickly found it very limited.

After that I found dotdrop, which is considerably more involved, but gives you total control. My config with dotdrop quickly started growing insanely huge, at some point I even had system-wide systemd services declared.

Then I found out I was basically reinventing nixos and home-manager, so I switched to that.

[–] ma1w4re@lemm.ee 4 points 3 months ago (1 children)

Recreating a path to original locations is a way to configure stow.

You can utilize bash to automate it. Mkdir can create entire trees in a single command.

After links were created you start using your configured software.

It's a link farm built using a packaging system. You put your configs into a "package" and then link said package where it belongs.

Git is useful not as a combination for stow, but a standalone way to version control your configs.

For nonidentical devices you create additional packages prefixed with specific device name. You don't need to link all packages at once with stow, pass a name of a package to link it alone.

[–] linuxPIPEpower@discuss.tchncs.de 3 points 3 months ago (1 children)

For nonidentical devices you create additional packages prefixed with specific device name. You don’t need to link all packages at once with stow, pass a name of a package to link it alone.uuu

Sooo... I find some way to share the dotfiles directory across devices (rsync, syncthing, git, nextcloud, DAV) then make specific subdirs like this?:

~
  - dotfiles
      - bash-desktop
         dot-bashrc
         dot-bash_profile
      - bash-laptop
         dot-bashrc
         dot-profile
         dot-bash_profile

But what is the software doing for me? I'm manually moving all these files and putting them together in the specific way requested. Setting the whole thing up is most of the work. Anyone who can write a script to create the structure can just as easily write it to make symlinks. I'm sure I'm missing something here.

[–] ma1w4re@lemm.ee 1 points 3 months ago

Sorry if it comes out robotic, since I don't use stow myself I just opened the manual and parsed it for you.

You manually create the repo of packages ONCE and then use stow to deploy them without having to link stuff manually every time.

As for "what's it doing for me", stow is just a generic deployment script that somebody else has written for you. You can just as well create your own and do it your way.

I personally used to have a bash script with one custom function "symlink" that error checked the linking process and a list of target/destination under the function.

Now I'm trying to code a python script similar to stow that works with packages of configs but instead of recreating paths inside the package you just provide a json file with target/destination for each file in the package.

Both of my ways have same shortcoming as stow: you have to do some manual work before the script can kick in.

Hopefully my messages have been helpful.

[–] lordnikon@lemmy.world 2 points 3 months ago

stow works great then lazy git to store the charges in a personal git server been using it like that for more than a decade