Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions flake.lock

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

41 changes: 41 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
};

outputs = {
self,
nixpkgs,
rust-overlay,
}: let
system = "aarch64-darwin";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also consider using flake-utils like we do in motoko to support all common systems.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, gonna cross-study. I am at present just copying the ggreif/sdk flake recipe!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't get nix develop working yet! Any idea what I am getting wrong?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You correctly added a devShells.${system}.default so that''s good. What error are you getting?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also seems you're using pkgs.mkShell correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ nix develop
error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37|   strict = derivationStrict drvAttrs;
             |            ^
           38|

       … while evaluating derivation 'nix-shell'
         whose name attribute is located at /nix/store/x9wnkly3k1gkq580m90jjn32q9f05q2v-source/pkgs/stdenv/generic/make-derivation.nix:439:13

       … while evaluating attribute '__impureHostDeps' of derivation 'nix-shell'
         at /nix/store/x9wnkly3k1gkq580m90jjn32q9f05q2v-source/pkgs/stdenv/generic/make-derivation.nix:579:15:
          578|               );
          579|               __impureHostDeps =
             |               ^
          580|                 computedImpureHostDeps

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: opening file '/nix/store/jwjajnviyim6mzpsbdwin496gv88x04b-source/rust-toolchain.toml': No such file or directory

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this dev-dependency needs to be declared?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It means you didn't add rust-toolchain.toml to git.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, there is no such file. Maybe later. Kind-of negates devShell, but no biggie.

pkgs = import nixpkgs {
inherit system;
overlays = [rust-overlay.overlays.default];
};
#toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
manifest = (pkgs.lib.importTOML ./Cargo.toml).package;
in {
devShells.${system}.default = pkgs.mkShell {
packages = [
#toolchain
];

nativeBuildInputs = [
#pkgs.clang_19
#pkgs.cmake
];

CXXFLAGS_aarch64_apple_darwin = "--target=aarch64-apple-darwin";

};

packages.${system}.default = pkgs.rustPlatform.buildRustPackage rec {
pname = manifest.name;
inherit (manifest) version;
cargoLock.lockFile = ./Cargo.lock;
src = pkgs.lib.cleanSource ./.;
};
};
}
Loading