use nix to build docker images
1 file changed, 15 insertions(+), 18 deletions(-)
changed files
M flake.nix → flake.nix
@@ -12,37 +12,34 @@ inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-utils.follows = "utils"; }; - outputs = { nixpkgs, utils, gomod2nix, ... }: + outputs = { self, nixpkgs, utils, gomod2nix, ... }: utils.lib.eachDefaultSystem (system: let - pkgs = nixpkgs.legacyPackages.${system}; - nativeBuildInputs = with pkgs; [ - git - go - ]; + pkgs = import nixpkgs { + inherit system; + overlays = [ gomod2nix.overlays.default ]; + }; + nativeBuildInputs = with pkgs; [ go ]; + packages = import ./nix/default.nix { + inherit pkgs self; + }; in - rec { + { + inherit packages; devShells = { default = pkgs.mkShell { packages = with pkgs; [ gopls gotools go-tools - go-licenses gomod2nix.packages.${system}.default gci flyctl - (writeShellScriptBin "watch-builder" '' - ${pkgs.watchexec}/bin/watchexec -r -w flake.nix --shell fish "direnv exec . watchexec -i server.go -i public -r go run ./cmd/build $@" - '') - (writeShellScriptBin "watch-server" '' - ${pkgs.watchexec}/bin/watchexec -r -w flake.nix --shell fish "direnv exec . watchexec -r go run ./server.go $@" - '') - (writeShellScriptBin "check-licenses" '' - ${pkgs.go-licenses}/bin/go-licenses check --include_tests ./... --disallowed_types=restricted,forbidden - '') - ] ++ nativeBuildInputs; + ] + ++ (import ./nix/scripts.nix { + inherit pkgs; + }); }; }; });