-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupgrade.nix
More file actions
65 lines (55 loc) · 1.33 KB
/
upgrade.nix
File metadata and controls
65 lines (55 loc) · 1.33 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
59
60
61
62
63
64
65
{ pkgs }:
let
name = "upgrade";
version = "0.0.1";
description = "Upgrade project dependencies and tools";
in
pkgs.stdenvNoCC.mkDerivation {
pname = name;
inherit version;
src = ./.;
dontBuild = true;
doCheck = false;
dontFixup = false;
phases = [ "unpackPhase" "installPhase" "fixupPhase" ];
nativeBuildInputs = with pkgs; [
makeWrapper
];
buildInputs = with pkgs; [
git
pre-commit
nix
nodePackages.npm
python3
go
];
installPhase = ''
mkdir -p $out/bin
mkdir -p $out/share/upgrade/config
# Copy the main script
cp scripts/${name} $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/upgrade/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.git
pkgs.pre-commit
pkgs.nix
pkgs.nodePackages.npm
pkgs.python3
pkgs.go
]} \
--set UPGRADE_CONFIG_DIR "$out/share/upgrade/config"
runHook postInstall
'';
meta = with pkgs.lib; {
inherit description;
platforms = platforms.unix;
maintainers = [ ];
license = licenses.mit;
};
}