|
14 | 14 | let
|
15 | 15 | pkgs = nixpkgs.legacyPackages.${system};
|
16 | 16 | npm2nix = import npmlock2nix { inherit pkgs; };
|
17 |
| - sqls = { arch, os }: with pkgs; (buildGoModule { |
| 17 | + buildSqls = { arch, os }: with pkgs; (buildGoModule { |
18 | 18 | name = "sqls_${arch}_${os}";
|
19 | 19 | src = fetchFromGitHub {
|
20 | 20 | owner = "cmoog";
|
|
32 | 32 | (arch:
|
33 | 33 | # skip this invalid os/arch combination
|
34 | 34 | if arch == "386" && os == "darwin" then "" else
|
35 |
| - "cp $(find ${sqls { inherit os arch; }} -type f) $out/bin/sqls_${arch}_${os}" |
| 35 | + "cp $(find ${buildSqls { inherit os arch; }} -type f) $out/bin/sqls_${arch}_${os}" |
36 | 36 | ) [ "amd64" "arm64" "386" ])) [ "linux" "darwin" "windows" ]));
|
37 |
| - sqlsBins = pkgs.runCommand "multiarch-sqls" { } '' |
| 37 | + sqls = pkgs.runCommand "multiarch-sqls" { } '' |
38 | 38 | mkdir -p $out/bin
|
39 | 39 | ${sqlsInstallCommands}
|
40 | 40 | '';
|
41 | 41 | in
|
42 | 42 | {
|
43 | 43 | formatter = pkgs.nixpkgs-fmt;
|
44 | 44 | packages = {
|
45 |
| - inherit sqlsBins; |
46 |
| - default = npm2nix.v2.build { |
47 |
| - src = pkgs.runCommand "src-with-sqls" { } '' |
48 |
| - mkdir $out |
49 |
| - cp -r ${./.}/* $out |
50 |
| - cp -r ${sqlsBins}/bin $out/sqls_bin |
51 |
| - ''; |
52 |
| - nodejs = pkgs.nodejs; |
53 |
| - buildCommands = [ "npm run build" ]; |
54 |
| - buildInputs = with pkgs; [ zip unzip ]; |
55 |
| - installPhase = '' |
56 |
| - # vsce errors when modtime of zipped files are > present |
57 |
| - new_modtime="0101120000" # MMDDhhmmYY (just needs to be fixed and < present) |
58 |
| - mkdir ./tmp |
59 |
| - unzip -q ./*.vsix -d ./tmp |
60 |
| -
|
61 |
| - for file in $(find ./tmp/ -type f); do |
62 |
| - touch -m "$new_modtime" "$file" |
63 |
| - touch -t "$new_modtime" "$file" |
64 |
| - done |
65 |
| -
|
66 |
| - cd ./tmp |
67 |
| - zip -q -r $out . |
68 |
| - ''; |
69 |
| - }; |
| 45 | + inherit sqls; |
| 46 | + default = pkgs.callPackage ./. { inherit sqls npm2nix; }; |
70 | 47 | };
|
71 | 48 | devShells.default = pkgs.mkShell {
|
72 | 49 | packages = with pkgs; [
|
|
0 commit comments