From bc7aba1db48388275ee22afe6f2de0e986b272fe Mon Sep 17 00:00:00 2001 From: jolheiser Date: Wed, 5 Jul 2023 16:48:24 -0500 Subject: [PATCH] feat: nixpkg Signed-off-by: jolheiser --- README.md | 4 ++-- template.toml | 6 ------ template/.tmplkeep | 1 - template/pkgs/{{gitea_repo}}/default.nix | 24 ++++++++++++++++++++++++ tmpl.yaml | 16 ++++++++++++++++ 5 files changed, 42 insertions(+), 9 deletions(-) delete mode 100644 template.toml delete mode 100644 template/.tmplkeep create mode 100644 template/pkgs/{{gitea_repo}}/default.nix create mode 100644 tmpl.yaml diff --git a/README.md b/README.md index 4b65cbd..b1c921d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# tmpl templates +# nixpkg template for [tmpl](https://git.jojodev.com/jolheiser/tmpl) -Check out the various branches for some basic examples of templates. +Starting at the root of your NUR, this template generates a pkg. ## License diff --git a/template.toml b/template.toml deleted file mode 100644 index 1507fc7..0000000 --- a/template.toml +++ /dev/null @@ -1,6 +0,0 @@ -# template.toml -# Write any template args here to prompt the user for, giving any defaults/options as applicable - -name = "MyProject" - -lang = ["Go", "Rust", "Python"] diff --git a/template/.tmplkeep b/template/.tmplkeep deleted file mode 100644 index b4bd1aa..0000000 --- a/template/.tmplkeep +++ /dev/null @@ -1 +0,0 @@ -Delete this file and put something else here! \ No newline at end of file diff --git a/template/pkgs/{{gitea_repo}}/default.nix b/template/pkgs/{{gitea_repo}}/default.nix new file mode 100644 index 0000000..1dc0d8e --- /dev/null +++ b/template/pkgs/{{gitea_repo}}/default.nix @@ -0,0 +1,24 @@ +{ buildGoModule, fetchFromGitea, lib, ... }: +buildGoModule rec { + pname = "{{gitea_repo}}"; + version = "{{version}}"; + + src = fetchFromGitea { + domain = "{{gitea_domain}}"; + owner = "{{gitea_user}}"; + repo = "{{gitea_repo}}"; + rev = "v${version}"; + sha256 = lib.fakeSha256; + }; + + vendorSha256 = lib.fakeSha256; + + ldflags = [ "-s" "-w" "-X={{version_package}}.Version=${version}" ]; + + meta = with lib; { + description = "{{description}}"; + homepage = "https://{{gitea_domain}}/{{gitea_user}}/{{gitea_repo}}"; + license = licenses.mit; + }; +} + diff --git a/tmpl.yaml b/tmpl.yaml new file mode 100644 index 0000000..7d95656 --- /dev/null +++ b/tmpl.yaml @@ -0,0 +1,16 @@ +prompts: + - id: gitea_domain + label: Gitea Domain + default: git.jojodev.com + help: No protocol or trailing slash + - id: gitea_user + label: Gitea User + - id: gitea_repo + label: Gitea Repo + - id: version + label: Version + - id: version_package + label: Version Package + default: main + - id: description + label: Description \ No newline at end of file