Commit 8710aa0a authored by Thiago Kenji Okada's avatar Thiago Kenji Okada
Browse files

nixos-option: use `git rev-parse --show-toplevel` to check for Git repo

parent f2d7d55c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -74,7 +74,9 @@ if [[ -n "$flake" ]]; then
  fi
  # Unlike nix cli, builtins.getFlake infer path:// when a path is given
  # See https://github.com/NixOS/nix/issues/5836
  if [[ -d "$flake" ]] && [[ -e "$flake/.git" ]] ; then
  # Using `git rev-parse --show-toplevel` since we can't assume the flake dir
  # itself is a git repo, because the flake could be in a sub directory
  if [[ -d "$flake" ]] && git -C "$flake" rev-parse --show-toplevel &>/dev/null; then
    flake="git+file://$(realpath "$flake")"
  fi
  if [[ -z "${flakeAttr:-}" ]]; then
+2 −0
Original line number Diff line number Diff line
{
  lib,
  coreutils,
  git,
  installShellFiles,
  jq,
  makeWrapper,
@@ -56,6 +57,7 @@ stdenvNoCC.mkDerivation {
      --prefix PATH : ${
        lib.makeBinPath [
          coreutils
          git
          jq
          man-db
          nix