summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/2022/gnu_stow.md53
-rw-r--r--content/2022/music_server.md34
2 files changed, 44 insertions, 43 deletions
diff --git a/content/2022/gnu_stow.md b/content/2022/gnu_stow.md
index 07cee9e..9c2bc02 100644
--- a/content/2022/gnu_stow.md
+++ b/content/2022/gnu_stow.md
@@ -18,17 +18,17 @@ GNU Stow.
<!--more-->
Let's take a very typical dotfiles repository.
-```
+{{< highlight shell>}}
./nvim/init.lua
./tmux/tmux.conf
-```
+{{</highlight>}}
You want to have those files available as
-```
+{{< highlight shell>}}
~/.config/nvim/init.lua
~/.tmux.conf
-```
+{{</highlight>}}
The most popular approach would be to symlink the files under the expected location. We
could also copy the files every time something changes, but that would be crazy. Are we
@@ -47,69 +47,69 @@ in the Stowed directory (called "Package directory") stores a separate directory
Stow will join all those separate trees and create a proper structure under Target Directory,
which by default is the parent of Stowed directory. Let's look at example.
-```
+{{< highlight shell>}}
~/target/stow/one/config/one.conf
~/target/stow/two/config/two.conf
~/target/stow/three/config/three.conf
-```
+{{< / highlight >}}
So, our home director now has a "Target" directory, which has a "Stow" directory. The Stow
directory stores three configs which we want to sylink as
-```
+{{< highlight shell>}}
~/target/config/one.conf
~/target/config/two.conf
~/target/config/three.conf
-```
+{{< / highlight >}}
Let's stow the first one
-```
+{{< highlight shell>}}
cd ~/target/stow
stow one
-```
+{{< / highlight >}}
And see what happened
-```
+{{< highlight shell>}}
cd ~/target
ls -lA
-```
+{{< / highlight >}}
We get somethine like
-```
+{{< highlight shell>}}
lrwxrwxrwx 1 msapka wheel 15 Jun 9 23:01 config -> stow/one/config
drwxr-xr-x 5 msapka wheel 4096 Jun 9 22:55 stow
-```
+{{< / highlight >}}
Stow created a config symlink in the target directory. Very cool, but it gets cooler! Let'
stow the second one
-```
+{{< highlight shell>}}
cd ~/target/stow
stow two
-```
+{{< / highlight >}}
and what we get
-```
+{{< highlight shell>}}
drwxr-xr-x 2 msapka wheel 4096 Jun 9 23:03 config
drwxr-xr-x 5 msapka wheel 4096 Jun 9 22:55 stow
-```
+{{< / highlight >}}
Our config is no longer a symlink, but a real folder. Let's see what's inside here.
-```
+{{< highlight shell>}}
cd config
ls -lA
-```
+{{< / highlight >}}
-```
+{{< highlight shell>}}
lrwxrwxrwx 1 msapka wheel 27 Jun 9 23:03 one.conf -> ../stow/two/config/one.conf
lrwxrwxrwx 1 msapka wheel 26 Jun 9 23:03 two.conf -> ../stow/one/config/two.conf
-```
+{{< / highlight >}}
We have our two configs, but what has happened? Stow looked at both sub trees for "one" and
"two"m and joined then in a way, that is possible. The only way for one.conf and two.conf to
@@ -119,17 +119,16 @@ Let's image that our target is actually homedir, so we have a ~/dotfiles directo
each package directory can mimic the tree struture of the actual config! Coming back
to our example, we can have a
-```
+{{< highlight shell>}}
~/dotfiles/tmux/.tmux.conf
~/dotfiles/nvim/.config/nvim/init.lua
-```
+{{< / highlight >}}
Then, after stowing both packages we have symlinks under our desired
-
-```
+{{< highlight shell>}}
~/.config/nvim/init.lua
~/.tmux.conf
-```
+{{< / highlight >}}
GNU Stow is a very simple tool. All we understand what will happen with each sub tree.
diff --git a/content/2022/music_server.md b/content/2022/music_server.md
index 287dbbc..81b3456 100644
--- a/content/2022/music_server.md
+++ b/content/2022/music_server.md
@@ -43,33 +43,34 @@ Served music is so small, that this does not add any noticeable overhead for the
First, I needed to install NFS support. I use Arch, so:
-```
+{{< highlight shell>}}
# pacman -S nfs-utils
-```
+{{</highlight>}}
Then I checked if the share actually exists. My server's address is 10.0.1.200.
-```
+{{< highlight shell>}}
$ showmount -e 10.0.1.200
------------------
Export list for 10.0.1.200:
/volume2/music 10.0.1.10
-```
+{{</highlight>}}
VoilĂ ! Next step: check if it works
-```
+{{< highlight shell>}}
# mkdir /mnt/music
# mount 10.0.1.200:/volume2/music /mnt/music/
# cd /mnt/music
# ls
-```
+{{</highlight>}}
And listing worked. Noice. To automate it for future, and to allow non-root users to actually mount the drive I added a new mount to /etc/fstab:
-```
+{{< highlight shell>}}
10.0.1.200:/volume2/music /mnt/music nfs _netdev,noauto,x-systemd.automount,x-systemd.mount-timeout=10,timeo=14,users,x-systemd.idle-timeout=1min 0 0
-```
+{{</highlight>}}
+
After the first user accesses /mnt/music, the drive will be mounted.
@@ -80,21 +81,22 @@ We have access to the files, let's play it. Every modern music player for Linux
[CMUS webpage](https://cmus.github.io/)
-```
+{{< highlight shell>}}
# pacman -S cmus
-```
+{{</highlight>}}
After we open cmus, we need to add music. It's done similarly to VIM, via an ex command.
-```
+{{< highlight shell>}}
:add /mnt/music/
-```
+{{</highlight>}}
+
And a few seconds later, the music is visible in the player. Using CMUS requires reading the manual
-```
+{{< highlight shell>}}
$ man cmus-tutorial
-```
+{{</highlight>}}=
but the basics I needed to play something from Artist/Album view were:
@@ -118,9 +120,9 @@ I have no idea how to auto mount a server on MacOS, so after every reboot or net
On Mac I also use CMUS, so all of the above apply as well. One difference is adding the files due to different location
-```
+{{< highlight shell>}}
:add /Volumes/music
-```
+{{</highlight>}}
## Next up