~ruther/nix-fpga

nix-fpga/pkgs/final-pkg-generator.nix -rw-r--r-- 598 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
{ lib, stdenv, customInstallScript ? "", fhsEnv ? "", executables ? "", mainProgram ? "" }:

let
  genScript = file: ''
    #!/usr/bin/env bash
    exec ${lib.getExe fhsEnv} ${file} \"\$@\"
  '';

  createScript = file: ''
   echo "${genScript file}" > $out/bin/${file}
   chmod +x $out/bin/${file}
  '';

  createScripts = map (file: createScript file) executables;

in stdenv.mkDerivation {
  name = mainProgram;

  installPhase = ''
    mkdir -p $out/bin
  '' + customInstallScript + (lib.concatStrings createScripts);

  phases = [ "installPhase" ];

  meta = {
    inherit mainProgram;
  };
}
Do not follow this link