diff --git a/flake.lock b/flake.lock index 4449ae6..48aaa8d 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,28 @@ { "nodes": { + "devshell": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1678957337, + "narHash": "sha256-Gw4nVbuKRdTwPngeOZQOzH/IFowmz4LryMPDiJN/ah4=", + "owner": "numtide", + "repo": "devshell", + "rev": "3e0e60ab37cd0bf7ab59888f5c32499d851edb47", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -71,6 +94,7 @@ }, "root": { "inputs": { + "devshell": "devshell", "flake-utils": "flake-utils", "gomod2nix": "gomod2nix", "nixpkgs": "nixpkgs_2" diff --git a/flake.nix b/flake.nix index 6984bd5..603f1d1 100644 --- a/flake.nix +++ b/flake.nix @@ -5,21 +5,33 @@ nixpkgs.url = "github:NixOS/nixpkgs/release-22.11"; flake-utils.url = "github:numtide/flake-utils"; gomod2nix.url = "github:nix-community/gomod2nix"; + devshell = { + url = "github:numtide/devshell"; + inputs.flake-utils.follows = "flake-utils"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { self, nixpkgs, flake-utils, gomod2nix }: + outputs = { self, nixpkgs, flake-utils, gomod2nix, devshell }: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; - overlays = [ gomod2nix.overlays.default ]; + overlays = [ gomod2nix.overlays.default devshell.overlays.default ]; }; in { - devShells.default = pkgs.mkShell { + devShells.default = pkgs.devshell.mkShell { packages = with pkgs; [ go gotools golangci-lint gopls gopkgs go-outline gomod2nix.packages.${system}.default ]; + commands = [ + { + name = "update-gomod2nix"; + help = "update gomod2nix.toml"; + command = "gomod2nix"; + } + ]; }; packages = rec { default = pkgs.buildGoApplication {