Skip to content

Commit

Permalink
build: add nix
Browse files Browse the repository at this point in the history
  • Loading branch information
subotic committed Mar 19, 2024
1 parent 7122c59 commit c166b3c
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
# Added by cargo

/target
/.direnv
155 changes: 155 additions & 0 deletions flake.lock

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

28 changes: 25 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-23.05";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
cargo2nix.url = "github:cargo2nix/cargo2nix/release-0.11.0";
flake-utils.follows = "cargo2nix/flake-utils";
nixpkgs.follows = "cargo2nix/nixpkgs";
Expand All @@ -18,11 +24,27 @@
packageFun = import ./Cargo.nix;
};

# The workspace defines a development shell with all of the dependencies
# and environment settings necessary for a regular `cargo build`
workspaceShell = rustPkgs.workspaceShell {
# This adds cargo2nix to the project shell via the cargo2nix flake
packages = [ cargo2nix.packages."${system}".cargo2nix ];
};

in rec {
# this is the output (recursive) set (expressed for each system)

devShells = {
default = workspaceShell; # nix develop
};

# the packages in `nix build .#packages.<system>.<name>`
packages = {
# replace hello-world with your package name
dsp-meta-cmd = (rustPkgs.workspace.dsp-meta-cmd {});
default = packages.hello-world;
# nix build .#dsp-meta-cmd
# nix build .#packages.x86_64-linux.dsp-meta-cmd
dsp-meta-cmd = (rustPkgs.workspace.dsp-meta-cmd {}).bin;
# nix build
default = packages.dsp-meta-cmd;
};
}
);
Expand Down
1 change: 1 addition & 0 deletions result-bin

0 comments on commit c166b3c

Please sign in to comment.