From b52dea88b0c1a84328c60604c32f711fb1d74e01 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Mon, 16 Dec 2024 18:33:26 +0530 Subject: [PATCH] chore: reformat all files with nixfmt-rfc-style --- default.nix | 11 ++-- flake.nix | 158 +++++++++++++++++++++++++++++----------------------- shell.nix | 11 ++-- 3 files changed, 100 insertions(+), 80 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 bb54f88..be78026 100644 --- a/flake.nix +++ b/flake.nix @@ -22,83 +22,101 @@ inputs.flake-compat.url = "github:nix-community/flake-compat"; inputs.flake-compat.flake = false; - outputs = { - self, - nixpkgs, - advisory-db, - crane, - devshell, - fenix, - flake-utils, - ... - }: - flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { - inherit system; - overlays = [devshell.overlays.default]; - }; + outputs = + { + self, + nixpkgs, + advisory-db, + crane, + devshell, + fenix, + flake-utils, + ... + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ devshell.overlays.default ]; + }; - rustStable = (import fenix {inherit pkgs;}).fromToolchainFile { - file = ./rust-toolchain.toml; - sha256 = "sha256-yMuSb5eQPO/bHv+Bcf/US8LVMbf/G/0MSfiPwBhiPpk="; - }; + rustStable = (import fenix { inherit pkgs; }).fromToolchainFile { + file = ./rust-toolchain.toml; + sha256 = "sha256-yMuSb5eQPO/bHv+Bcf/US8LVMbf/G/0MSfiPwBhiPpk="; + }; - craneLib = (crane.mkLib pkgs).overrideToolchain rustStable; - commonArgs = { - src = craneLib.cleanCargoSource ./.; - buildInputs = []; - nativeBuildInputs = with pkgs; - [xorg.libxcb python312] - ++ pkgs.lib.optionals stdenv.isDarwin - [pkgs.darwin.apple_sdk.frameworks.AppKit]; - cargoClippyExtraArgs = "--all-targets -- --deny warnings"; - }; - cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {doCheck = false;}); + craneLib = (crane.mkLib pkgs).overrideToolchain rustStable; + commonArgs = { + src = craneLib.cleanCargoSource ./.; + buildInputs = [ ]; + nativeBuildInputs = + with pkgs; + [ + xorg.libxcb + python312 + ] + ++ pkgs.lib.optionals stdenv.isDarwin [ pkgs.darwin.apple_sdk.frameworks.AppKit ]; + cargoClippyExtraArgs = "--all-targets -- --deny warnings"; + }; + cargoArtifacts = craneLib.buildDepsOnly (commonArgs // { doCheck = false; }); - clipboard-substitutor = craneLib.buildPackage (commonArgs // {doCheck = false;}); - clipboard-substitutor-clippy = craneLib.cargoClippy (commonArgs - // { - inherit cargoArtifacts; - }); - clipboard-substitutor-fmt = craneLib.cargoFmt (commonArgs // {}); - clipboard-substitutor-audit = craneLib.cargoAudit (commonArgs // {inherit advisory-db;}); - clipboard-substitutor-nextest = craneLib.cargoNextest (commonArgs - // { - inherit cargoArtifacts; - partitions = 1; - partitionType = "count"; - }); - in { - checks = { - inherit clipboard-substitutor clipboard-substitutor-audit clipboard-substitutor-clippy clipboard-substitutor-fmt clipboard-substitutor-nextest; - }; + clipboard-substitutor = craneLib.buildPackage (commonArgs // { doCheck = false; }); + clipboard-substitutor-clippy = craneLib.cargoClippy ( + commonArgs + // { + inherit cargoArtifacts; + } + ); + clipboard-substitutor-fmt = craneLib.cargoFmt (commonArgs // { }); + clipboard-substitutor-audit = craneLib.cargoAudit (commonArgs // { inherit advisory-db; }); + clipboard-substitutor-nextest = craneLib.cargoNextest ( + commonArgs + // { + inherit cargoArtifacts; + partitions = 1; + partitionType = "count"; + } + ); + in + { + checks = { + inherit + clipboard-substitutor + clipboard-substitutor-audit + clipboard-substitutor-clippy + clipboard-substitutor-fmt + clipboard-substitutor-nextest + ; + }; - packages.default = clipboard-substitutor; + packages.default = clipboard-substitutor; - apps.default = flake-utils.lib.mkApp {drv = clipboard-substitutor;}; + apps.default = flake-utils.lib.mkApp { drv = clipboard-substitutor; }; - devShells.default = pkgs.devshell.mkShell { - imports = [ - "${devshell}/extra/language/c.nix" - "${devshell}/extra/language/rust.nix" - ]; + devShells.default = pkgs.devshell.mkShell { + imports = [ + "${devshell}/extra/language/c.nix" + "${devshell}/extra/language/rust.nix" + ]; - env = [ - { - name = "DEVSHELL_NO_MOTD"; - value = 1; - } - ]; + env = [ + { + name = "DEVSHELL_NO_MOTD"; + value = 1; + } + ]; - packages = with pkgs; [ - cargo-dist - cargo-nextest - cargo-release - rustStable - ]; + packages = with pkgs; [ + cargo-dist + cargo-nextest + cargo-release + rustStable + ]; - language.c.libraries = commonArgs.nativeBuildInputs; - language.rust.enableDefaultToolchain = false; - }; - }); + language.c.libraries = commonArgs.nativeBuildInputs; + language.rust.enableDefaultToolchain = false; + }; + } + ); } 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