mirror of
https://github.com/NotAShelf/catApi.git
synced 2024-11-01 15:01:13 +00:00
feat: nix tooling
This commit is contained in:
parent
716b27da8f
commit
5203a18d2d
5 changed files with 79 additions and 1 deletions
2
.envrc
2
.envrc
|
@ -1 +1 @@
|
|||
use flake
|
||||
use flake . --builders ""
|
||||
|
|
11
default.nix
11
default.nix
|
@ -0,0 +1,11 @@
|
|||
{buildGoModule}:
|
||||
buildGoModule {
|
||||
pname = "sample-go";
|
||||
version = "0.0.1";
|
||||
|
||||
src = ./.;
|
||||
|
||||
vendorHash = null;
|
||||
|
||||
ldflags = ["-s" "-w"];
|
||||
}
|
26
flake.lock
Normal file
26
flake.lock
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1698331563,
|
||||
"narHash": "sha256-arDwz/scx6iPEkxLV78hTL7U2M+BLH/zxgzPOLuyd6M=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "338a8633bc883122459c3f3daeb0a782d6e3bb56",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
26
flake.nix
26
flake.nix
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
description = "Golang Project Template";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
}: let
|
||||
systems = ["x86_64-linux" "aarch64-linux"];
|
||||
forEachSystem = nixpkgs.lib.genAttrs systems;
|
||||
|
||||
pkgsForEach = nixpkgs.legacyPackages;
|
||||
in rec {
|
||||
packages = forEachSystem (system: {
|
||||
default = pkgsForEach.${system}.callPackage ./default.nix {};
|
||||
});
|
||||
|
||||
devShells = forEachSystem (system: {
|
||||
default = pkgsForEach.${system}.callPackage ./shell.nix {};
|
||||
});
|
||||
|
||||
hydraJobs = packages;
|
||||
};
|
||||
}
|
15
shell.nix
15
shell.nix
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
callPackage,
|
||||
gopls,
|
||||
go,
|
||||
}: let
|
||||
mainPkg = callPackage ./default.nix {};
|
||||
in
|
||||
mainPkg.overrideAttrs (oa: {
|
||||
nativeBuildInputs =
|
||||
[
|
||||
gopls
|
||||
go
|
||||
]
|
||||
++ (oa.nativeBuildInputs or []);
|
||||
})
|
Loading…
Reference in a new issue