This is a PUBLIC repository. Contributors are advised to NOT commit any sensitive information!
This repository contains the Nix expressions providing
packages used at Swift Navigation that are otherwise not available in nixpkgs
.
To quickly add the GitHub host key to the known hosts file, run the following
command as root and answer yes
when prompted:
$> ssh -T [email protected]
The authenticity of host 'github.com (140.82.116.4)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
It is OK if the command fails with the following message:
[email protected]: Permission denied (publickey).
To add the channel to a NixOS machine, run the following commands as root:
$> nix-channel --add https://github.com/swift-nav/nix-channel/archive/main.tar.gz swiftpkgs
$> nix-channel --list
$> nix-channel --update
The nix-channel --update
command will download the Nix expressions from the
main
branch of the repository and build it as a derivation. The packages will
then be available via the <swiftpkgs>
expression.
In the configuration.nix
of the NixOS machine:
- Import the channel and assign it to a variable.
- Add the desired package(s) to the
environment.systemPackages
list.
let
swiftpkgs = import <swiftpkgs> {};
in
{
environment.systemPackages = with pkgs; [
swiftpkgs.sd-mux-ctrl
];
}
Rebuild NixOS (nixos-rebuild switch
) to apply the changes.
To verify that the packages installed correctly, use the which
command to
check if the executable is in the PATH
:
$> which sd-mux-ctrl
/run/current-system/sw/bin/sd-mux-ctrl
According to one Luc Perkins (paraphrased):
Nix channels are essentially tarballs that are made available via an unchanging URL. Conveniently, GitHub has a built-in archive feature that automatically turns every branch in every GitHub repository into a tarball available at a URL with this structure:
https://github.com/<username>/<repo>/archive/<branch>.tar.gz
Therefore, it is possible to create and maintain a Nix channel without any additional work beyond committing and updating code in a GitHub repository.
Although the manual entry for nix-channel --add URL [name]
claims that:
A channel URL must point to a directory containing a file
nixexprs.tar.xz
.
In practice, the URL can point to a tarball file. The extracted contents of the
tarball need only contain a top-level default.nix
file acting as channel's
entry point to work as intended.
Finally, the GitHub repository MUST be public because the
nix-channel --update
command's download mechanism only supports HTTP Basic
Authentication at this time; therefore, it is not capable of authenticating to
GitHub in order to access a private repository.