From bbb5a41617881d951a383d73643525aa5200b62a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linnea=20Gr=C3=A4f?= Date: Tue, 29 Oct 2024 21:46:01 +0100 Subject: [PATCH] Add nix formatter --- flake.nix | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/flake.nix b/flake.nix index ad269f3..44d5024 100644 --- a/flake.nix +++ b/flake.nix @@ -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; }); }