Skip to content

Commit

Permalink
v0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoog committed Oct 13, 2023
1 parent 596e4ff commit 87b95ae
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 29 deletions.
25 changes: 25 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{ npm2nix, runCommand, nodejs, zip, unzip, sqls }:
npm2nix.v2.build {
src = runCommand "src-with-sqls" { } ''
mkdir $out
cp -r ${./.}/* $out
cp -r ${sqls}/bin $out/sqls_bin
'';
inherit nodejs;
buildCommands = [ "npm run build" ];
buildInputs = [ zip unzip ];
installPhase = ''
# vsce errors when modtime of zipped files are > present
new_modtime="0101120000" # MMDDhhmmYY (just needs to be fixed and < present)
mkdir ./tmp
unzip -q ./*.vsix -d ./tmp
for file in $(find ./tmp/ -type f); do
touch -m "$new_modtime" "$file"
touch -t "$new_modtime" "$file"
done
cd ./tmp
zip -q -r $out .
'';
}
33 changes: 5 additions & 28 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
let
pkgs = nixpkgs.legacyPackages.${system};
npm2nix = import npmlock2nix { inherit pkgs; };
sqls = { arch, os }: with pkgs; (buildGoModule {
buildSqls = { arch, os }: with pkgs; (buildGoModule {
name = "sqls_${arch}_${os}";
src = fetchFromGitHub {
owner = "cmoog";
Expand All @@ -32,41 +32,18 @@
(arch:
# skip this invalid os/arch combination
if arch == "386" && os == "darwin" then "" else
"cp $(find ${sqls { inherit os arch; }} -type f) $out/bin/sqls_${arch}_${os}"
"cp $(find ${buildSqls { inherit os arch; }} -type f) $out/bin/sqls_${arch}_${os}"
) [ "amd64" "arm64" "386" ])) [ "linux" "darwin" "windows" ]));
sqlsBins = pkgs.runCommand "multiarch-sqls" { } ''
sqls = pkgs.runCommand "multiarch-sqls" { } ''
mkdir -p $out/bin
${sqlsInstallCommands}
'';
in
{
formatter = pkgs.nixpkgs-fmt;
packages = {
inherit sqlsBins;
default = npm2nix.v2.build {
src = pkgs.runCommand "src-with-sqls" { } ''
mkdir $out
cp -r ${./.}/* $out
cp -r ${sqlsBins}/bin $out/sqls_bin
'';
nodejs = pkgs.nodejs;
buildCommands = [ "npm run build" ];
buildInputs = with pkgs; [ zip unzip ];
installPhase = ''
# vsce errors when modtime of zipped files are > present
new_modtime="0101120000" # MMDDhhmmYY (just needs to be fixed and < present)
mkdir ./tmp
unzip -q ./*.vsix -d ./tmp
for file in $(find ./tmp/ -type f); do
touch -m "$new_modtime" "$file"
touch -t "$new_modtime" "$file"
done
cd ./tmp
zip -q -r $out .
'';
};
inherit sqls;
default = pkgs.callPackage ./. { inherit sqls npm2nix; };
};
devShells.default = pkgs.mkShell {
packages = with pkgs; [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"repository": {
"url": "https://github.com/cmoog/vscode-sql-notebook"
},
"version": "0.6.1",
"version": "0.7.0",
"preview": false,
"engines": {
"vscode": "^1.59.0"
Expand Down

0 comments on commit 87b95ae

Please sign in to comment.