-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlicense.nix
More file actions
58 lines (49 loc) · 1.18 KB
/
license.nix
File metadata and controls
58 lines (49 loc) · 1.18 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{ pkgs }:
let
name = "license";
version = "0.0.1";
description = "Manage and validate license headers in source files";
in
pkgs.stdenvNoCC.mkDerivation {
pname = name;
inherit version;
src = ./.;
dontBuild = true;
doCheck = false;
nativeBuildInputs = with pkgs; [
makeWrapper
];
buildInputs = with pkgs; [
python3
git
addlicense
];
installPhase = ''
mkdir -p $out/bin
mkdir -p $out/share/license/config
# Copy the main script
cp scripts/license.py $out/bin/${name}
chmod +x $out/bin/${name}
# Copy shared configuration files
if [ -d shared ]; then
find shared -maxdepth 1 -type f -exec cp {} $out/share/license/config/ \;
fi
# Wrap the script to ensure all dependencies are in PATH and set config path
wrapProgram $out/bin/${name} \
--prefix PATH : ${
pkgs.lib.makeBinPath [
pkgs.python3
pkgs.git
pkgs.addlicense
]
} \
--set LICENSE_CONFIG_DIR "$out/share/license/config"
runHook postInstall
'';
meta = with pkgs.lib; {
inherit description;
platforms = platforms.unix;
maintainers = [ ];
license = licenses.mit;
};
}