Skip to content

Commit

Permalink
macos nix build support
Browse files Browse the repository at this point in the history
  • Loading branch information
emilytrau committed Aug 25, 2021
1 parent 3a194bc commit 4c17094
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/windows_package_create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
with:
name: melbournehighschoolrobotics
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'


- run: nix build --print-build-logs ".#unix"
- run: nix build --print-build-logs ".#windows"
- run: nix flake check

- uses: actions/upload-artifact@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ To build installers for Windows:
nix build ".#windows"
To build for Linux:
To build for Linux and macOS:

.. code-block:: bash
nix build ".#linux"
nix build ".#unix"
7 changes: 6 additions & 1 deletion ev3sim/file_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def find_platform_location(dir_type):
"""
Attempt to find and create operating system data folders
"""
if platform.system() == "Linux":
p = platform.system()
if p == "Linux":
home_dir = os.path.expanduser("~")
if dir_type == "config":
xdg_dir = os.environ.get("XDG_CONFIG_HOME") or os.path.join(home_dir, ".config")
Expand All @@ -22,6 +23,10 @@ def find_platform_location(dir_type):
ev3sim_dir = os.path.join(xdg_dir, "ev3sim")
Path(ev3sim_dir).mkdir(parents=True, exist_ok=True)
return ev3sim_dir
elif p == "Darwin":
directory = os.path.expanduser("~/Library/Application Support/ev3sim/" + dir_type)
Path(directory).mkdir(parents=True, exist_ok=True)
return directory
return None


Expand Down
12 changes: 6 additions & 6 deletions flake.lock

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

6 changes: 3 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
inputs.mindpile.inputs.flake-utils.follows = "flake-utils";

outputs = { nixpkgs, flake-utils, mindpile, ... }:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
flake-utils.lib.eachSystem [ "x86_64-linux" "x86_64-darwin" ] (system:
let
pkgs = nixpkgs.legacyPackages.${system};
mp = mindpile.legacyPackages.${system};
in rec {
packages = {
linux = pkgs.callPackage ./nix/linux.nix {
unix = pkgs.callPackage ./nix/unix.nix {
inherit (mp) mindpile;
};

windows = pkgs.callPackage ./nix/windows-installer.nix { };
};
defaultPackage = packages.linux;
defaultPackage = packages.unix;
});
}
File renamed without changes.

0 comments on commit 4c17094

Please sign in to comment.