Skip to content

Commit

Permalink
feat: add nix flake and module to easy and deterministic builds
Browse files Browse the repository at this point in the history
  • Loading branch information
willyrgf committed Oct 1, 2023
1 parent 2455ab2 commit f915fce
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ MFM (Multiverse Finance Machine) is a CLI to managing portfolio of cryptoassets
- [ ] Add automatic hedge using levarage derivatives (futures/options)
- [ ] Trading strategies with TA (in [mfm_server](https://github.com/willyrgf/mfm_server)?) to adjust dynamic portfolio positions

## Fast local install & update using releases
## Install via Nix profile
```sh
nix profile install github:willyrgf/mfm
```

## Local install & update using releases

### *nix (?)
```sh
Expand All @@ -24,7 +29,6 @@ LATEST_APP_URL="$( \
)"
curl -s -L $LATEST_APP_URL -O
unzip -qo ${LATEST_APP_URL##*/}

```

## res/ directory
Expand Down
26 changes: 26 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{ pkgs }:
let
common = {
version = "0.1.29";
src = ./.;

cargoLock = {
lockFile = ./Cargo.lock;
};

buildInputs = with pkgs;[
darwin.apple_sdk.frameworks.Security
pkg-config
openssl
];
};
in {
mfm = pkgs.rustPlatform.buildRustPackage (common // {
pname = "mfm";
meta = {
description = "An Nix module for MFM CLI";
license = pkgs.lib.licenses.mit;
homepage = "https://github.com/willyrgf/mfm";
};
});
}
130 changes: 130 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
description = "A flake for the MFM CLI";

inputs = {
rust-overlay.url = "github:oxalica/rust-overlay";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { nixpkgs, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};

packages = pkgs.callPackage ./. {};
in
{
packages = {
default = packages.mfm;
};
}
);
}

0 comments on commit f915fce

Please sign in to comment.