From d17cc2a6d5b2c37eb83634dbc497d8c279afe0d9 Mon Sep 17 00:00:00 2001
From: Volker Schukai <volker.schukai@schukai.com>
Date: Mon, 14 Aug 2023 18:11:49 +0200
Subject: [PATCH] chore: change to devenv

---
 .envrc         |   3 +
 .gitlab-ci.yml |  64 +++++++++++++++++
 Makefile       | 157 ----------------------------------------
 Taskfile.yml   |  48 +++++++++++++
 devenv.lock    | 190 +++++++++++++++++++++++++++++++++++++++++++++++++
 devenv.nix     | 149 ++++++++++++++++++++++++++++++++++++++
 devenv.yaml    |   7 ++
 7 files changed, 461 insertions(+), 157 deletions(-)
 create mode 100644 .envrc
 create mode 100644 .gitlab-ci.yml
 delete mode 100644 Makefile
 create mode 100644 Taskfile.yml
 create mode 100644 devenv.lock
 create mode 100644 devenv.nix
 create mode 100644 devenv.yaml

diff --git a/.envrc b/.envrc
new file mode 100644
index 0000000..6de8a8a
--- /dev/null
+++ b/.envrc
@@ -0,0 +1,3 @@
+source_url "https://raw.githubusercontent.com/cachix/devenv/d1f7b48e35e6dee421cfd0f51481d17f77586997/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0="
+
+use devenv
\ No newline at end of file
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..7b2885e
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,64 @@
+image: docker-registry.schukai.com:443/nixos-ci-devenv:latest
+
+services:
+  - docker:dind
+
+
+variables:
+  # The repo name as used in
+  # https://github.com/nix-community/NUR/blob/master/repos.json
+  NIXOS_VERSION: "23.05"
+  NIXPKGS_ALLOW_UNFREE: "1"
+  NIXPKGS_ALLOW_INSECURE: "1"
+  DOCKER_DRIVER: overlay2
+  GIT_DEPTH: 10
+
+
+stages:
+  - test
+  - deploy 
+
+before_script:
+  - nix shell nixpkgs#coreutils-full -c mkdir -p /certs/client/
+  - nix shell nixpkgs#coreutils-full -c ln -fs /etc/ssl/certs/ca-bundle.crt /certs/client/ca.pem
+  - echo > .env-gitlab-ci
+  - variables=("HOME=$HOME" "CI_COMMIT_REF_NAME=$CI_COMMIT_REF_NAME" "CI_REPOSITORY_URL=$CI_REPOSITORY_URL" "GITLAB_TOKEN=$GITLAB_TOKEN" "CI_JOB_TOKEN=$CI_JOB_TOKEN" "GITLAB_USER_EMAIL=$GITLAB_USER_EMAIL" "GITLAB_USER_NAME=\"$GITLAB_USER_NAME\"" "CI_REGISTRY_USER=$CI_REGISTRY_USER" "CI_PROJECT_ID=$CI_PROJECT_ID" "CI_PROJECT_DIR=$CI_PROJECT_DIR" "CI_API_V4_URL=$CI_API_V4_URL" "CI_PROJECT_NAME=$CI_PROJECT_NAME" "CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA"); for var in "${variables[@]}"; do echo "$var" >> .env-gitlab-ci; done
+  - cat .env-gitlab-ci
+
+after_script:
+  - if [ -f .env-gitlab-ci ]; then rm .env-gitlab-ci; fi
+
+test:
+  stage: test
+  tags:
+    - nixos
+  script:
+    - devenv shell test-lib
+
+  cache:
+    - key: nixos
+      paths:
+        - /nix/store
+  
+  artifacts:
+    paths:
+      - dist
+
+deploy:
+  stage: deploy
+  tags:
+    - nixos
+  script:
+    - devenv shell -c deploy-lib
+
+  when: on_success
+
+  cache:
+    - key: nixos
+      paths:
+        - /nix/store
+
+
+  artifacts:
+    paths:
+      - dist   
diff --git a/Makefile b/Makefile
deleted file mode 100644
index c149982..0000000
--- a/Makefile
+++ /dev/null
@@ -1,157 +0,0 @@
-## Copyright 2022 schukai GmbH. All rights reserved.
-## Use of this source code is governed by a AGPL-3.0
-## license that can be found in the LICENSE file.
-
-PROJECT_ROOT:=$(dir $(realpath $(lastword $(MAKEFILE_LIST))))
-THIS_MAKEFILE:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
-THIS_MAKEFILE_PATH:=$(PROJECT_ROOT)$(THIS_MAKEFILE) 
-
-# @see .PHONY https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html#Phony-Targets
-.DEFAULT_GOAL := help
-
-.PHONY: print
-## Print Path	
-print:
-	@echo "THIS_MAKEFILE:      $(THIS_MAKEFILE)"
-	@echo "THIS_MAKEFILE_PATH: $(THIS_MAKEFILE_PATH)"
-	@echo "PROJECT_ROOT:       $(PROJECT_ROOT)"
-
-# Add a comment to the public targets so that it appears
-# in this help Use two # characters for a help comment
-.PHONY: help
-help:
-	@printf "${COMMENT}Usage:${RESET}\n"
-	@printf " make [target] [arg=\"val\"...]\n\n"
-	@printf "${COMMENT}Available targets:${RESET}\n"
-	@awk '/^[a-zA-Z\-\\_0-9\.@]+:/ { \
-		helpMessage = match(lastLine, /^## (.*)/); \
-		if (helpMessage) { \
-			helpCommand = substr($$1, 0, index($$1, ":")); \
-			helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
-			printf " ${INFO}%-22s${RESET} %s\n", helpCommand, helpMessage; \
-		} \
-	} \
-	{ lastLine = $$0 }' $(MAKEFILE_LIST)
-	@printf "\n${COMMENT}Available arguments:${RESET}\n\n"
-	@awk '/^(([a-zA-Z\-\\_0-9\.@]+)\s[?:]?=)/ { \
-		helpMessage = match(lastLine, /^## (.*)/); \
-		if (helpMessage) { \
-			helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
-			printf " ${INFO}%-22s${RESET} %s (Default: %s)\n", $$1, helpMessage, $$3; \
-		} \
-	} \
-	{ lastLine = $$0 }' $(MAKEFILE_LIST)
-
-
-## run tests
-test:
-	echo "Running tests"
-	go test -cover -v ./...
-
-## run tests with fuzzing
-test-fuzz:
-	echo "Running fuzz tests"
-	go test -v -fuzztime=30s -fuzz=Fuzz ./...
-
-#### VERSION
-BIN_DIR ?= $(shell echo $$HOME)/.local/bin/
-VERSION_NAME 	     := version
-EXECUTABLES = $(EXECUTABLES:-) $(VERSION_NAME)
-VERSION_BIN_PATH := $(BIN_DIR)$(VERSION_NAME)
-
-VERSION_BIN := $(shell command -v $(VERSION_NAME) 2> /dev/null)
-
-ifndef VERSION_BIN
-    $(shell curl -o $(VERSION_BIN_PATH) http://download.schukai.com/tools/version/version-$(shell uname -s | tr [:upper:] [:lower:])-$(shell echo `uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/`))
-    $(shell chmod +x $(VERSION_BIN_PATH))
-endif
-
-GIT_CHGLOG_BIN := $(shell command -v git-chglog 2> /dev/null)
-
-ifeq ($(GIT_CHGLOG_BIN),)
-    $(shell go install github.com/git-chglog/git-chglog/cmd/git-chglog@latest)
-endif     
-     
-RELEASE_FILE ?= $(PROJECT_ROOT)release.json
-CHANGELOG_FILE ?= $(PROJECT_ROOT)CHANGELOG.md
- 
-ifeq ("$(wildcard $(RELEASE_FILE))","")
-  $(shell echo '{"version":"0.1.0"}' > $(RELEASE_FILE))
-endif
-
-PROJECT_VERSION ?= $(shell cat $(RELEASE_FILE) | jq -r .version)
-PROJECT_BUILD_DATE ?= $(shell $(VERSION_BIN) date)
-
-.PHONY: next-patch-version
-next-patch-version: check-clean-repo
-	echo "Creating next version"
-	$(VERSION_BIN) patch --path $(RELEASE_FILE) --selector "version"
-	git add $(RELEASE_FILE) && git commit -m "Bump version to $$(cat $(RELEASE_FILE) | jq -r .version)"
-
-.PHONY: next-minor-version
-next-minor-version: check-clean-repo
-	echo  "Creating next minor version"
-	$(VERSION_BIN) minor --path $(RELEASE_FILE) --selector "version"
-	git add $(RELEASE_FILE) && git commit -m "Bump version to $$( cat $(RELEASE_FILE) | jq -r .version)"
-
-.PHONY: next-major-version
-next-major-version: check-clean-repo
-	echo "Creating next minor version"
-	$(VERSION_BIN) major --path $(RELEASE_FILE) --selector "version"
-	git add $(RELEASE_FILE) && git commit -m "Bump version to $$(cat $(RELEASE_FILE) | jq -r .version)"
-
-.PHONY: check-clean-repo
-check-clean-repo:
-	git diff-index --quiet HEAD || (echo "There are uncommitted changes after running make. Please commit or stash them before running make."; exit 1)
-	
-## tag repository with next patch version
-tag-patch-version: next-patch-version 
-	echo "Tagging patch version"
-	$(eval PROJECT_VERSION := $(shell cat $(RELEASE_FILE) | jq -r .version))
-	git-chglog --next-tag v$(PROJECT_VERSION) -o $(CHANGELOG_FILE)
-	git add $(CHANGELOG_FILE) && git commit -m "Update changelog"
-	git tag -a v$(PROJECT_VERSION) -m "Version $(PROJECT_VERSION)"
-
-## tag repository with next minor version
-tag-minor-version: next-minor-version 
-	echo "Tagging minor version"
-	$(eval PROJECT_VERSION := $(shell cat $(RELEASE_FILE) | jq -r .version))
-	git-chglog --next-tag v$(PROJECT_VERSION) -o $(CHANGELOG_FILE)
-	git add $(CHANGELOG_FILE) && git commit -m "Update changelog"
-	git tag -a v$(PROJECT_VERSION) -m "Version $(PROJECT_VERSION)"
-
-## tag repository with next major version
-tag-major-version: next-major-version 
-	echo "Tagging major version"
-	$(eval PROJECT_VERSION := $(shell cat $(RELEASE_FILE) | jq -r .version))
-	git-chglog --next-tag v$(PROJECT_VERSION) -o $(CHANGELOG_FILE)
-	git add $(CHANGELOG_FILE) && git commit -m "Update changelog"
-	git tag -a v$(PROJECT_VERSION) -m "Version $(PROJECT_VERSION)"
-
-GO_MOD_FILE := $(SOURCE_PATH)go.mod
-
-ifeq ($(shell test -e $(GO_MOD_FILE) && echo -n yes),yes)
-    GO_CURRENT_MODULE := $(shell cat $(GO_MOD_FILE) | head -n1 | cut -d" " -f2)
-	# go install github.com/google/go-licenses@latest
-	EXECUTABLES = $(EXECUTABLES:-) go-licenses;    
-endif
-
-.PHONY: fetch-licenses
-## Fetch licenses for all modules
-fetch-licenses:
-	go-licenses save $(GO_CURRENT_MODULE) --ignore gitlab.schukai.com --force --save_path $(PROJECT_ROOT)licenses/
-
-# https://spdx.github.io/spdx-spec/v2.3/SPDX-license-list/
-ADDLICENSE_BIN ?= addlicense
-ifeq ($(shell command -v $(ADDLICENSE_BIN) 2> /dev/null),)
-	$(shell go install github.com/google/addlicense@latest)
-	EXECUTABLES = $(EXECUTABLES:-) $(ADDLICENSE_BIN);
-endif
-
-.PHONY: add-licenses
-## Add license headers to all go files
-add-licenses:
-	addlicense -c "schukai GmbH" -s -l "AGPL-3.0" ./*.go
-
-
-
diff --git a/Taskfile.yml b/Taskfile.yml
new file mode 100644
index 0000000..7febe83
--- /dev/null
+++ b/Taskfile.yml
@@ -0,0 +1,48 @@
+# https://taskfile.dev
+
+version: '3'
+
+tasks:
+  default:
+    cmds:
+      - task --list-all
+    silent: true
+  test:
+    desc: Execute unit tests in Go.
+    cmds:  
+      - echo "Execute unit tests in Go."
+      - go test -cover -v ./...
+
+  test-fuzz:
+    desc: Conduct fuzzing tests.#
+    cmds:  
+      - echo "Conduct fuzzing tests."
+      - go test -v -fuzztime=30s -fuzz=Fuzz ./...
+
+  add-licenses:
+    desc: Attach license headers to Go files.
+    cmds:
+      - echo "Attach license headers to Go files."
+      - addlicense -c "schukai GmbH" -s -l "AGPL-3.0" ./*.go
+    silent: true
+
+  check:
+    desc: Confirm repository status.
+    cmds:
+      - git diff-index --quiet HEAD || (echo "There are uncommitted changes after running make. Please commit or stash them before running make."; exit 1)
+    silent: true
+
+  build:
+    desc: Compile the application,
+    aliases:
+      - b
+    vars:
+      DEVENV_ROOT:
+        sh: echo "$DEVENV_ROOT"
+    
+    cmds:
+      - devenv shell build-app
+    sources:
+      - source/**/*.go
+      - source/**/*.mod
+      - dist/**      
diff --git a/devenv.lock b/devenv.lock
new file mode 100644
index 0000000..8993ca8
--- /dev/null
+++ b/devenv.lock
@@ -0,0 +1,190 @@
+{
+  "nodes": {
+    "devenv": {
+      "locked": {
+        "dir": "src/modules",
+        "lastModified": 1692003204,
+        "narHash": "sha256-gO2DXwXuArjpywgtRTDb3aKscWMbnI7YwFaqvV46yv0=",
+        "owner": "cachix",
+        "repo": "devenv",
+        "rev": "ade3ae522baf366296598e232b7b063d81740bbb",
+        "type": "github"
+      },
+      "original": {
+        "dir": "src/modules",
+        "owner": "cachix",
+        "repo": "devenv",
+        "type": "github"
+      }
+    },
+    "flake-compat": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1673956053,
+        "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
+        "owner": "edolstra",
+        "repo": "flake-compat",
+        "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
+        "type": "github"
+      },
+      "original": {
+        "owner": "edolstra",
+        "repo": "flake-compat",
+        "type": "github"
+      }
+    },
+    "flake-utils": {
+      "inputs": {
+        "systems": "systems"
+      },
+      "locked": {
+        "lastModified": 1685518550,
+        "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "gitignore": {
+      "inputs": {
+        "nixpkgs": [
+          "pre-commit-hooks",
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1660459072,
+        "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
+        "owner": "hercules-ci",
+        "repo": "gitignore.nix",
+        "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
+        "type": "github"
+      },
+      "original": {
+        "owner": "hercules-ci",
+        "repo": "gitignore.nix",
+        "type": "github"
+      }
+    },
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1691950488,
+        "narHash": "sha256-iUNEeudc4dGjx+HsHccnGiuZUVE/nhjXuQ1DVCsHIUY=",
+        "owner": "nixos",
+        "repo": "nixpkgs",
+        "rev": "720e61ed8de116eec48d6baea1d54469b536b985",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nixos",
+        "ref": "nixos-23.05",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "nixpkgs-stable": {
+      "locked": {
+        "lastModified": 1685801374,
+        "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
+        "type": "github"
+      },
+      "original": {
+        "owner": "NixOS",
+        "ref": "nixos-23.05",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "nixpkgs_2": {
+      "locked": {
+        "lastModified": 1691950488,
+        "narHash": "sha256-iUNEeudc4dGjx+HsHccnGiuZUVE/nhjXuQ1DVCsHIUY=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "720e61ed8de116eec48d6baea1d54469b536b985",
+        "type": "github"
+      },
+      "original": {
+        "id": "nixpkgs",
+        "ref": "nixos-23.05",
+        "type": "indirect"
+      }
+    },
+    "pre-commit-hooks": {
+      "inputs": {
+        "flake-compat": "flake-compat",
+        "flake-utils": "flake-utils",
+        "gitignore": "gitignore",
+        "nixpkgs": [
+          "nixpkgs"
+        ],
+        "nixpkgs-stable": "nixpkgs-stable"
+      },
+      "locked": {
+        "lastModified": 1691747570,
+        "narHash": "sha256-J3fnIwJtHVQ0tK2JMBv4oAmII+1mCdXdpeCxtIsrL2A=",
+        "owner": "cachix",
+        "repo": "pre-commit-hooks.nix",
+        "rev": "c5ac3aa3324bd8aebe8622a3fc92eeb3975d317a",
+        "type": "github"
+      },
+      "original": {
+        "owner": "cachix",
+        "repo": "pre-commit-hooks.nix",
+        "type": "github"
+      }
+    },
+    "root": {
+      "inputs": {
+        "devenv": "devenv",
+        "nixpkgs": "nixpkgs",
+        "pre-commit-hooks": "pre-commit-hooks",
+        "version": "version"
+      }
+    },
+    "systems": {
+      "locked": {
+        "lastModified": 1681028828,
+        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+        "owner": "nix-systems",
+        "repo": "default",
+        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-systems",
+        "repo": "default",
+        "type": "github"
+      }
+    },
+    "version": {
+      "inputs": {
+        "nixpkgs": "nixpkgs_2"
+      },
+      "locked": {
+        "lastModified": 1690668568,
+        "narHash": "sha256-jzixQKFFW4oxO0S4GYqbkFCXzhBd6com6Z9+MtVKakU=",
+        "ref": "refs/heads/master",
+        "rev": "3838f03165b726e47d586c04a1821749375e1001",
+        "revCount": 37,
+        "type": "git",
+        "url": "https://gitlab.schukai.com/oss/utilities/version.git"
+      },
+      "original": {
+        "type": "git",
+        "url": "https://gitlab.schukai.com/oss/utilities/version.git"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}
diff --git a/devenv.nix b/devenv.nix
new file mode 100644
index 0000000..2568f0c
--- /dev/null
+++ b/devenv.nix
@@ -0,0 +1,149 @@
+{ pkgs, inputs, phps, lib, config, modulesPath,... }:
+
+{
+
+  # https://devenv.sh/packages/
+  packages = [
+    inputs.version.defaultPackage."${builtins.currentSystem}"
+    pkgs.git
+    pkgs.gcc12
+    pkgs.go-task
+    pkgs.blackbox
+    pkgs.blackbox-terminal
+    pkgs.jq
+    pkgs.delve
+    pkgs.gdlv
+    pkgs.wget
+    pkgs.glab
+    pkgs.unixtools.xxd
+    pkgs.libffi
+    pkgs.zlib
+    pkgs.procps
+    pkgs.php81Extensions.xdebug
+    pkgs.ranger
+    pkgs.meld
+    pkgs.gnused
+    pkgs.coreutils-full
+    pkgs.gnugrep
+    pkgs.gnumake
+    pkgs.util-linux
+    pkgs.httpie
+    pkgs.netcat
+    pkgs.memcached
+    pkgs.fd    
+  ];
+
+
+  # https://devenv.sh/languages/
+  # languages.nix.enable = true;
+  languages = {
+    go = { enable = true; };
+  };
+  
+   difftastic.enable = true;
+
+    
+  # This script is executed when the app is built
+  # You can use it to build the app  
+  scripts.test-lib.exec =  ''
+#!${pkgs.bash}/bin/bash
+#set -euo pipefail
+set -x
+
+PATH="''${PATH}":${pkgs.coreutils}/bin
+PATH="''${PATH}":${pkgs.findutils}/bin
+PATH="''${PATH}":${pkgs.jq}/bin/
+PATH="''${PATH}":${pkgs.rsync}/bin/
+PATH="''${PATH}":${pkgs.bash}/bin/
+PATH="''${PATH}":${pkgs.curl}/bin/
+PATH="''${PATH}":${pkgs.moreutils}/bin/
+PATH="''${PATH}":${pkgs.gnutar}/bin
+PATH="''${PATH}":${pkgs.gzip}/bin/
+PATH="''${PATH}":${pkgs.procps}/bin/
+PATH="''${PATH}":${pkgs.exa}/bin/
+PATH="''${PATH}":${pkgs.git}/bin/
+PATH="''${PATH}":${pkgs.gnugrep}/bin/
+PATH="''${PATH}":${inputs.version.defaultPackage."${builtins.currentSystem}"}/bin/
+
+export -f PATH
+
+task test
+
+'';
+
+  # This scritp is used to deploy the app to the gitlab registry
+  # It is used by the gitlab-ci.yml file
+  # The environment variables are set in the gitlab project settings
+  scripts.deploy-lib.exec =  ''
+#!${pkgs.bash}/bin/bash
+
+PATH="''${PATH}":${pkgs.coreutils}/bin
+PATH="''${PATH}":${pkgs.jq}/bin/
+PATH="''${PATH}":${pkgs.curl}/bin/
+PATH="''${PATH}":${pkgs.moreutils}/bin/
+PATH="''${PATH}":${pkgs.gnutar}/bin
+PATH="''${PATH}":${pkgs.gzip}/bin/
+PATH="''${PATH}":${pkgs.exa}/bin/
+PATH="''${PATH}":${pkgs.git}/bin/
+PATH="''${PATH}":${inputs.version.defaultPackage."${builtins.currentSystem}"}/bin/
+
+export PATH
+
+if [[ -f .env-gitlab-ci ]]; then
+    source .env-gitlab-ci
+    rm .env-gitlab-ci
+fi
+
+set -x
+## if $HOME not set, set it to current directory
+if [[ -z "''${HOME}" ]]; then
+    HOME=$(pwd)
+fi
+
+export HOME
+
+git config user.email "''${GITLAB_USER_EMAIL}"
+git config user.name "''${GITLAB_USER_NAME:-"Gitlab CI"}"
+git config pull.rebase true
+git config http.sslVerify "false"
+git remote set-url origin https://pad:''${GITLAB_TOKEN}@''${CI_REPOSITORY_URL#*@}
+
+git fetch --all --tags --unshallow
+git reset --hard origin/master
+git checkout $CI_COMMIT_REF_NAME
+git pull origin $CI_COMMIT_REF_NAME
+
+if [ ! -z "''${CI_PROJECT_DIR}" ]; then
+    echo "CI_PROJECT_DIR is set, using it as project root."
+    project_root=$(realpath "''${CI_PROJECT_DIR}")/
+elif [ ! -z "''${DEVENV_ROOT}" ]; then
+    echo "DEVENV_ROOT is set, using it as project root."
+    project_root=$(realpath "''${DEVENV_ROOT}")/
+else
+    echo "Error: DEVENV_ROOT or CI_PROJECT_DIR environment variables are not set."
+    exit 1  
+fi
+
+if [ ! -d "''${project_root}" ]; then
+    echo "Error: Project root directory does not seem to be valid."
+    echo "Check the DEVENV_ROOT or CI_PROJECT_DIR environment variables."
+    exit 1
+fi
+
+if [ -z "'CI_JOB_TOKEN" ]; then
+    echo "Error: CI_JOB_TOKEN variable is not set."
+    exit 1
+fi
+
+git --no-pager log --decorate=short --pretty=oneline
+gitVersion=v$(version predict)
+git tag -a $gitVersion -m"chore: bump version" 
+git --no-pager log --decorate=short --pretty=oneline
+git push -o ci.skip origin ''${CI_COMMIT_REF_NAME} --tags
+
+echo "done"
+
+'';
+
+
+}
diff --git a/devenv.yaml b/devenv.yaml
new file mode 100644
index 0000000..525a6f0
--- /dev/null
+++ b/devenv.yaml
@@ -0,0 +1,7 @@
+inputs:
+  nixpkgs:
+    url: github:nixos/nixpkgs/nixos-23.05
+
+  version:
+    url: git+https://gitlab.schukai.com/oss/utilities/version.git
+    flake: true
-- 
GitLab