1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-12 16:52:10 -04:00

nix: dynamically resolve go version in flake

This commit is contained in:
bbedward
2026-03-13 11:58:08 -04:00
parent 8b003ac9cd
commit 57279d1c53

View File

@@ -17,6 +17,22 @@
... ...
}: }:
let let
goModVersion =
let
content = builtins.readFile ./core/go.mod;
matched = builtins.match ".*\ngo ([0-9]+)\.([0-9]+).*" content;
in
if matched != null then
{
major = builtins.elemAt matched 0;
minor = builtins.elemAt matched 1;
}
else
{
major = "1";
minor = "25";
};
goForPkgs = pkgs: pkgs.${"go_${goModVersion.major}_${goModVersion.minor}"};
forEachSystem = forEachSystem =
fn: fn:
nixpkgs.lib.genAttrs [ "aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux" ] ( nixpkgs.lib.genAttrs [ "aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux" ] (
@@ -85,6 +101,7 @@
inherit version; inherit version;
pname = "dms-shell"; pname = "dms-shell";
src = ./core; src = ./core;
go = goForPkgs pkgs;
vendorHash = "sha256-dEk7IOd6aQwaxZruxQclN7TGMyb8EJOl6NBWRsoZ9HQ="; vendorHash = "sha256-dEk7IOd6aQwaxZruxQclN7TGMyb8EJOl6NBWRsoZ9HQ=";
subPackages = [ "cmd/dms" ]; subPackages = [ "cmd/dms" ];
@@ -187,7 +204,7 @@
buildInputs = buildInputs =
with pkgs; with pkgs;
[ [
go_1_26 (goForPkgs pkgs)
gopls gopls
delve delve
go-tools go-tools