diff --git a/README.md b/README.md index f6e2b13..60cecd2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,24 @@ # nix-environments -some personal flakes \ No newline at end of file +some personal flakes + +# usage + +### create a new dir + +```bash +nix flake new -t https://git.elisiei.xyz:elisiei/nix-environments#ENV_HERE +``` + +### or init an existing dir + +```bash +nix flake init -t https://git.elisiei.xyz:elisiei/nix-environments#ENV_HERE +``` + +# license + +all original content and codes in this project is dedicated to the public domain under the +[Creative Commons CC0 1.0 Universal (CC0 1.0) Public Domain Dedication](https://creativecommons.org/publicdomain/zero/1.0/). +this grants you the freedom to use, modify, and distribute the content without any restrictions +or attribution requirements. diff --git a/go/.envrc b/go/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/go/.envrc @@ -0,0 +1 @@ +use flake diff --git a/go/.gitignore b/go/.gitignore new file mode 100644 index 0000000..50b5dca --- /dev/null +++ b/go/.gitignore @@ -0,0 +1,33 @@ +# If you prefer the allow list template instead of the deny list, see community template: +# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore +# +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Code coverage profiles and other test artifacts +*.out +coverage.* +*.coverprofile +profile.cov + +# Dependency directories (remove the comment below to include it) +# vendor/ + +# Go workspace file +go.work +go.work.sum + +# env file +.env +.direnv + +# Editor/IDE +# .idea/ +# .vscode/ diff --git a/go/flake.nix b/go/flake.nix new file mode 100644 index 0000000..d689e7f --- /dev/null +++ b/go/flake.nix @@ -0,0 +1,45 @@ +{ + description = "minimal flake for go dev"; + + inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; + + outputs = + inputs: + let + goVersion = 24; + + supportedSystems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + forEachSupportedSystem = + f: + inputs.nixpkgs.lib.genAttrs supportedSystems ( + system: + f { + pkgs = import inputs.nixpkgs { + inherit system; + overlays = [ inputs.self.overlays.default ]; + }; + } + ); + in + { + overlays.default = final: prev: { + go = final."go_1_${toString goVersion}"; + }; + + devShells = forEachSupportedSystem ( + { pkgs }: + { + default = pkgs.mkShell { + packages = with pkgs; [ + go + ]; + }; + } + ); + }; +}