~ruther/nix-fpga

nix-fpga/pkgs/common.nix -rw-r--r-- 878 bytes
0a072151 — Rutherther feat: add vitis 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{ lib, pkgs, ... }:

{
  runScriptPrefix = package: required: ''
    # Search for an imperative declaration of the installation directory of ${package}
    error=0
    if [[ -f ~/.config/${package}/nix.sh ]]; then
      source ~/.config/${package}/nix.sh

    '' +

    lib.optionalString required ''
    else
      echo "nix-${package}-error: Did not find ~/.config/${package}/nix.sh" >&2
      error=1
    fi
    '' +

    lib.optionalString (!required) ''
    else
      echo "nix-${package}-warn: Did not find ~/.config/${package}/nix.sh"
    fi
    '' +

    ''
    if [[ ! -z "$INSTALL_DIR" && ! -d "$INSTALL_DIR" ]]; then
      echo "nix-${package}-error: INSTALL_DIR $INSTALL_DIR isn't a directory" >&2
      error=2
  '' + ''
    fi

    if [[ $error -ne 0 ]]; then
      exit $error
    fi
  '';

  finalPkgGenerator = pkgs.callPackage ./final-pkg-generator.nix {};
}
Do not follow this link