-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(nix): nix flake shell + rust-toolchain.toml setup (#14)
* nix flake shell + rust-toolchain.toml setup * migrated to naersk + nixpkgs-mozilla, it works for this workspace setup, updated Cargo.toml by autoformatting with taplo and adding reame to workspace.package to make `nix build` work
- Loading branch information
Showing
6 changed files
with
191 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
watch_file flake.nix | ||
|
||
use flake . |
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 |
---|---|---|
|
@@ -18,3 +18,5 @@ Cargo.lock | |
|
||
.data/*.log | ||
|
||
# Direnv (Nix Shell) | ||
.direnv/ |
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,66 @@ | ||
{ | ||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | ||
|
||
nixpkgs-mozilla = { | ||
url = "github:mozilla/nixpkgs-mozilla"; | ||
flake = false; | ||
}; | ||
|
||
flake-utils.url = "github:numtide/flake-utils"; | ||
naersk.url = "github:nix-community/naersk"; | ||
}; | ||
|
||
outputs = { | ||
self, | ||
flake-utils, | ||
naersk, | ||
nixpkgs, | ||
nixpkgs-mozilla, | ||
}: | ||
flake-utils.lib.eachDefaultSystem ( | ||
system: let | ||
pkgs = (import nixpkgs) { | ||
inherit system; | ||
|
||
overlays = [ | ||
(import nixpkgs-mozilla) | ||
]; | ||
}; | ||
|
||
toolchain = | ||
( | ||
pkgs.rustChannelOf | ||
{ | ||
rustToolchain = ./rust-toolchain.toml; | ||
sha256 = "6eN/GKzjVSjEhGO9FhWObkRFaE1Jf+uqMSdQnb8lcB4="; | ||
} | ||
) | ||
.rust; | ||
|
||
naersk' = pkgs.callPackage naersk { | ||
cargo = toolchain; | ||
rustc = toolchain; | ||
}; | ||
in { | ||
packages.default = naersk'.buildPackage { | ||
src = ./.; | ||
}; | ||
apps = { | ||
default = flake-utils.lib.mkApp { | ||
drv = self.packages.${system}.default; | ||
exePath = "/bin/tv"; | ||
}; | ||
}; | ||
|
||
devShell = pkgs.mkShell { | ||
nativeBuildInputs = [toolchain]; | ||
packages = with pkgs; [ | ||
rustfmt | ||
clippy | ||
rust-analyzer | ||
]; | ||
}; | ||
} | ||
); | ||
} |
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,3 @@ | ||
[toolchain] | ||
channel = "1.80.0" | ||
components = ["rustfmt", "clippy", "rust-analyzer"] |