From 30e4cb4e4af3a6eebd3b4fb431828d284a72a10a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 19 Apr 2024 16:11:33 +0200 Subject: use nix to build docker images --- flake.nix | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 4d78ce1..78a2c53 100644 --- a/flake.nix +++ b/flake.nix @@ -12,37 +12,34 @@ 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; + }); }; }; }); -- cgit 1.4.1