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";
};
outputs = { self, nixpkgs, zephyr-nix, ... }: let
# Set your system ("x86_64-linux", "aarch64-linux", "x86_64-darwin", or "aarch64-darwin")
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
zephyr = zephyr-nix.packages.${system};
outputs = { nixpkgs, zephyr-nix, ... }: let
forAllSystems = nixpkgs.lib.genAttrs ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
in {
devShells.${system}.default = pkgs.mkShell {
packages = [
# zephyr.hosttools-nix
# (zephyr.pythonEnv.override {extraPackages = pkgs: [pkgs.pyyaml];})
zephyr.pythonEnv
zephyr.sdkFull
pkgs.cmake
pkgs.dtc
pkgs.just
pkgs.ninja
pkgs.yq
];
};
devShells = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
zephyr = zephyr-nix.packages.${system};
in {
default = pkgs.mkShell {
packages = [
# zephyr.hosttools-nix
# (zephyr.pythonEnv.override {extraPackages = pkgs: [pkgs.pyyaml];})
zephyr.pythonEnv
zephyr.sdkFull
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
```
2. If on `macOS`, edit `flake.nix` and replace `system = "x86_64-linux` with
`"x86_64-darwin"` (Intel processor) or `"aarch64-darwin"` (Apple silicon).
3. Enter the workspace and set up the environment.
2. Enter the workspace and set up the environment.
```bash
# This automatically sets up and activates a virtual shell with the Zephyr toolchain.