~ruther/nix-fpga

ref: 657f7298a01b67041204aea5496e1947a76e64c7 nix-fpga/pkgs/final-pkg-generator.nix -rw-r--r-- 598 bytes
657f7298 — Rutherther feat: add executables to fhs package, split to individual frameworks 1 year, 19 days 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