Skip to content

Commit

Permalink
Add nix formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
nea89o committed Oct 29, 2024
1 parent ee007f9 commit bbb5a41
Showing 1 changed file with 24 additions and 17 deletions.
41 changes: 24 additions & 17 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,42 @@
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
rustToolchain =
pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
rustPlatform = pkgs.makeRustPlatform {
cargo = rustToolchain;
rustc = rustToolchain;
};
deps = [ pkgs.openssl ];
in with pkgs; {
outputs = {
self,
nixpkgs,
rust-overlay,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs {inherit system overlays;};
rustToolchain =
pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
rustPlatform = pkgs.makeRustPlatform {
cargo = rustToolchain;
rustc = rustToolchain;
};
deps = [pkgs.openssl];
in
with pkgs; {
defaultPackage = rustPlatform.buildRustPackage {
name = "ursa-minor";
src = ./.;
cargoLock = { lockFileContents = builtins.readFile ./Cargo.lock; };
cargoLock = {lockFileContents = builtins.readFile ./Cargo.lock;};
buildInputs = deps;
nativeBuildInputs = [ pkgs.pkg-config ];
env = { GIT_HASH = self.rev or self.dirtyRev or "nix-dirty"; };
nativeBuildInputs = [pkgs.pkg-config];
env = {GIT_HASH = self.rev or self.dirtyRev or "nix-dirty";};
};
devShells.default = mkShell {
buildInputs =
[ pkg-config rustToolchain rust-analyzer sccache cargo-make ]
[pkg-config rustToolchain rust-analyzer sccache cargo-make]
++ deps;

shellHook = ''
export RUSTC_WRAPPER="${sccache}/bin/sccache"
'';
};
formatter = alejandra;
});
}

0 comments on commit bbb5a41

Please sign in to comment.