Skip to content

Commit

Permalink
Added nix flake for developer convenience (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheButlah authored Feb 29, 2024
1 parent c937759 commit 65c6fd7
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 8 deletions.
1 change: 1 addition & 0 deletions .envrc.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
14 changes: 6 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
*.egg-info/
*.DS_Store

target/
*.egg-info/
.direnv/
.docker_image_built
.envrc
__pycache__/
nanopb
nanopb_out/
.docker_image_built

# generated
out.bin

nanopb
target/
61 changes: 61 additions & 0 deletions flake.lock

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

48 changes: 48 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
description = "orb-mcu-messaging flake";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
# Provides eachDefaultSystem and other utility functions
utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, utils }:

# This helper function is used to more easily abstract
# over the host platform.
# See https://github.com/numtide/flake-utils#eachdefaultsystem--system---attrs
utils.lib.eachDefaultSystem (system:
let
p = {
# The platform that you are running nix on and building from
native = nixpkgs.legacyPackages.${system};
};
in
{
# Everything in here becomes your shell (nix develop)
devShells.default = p.native.mkShell {
# Nix makes the following list of dependencies available to the development
# environment.
buildInputs = (with p.native; [
protobuf
nixpkgs-fmt

# This is missing on mac m1 nix, for some reason.
# see https://stackoverflow.com/a/69732679
libiconv
]);

# The following sets up environment variables for the shell. These are used
# by the build.rs build scripts of the rust crates.
shellHook = ''
# Env vars here
'';
};
# Lets you type `nix fmt` to format the flake.
formatter = p.native.nixpkgs-fmt;
}

);

}

0 comments on commit 65c6fd7

Please sign in to comment.