Open PedroRegisPOAR opened 2 years ago
Main references:
nix show-derivation nixpkgs#darwin.builder
nix show-derivation --system aarch64-darwin nixpkgs#darwin.builder | jq '.[]."inputDrvs"' -r
nix build -L --system aarch64-darwin nixpkgs#darwin.builder
nix \
--option allowed-impure-host-deps \
'/bin/sh /usr/lib/libSystem.B.dylib /usr/lib/system/libunc.dylib /dev/zero /dev/random /dev/urandom' \
build \
-L \
--system aarch64-darwin \
nixpkgs#darwin.builder
file /bin/sh
/bin/sh: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/bin/sh (for architecture x86_64): Mach-O 64-bit executable x86_64
/bin/sh (for architecture arm64e): Mach-O 64-bit executable arm64e
nix profile install nixpkgs#qemu_kvm nixpkgs#podman nixpkgs#socat
podman machine stop; \
podman machine rm --force; \
podman --log-level=trace machine init --memory=3072 --cpus=8 \
&& podman --log-level=trace machine start
socat -u OPEN:/dev/null UNIX-CONNECT:"${XDG_RUNTIME_DIR}"/tmp/podman-run-1000/podman/podman-machine-default_ready.sock
curl -v -s -X GET --unix-socket /tmp/podman-run-1000/podman/podman-machine-default_ready.sock "http:///libpod/containers/json"
qemu-system-x86_64 \
-m 3072 \
-smp 4 \
-fw_cfg name=opt/com.coreos/config,file=/home/vagrant/.config/containers/podman/machine/qemu/podman-machine-default.ign \
-qmp unix:/tmp/podman-run-$(id -u)/podman/qmp_podman-machine-default.sock,server=on,wait=off \
-netdev socket,id=vlan,fd=3 \
-device virtio-net-pci,netdev=vlan,mac=5a:94:ef:e4:0c:ee \
-device virtio-serial \
-chardev socket,path=/tmp/podman-run-$(id -u)/podman/podman-machine-default_ready.sock,server=on,wait=off,id=apodman-machine-default_ready \
-device virtserialport,chardev=apodman-machine-default_ready,name=org.fedoraproject.port.0 \
-pidfile /tmp/podman-run-$(id -u)/podman/podman-machine-default_vm.pid \
-accel kvm \
-cpu host \
-virtfs local,path=/home/vagrant,mount_tag=vol0,security_model=none \
-drive if=virtio,file=/home/vagrant/.local/share/containers/podman/machine/qemu/podman-machine-default_fedora-coreos-37.20230303.2.0-qemu.x86_64.qcow2 \
-nographic &
podman system service --time=0 unix:///tmp/podman.sock &
curl -s --unix-socket /tmp/podman.sock http://d/v1.0.0/libpod/info
Refs.:
--memory=3072 --cpus=8
podman machine stop; \
podman machine rm --force; \
podman --log-level=trace machine init --image-path $(show-coreos-path) \
&& podman --log-level=trace machine start
podman machine stop; \
podman machine rm --force; \
podman --log-level=trace machine init \
&& sleep 30 \
&& podman --log-level=trace machine start
podman machine stop; \
podman machine rm --force; \
podman --log-level=trace machine init --memory=3072 --cpus=8 \
&& sleep 30 \
&& podman --log-level=trace machine start
mkdir -p ~/.config/containers
cat << 'EOF' >> ~/.config/containers/policy.json
{
"default": [
{
"type": "insecureAcceptAnything"
}
],
"transports":
{
"docker-daemon":
{
"": [{"type":"insecureAcceptAnything"}]
}
}
}
EOF
mkdir -p ~/.config/containers
cat << 'EOF' >> ~/.config/containers/registries.conf
[registries.search]
registries = ['docker.io']
[registries.block]
registries = []
EOF
podman machine list
podman machine inspect
cat /home/nixuser/.config/containers/storage.conf
Notes about nix and MacOS and AMD and ARM
Some background about AMD vs ARM
Take a look at:
brew
on Linux)., aboutdtruss
and https://ianthehenry.com/posts/how-to-learn-nix/more-flakes/ -It only supports Linux, not macOS (some people usebrew
on Linux)., aboutdtrace
llvm-otool
, was it renamed?nix shell nixpkgs#llvm
it hasllvm-objdump
UTM
It worked, but still missing a lot of documentation!
Why?
https://www.slant.co/topics/511/~best-mac-package-managers https://news.ycombinator.com/item?id=27825420
Setting up nix-darwin home-manager and flakes on M1 Macbook Pro OSX Monterey 12.0.1 Discontinuing support for macOS Monterey
Mitchell is a Co-founder and CTO of HashiCorp, creators of popular tools such as Terraform, Vault, Vagrant, Packer, and more.
List:
TODO: watch it this Did someone say virtual is slow?, start=76&end=181 + Walkthrough of Nix Install and Setup on MacOS
This Linux PC Runs macOS Faster Than a Real Mac
TODO:
The sandbox
Really watch this:
See https://discourse.nixos.org/t/nixos-virtual-machine-on-apple-m1-arm64/15167 and https://mac.getutm.app/
https://github.com/NixOS/nixpkgs/issues/95903#issuecomment-914061347
Bugs, many bugs
I tried 10 code editors, start=0&end=19
how a silent computer bug ended 6 lives
Bugs and more bugs:
https://github.com/NixOS/nix/pull/9860
Take an look at this:
List:
Domen Kožar - Nix Is Going Mainstream (SoN2022 - public lecture series), start=480&end=516
The NixOS "shebang" and the GNU/Linux kernel:
The case of the supersized shebang, by Jonathan Corbet and again in https://bugs.ghostscript.com/show_bug.cgi?id=699964 from
https://github.com/NixOS/nixpkgs/issues/24485#issuecomment-429636677
https://www.youtube.com/embed/QkcjCRE8Vvs?start=673&end=807&version=3
https://discussion.fedoraproject.org/t/disabling-selinux-breaks-docker-overlayfs/20232
MWEs + how to never write bug, start=264&end=294
Unfortunately there are really hard/impossible to reproduce bugs: how to never write bug, start=294&end=319
If nothing works:
Specific to javascript, but valid for many other situations:
This kind of bug is scary:
TODO: test is
"aarch64-darwin"
Darwin 22.3.0, macOS 13.2.1
yes
no
nix-env (Nix) 2.10.2
"nixpkgs"
/nix/var/nix/profiles/per-user/root/channels/nixpkgs
The rosetta thing
List:
The qemu-user-static thing
What name put here?
macOS to NixOS the Purely Functional Linux Distribution by Daniel Britten
Franz Pletz: NixOS, start=913&end=928, about homebrew vs nix
https://discourse.nixos.org/t/nixos-on-the-new-apple-macbook-m1/15715/2
Remember Mac uses
zsh
(since when?):https://github.com/utmapp/UTM/issues/2688#issuecomment-1006771424
MacOS Simple KVM
Part 1:
Part 2:
Part 3:
About the installer
TODO: try to test that https://github.com/NixOS/nix/issues/3616#issuecomment-1198931273
qemu
TODO: it documents part of history: https://stackoverflow.com/a/66887947 TODO: https://www.willhaley.com/blog/debian-arm-qemu/
https://www.willhaley.com/blog/debian-arm-qemu/
qemu + NixOS => build-vm
Excelent: Running qemu-system-aarch64 with -accel hvf on aarch64-darwin
Copying files like .img .qcow2
https://serverfault.com/a/670227 https://stackoverflow.com/questions/41733410/remove-qcow2-image-files-holes