Giter Site home page Giter Site logo

lq1984 / cosmos.nix Goto Github PK

View Code? Open in Web Editor NEW

This project forked from informalsystems/cosmos.nix

0.0 0.0 0.0 1.17 MB

A reproducible package set for Cosmos, IBC and CosmWasm

Home Page: https://flakehub.com/flake/informalsystems/cosmos.nix

License: MIT License

Nu 0.07% Nix 99.25% Nushell 0.68%

cosmos.nix's Introduction

Cosmos ecosystem Built with nix License

Cosmos.nix

This is an experimental Nix project for integrating the Rust and Go projects in Cosmos as Nix packages. Use this at your own risk.

Setup

NOTE: If you already have nix installed, make sure you are on version >=2.18. Instructions to upgrade nix can be found here

Non-NixOS

This project is developed entirely in Nix Flakes. To get started, run the following:

  1. Install Nix:
$ curl -L https://nixos.org/nix/install | sh
  1. Install Nix Unstable:
$ nix-env -iA nixpkgs.nixFlakes
  1. Enable experimental features:
mkdir -p ~/.config/nix
echo 'experimental-features = nix-command flakes' >> ~/.config/nix/nix.conf
  1. Setup Caches:

Run this to add the cosmos-nix cache as a substituter

cachix use cosmos-nix

Shell

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

Overlays

There are a few nix utilities provided as a nix library. There is also an overlay for all the cosmos packages exported by this flake, so you can fold them into your nixpkgs package set.

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs";
    cosmos-nix.url = "github:informalsystems/cosmos.nix";
  };
  outputs = { cosmos-nix, nixpkgs }: {
    let pkgs = import nixpkgs { 
            system = "x86_64-linux"; # Or whatever system you are on
            overlays = [
                cosmos-nix.overlays.cosmosNixLib       # Provides just the nix utility lib
                cosmos-nix.overlays.cosmosNixPackages  # Provides all the cosmos packages provided by cosmos.nix
                cosmos-nix.overlay                     # The default overlay gives you everything in the previous two combined
            ];
        }
    in ...
  };
}

Development

Formatting

Formatting will be run via the default nix command. You can find the formatter configuration in modules/formatter.nix

nix fmt

Contribution Guide

  1. Add the chains source code as a flake input
    inputs = {
        my-chain-src.url = "github:my-chains-organization/my-chains-repo";
        my-chain-src.flake = false;
    };
  1. Add a new file in packages/ named after the chain that you are packaging

Usually you will use this structure for cosmos-sdk chains, there are other examples of non-sdk chains in the repo

# packages/my-chain.nix
{
  mkCosmosGoApp,
  my-chain-src,
}:
mkCosmosGoApp {
  name = "my-chain";
  version = "v0.1.0";
  src = my-chain-src;
  rev = my-chain-src.rev;
  vendorHash = "sha256-WLLQKXjPRhK19oEdqp2UBZpi9W7wtYjJMj07omH41K0=";
  tags = ["netgo"];
  engine = "cometbft/cometbft";
}
  1. Import your new derivation into the modules/packages.nix file
    my-chain = import ../packages/my-chain.nix {
      inherit (cosmosLib) mkCosmosGoApp;
      inherit (inputs) my-chain-src;
    };
  1. Test that it works by running:
> git add .
> nix build .#my-chain
  1. Add the package to apps.nix, after you have built the package in step 4 you can check what the binary path is by running ls result/
  my-chain = {
    type = "app";
    program = "${packages.my-chain}/bin/mychaind";
  };

cosmos.nix's People

Contributors

jonathanlorimer avatar ljoss17 avatar soareschen avatar romac avatar dzmitry-lahoda avatar onsails avatar lorenzleutgeb avatar magiodev avatar mitchmindtree avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.