-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
anonymous
committed
Jan 26, 2024
1 parent
b8858f0
commit 5772a26
Showing
7 changed files
with
451 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ nohup.out | |
zerobot | ||
ZeroBot-Plugin* | ||
*.syso | ||
/.direnv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ 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 | ||
}: | ||
|
||
buildGoApplication { | ||
pname = "ZeroBot-Plugin"; | ||
version = "0.1"; | ||
pwd = ./.; | ||
src = ./.; | ||
# spec go version manually bcs | ||
# https://github.com/nix-community/gomod2nix/blob/30e3c3a9ec4ac8453282ca7f67fca9e1da12c3e6/builder/default.nix#L130 | ||
# do no work | ||
go = pkgs.go_1_20; | ||
modules = ./gomod2nix.toml; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
description = "A basic gomod2nix flake"; | ||
|
||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
inputs.flake-utils.url = "github:numtide/flake-utils"; | ||
inputs.gomod2nix.url = "github:nix-community/gomod2nix"; | ||
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}; | ||
|
||
# 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; | ||
}) | ||
); | ||
} |
Oops, something went wrong.