Skip to content

Commit

Permalink
feat: add flake
Browse files Browse the repository at this point in the history
  • Loading branch information
ahkohd committed Dec 23, 2024
1 parent e7503c9 commit b9eecc6
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ dist-ssr
*.njsproj
*.sln
*.sw?

.direnv/*
58 changes: 58 additions & 0 deletions flake.lock

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

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

outputs = { self, nixpkgs, rust-overlay }:
let
overlays = [ rust-overlay.overlays.default ];

pkgs = import nixpkgs {
system = "aarch64-darwin";
inherit overlays;
};
pkgsX86 = import nixpkgs {
system = "x86_64-darwin";
inherit overlays;
};

rustToolchainExtensions = [ "rust-src" "rust-analyzer" "clippy" ];
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
targets = [ "aarch64-apple-darwin" ];
extensions = rustToolchainExtensions;
};
rustToolchainX86 = pkgsX86.rust-bin.stable.latest.default.override {
targets = [ "x86_64-apple-darwin" ];
extensions = rustToolchainExtensions;
};

buildInputs = p: with p; [ apple-sdk_12 ];

commonPackages = p: with p; [ cargo-tauri nodejs_22 corepack_22 bacon ];

in {
devShells = {
aarch64-darwin.default = pkgs.mkShellNoCC {
buildInputs = buildInputs pkgs;
packages = [ rustToolchain ] ++ (commonPackages pkgs);
shellHook = ''
echo "=== 🛠️ DEV SHELL (APPLE SILICON) ==="
'';
};
x86_64-darwin.default = pkgsX86.mkShellNoCC {
buildInputs = buildInputs pkgsX86;
packages = [ rustToolchainX86 ] ++ (commonPackages pkgsX86);
shellHook = ''
echo "=== 🛠️ DEV SHELL (APPLE ROSETTA) ==="
'';
};
};
};
}

0 comments on commit b9eecc6

Please sign in to comment.