update script for go dependancies

This commit is contained in:
Alan Daniels 2025-02-13 09:56:52 +11:00
parent c5a07cc35b
commit c2a81f7d2a
2 changed files with 22 additions and 19 deletions

View file

@ -25,6 +25,7 @@
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication; inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
}; };
devShells.default = callPackage ./shell.nix { devShells.default = callPackage ./shell.nix {
inherit source;
inherit (gomod2nix.legacyPackages.${system}) mkGoEnv gomod2nix; inherit (gomod2nix.legacyPackages.${system}) mkGoEnv gomod2nix;
}; };
}) })

View file

@ -1,4 +1,6 @@
{ pkgs ? ( {
source,
pkgs ? (
let let
inherit (builtins) fetchTree fromJSON readFile; inherit (builtins) fetchTree fromJSON readFile;
inherit ((fromJSON (readFile ./flake.lock)).nodes) nixpkgs gomod2nix; inherit ((fromJSON (readFile ./flake.lock)).nodes) nixpkgs gomod2nix;
@ -8,17 +10,17 @@
(import "${fetchTree gomod2nix.locked}/overlay.nix") (import "${fetchTree gomod2nix.locked}/overlay.nix")
]; ];
} }
) ),
, mkGoEnv ? pkgs.mkGoEnv mkGoEnv ? pkgs.mkGoEnv,
, gomod2nix ? pkgs.gomod2nix gomod2nix ? pkgs.gomod2nix,
}: }: let
update_gomod2nix = pkgs.writeShellScriptBin "update_gomod2nix" ''
let ${gomod2nix}/bin/gomod2nix --dir ${source} --outdir ./
goEnv = mkGoEnv { pwd = ./.; }; '';
in in
pkgs.mkShell { pkgs.mkShell {
packages = [ packages = [
goEnv
gomod2nix gomod2nix
update_gomod2nix
]; ];
} }