This is an experimental Nix project for integrating the Rust and Go projects in Cosmos as Nix packages. Use this at your own risk.
NOTE: If you already have nix installed, make sure you are on version >=2.7. Instructions to upgrade nix can be found here
This project is developed entirely in Nix Flakes. To get started, run the following:
$ curl -L https://nixos.org/nix/install | sh
$ nix-env -iA nixpkgs.nixFlakes
mkdir -p ~/.config/nix
echo 'experimental-features = nix-command flakes' >> ~/.config/nix/nix.conf
With nix installed you can run nix-env -iA cachix -f https://cachix.org/api/v1/install
. If you don't want to install cachix globally and just want a one time use, you can run nix-shell -p cachix
to enter a temporary shell with cachix
available. You can check that this worked by running cachix --version
.
You can now run these commands to add all of our cachix caches:
$ cachix use cosmos
$ cachix use pre-commit-hooks
$ cachix use nix-community
Add these lines to your Nix config (either ~/.config/nix/nix.conf [for MacOS] or /etc/nix/nix.conf [for flavors of Linux, depending on your distro]):
extra-substituters = https://cache.nixos.org https://nix-community.cachix.org https://pre-commit-hooks.cachix.org https://cosmos.cachix.org
trusted-public-keys = nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= pre-commit-hooks.cachix.org-1:Pkk3Panw5AW24TOv6kz3PvLhlH8puAsJTBbOPmBo7Rc= cosmos.cachix.org-1:T5U9yg6u2kM48qAOXHO/ayhO8IWFnv0LOhNcq0yKuR8=
cores = 4 # NB: You may want to increase this on machines with more cores
In your configuration.nix
file you can add code below. It does 2 things, the
first is that it enables nix experimental features (which enables flakes) and
second it adds cache information so you don't have to build everything yourself.
Note, you can add the suggested binary caches in addition to your existing ones.
nix = {
package = pkgs.nixFlakes;
extraOptions = ''
experimental-features = nix-command flakes
'';
binaryCaches = [
"https://cache.nixos.org"
"https://nix-community.cachix.org"
"https://pre-commit-hooks.cachix.org"
"https://cosmos.cachix.org"
];
binaryCachePublicKeys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"pre-commit-hooks.cachix.org-1:Pkk3Panw5AW24TOv6kz3PvLhlH8puAsJTBbOPmBo7Rc="
"cosmos.cachix.org-1:T5U9yg6u2kM48qAOXHO/ayhO8IWFnv0LOhNcq0yKuR8="
];
};
If you are just here for a remote nix shell (a development environment where you don't need to clone the repo) you can run the following command:
nix develop github:informalsystems/cosmos.nix#cosmos-shell
This will build the development environment. The environment will then be cached in your nix store and should be very fast. If you want to pull the latest development environment you should run:
nix develop github:informalsystems/cosmos.nix#cosmos-shell --refresh
Formatting will be run via pre-commit hook if you are in the nix shell, otherise you can manually format using the format
command like so:
nix develop -c format
Note: every command has a local and a remote variant. The local variant requires that the command is run from within the cloned repo. The remote variant can be run from wherever.
Local: nix run .#my-app-name
Remote: nix run github:informalsystems/cosmos.nix#my-app-name
For brevity and consistency all the commands are listed in the local variant
- hermes:
nix run .#hermes
- ts-relayer:
nix run .#ts-relayer
nix run .#ts-relayer-setup
- relayer:
nix run .#relayer
- thor:
- bifrost:
nix run .#bifrost
- thorcli:
nix run .#thorcli
- thord:
nix run .#thord
- bifrost:
- osmosis:
nix run .#osmosis
- gravity dex:
nix run .#gdex
- iris:
nix run .#iris
- regen:
nix run .#regen
- evmos:
nix run .#evmos
- centauri:
nix run .#centauri
- gaia:
nix run .#gaia
- ica:
nix run .#ica
- cosmovisor:
nix run .#cosmovisor
- simd:
nix run .#simd
- gm:
nix run .#gm
- gex:
nix run .#gex
- beaker:
nix run .#beaker
- cosmwasm-check:
nix run .#cosmwasm-check