From a7b12817bf5457a79f89d549e9d2c665e879efac Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Mon, 16 Dec 2024 18:33:28 +0530 Subject: [PATCH] chore: reformat all files with nixfmt-rfc-style --- default.nix | 11 ++-- flake.nix | 163 +++++++++++++++++++++++++++++----------------------- shell.nix | 11 ++-- 3 files changed, 103 insertions(+), 82 deletions(-) diff --git a/default.nix b/default.nix index 806a038..705c7e4 100644 --- a/default.nix +++ b/default.nix @@ -1,8 +1,9 @@ -(import (let - lock = builtins.fromJSON (builtins.readFile ./flake.lock); -in +(import ( + let + lock = builtins.fromJSON (builtins.readFile ./flake.lock); + in fetchTarball { url = "https://github.com/nix-community/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; sha256 = lock.nodes.flake-compat.locked.narHash; - }) {src = ./.;}) -.defaultNix + } +) { src = ./.; }).defaultNix diff --git a/flake.nix b/flake.nix index 2ef01ac..170204b 100644 --- a/flake.nix +++ b/flake.nix @@ -22,77 +22,96 @@ inputs.flake-compat.url = "github:nix-community/flake-compat"; inputs.flake-compat.flake = false; - outputs = { - nixpkgs, - advisory-db, - crane, - devshell, - fenix, - flake-utils, - ... - }: - flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { - inherit system; - overlays = [devshell.overlays.default]; - }; - - rustNightly = (import fenix {inherit pkgs;}).fromToolchainFile { - file = ./rust-toolchain.toml; - sha256 = "sha256-XPGNBesOSwZJCXgynlavqa5QdsTAnodTmbx6t6XUWsY="; - }; - - craneLib = (crane.mkLib pkgs).overrideToolchain rustNightly; - src = craneLib.cleanCargoSource ./.; - nativeBuildInputs = []; - buildInputs = []; - cargoArtifacts = craneLib.buildDepsOnly { - inherit src buildInputs nativeBuildInputs; - }; - - commonArgs = { - inherit src cargoArtifacts buildInputs nativeBuildInputs; - cargoClippyExtraArgs = "--all-targets -- --deny warnings"; - }; - - gitice = craneLib.buildPackage (commonArgs // {doCheck = false;}); - gitice-clippy = craneLib.cargoClippy (commonArgs // {}); - gitice-fmt = craneLib.cargoFmt (commonArgs // {}); - gitice-audit = - craneLib.cargoAudit (commonArgs // {inherit advisory-db;}); - gitice-nextest = craneLib.cargoNextest (commonArgs - // { - partitions = 1; - partitionType = "count"; - }); - in { - checks = { - inherit gitice gitice-audit gitice-clippy gitice-fmt gitice-nextest; - }; - - packages.default = gitice; - - apps.default = flake-utils.lib.mkApp {drv = gitice;}; - - devShells.default = pkgs.devshell.mkShell { - bash = {interactive = "";}; - - env = [ - { - name = "DEVSHELL_NO_MOTD"; - value = 1; + outputs = + { + nixpkgs, + advisory-db, + crane, + devshell, + fenix, + flake-utils, + ... + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ devshell.overlays.default ]; + }; + + rustNightly = (import fenix { inherit pkgs; }).fromToolchainFile { + file = ./rust-toolchain.toml; + sha256 = "sha256-XPGNBesOSwZJCXgynlavqa5QdsTAnodTmbx6t6XUWsY="; + }; + + craneLib = (crane.mkLib pkgs).overrideToolchain rustNightly; + src = craneLib.cleanCargoSource ./.; + nativeBuildInputs = [ ]; + buildInputs = [ ]; + cargoArtifacts = craneLib.buildDepsOnly { + inherit src buildInputs nativeBuildInputs; + }; + + commonArgs = { + inherit + src + cargoArtifacts + buildInputs + nativeBuildInputs + ; + cargoClippyExtraArgs = "--all-targets -- --deny warnings"; + }; + + gitice = craneLib.buildPackage (commonArgs // { doCheck = false; }); + gitice-clippy = craneLib.cargoClippy (commonArgs // { }); + gitice-fmt = craneLib.cargoFmt (commonArgs // { }); + gitice-audit = craneLib.cargoAudit (commonArgs // { inherit advisory-db; }); + gitice-nextest = craneLib.cargoNextest ( + commonArgs + // { + partitions = 1; + partitionType = "count"; } - ]; - - packages = with pkgs; [ - cargo-dist - cargo-nextest - cargo-release - fenix.packages.${system}.rust-analyzer - git-cliff - rustNightly - stdenv.cc - ]; - }; - }); + ); + in + { + checks = { + inherit + gitice + gitice-audit + gitice-clippy + gitice-fmt + gitice-nextest + ; + }; + + packages.default = gitice; + + apps.default = flake-utils.lib.mkApp { drv = gitice; }; + + devShells.default = pkgs.devshell.mkShell { + bash = { + interactive = ""; + }; + + env = [ + { + name = "DEVSHELL_NO_MOTD"; + value = 1; + } + ]; + + packages = with pkgs; [ + cargo-dist + cargo-nextest + cargo-release + fenix.packages.${system}.rust-analyzer + git-cliff + rustNightly + stdenv.cc + ]; + }; + } + ); } diff --git a/shell.nix b/shell.nix index be08c91..eae9029 100644 --- a/shell.nix +++ b/shell.nix @@ -1,8 +1,9 @@ -(import (let - lock = builtins.fromJSON (builtins.readFile ./flake.lock); -in +(import ( + let + lock = builtins.fromJSON (builtins.readFile ./flake.lock); + in fetchTarball { url = "https://github.com/nix-community/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; sha256 = lock.nodes.flake-compat.locked.narHash; - }) {src = ./.;}) -.shellNix + } +) { src = ./.; }).shellNix