Skip to content

Commit

Permalink
Add Nix development environment for the Nix users out there (#9)
Browse files Browse the repository at this point in the history
This PR adds a Nix development environment that will allow Nix users to
easily build and work on valence without having to write their own.

If using flakes you can get into the development shell using `nix
develop`, otherwise you can use `nix-shell`
  • Loading branch information
cody-quinn authored Jul 28, 2024
1 parent 7cd3f5b commit 2775646
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 0 deletions.
111 changes: 111 additions & 0 deletions flake.lock

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

31 changes: 31 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/master";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};

outputs = { self, nixpkgs, flake-utils, rust-overlay, ... }:
flake-utils.lib.eachSystem
[ "x86_64-linux" ]
(system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
in
rec
{
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
(rust-bin.selectLatestNightlyWith (toolchain: toolchain.default))
rust-analyzer
];
};
});
}
9 changes: 9 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(import (
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash; }
) {
src = ./.;
}).shellNix

0 comments on commit 2775646

Please sign in to comment.