-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support files for development with Nix.
- Loading branch information
Showing
4 changed files
with
160 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Note: | ||
# | ||
# This file provides a Flake for Nix/NixOs users. It allows users to | ||
# build or work with the project without having to worry about which | ||
# dependencies are required. It is not required to build the project | ||
# and can be ignored by users who do not use Nix/NixOs. | ||
# | ||
# See README for instructions on building the project. | ||
# | ||
# | ||
# Usage: | ||
# | ||
# ```bash | ||
# $ nix build # Build | ||
# $ nix develop # Instant Dev Environment | ||
# $ nix run . -- <args...> # Run pyth-agent without installing. | ||
# ``` | ||
# | ||
# You can still run `nix-shell` if you prefer to not use flakes. | ||
|
||
{ | ||
description = "Pyth Agent"; | ||
nixConfig.bash-prompt = "\[nix@pyth-agent\]$ "; | ||
inputs.nixpkgs.url = "nixpkgs/nixos-unstable"; | ||
inputs.flake-utils.url = "github:numtide/flake-utils"; | ||
inputs.fenix.url = "github:nix-community/fenix"; | ||
inputs.fenix.inputs.nixpkgs.follows = "nixpkgs"; | ||
|
||
outputs = | ||
{ self | ||
, nixpkgs | ||
, fenix | ||
, flake-utils | ||
}: | ||
|
||
# Generate a Flake Configuration for each supported system. | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
shell = import ./shell.nix { inherit pkgs; }; | ||
rust = pkgs.makeRustPlatform { | ||
inherit (fenix.packages.${system}.minimal) | ||
rustc | ||
cargo; | ||
}; | ||
|
||
in | ||
{ | ||
devShells.default = shell; | ||
packages.default = rust.buildRustPackage { | ||
pname = "pyth-agent"; | ||
version = "0.0.1"; | ||
src = ./.; | ||
cargoLock = { lockFile = ./Cargo.lock; }; | ||
}; | ||
} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ pkgs ? import <nixpkgs> {} | ||
, ... | ||
}: | ||
|
||
with pkgs; mkShell { | ||
buildInputs = [ | ||
clang | ||
llvmPackages.libclang | ||
openssl | ||
pkgconfig | ||
rustup | ||
]; | ||
|
||
shellHook = '' | ||
export LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib"; | ||
''; | ||
} |