mirror of
https://github.com/tweag/gomod2nix.git
synced 2024-11-09 12:09:08 +00:00
Align flake template with recent API changes and improvements
This commit is contained in:
parent
86ee592eb2
commit
759483247e
3 changed files with 32 additions and 14 deletions
10
shell.nix
10
shell.nix
|
@ -1,14 +1,8 @@
|
||||||
{ pkgs ? (
|
{ pkgs ? (
|
||||||
let
|
let
|
||||||
inherit (builtins) fromJSON readFile;
|
inherit (builtins) fetchTree fromJSON readFile;
|
||||||
flakeLock = fromJSON (readFile ./flake.lock);
|
|
||||||
locked = flakeLock.nodes.nixpkgs.locked;
|
|
||||||
nixpkgs = assert locked.type == "github"; builtins.fetchTarball {
|
|
||||||
url = "https://github.com/${locked.owner}/${locked.repo}/archive/${locked.rev}.tar.gz";
|
|
||||||
sha256 = locked.narHash;
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
import nixpkgs {
|
import (fetchTree (fromJSON (readFile ./flake.lock)).nodes.nixpkgs.locked) {
|
||||||
overlays = [
|
overlays = [
|
||||||
(import ./overlay.nix)
|
(import ./overlay.nix)
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,10 +1,20 @@
|
||||||
{ buildGoApplication, go, lib }:
|
{ pkgs ? (
|
||||||
|
let
|
||||||
|
inherit (builtins) fetchTree fromJSON readFile;
|
||||||
|
inherit ((fromJSON (readFile ./flake.lock)).nodes) nixpkgs gomod2nix;
|
||||||
|
in
|
||||||
|
import (fetchTree nixpkgs.locked) {
|
||||||
|
overlays = [
|
||||||
|
(import "${fetchTree gomod2nix.locked}/overlay.nix")
|
||||||
|
];
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}:
|
||||||
|
|
||||||
buildGoApplication {
|
pkgs.buildGoApplication {
|
||||||
inherit go;
|
|
||||||
pname = "myapp";
|
pname = "myapp";
|
||||||
version = "0.1";
|
version = "0.1";
|
||||||
|
pwd = ./.;
|
||||||
src = ./.;
|
src = ./.;
|
||||||
modules = ./gomod2nix.toml;
|
modules = ./gomod2nix.toml;
|
||||||
subPackages = [ "." ];
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,22 @@
|
||||||
{ pkgs ? import <nixpkgs> { } }:
|
{ pkgs ? (
|
||||||
|
let
|
||||||
|
inherit (builtins) fetchTree fromJSON readFile;
|
||||||
|
inherit ((fromJSON (readFile ./flake.lock)).nodes) nixpkgs gomod2nix;
|
||||||
|
in
|
||||||
|
import (fetchTree nixpkgs.locked) {
|
||||||
|
overlays = [
|
||||||
|
(import "${fetchTree gomod2nix.locked}/overlay.nix")
|
||||||
|
];
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
goEnv = pkgs.mkGoEnv { pwd = ./.; };
|
||||||
|
in
|
||||||
pkgs.mkShell {
|
pkgs.mkShell {
|
||||||
packages = [
|
packages = [
|
||||||
pkgs.go
|
goEnv
|
||||||
pkgs.gomod2nix
|
pkgs.gomod2nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue