Skip to content

Commit

Permalink
adapted M1 patches, vmnet patches, macos sdk 11.0 from thefloweringha…
Browse files Browse the repository at this point in the history
…sh, xattr fixes for p9fs, fix for mkdir in qemu-vm
  • Loading branch information
r2r-dev committed May 16, 2021
1 parent 95b586b commit 1f53a82
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,25 @@ With following changes in place:
- https://github.com/dermetfan/nixos-shell/commit/28ea39e0b76698e7dbd198e9755d7dbc12bf5146
- https://github.com/r2r-dev/nixpkgs/commit/58142a0fa46a3e920cb4e92fcd0420eeec62ae27
- https://github.com/NixOS/nixpkgs/pull/72354
- https://mail.gnu.org/archive/html/qemu-devel/2021-02/msg04637.html
- https://patchwork.kernel.org/project/qemu-devel/patch/[email protected]/
- https://patchwork.kernel.org/project/qemu-devel/list/?series=400619&state=%2A&archive=both
- https://github.com/thefloweringash/nixpkgs/tree/apple-silicon/pkgs/os-specific/darwin/apple-sdk-11.0
- https://github.com/thefloweringash/nixpkgs/blob/apple-silicon/pkgs/os-specific/darwin/rewrite-tbd/default.nix


It is possible to use nixos-shell on darwin host. Word of notice, you will need a remote x86_64-linux builder in order to produce a VM image.

```
# Install nixos-shell from source:
nix-env -i -f .
# Run darwin example:
nixos-shell examples/darwin.nix -- -- --argstr system x86_64-linux -I nixpkgs=http://github.com/r2r-dev/nixpkgs/archive/58142a0fa46a3e920cb4e92fcd0420eeec62ae27.tar.gz
# Build darwin example:
nixos-shell examples/darwin.nix -- -- --argstr system x86_64-linux -I nixpkgs=http://github.com/r2r-dev/nixpkgs/archive/f68911645209742013dd6abe570a23548d9a5780.tar.gz --option builders-use-substitutes true
# Grab build output and run is as root (if you wish to use vmnet)
sudo /nix/store/somehash-nixos-vm/bin/run-nixos-vm
```

## More configuration
Expand Down
13 changes: 11 additions & 2 deletions examples/darwin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,24 @@
shareExchangeDir = true;

qemu = {
options = [ "-accel hvf" ];
# use vmnet adapter
networkingOptions = [
"-net nic,netdev=user.0,model=virtio"
"-netdev user,id=user.0,hostfwd=tcp::2222-:22"
"-net nic,model=virtio,netdev=hn0"
"-netdev vmnet-macos,id=hn0,mode=bridged,ifname=en8"
];
pkgs = import <nixpkgs> {
system = "x86_64-darwin";
overlays = [
(self: super: {
qemu = super.qemu.overrideAttrs (attrs: {
buildInputs = attrs.buildInputs
++ [ super.darwin.apple_sdk_11.frameworks.vmnet ];
sandboxProfile = ''
(allow file-read* file-write* process-exec mach-lookup)
; block homebrew dependencies
(deny file-read* file-write* process-exec mach-lookup (subpath "/usr/local") (with no-log))
'';
preConfigure = attrs.preConfigure
+ "substituteInPlace meson.build --replace 'if exe_sign' 'if false'";
});
Expand Down

0 comments on commit 1f53a82

Please sign in to comment.