Skip to content

Commit

Permalink
Merge branch 'main' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
guillemcordoba committed Sep 23, 2024
2 parents 51a8984 + 350abac commit 9d0321e
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 98 deletions.
4 changes: 2 additions & 2 deletions crates/compare_dnas_integrity/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
buildInputs = self.lib.holochainDeps { inherit pkgs lib; };
};
cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {
pname = "workspace";
version = "workspace";
pname = "t-nesh-workspace";
version = "0.3.x";
});
in craneLib.buildPackage (commonArgs // {
pname = crate;
Expand Down
4 changes: 2 additions & 2 deletions crates/scaffold_remote_zome/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
buildInputs = self.lib.holochainDeps { inherit pkgs lib; };
};
cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {
pname = "workspace";
version = "workspace";
pname = "t-nesh-workspace";
version = "0.3.x";
});
in craneLib.buildPackage (commonArgs // {
pname = crate;
Expand Down
31 changes: 31 additions & 0 deletions crates/sync_npm_git_dependencies_with_nix/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{ inputs, self, ... }:

{
perSystem = { inputs', pkgs, self', lib, ... }: {

packages.sync-npm-git-dependencies-with-nix = let
craneLib = inputs.crane.mkLib pkgs;

cratePath = ./.;

cargoToml =
builtins.fromTOML (builtins.readFile "${cratePath}/Cargo.toml");
crate = cargoToml.package.name;

commonArgs = {
src = craneLib.cleanCargoSource (craneLib.path ../../.);
doCheck = false;
buildInputs = self.lib.holochainDeps { inherit pkgs lib; };
};
cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {
pname = "t-nesh-workspace";
version = "0.3.x";
});
in craneLib.buildPackage (commonArgs // {
pname = crate;
version = cargoToml.package.version;
inherit cargoArtifacts;
});
};
}

4 changes: 2 additions & 2 deletions crates/zome_wasm_hash/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
buildInputs = self.lib.holochainDeps { inherit pkgs lib; };
};
cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {
pname = "workspace";
version = "workspace";
pname = "t-nesh-workspace";
version = "0.3.x";
});
in craneLib.buildPackage (commonArgs // {
pname = crate;
Expand Down
117 changes: 33 additions & 84 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ rec {
]);

zomeCargoArtifacts = { system, craneLib ? (let

pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ (import inputs.rust-overlay) ];
Expand Down Expand Up @@ -163,11 +162,12 @@ rec {
./crates/compare_dnas_integrity/default.nix
./crates/zome_wasm_hash/default.nix
./crates/dna_hash/default.nix
./crates/sync_npm_git_dependencies_with_nix/default.nix
];

systems = builtins.attrNames inputs.holonix.devShells;

perSystem = { inputs', config, pkgs, system, lib, ... }: rec {
perSystem = { inputs', self', config, pkgs, system, lib, ... }: rec {
devShells.default = pkgs.mkShell {
inputsFrom = [ inputs'.holonix.devShells.default ];
packages = with pkgs;
Expand All @@ -181,105 +181,54 @@ rec {
buildInputs = flake.lib.holochainDeps { inherit pkgs lib; };
};

packages.npm-warning = pkgs.writeShellScriptBin "echo-npm-warning" ''
echo "
-----------------
packages.synchronized-pnpm = pkgs.symlinkJoin {
name = "synchronized-pnpm";
paths = [ inputs'.pnpmnixpkgs.legacyPackages.pnpm ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/pnpm --run ${self'.packages.sync-npm-git-dependencies-with-nix}/bin/sync-npm-git-dependencies-with-nix
'';
};

WARNING: this repository is not managed with npm, but pnpm.
devShells.synchronized-pnpm = pkgs.mkShell {
packages = let
npm-warning = pkgs.writeShellScriptBin "echo-npm-warning" ''
echo "
-----------------
Don't worry! They are really similar to each other. Here are some helpful reminders:
If you are trying to run \`npm install\`, you can run \`pnpm install\`
If you are trying to run \`npm install some_dependency\`, you can run \`pnpm add some_dependency\`
If you are trying to run a script like \`npm run build\`, you can run \`pnpm build\`
If you are trying to run a script for a certain workspace like \`npm run build -w ui\`, you can run \`pnpm -F ui build\`
WARNING: this repository is not managed with npm, but pnpm.
The npm command that you just ran will continue now, but it is recommended that you do all commands in this repository with pnpm.
Don't worry! They are really similar to each other. Here are some helpful reminders:
If you are trying to run \`npm install\`, you can run \`pnpm install\`
If you are trying to run \`npm install some_dependency\`, you can run \`pnpm add some_dependency\`
If you are trying to run a script like \`npm run build\`, you can run \`pnpm build\`
If you are trying to run a script for a certain workspace like \`npm run build -w ui\`, you can run \`pnpm -F ui build\`
-----------------
The npm command that you just ran will continue now, but it is recommended that you do all commands in this repository with pnpm.
"
'';
-----------------
devShells.synchronized-pnpm = pkgs.mkShell {
packages = [
(pkgs.symlinkJoin {
"
'';
npm-with-warning = pkgs.symlinkJoin {
name = "npm";
paths = [ pkgs.nodejs_20 ];
buildInputs = [ pkgs.makeWrapper ];
postBuild =
" wrapProgram $out/bin/npm \\\n --run ${packages.npm-warning}/bin/echo-npm-warning\n ";
})
" wrapProgram $out/bin/npm \\\n --run ${npm-warning}/bin/echo-npm-warning\n ";
};
in [
npm-with-warning
pkgs.nodejs_20
inputs'.pnpmnixpkgs.legacyPackages.pnpm
packages.sync-npm-git-dependencies-with-nix
packages.synchronized-pnpm
self'.packages.sync-npm-git-dependencies-with-nix
];

shellHook = ''
sync-npm-git-dependencies-with-nix
'';
};

# devShells.zomeDev = let
# configureCargoVendoredDepsHook =
# pkgs.writeShellScriptBin "configureCargoVendoredDeps"
# (builtins.readFile ./nix/configureCargoVendoredDepsHook.sh);
# inheritCargoArtifacts =
# pkgs.writeShellScriptBin "inheritCargoArtifacts"
# (builtins.readFile ./nix/inheritCargoArtifacts.sh);
# craneLib = flake.lib.holochainCraneLib { inherit system; };
# zomeDeps = flake.lib.zomeCargoDeps { inherit craneLib; };
# in pkgs.mkShell {
# packages = [ configureCargoVendoredDepsHook inheritCargoArtifacts ];

# shellHook = ''
# cargoVendorDir=${zomeDeps.cargoVendorDir} configureCargoVendoredDeps
# cargoArtifacts=${zomeDeps.cargoArtifacts} inheritCargoArtifacts
# '';
# };

# devShells.sweettestDev = let
# configureCargoVendoredDepsHook =
# pkgs.writeShellScriptBin "configureCargoVendoredDeps"
# (builtins.readFile ./nix/configureCargoVendoredDepsHook.sh);
# inheritCargoArtifacts =
# pkgs.writeShellScriptBin "inheritCargoArtifacts"
# (builtins.readFile ./nix/inheritCargoArtifacts.sh);
# craneLib = flake.lib.holochainCraneLib { inherit system; };
# holochainDeps =
# pkgs.callPackage flake.lib.holochainCargoDeps { inherit craneLib; };
# in pkgs.mkShell {
# packages = [ configureCargoVendoredDepsHook inheritCargoArtifacts ];

# shellHook = ''
# cargoVendorDir=${holochainDeps.cargoVendorDir} configureCargoVendoredDeps
# cargoArtifacts=${holochainDeps.cargoArtifacts} inheritCargoArtifacts
# '';
# };

packages.sync-npm-git-dependencies-with-nix = let
craneLib = inputs.crane.mkLib pkgs;

cratePath = ./crates/sync_npm_git_dependencies_with_nix;

cargoToml =
builtins.fromTOML (builtins.readFile "${cratePath}/Cargo.toml");
crate = cargoToml.package.name;

commonArgs = {
src = craneLib.cleanCargoSource (craneLib.path ./.);
doCheck = false;
buildInputs = flake.lib.holochainDeps { inherit pkgs lib; };
};
cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {
pname = "workspace";
version = "workspace";
});
in craneLib.buildPackage (commonArgs // {
pname = crate;
version = cargoToml.package.version;
inherit cargoArtifacts;
});
};
};
}
6 changes: 3 additions & 3 deletions nix/fixtures/app-repo/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nix/fixtures/module-repo/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions nix/fixtures/service-repo/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions nix/reference-happ/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9d0321e

Please sign in to comment.