mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 09:07:21 +01:00
feat: add go template
This commit is contained in:
parent
f4f98b248d
commit
6da0fcbb1b
9 changed files with 75 additions and 3 deletions
52
templates/go/flake.nix
Normal file
52
templates/go/flake.nix
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
# heavily inspired by https://github.com/nulladmin1/nix-flake-templates/blob/main/go-nix/flake.nix
|
||||
{
|
||||
description = "Go Flake";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
systems.url = "github:nix-systems/default";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self
|
||||
, nixpkgs
|
||||
, systems
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
forEachSystem = nixpkgs.lib.genAttrs (import systems);
|
||||
pkgsFor = forEachSystem (system: import nixpkgs { inherit system; });
|
||||
|
||||
pname = "name";
|
||||
in
|
||||
{
|
||||
formatter = forEachSystem (system: pkgsFor.${system}.nixpkgs-fmt);
|
||||
|
||||
devShells = forEachSystem (system: {
|
||||
default = pkgsFor.${system}.mkShell {
|
||||
packages = with pkgsFor.${system}; [
|
||||
go
|
||||
gopls
|
||||
go-tools
|
||||
gotools
|
||||
];
|
||||
};
|
||||
});
|
||||
|
||||
packages = forEachSystem (system: {
|
||||
default = pkgsFor.${system}.buildGoModule {
|
||||
inherit pname;
|
||||
version = "0.1.0";
|
||||
src = ./.;
|
||||
vendorHash = null;
|
||||
};
|
||||
});
|
||||
|
||||
apps = forEachSystem (system: {
|
||||
default = {
|
||||
type = "app";
|
||||
program = "${self.packages.${system}.default}/bin/${pname}";
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue