{"id":17656415,"url":"https://github.com/darnir/dotfiles","last_synced_at":"2025-08-28T06:05:30.826Z","repository":{"id":11946637,"uuid":"14516862","full_name":"darnir/dotfiles","owner":"darnir","description":"A bunch of configuration files","archived":false,"fork":false,"pushed_at":"2019-08-19T06:22:54.000Z","size":816,"stargazers_count":19,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-11T02:50:32.609Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/darnir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-19T07:00:17.000Z","updated_at":"2023-11-05T21:17:04.000Z","dependencies_parsed_at":"2022-09-12T01:01:23.107Z","dependency_job_id":null,"html_url":"https://github.com/darnir/dotfiles","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/darnir/dotfiles","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darnir%2Fdotfiles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darnir%2Fdotfiles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darnir%2Fdotfiles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darnir%2Fdotfiles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darnir","download_url":"https://codeload.github.com/darnir/dotfiles/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darnir%2Fdotfiles/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272451948,"owners_count":24937463,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-28T02:00:10.768Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-23T14:32:02.755Z","updated_at":"2025-08-28T06:05:30.798Z","avatar_url":"https://github.com/darnir.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dotfiles\n\nThis is a dotfiles repository to store the configuration files for my (Arch)\nLinux system and other systems that I may be using. These files may be freely\ncopied for use by anybody.\n\nThe configuration files are grouped in the form of logical packages. Each\ndirectory inside the `Packages/` directory represents a single, logical package.\nEach package contains an `InstallScript` which defines where each file should be\nplaced. To install any package, use the master `dotfiles` script. Each package\nusually also contains a small README file describing the contents of the\npackage.\n\n\n## Dotfiles Manager\n\n`Dotfiles Manager` is a way of managing all your dotfiles on a \\*nix\nsystem with ease. This project spawned from the simple idea of writing a couple\nof scripts to automate the task of \"installing\" the configuration files to the\nright locations on a new machine. It was later extended to use the concept of\npackages to provide a finer granularity on which configuration files are\ninstalled on a new system. Configuration files which should ideally all be\ninstalled together, are grouped together as a single package.\n\nWhen trying to keep a set of configuration files in a separate repository, it is\nimportant that the repository be able to automatically track the changes to the\nfile. We should not have to remember to copy the file to the repository first.\nHence, the simplest way to accomplish this is to keep all the configuration\nfiles in a single location which is tracked under a version control system. From\nthis location, the files are symlinked to the specific locations in the\nfilesystem where the relevant programs expect to find them. In this project, we\nuse Git as the version control system.\n\nThis project works by creating a symlink for the file from the Package in the\nrepository to the location on the system where it needs to be. As a result, any\nchanges to the configuration files, AFTER the package has been installed will\nautomatically be reflected in the repository. Since this is a Git repository,\none can look at the diffs of the changes and revert back to the original state\nif need be. Upon confirming the changes are good, they should be immediately\ncommitted to the repository.\n\nA lot of the design decisions in this project are inspired from Arch Linux's\npacman and the format of the PKGBUILD files for defining a package.\n\n### Packaging\n\nA package is a collection of files which configure a particular aspect of the\nsystem. Hence, one can have a package for Vim, Bash, SSH, X, etc. To create a\nnew package, simply create a new directory with the package name within the\n`Packages/` directory and populate it with the files and directories that will\nneed to be tracked within this framework. Then write an `InstallScript` file\nwhich contains the mappings for where each of the files in the packages should\nbe installed on the target system.\n\n### InstallScripts\n\nThe concept of an `InstallScript` is based on ArchLinux's PKGBUILDs. An\n`InstallScript` is a valid Bash script which is executed to install a particular\npackage. The script must implement the following variables:\n\n  * **`PACKAGE_NAME`**: This is the name of the package being installed. It\n    **must** contain the same name as that of the directory in which it resides.\n    This variable is used to track Package Dependencies currently, though it may\n    be used for other things in the future.\n\nThe master `dotfiles` script will invoke the following functions in the\nspecified order from the `InstallScript`. Only the `install()` function is\nmandatory, the others may not be defined if there is no requirement.\n\n   1. **`prepare()`**: Used to perform initialization tasks before a package is\n      installed. This is includes installing dependencies, creating the\n      directory structure, setting environment variables, etc.\n   2. **`install()`**: This function is always called by the script and **must**\n      always be defined. It is used for the actual installation of the files\n      in the system.\n   3. **`post_install()`**: Used to perform some post-installation tasks like\n      setting the attributes of some file, or installing files not included in\n      dotfiles.\n\nSometimes a package may be dependent on settings that are provided by another\npackages. For example, a package may require using aliases or functions provided\nby the Bash package. In such a case, it is useful to ensure that the required\npackage is installed first, before the current package is installed. For this,\nthe framework provides the `depends` function. Add the following line for each\npackage that must be installed before the current package at the top of the\n`prepare()` function:\n\n```\ndepends $REQUIRED_PKG_NAME\n```\n\nThe concept of dependencies can also be used to create *meta packages*. A meta\npackage is one that installs no files of its own but instead a collection of\nsmaller packages in a single go. An example of such a meta package could be one\nthat installs the configuration packages for offlineimap, msmtp and mutt to\nprovide a functioning console based email client.\n\n\"Installing\" a file is the act of creating a symlink from the\nfile in the repository to the path on the system where the configuration file is\nexpected to exist. For example, the `bashrc` file is generally expected to\nexist at `~/.bashrc`, hence installing the file is equivalent to running the\ncommand `$ ln -s $PWD/Packages/Bash/bashrc $HOME/.bashrc` from the root of the\nrepository. To make things easier, the package manager provides some helper\nfunctions that can be utilized for installing files and directories:\n\n   * **`install_file()`**: Expects 4 parameters\n      1. **File Name**: This is the exact name of the file as it exists in the\n         package\n      2. **Final Location**: The location where this file should be symlinked.\n         It accepts full paths, up to the final directory but not the filename,\n         or you can use one of the given shortcut paths:\n           * *home*: Store in `$HOME` after adding a dot (.) prefix to the\n             filename\n           * *etc*: Store in `/etc`\n           * *userconf*: Store the file in the user's config directory. This is\n             always `~/.config`\n           * *systemd-user*: Store in `$HOME/.config/systemd/user/ as a systemd`\n             user session unit\n           * *bin*: Store in `/usr/local/bin`\n           * autostart: A X autostart file, store in `$HOME/.config/autostart`\n      3. **Sudo**: Boolean value. Does the file need to be linked with root\n         privileges?\n      4. **Link Type**: What kind of a link should be made? This should always\n         be true, which implies soft links. Only certain files, such as systemd\n         units should be hard linked.\n   * **`install_private_file()`**: This function is similar to\n     `install_file()` except that it expects the file being symlinked to exist\n     in `/media/truecrypt1/` instead of in the dotfiles package. This function\n     is used to install files which contain sensitive information and hence are\n     stored in a secure container instead of committing them to a public\n     repository.\n   * **`install_directory()`**: This function is used to install a complete\n     directory as a symlink.\n\nUsage\n-----\n\nThe central entity in this project is the `dotfiles` script available in the\nroot directory of the repository. The script assumes that the user actually\nknows what he/she is doing and as a result does not implement many sanity\nchecks. However, with a little bit of common, using this script shouldn't pose\nany problems at all. One of the chief limitations of the script is that it\nmust always be called from the root directory of the repository\nsince it uses relative paths from there. Since I don't care much about this\nrestriction, I've decided not to work on it. However, if someone submits a\npatch, I would not mind merging it.\n\n```\nUsage: ./dotfiles [Options]\nList of valid options:\n-S package  : Install dotfiles package \"package\"\n-l          : List available packages\n-h          : Print this help and exit\nRemember, this script must only be invoked from the root dir of the repository\n```\n\n## TODO\n\n  1. Before backing up a file, allow the user to immediately merge the two\n  2. When installing a package, test if it has already been installed\n  3. Do not re-install a dependency package if it has already been installed\n  4. Before installing a file, try to figure out if the `ln` command will\n     succeed. The most common failure is creating hard links across devices.\n  5. Be smart and try to set the right sudo and linktype variables based on the\n     filetype and path. E.g.: Files in /etc/ need sudo. Systemd units need to be\n     hardlinked.\n  6. Rework the concept of private files into private sub-packages that are\n     stored in a non-public version control.\n  7. Remove the requirement that `./dotfiles` be called from the root of the\n     repository only.\n\n## License\nMIT\n\n## Authors\nDarshit Shah  \u003cdarnir@gmail.com\u003e\n\n\u003e  vim: set ts=2 sts=4 sw=2 tw=80 et :\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarnir%2Fdotfiles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarnir%2Fdotfiles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarnir%2Fdotfiles/lists"}