Skip to content

Commit

Permalink
nix fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
anonymous committed Jan 26, 2024
1 parent 01acec4 commit 3ee1b08
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 47 deletions.
18 changes: 9 additions & 9 deletions default.nix
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
43 changes: 24 additions & 19 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
})
);
}
37 changes: 18 additions & 19 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -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
];
}

0 comments on commit 3ee1b08

Please sign in to comment.