From a6570d33a6e48af069c4c8c9d08da55bf660872f Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Mon, 7 Mar 2022 17:18:41 +0000 Subject: [PATCH] Add option to build docker image This commit adds dockerbuild to flakes.nix: ``` nix build .#headscale-docker ``` This uses the Nix infra to build and _does not_ use Dockerfile. It currently works on Linux (no macOS) --- flake.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/flake.nix b/flake.nix index a839431e..8b81a401 100644 --- a/flake.nix +++ b/flake.nix @@ -84,6 +84,16 @@ buf clang-tools # clang-format ]; + + + # Add entry to build a docker image with headscale + # caveat: only works on Linux + headscale-docker = pkgs.dockerTools.buildLayeredImage { + name = "headscale"; + tag = "latest"; + contents = [ pkgs.${system}.headscale ]; + config.Entrypoint = [ (pkgs.${system}.headscale + "/bin/headscale") ]; + }; in rec { # `nix develop` @@ -92,6 +102,8 @@ # `nix build` packages = with pkgs; { inherit headscale; + inherit headscale-docker; + }; defaultPackage = pkgs.headscale; @@ -101,5 +113,6 @@ }; defaultApp = apps.headscale; + }); }