Compare commits

..

No commits in common. "0a0c6755525ff60f41341b46ee7eae13e465e498" and "b0951b680501baebb9604e0ac496b748b6f10b2f" have entirely different histories.

2 changed files with 43 additions and 47 deletions

View File

@ -1,3 +0,0 @@
disabled = []
nix_version = '2.4'
ignore = ['.direnv' 'templates']

View File

@ -1,59 +1,58 @@
{ {
inputs = { inputs = {
crane.url = "github:ipetkov/crane"; crane = {
crane.inputs.nixpkgs.follows = "nixpkgs"; url = "github:ipetkov/crane";
fenix.url = "github:nix-community/fenix"; inputs = {
fenix.inputs.nixpkgs.follows = "nixpkgs"; flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs";
};
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "nixpkgs/nixos-unstable"; nixpkgs.url = "nixpkgs/nixos-unstable";
}; };
outputs = { self, crane, flake-utils, nixpkgs, ... }@inputs: outputs = { self, crane, fenix, flake-utils, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system: flake-utils.lib.eachDefaultSystem (system:
let let
inherit (pkgs) lib; pkgs = (import nixpkgs) {
pkgs = import nixpkgs { inherit system; }; inherit system;
fenix = inputs.fenix.packages.${system}; };
toolchain = fenix.packages.${system}.stable;
craneLib = crane.lib.${system}.overrideToolchain toolchain.toolchain; craneLib = crane.lib.${system}.overrideToolchain toolchain.toolchain;
mkSrc = extraPaths: with lib.fileset; let
root = ./.;
rustFiles = fromSource (craneLib.cleanCargoSource root);
fileset = union rustFiles (unions extraPaths);
in
toSource { inherit root fileset; };
## Customize here ##
toolchain = fenix.complete; # or fenix.stable;
stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.stdenv; stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.stdenv;
in in
{ {
packages.default = craneLib.buildPackage { packages =
inherit stdenv; let
src = mkSrc [ ]; inherit (pkgs.lib) fileset;
strictDeps = true; without = fs: fileset.difference ./. fs;
buildInputs = [ nixFiles = fileset.unions [ ./flake.nix ./flake.lock ./.envrc ];
# Add additional build inputs here gitFiles = fileset.gitTracked ./.;
] ++ lib.optionals pkgs.stdenv.isDarwin [ src = fileset.toSource {
# Additional darwin specific inputs can be set here root = ./.;
pkgs.libiconv fileset = fileset.intersection (without nixFiles) gitFiles;
]; };
# Additional environment variables can be set directly in
# MY_CUSTOM_VAR = "some value"; {
default =
craneLib.buildPackage {
inherit src stdenv;
};
}; };
devShells.default = pkgs.mkShell.override { inherit stdenv; } devShell = pkgs.mkShell.override
{ {
nativeBuildInputs = with pkgs; [ inherit stdenv;
# Add additional build inputs here
] ++ (with toolchain; [
cargo
clippy
rustfmt
rustc
fenix.rust-analyzer
]);
RUST_SRC_PATH = "${toolchain.rust-src}/lib/rustlib/src/rust/library";
};
} }
{
nativeBuildInputs = with toolchain;
[ rustc cargo rust-analyzer clippy ] ++ (with pkgs;
[ ]
); );
};
});
} }