Skip to content

Commit

Permalink
fix: update toolchain in nix (amber-lang#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
lxl66566 authored Jul 16, 2024
1 parent 98ca813 commit 12c6b74
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 23 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "amber"
version = "0.3.4-alpha"
edition = "2021"
repository = "https://github.com/Ph0enixKM/Amber"
rust-version = "1.79"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
39 changes: 27 additions & 12 deletions flake.lock

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

53 changes: 42 additions & 11 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,58 @@
naersk.url = "github:nix-community/naersk/master";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
nixpkgs-mozilla = {
url = "github:mozilla/nixpkgs-mozilla";
flake = false;
};
};

outputs = { self, nixpkgs, utils, naersk }:
utils.lib.eachDefaultSystem (system:
outputs =
{
self,
nixpkgs,
utils,
naersk,
nixpkgs-mozilla,
}:
utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
naersk-lib = pkgs.callPackage naersk { };
pkgs = import nixpkgs {
inherit system;
overlays = [ (import nixpkgs-mozilla) ];
};
toolchain =
(pkgs.rustChannelOf {
rustToolchain = ./rust-toolchain.toml;
sha256 = "sha256-Ngiz76YP4HTY75GGdH2P+APE/DEIx2R/Dn+BwwOyzZU=";
}).rust;
naersk-lib = pkgs.callPackage naersk {
cargo = toolchain;
rustc = toolchain;
};
in
{
packages.default = naersk-lib.buildPackage {
src = ./.;
postInstall = ''
wrapProgram "$out/bin/amber" --set PATH ${nixpkgs.lib.makeBinPath [
pkgs.bc
]}
wrapProgram "$out/bin/amber" --set PATH ${nixpkgs.lib.makeBinPath [ pkgs.bc ]}
'';
};
devShells.default = with pkgs; mkShell {
buildInputs = [ bc cargo rustc rustfmt pre-commit rustPackages.clippy ];
RUST_SRC_PATH = rustPlatform.rustLibSrc;
};
devShells.default =
with pkgs;
mkShell {
buildInputs = [
bc
cargo
rustc
rustfmt
pre-commit
rustPackages.clippy
];
nativeBuildInputs = [ toolchain ];
RUST_SRC_PATH = rustPlatform.rustLibSrc;
};
}
);
}
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "stable"
components = ["rustfmt", "clippy", "rust-src"]

0 comments on commit 12c6b74

Please sign in to comment.