diff options
author | Andreas Fuchs | 2020-11-25 00:11:15 -0500 |
---|---|---|
committer | GitHub | 2020-11-24 22:11:15 -0700 |
commit | 42cbe751a860470cc8fd36f9e105566b97b6a2ff (patch) | |
tree | dfa31d91ea6f770efcad087df688ca737aa7507b /flake.nix | |
parent | ed97d54648e5e440017c73d1e111c65f99feb140 (diff) |
Fix running & building under macOS (Big Sur) (#9)
* Add xcbuild as native build input 2 ways & pass --verbose to cargo build
* Make "deploy" build on macOS
* Bump the nixpkgs version to one that ships Rust 1.47, which can
produce binaries under macOS 11 (Big Sur).
* Use darwin-specific options that let Naersk build the "deploy"
binary under macOS. (With a work-around for
https://github.com/nmattia/naersk/issues/127, which prevents this
from being much more straight-forward).
Unfortunately, the "activate" binary can't be built under macOS due to
the inotify dependency; that means the best we can do is to run the
deploy under macOS, not deploy *to* macOS.
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -23,10 +23,20 @@ let pkgs = import nixpkgs { inherit system; }; naersk-lib = pkgs.callPackage naersk { }; + isDarwin = pkgs.lib.strings.hasSuffix "-darwin" system; + darwinOptions = pkgs.lib.optionalAttrs isDarwin { + nativeBuildInputs = [ + pkgs.darwin.apple_sdk.frameworks.SystemConfiguration + ]; + singleStep = true; # https://github.com/nmattia/naersk/issues/127 + cargoBuildOptions = opts: opts ++ [ "--bin" "deploy" ]; # The "activate" binary is linux-only. + }; in { defaultPackage = self.packages."${system}".deploy-rs; - packages.deploy-rs = naersk-lib.buildPackage ./.; + packages.deploy-rs = naersk-lib.buildPackage (darwinOptions // { + root = ./.; + }); defaultApp = self.apps."${system}".deploy-rs; apps.deploy-rs = { @@ -35,9 +45,9 @@ }; devShell = pkgs.mkShell { - inputsFrom = [ self.packages.${system}.deploy-rs ]; - buildInputs = [ pkgs.nixUnstable ]; - }; + inputsFrom = [ self.packages.${system}.deploy-rs ]; + buildInputs = [ pkgs.nixUnstable ]; + }; lib = rec { |