try crane + rust-overlay
This commit is contained in:
parent
2c1aa7649d
commit
517650984c
2 changed files with 167 additions and 21 deletions
48
flake.nix
48
flake.nix
|
|
@ -1,21 +1,45 @@
|
|||
{
|
||||
description = "Doggo flake";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
crane = {
|
||||
url = "github:ipetkov/crane";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs = {
|
||||
nixpkgs.follows = "nixpkgs";
|
||||
flake-utils.follows = "flake-utils";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
in {
|
||||
# packages.x86_64-linux.hello = pkgs.hello;
|
||||
# packages.x86_64-linux.hello = nixpkgs.legacyPackages.x86_64-linux.hello;
|
||||
# defaultPackage.x86_64-linux = self.packages.x86_64-linux.hello;
|
||||
outputs = { self, nixpkgs, crane, flake-utils, rust-overlay }:
|
||||
flake-utils.lib.eachSystem [ flake-utils.lib.system.x86_64-linux ] (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
system = system;
|
||||
overlays = [ (import rust-overlay) ];
|
||||
};
|
||||
|
||||
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||
craneLib = crane.lib.${system}.overrideToolchain rustToolchain;
|
||||
in {
|
||||
packages.default = craneLib.buildPackage {
|
||||
src = craneLib.cleanCargoSource ./.;
|
||||
|
||||
devShell.x86_64-linux = with pkgs;
|
||||
mkShell {
|
||||
buildInputs = [
|
||||
# Add extra inputs here or any other derivation settings
|
||||
buildInputs = with pkgs; [
|
||||
libxkbcommon
|
||||
];
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
just
|
||||
cargo
|
||||
rustup
|
||||
rust-analyzer
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue