Crates.io | deftsilo |
lib.rs | deftsilo |
version | 0.4.0 |
source | src |
created_at | 2024-03-11 00:59:37.93776 |
updated_at | 2024-09-22 20:11:04.10976 |
description | deftsilo is a dotfiles manager |
homepage | |
repository | https://github.com/rescrv/deftsilo |
max_upload_size | |
id | 1169074 |
size | 27,364 |
deftsilo is a powerful and minimalistic dotfiles management tool written in Rust. It enables power users to easily synchronize their home directory dotfiles (deftsilo is an anagram for dotfiles), ensuring consistency across systems. The chief problem it solves is the bootstrap problem: While the build-time dependencies include Rust and git, the output is a POSIX-compatible shell script that will install the files by copying them or by creating a symlink farm. Consequently one can export dotfiles to systems without Rust or git. That last bit's become less important with the advent of container-based computing, but it's still handy to bootstrap a new machine every few years without having to do anything special.
deftsilo
from the root of the repository generates an install script that can be used to synchronize files.Experienced UNIX users and power users who want an almost-zero-configuration way to manage their dotfiles and ensure consistency across multiple machines. This tool is particularly suitable for developers who wish to maintain a single source of truth for their home directory.
For example, if ~/dotfiles
held dotfiles, we could do the following:
cargo run -- --path ~/dotfiles
which would generate, in part, this script:
deftsilo_mkdir ".ssh" 775
deftsilo_mkdir ".vim" 775
deftsilo_mkdir ".vim/colors" 775
deftsilo_mkdir ".vim/spell" 775
deftsilo_mkdir ".vim/syntax" 775
deftsilo_mkdir ".zkbd" 775
deftsilo_mkdir "bin" 775
deftsilo_mkdir "mail" 775
deftsilo_install ".gitconfig" 664 089886a87f7c859b19764957a029c69bcbe120fa0d0388c256205b5fdaf4529a 089886a87f7c859b19764957a029c69bcbe120fa0d0388c256205b5fdaf4529a 1b4afc46b49c07cab0339a83cd8c3105d39f43d7aa25f0df6674c40737b15f7c 1b4afc46b49c07cab0339a83cd8c3105d39f43d7aa25f0df6674c40737b15f7c 83d75106ccfd35c9c50b926cdc13e54cad4027837f27b990c5ec2d2c07d7ab33 bd3d940866bb88a53d13292a58d233951ad5ec2e544724a96abcec75791777de fab34430cb6000a8bf387490976088a83cf18d44b1597e6f8c8574bbfbfff2eb bc5f7f1873058329c496269c1c286d134bbd8e0c8cc692e3fc95cd29fceb9059
Omitted from this output is the preamble that defines the deftsilo_mkdir
and deftsilo_install
commands. We can see
that the install of .gitconfig
lists several sha256sum hashes. Deftsilo will only overwrite .gitconfig
if it
matches one of these hashes. In this way, you can manage dotfiles on multiple machines and be warned if a change would
overwrite a file that's never been checked into version control. The -l
flag can be provided to link files instead of
copy.
You can run the unit tests of the deftsilo script to test portability to your platform with:
cargo run -- --test >! test.sh && /bin/sh test.sh testing-dir
Active development and testing.
This crate provides the deftsilo tool for generating portable dotfiles-installing shell scripts.
What is the license for deftsilo
? deftsilo is licensed under the BSD license.
What platforms are supported by deftsilo
? deftsilo is written in Rust and should be portable to any platform
that supports Rust. The output is portable POSIX-compliant shell script.
How does deftsilo
handle permissions and ownership for created directories and installed files? deftsilo uses
the copy
or ln -s
commands to install files and inherits behavior accordingly.
What happens when the hashes don't match? If the current file does not match any of the provided hashes, deftsilo will loudly fail immediately and short-circuit the rest of the script.
Are there any known limitations or edge cases to be aware of? deftsilo does not know about case-insensitive filesystems. It will not warn you if you are about to overwrite a file that differs only in case.
How is the generated shell script validated? deftsilo --test
will generate as output the unit tests for the
generated script. Invoke it with deftsilo --test > unittest.sh && /bin/my-shell unittest.sh
.
Are there any plans or ideas for future developments? I'm soliciting feedback here. I rarely change my dotfiles, so there's little need to interact with this when it works.
How can users provide feedback or report issues? Clone the github repo and email me at the address in the changelog.
The latest documentation is always available at docs.rs.