From 3ee1b08d70783abddcfefb8161aaa832251bf59e Mon Sep 17 00:00:00 2001 From: anonymous Date: Fri, 26 Jan 2024 01:07:31 +0000 Subject: [PATCH] nix fmt --- default.nix | 18 +++++++++--------- flake.nix | 43 ++++++++++++++++++++++++------------------- shell.nix | 37 ++++++++++++++++++------------------- 3 files changed, 51 insertions(+), 47 deletions(-) diff --git a/default.nix b/default.nix index 7f3133acfb..20fb7bf067 100644 --- a/default.nix +++ b/default.nix @@ -1,17 +1,17 @@ -{ pkgs ? ( +{ + pkgs ? ( let inherit (builtins) fetchTree fromJSON readFile; inherit ((fromJSON (readFile ./flake.lock)).nodes) nixpkgs gomod2nix; in - import (fetchTree nixpkgs.locked) { - overlays = [ - (import "${fetchTree gomod2nix.locked}/overlay.nix") - ]; - } - ) -, buildGoApplication ? pkgs.buildGoApplication + import (fetchTree nixpkgs.locked) { + overlays = [ + (import "${fetchTree gomod2nix.locked}/overlay.nix") + ]; + } + ), + buildGoApplication ? pkgs.buildGoApplication, }: - buildGoApplication { pname = "ZeroBot-Plugin"; version = "0.1"; diff --git a/flake.nix b/flake.nix index c240efe870..3493c0eda3 100644 --- a/flake.nix +++ b/flake.nix @@ -7,25 +7,30 @@ inputs.gomod2nix.inputs.nixpkgs.follows = "nixpkgs"; inputs.gomod2nix.inputs.flake-utils.follows = "flake-utils"; - outputs = { self, nixpkgs, flake-utils, gomod2nix }: - (flake-utils.lib.eachDefaultSystem - (system: - let - pkgs = nixpkgs.legacyPackages.${system}; + outputs = { + self, + nixpkgs, + flake-utils, + gomod2nix, + }: ( + flake-utils.lib.eachDefaultSystem + (system: let + pkgs = nixpkgs.legacyPackages.${system}; - # The current default sdk for macOS fails to compile go projects, so we use a newer one for now. - # This has no effect on other platforms. - callPackage = pkgs.darwin.apple_sdk_11_0.callPackage or pkgs.callPackage; - in - { - # doCheck will fail at write files - packages.default = (callPackage ./. { - inherit (gomod2nix.legacyPackages.${system}) buildGoApplication; - }).overrideAttrs (_: { doCheck = false; }); - devShells.default = callPackage ./shell.nix { - inherit (gomod2nix.legacyPackages.${system}) mkGoEnv gomod2nix; - }; - formatter = pkgs.alejandra; + # The current default sdk for macOS fails to compile go projects, so we use a newer one for now. + # This has no effect on other platforms. + callPackage = pkgs.darwin.apple_sdk_11_0.callPackage or pkgs.callPackage; + in { + # doCheck will fail at write files + packages.default = + (callPackage ./. { + inherit (gomod2nix.legacyPackages.${system}) buildGoApplication; }) - ); + .overrideAttrs (_: {doCheck = false;}); + devShells.default = callPackage ./shell.nix { + inherit (gomod2nix.legacyPackages.${system}) mkGoEnv gomod2nix; + }; + formatter = pkgs.alejandra; + }) + ); } diff --git a/shell.nix b/shell.nix index d4f21a84fe..b7b1aabc2e 100644 --- a/shell.nix +++ b/shell.nix @@ -1,24 +1,23 @@ -{ pkgs ? ( +{ + pkgs ? ( let inherit (builtins) fetchTree fromJSON readFile; inherit ((fromJSON (readFile ./flake.lock)).nodes) nixpkgs gomod2nix; in - import (fetchTree nixpkgs.locked) { - overlays = [ - (import "${fetchTree gomod2nix.locked}/overlay.nix") - ]; - } - ) -, mkGoEnv ? pkgs.mkGoEnv -, gomod2nix ? pkgs.gomod2nix -}: - -let - goEnv = mkGoEnv { pwd = ./.; }; + import (fetchTree nixpkgs.locked) { + overlays = [ + (import "${fetchTree gomod2nix.locked}/overlay.nix") + ]; + } + ), + mkGoEnv ? pkgs.mkGoEnv, + gomod2nix ? pkgs.gomod2nix, +}: let + goEnv = mkGoEnv {pwd = ./.;}; in -pkgs.mkShell { - packages = [ - goEnv - gomod2nix - ]; -} + pkgs.mkShell { + packages = [ + goEnv + gomod2nix + ]; + }