Detect system automatically

This commit is contained in:
urob 2024-08-12 09:44:55 -04:00
parent d20d53d700
commit c52a249720
2 changed files with 21 additions and 22 deletions

View file

@ -13,24 +13,26 @@
zephyr-nix.inputs.zephyr.follows = "zephyr"; zephyr-nix.inputs.zephyr.follows = "zephyr";
}; };
outputs = { self, nixpkgs, zephyr-nix, ... }: let outputs = { nixpkgs, zephyr-nix, ... }: let
# Set your system ("x86_64-linux", "aarch64-linux", "x86_64-darwin", or "aarch64-darwin") forAllSystems = nixpkgs.lib.genAttrs ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
zephyr = zephyr-nix.packages.${system};
in { in {
devShells.${system}.default = pkgs.mkShell { devShells = forAllSystems (system: let
packages = [ pkgs = nixpkgs.legacyPackages.${system};
# zephyr.hosttools-nix zephyr = zephyr-nix.packages.${system};
# (zephyr.pythonEnv.override {extraPackages = pkgs: [pkgs.pyyaml];}) in {
zephyr.pythonEnv default = pkgs.mkShell {
zephyr.sdkFull packages = [
pkgs.cmake # zephyr.hosttools-nix
pkgs.dtc # (zephyr.pythonEnv.override {extraPackages = pkgs: [pkgs.pyyaml];})
pkgs.just zephyr.pythonEnv
pkgs.ninja zephyr.sdkFull
pkgs.yq pkgs.cmake
]; pkgs.dtc
}; pkgs.just
pkgs.ninja
pkgs.yq
];
};
});
}; };
} }

View file

@ -313,10 +313,7 @@ environment is _completely isolated_ and won't pollute your system.
git clone https://github.com/urob/zmk-config zmk-workspace git clone https://github.com/urob/zmk-config zmk-workspace
``` ```
2. If on `macOS`, edit `flake.nix` and replace `system = "x86_64-linux` with 2. Enter the workspace and set up the environment.
`"x86_64-darwin"` (Intel processor) or `"aarch64-darwin"` (Apple silicon).
3. Enter the workspace and set up the environment.
```bash ```bash
# This automatically sets up and activates a virtual shell with the Zephyr toolchain. # This automatically sets up and activates a virtual shell with the Zephyr toolchain.