title: Using nix to build a container with a git checkout
body: <p>I want to build a nix container that includes both nix packages and just the source from a github repository. I've been looking through a lot of documentation, but am pretty confused about the right syntax to use, or actual API docs for what some of these functions do. I've ended up with the following:</p>
  <pre><code>let
    pkgs = import (fetchTarball &quot;https://github.com/NixOS/nixpkgs/archive/15493135c0af2e5562500ab5225f2bd75b38af09.tar.gz&quot;);
  
    certbot_dns_namecom = fetchGit {
      url = &quot;https://github.com/laonan/certbot-dns-name-com.git&quot;;
      ref = &quot;master&quot;;
      rev = &quot;cdb98b67e873ee26c9b70593dae23aa19c0df60b&quot;;
    };
  in rec {
  
    docker = pkgs.dockerTools.buildImage {
      name = &quot;certbot-namedns&quot;;
      contents = [ pkgs.certbot certbot_dns_namecom ];
      config = {
        Cmd = [ &quot;/bin/sh&quot; ];
      };
    };
  }
  </code></pre>
  <p>Which gives me the error <code>error: value is a function while a set was expected</code> on the line where <code>docker = pkgs.dockerTools.buildImage</code>.</p>
  <p>I'm not even trying to build what's in the git repo, although the repo does contain debian package build information. Is it possible with Nix to checkout the git repo at a certain revision, build the debian package using the repo's <code>pkg-src</code>, and then have that available within the nix container? How would that be written?</p>