nix: initial tooling
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Iabcad180d133f01d3c98e3d5fc9630b26a6a6964
This commit is contained in:
parent
7146a61326
commit
3fca34dd6f
4 changed files with 76 additions and 0 deletions
27
flake.lock
generated
Normal file
27
flake.lock
generated
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1771848320,
|
||||||
|
"narHash": "sha256-0MAd+0mun3K/Ns8JATeHT1sX28faLII5hVLq0L3BdZU=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "2fc6539b481e1d2569f25f8799236694180c0993",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
24
flake.nix
Normal file
24
flake.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
description = "Go Project Template";
|
||||||
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
|
||||||
|
|
||||||
|
outputs = {
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
systems = ["x86_64-linux" "aarch64-linux"];
|
||||||
|
forEachSystem = nixpkgs.lib.genAttrs systems;
|
||||||
|
pkgsForEach = nixpkgs.legacyPackages;
|
||||||
|
in {
|
||||||
|
packages = forEachSystem (system: {
|
||||||
|
default = pkgsForEach.${system}.callPackage ./nix/package.nix {};
|
||||||
|
});
|
||||||
|
|
||||||
|
devShells = forEachSystem (system: {
|
||||||
|
default = pkgsForEach.${system}.callPackage ./nix/shell.nix {};
|
||||||
|
});
|
||||||
|
|
||||||
|
hydraJobs = self.packages;
|
||||||
|
};
|
||||||
|
}
|
||||||
11
nix/package.nix
Normal file
11
nix/package.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
{buildGoModule}:
|
||||||
|
buildGoModule {
|
||||||
|
pname = "sample-go";
|
||||||
|
version = "0.0.1";
|
||||||
|
|
||||||
|
src = ../.;
|
||||||
|
|
||||||
|
vendorHash = "";
|
||||||
|
|
||||||
|
ldflags = ["-s" "-w"];
|
||||||
|
}
|
||||||
14
nix/shell.nix
Normal file
14
nix/shell.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
mkShell,
|
||||||
|
go,
|
||||||
|
gopls,
|
||||||
|
delve,
|
||||||
|
}:
|
||||||
|
mkShell {
|
||||||
|
name = "go";
|
||||||
|
packages = [
|
||||||
|
delve
|
||||||
|
go
|
||||||
|
gopls
|
||||||
|
];
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue