# Tweed.MAINTAIN Copyright © 2016 Paul Garlick <[pgarlick@tourbillion-technology.com](mailto:pgarlick@tourbillion-technology.com)> Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty. There are two aspects to maintaining a *TWEED* installation. Firstly, *TWEED* itself is updated by downloading the latest files from the online repository. The configuration files contain information regarding packages added or removed, plus information on new versions and dependencies. Secondly, the package managers have their own update procedures for the files that they control. In the case of GNU Guix and Nix the procedures reference online package definitions. In the case of HashDist the procedure references the local HashStack repository. There are two options for updating *TWEED* itself. The latest tagged version may be downlaoded and unpacked, creating a new installation directory. Alternatively, if the installation is managed by *git*, the latest development version may be obtained by pulling the files directly from the repository. To use this method, simply navigate to the original installation directory and enter the command: $ git pull The *TWEED* applications may then upgraded by updating the respective package managers. The update procedures install the new application versions plus any new versions of dependencies. A suitable update frequency can be determined by keeping a watch on application releases. If there are approximately ten version releases per year in total, for example, then a monthly upgrade cycle would keep the installation up-to-date. All three package managers use a hash value as part of the pathname for an application. Since all versions of an application have a different hash value there is no conflict between older and newer versions. Older versions are retained in the store by default. It is possible to immediately switch to any version that has previously been installed. To upgrade any given application it is only necessary to update one package manager. Sometimes an application has not been upgraded but some of its dependencies have been. It is up to the user to decide whether or not to update the package manager in this case. It is often acceptable to skip the dependency updates and wait for an upgrade to the application itself. The update procedures are outlined below. Each package manager also offers a way to delete unused files. This is termed *garbage collection*. Part 1: GNU Guix update procedure --------------------------------- The command to update the GNU Guix installation is: $ guix package --upgrade The command to delete unused files is: $ guix gc --collect-garbage The command to delete previous application versions is: $ guix package --delete-generations The command to download the latest version of GNU Guix, with its list of the new package versions, is: $ guix pull More information on these commands is avaialable in the [GNU Guix manual](https://www.gnu.org/software/guix/manual/html_node/index.html). Part 2: Nix update procedure ---------------------------- The command to update the Nix installation is: $ nix-env --upgrade The command to delete unused files is: $ nix-store --gc The command to delete previous application versions is: $ nix-env --delete-generations old The command to download the latest list of the packages is: $ nix-channel --update More information on these commands is avaialable in the [Nix manual](http://nixos.org/nix/manual/). Part 3: HashDist update procedure --------------------------------- There are two stages to an update of the HashDist store; first updating the HashStack with the latest build instructions, then re-running the build process. To update the HashStack use git: $ git pull origin master The HashDist update procedure is a repeat of the latter part of the original installation process. First, move to the HashStack directory and delete the ``default`` link: $ rm default If the configuration file, ``tweed.hashdist.yaml``, has been updated then it is necessary to delete the ``default.yaml`` file as well and replace it with the new version: $ rm default.yaml $ cp /path/to/tweed/installation/tweed.hashdist.yaml default.yaml Then, for a system with M cores available for the build process, run the command: $ hit build -jM followed by: $ cd /path/to/tweed/installation $ HASHSTACK_DIR=/path/to/hashstack/repository \ sh tweed.hashdist.post-install HashDist deletes previous application versions and removes unused files in one command: $ hit gc More information on HashDist is avaialable in the [HashDist manual](http://hashdist.readthedocs.io/en/latest/index.html).