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 ? (
|
||||
let
|
||||
inherit (builtins) 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;
|
||||
};
|
||||
inherit (builtins) fetchTree fromJSON readFile;
|
||||
in
|
||||
import nixpkgs {
|
||||
import (fetchTree (fromJSON (readFile ./flake.lock)).nodes.nixpkgs.locked) {
|
||||
overlays = [
|
||||
(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 {
|
||||
inherit go;
|
||||
pkgs.buildGoApplication {
|
||||
pname = "myapp";
|
||||
version = "0.1";
|
||||
pwd = ./.;
|
||||
src = ./.;
|
||||
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 {
|
||||
packages = [
|
||||
pkgs.go
|
||||
goEnv
|
||||
pkgs.gomod2nix
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue