diff --git a/README.md b/README.md index 0559f86..49bceb5 100644 --- a/README.md +++ b/README.md @@ -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 @@ -24,7 +29,6 @@ LATEST_APP_URL="$( \ )" curl -s -L $LATEST_APP_URL -O unzip -qo ${LATEST_APP_URL##*/} - ``` ## res/ directory diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..5d530f6 --- /dev/null +++ b/default.nix @@ -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"; + }; + }); +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..d10f47b --- /dev/null +++ b/flake.lock @@ -0,0 +1,130 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1696019113, + "narHash": "sha256-X3+DKYWJm93DRSdC5M6K5hLqzSya9BjibtBsuARoPco=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f5892ddac112a1e9b3612c39af1b72987ee5783a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1681358109, + "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1696126582, + "narHash": "sha256-uo4cn/d2rHPy/fpKZKFBOaVO531zs/Doxz43imrpqZM=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "fc6fe50d9a4540a1111731baaa00f207301fdeb7", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..fbeefc3 --- /dev/null +++ b/flake.nix @@ -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; + }; + } + ); +}