From 6c414bf07de088aa5c85e0965f1016c3caee7e45 Mon Sep 17 00:00:00 2001 From: Valentin Brandl Date: Fri, 20 Mar 2020 17:47:41 +0100 Subject: [PATCH] Build Docker image using nix --- default.nix | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/default.nix b/default.nix index 370f1df..9c40010 100644 --- a/default.nix +++ b/default.nix @@ -27,6 +27,25 @@ let # packageOverrides }; in - (rustPkgs.workspace.hoc {}).overrideAttrs (drv: { +rec { + inherit rustPkgs; + shell = pkgs.mkShell { + inputsFrom = pkgs.lib.mapAttrsToList (_: pkg: pkg { }) rustPkgs.noBuild.workspace; + nativeBuildInputs = with rustPkgs; [ cargo rustc ]; + }; + package = (rustPkgs.workspace.hoc {}).overrideAttrs (drv: { buildInputs = drv.buildInputs or [ ] ++ [ pkgs.git ]; - }) + }); + dockerImage = + pkgs.dockerTools.buildImage { + name = "vbrandl/hits-of-code"; + tag = "1"; + + contents = [ package ]; + + config = { + Cmd = [ "/bin/hoc" ]; + WorkingDir = "/"; + }; + }; +}