diff --git a/Taskfile.yml b/Taskfile.yml index 42e7112678dd0a56f34c3f01c6e12799a4302831..62a453aea9ad20e3eea212327808479f1d7c8143 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -23,6 +23,15 @@ tasks: - source/**/*.mod - dist/** + release: + desc: Commit changes (update version, hashes, etc.) + aliases: + - cc + cmds: + - update-hashes || true + - git-commit + - update-version + update-code: desc: Update the code, calculate hashes and update version aliases: diff --git a/flake.lock b/flake.lock index 4123ba53b13a51f9e8a3f6a5ab712e82757cdc7b..e1387006392cd9d7764beea135106f9572e4985e 100644 --- a/flake.lock +++ b/flake.lock @@ -87,21 +87,6 @@ "type": "github" } }, - "git-commit": { - "inputs": { - "nixpkgs": "nixpkgs_2" - }, - "locked": { - "lastModified": 1, - "narHash": "sha256-8hXrOA8SKy//ctoL1poIhJwuT7G4rvVu7FguROzEoDg=", - "path": "./git-commit", - "type": "path" - }, - "original": { - "path": "./git-commit", - "type": "path" - } - }, "gitignore": { "inputs": { "nixpkgs": [ @@ -179,25 +164,6 @@ "type": "github" } }, - "nix-templates": { - "inputs": { - "git-commit": "git-commit", - "nixpkgs": "nixpkgs_3" - }, - "locked": { - "lastModified": 1704993617, - "narHash": "sha256-++u7I3KCDgP+JhW70k5tiLfBESWVSKdVK7aei0G+mR8=", - "ref": "refs/heads/master", - "rev": "e63b1d6ae5526158fa2a1f4cd53b0ea4f4c93573", - "revCount": 18, - "type": "git", - "url": "https://gitlab.schukai.com/schukai/entwicklung/nix-flakes" - }, - "original": { - "type": "git", - "url": "https://gitlab.schukai.com/schukai/entwicklung/nix-flakes" - } - }, "nixpkgs": { "locked": { "lastModified": 1678875422, @@ -265,36 +231,6 @@ } }, "nixpkgs_2": { - "locked": { - "lastModified": 1704874635, - "narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-23.11", - "type": "indirect" - } - }, - "nixpkgs_3": { - "locked": { - "lastModified": 1706373441, - "narHash": "sha256-S1hbgNbVYhuY2L05OANWqmRzj4cElcbLuIkXTb69xkk=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "56911ef3403a9318b7621ce745f5452fb9ef6867", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-23.11", - "type": "indirect" - } - }, - "nixpkgs_4": { "locked": { "lastModified": 1706373441, "narHash": "sha256-S1hbgNbVYhuY2L05OANWqmRzj4cElcbLuIkXTb69xkk=", @@ -310,7 +246,7 @@ "type": "github" } }, - "nixpkgs_5": { + "nixpkgs_3": { "locked": { "lastModified": 1705856552, "narHash": "sha256-JXfnuEf5Yd6bhMs/uvM67/joxYKoysyE3M2k6T3eWbg=", @@ -326,7 +262,7 @@ "type": "github" } }, - "nixpkgs_6": { + "nixpkgs_4": { "locked": { "lastModified": 1704145853, "narHash": "sha256-G/1AMt9ibpeMlcxvD1vNaC8imGaK+g7zZ99e29BLgWw=", @@ -375,10 +311,9 @@ "flake-parts": "flake-parts", "flake-root": "flake-root", "mk-shell-bin": "mk-shell-bin", - "nix-templates": "nix-templates", - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_2", "treefmt-nix": "treefmt-nix", - "versionsTool": "versionsTool" + "versions-tool": "versions-tool" } }, "systems": { @@ -398,7 +333,7 @@ }, "treefmt-nix": { "inputs": { - "nixpkgs": "nixpkgs_5" + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1706462057, @@ -414,9 +349,9 @@ "type": "github" } }, - "versionsTool": { + "versions-tool": { "inputs": { - "nixpkgs": "nixpkgs_6" + "nixpkgs": "nixpkgs_4" }, "locked": { "lastModified": 1704542622, diff --git a/flake.nix b/flake.nix index 9d8dffe614c937ab16bc46fcf72f4ea02312a2ea..2b64440cf3192c8485c3849212d75d17fe01f30c 100644 --- a/flake.nix +++ b/flake.nix @@ -7,8 +7,7 @@ mk-shell-bin.url = "github:rrbutani/nix-mk-shell-bin"; flake-root.url = "github:srid/flake-root"; treefmt-nix.url = "github:numtide/treefmt-nix"; - versionsTool.url = "git+https://gitlab.schukai.com/oss/utilities/version.git"; - nix-templates.url = "git+https://gitlab.schukai.com/schukai/entwicklung/nix-flakes"; + versions-tool.url = "git+https://gitlab.schukai.com/oss/utilities/version.git"; }; nixConfig = { @@ -19,8 +18,7 @@ outputs = inputs @ { self, flake-parts, - versionsTool, - nix-templates, + versions-tool, ... }: flake-parts.lib.mkFlake {inherit inputs;} { @@ -130,7 +128,7 @@ name = projectDefinition.name; scripts = let - versionsTool = inputs.versionsTool.defaultPackage."${builtins.currentSystem}"; + versions-tool = inputs.versions-tool.defaultPackage."${builtins.currentSystem}"; workingDirectory = builtins.getEnv "PWD"; in { @@ -155,7 +153,11 @@ }; update-version.exec = import ./system/scripts/update-version.nix { - inherit pkgs config buildRoot projectDefinition versionsTool workingDirectory; + inherit pkgs config buildRoot projectDefinition versions-tool workingDirectory; + }; + + git-commit.exec = import ./system/scripts/git-commit.nix { + inherit pkgs; }; }; @@ -163,8 +165,7 @@ ]; packages = with pkgs; [ - inputs.versionsTool.defaultPackage."${builtins.currentSystem}" - inputs.nix-templates.packages."${builtins.currentSystem}".git-commit + inputs.versions-tool.defaultPackage."${builtins.currentSystem}" nodePackages.prettier-plugin-toml nodePackages.prettier go-task diff --git a/system/scripts/git-commit.nix b/system/scripts/git-commit.nix new file mode 100644 index 0000000000000000000000000000000000000000..13341a1b8277d0cf7558a7b9445bd8de127ed067 --- /dev/null +++ b/system/scripts/git-commit.nix @@ -0,0 +1,8 @@ +{pkgs, ...}: let + common = import ./common.nix {inherit pkgs;}; + nix-flakes = builtins.getFlake "git+https://gitlab.schukai.com/schukai/entwicklung/nix-flakes"; +in '' + #!${pkgs.bash}/bin/bash + ${common} + ${nix-flakes.packages.${builtins.currentSystem}.git-commit}/bin/git-commit +'' diff --git a/system/scripts/update-version.nix b/system/scripts/update-version.nix index 4c13134c7f34858b73dc4f57cd34c5b6bb8661cd..8deb58a8851449108b19ebd53fac96e8f95936d3 100644 --- a/system/scripts/update-version.nix +++ b/system/scripts/update-version.nix @@ -2,7 +2,7 @@ pkgs, buildRoot, projectDefinition, - versionsTool, + versions-tool, workingDirectory, ... }: let @@ -14,7 +14,7 @@ in '' ${common} - cmd=${versionsTool}/bin/version + cmd=${versions-tool}/bin/version echo_step "Getting current commit hash" HASH=$(${pkgs.git}/bin/git -C ${workingDirectory}/ rev-parse --short HEAD)