mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 00:57:22 +01:00
feat: add go template
This commit is contained in:
parent
f4f98b248d
commit
6da0fcbb1b
9 changed files with 75 additions and 3 deletions
|
|
@ -116,7 +116,7 @@ These blocks are later inserted here: [[#h:aee5ec75-7ca6-40d8-b6ac-a3e7e33a474b]
|
|||
|
||||
|
||||
|
||||
** flake.nix template
|
||||
** flake.nix skeleton
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: h:aee5ec75-7ca6-40d8-b6ac-a3e7e33a474b
|
||||
:END:
|
||||
|
|
@ -486,6 +486,7 @@ This file defines the templates that are being exposed by the flake. These can b
|
|||
templateNames = [
|
||||
"python"
|
||||
"rust"
|
||||
"go"
|
||||
];
|
||||
in
|
||||
lib.swarselsystems.mkTemplates templateNames
|
||||
|
|
@ -13852,6 +13853,8 @@ After having tried out =lsp-mode= and =lsp-bridge= for a while each, I must say
|
|||
c-ts-mode
|
||||
c++-mode
|
||||
c++-ts-mode
|
||||
go-mode
|
||||
go-ts-mode
|
||||
rust-ts-mode
|
||||
rustic-mode
|
||||
tex-mode
|
||||
|
|
|
|||
|
|
@ -1376,6 +1376,8 @@ create a new one."
|
|||
c-ts-mode
|
||||
c++-mode
|
||||
c++-ts-mode
|
||||
go-mode
|
||||
go-ts-mode
|
||||
rust-ts-mode
|
||||
rustic-mode
|
||||
tex-mode
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ let
|
|||
templateNames = [
|
||||
"python"
|
||||
"rust"
|
||||
"go"
|
||||
];
|
||||
in
|
||||
lib.swarselsystems.mkTemplates templateNames
|
||||
|
|
|
|||
1
templates/go/.envrc
Normal file
1
templates/go/.envrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
use flake
|
||||
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}";
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
3
templates/go/go.mod
Normal file
3
templates/go/go.mod
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
module name
|
||||
|
||||
go 1.22.7
|
||||
9
templates/go/name/name.go
Normal file
9
templates/go/name/name.go
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hello, World!")
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
# based on https://github.com/pyproject-nix/uv2nix/tree/master/templates/hello-world
|
||||
|
||||
{
|
||||
description = "Hello world flake using uv2nix";
|
||||
description = "Python flake using uv2nix";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
# heavily inspired by https://github.com/nulladmin1/nix-flake-templates/blob/main/rust-fenix-naersk/flake.nix
|
||||
{
|
||||
description = "Nix Flake Template for Rust using Fenix and Naersk";
|
||||
description = "Rust Flake using Fenix and Naersk";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue