Skip to content

Commit

Permalink
Dirty hack to enable nixos-shell on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
r2r-dev committed May 11, 2021
1 parent 1c44b06 commit e2f3e30
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ test-efi:

install:
$(INSTALL) -D bin/nixos-shell $(DESTDIR)$(PREFIX)/bin/nixos-shell
$(INSTALL) -D bin/config.nix $(DESTDIR)$(PREFIX)/bin/config.nix
$(INSTALL) -D share/nixos-shell/nixos-shell.nix $(DESTDIR)$(PREFIX)/share/nixos-shell/nixos-shell.nix
12 changes: 12 additions & 0 deletions bin/config.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
virtualisation.qemu.pkgs = import <qnixpkgs> {
system = "x86_64-darwin";
overlays = [
(self: super: {
qemu = super.qemu.overrideAttrs (attrs: {
preConfigure = attrs.preConfigure + "substituteInPlace meson.build --replace \'if exe_sign\' \'if false\'";
});
})
];
};
}
7 changes: 6 additions & 1 deletion bin/nixos-shell
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p bash coreutils

set -euo pipefail

Expand Down Expand Up @@ -54,6 +55,10 @@ trap cleanup EXIT SIGINT SIGQUIT ERR
nix-build '<nixpkgs/nixos>' -A vm -k \
-I "nixos-config=${script_dir}/../share/nixos-shell/nixos-shell.nix" \
-o "${tempdir}/result" \
--argstr system x86_64-linux \
--arg configuration "${script_dir}/config.nix" \
-I nixpkgs=http://github.com/SCOTT-HAMILTON/NixPkgs/archive/230f823cd985e499ff2fd450b419bc5b44c6dbf8.tar.gz \
-I qnixpkgs=https://github.com/mroi/nixpkgs/archive/a180e45138f63f283b6d155bbd46367f09e29d1e.tar.gz \
"${extraBuildFlags[@]}"
"$@"
"${tempdir}/result/bin/"run-*-vm

0 comments on commit e2f3e30

Please sign in to comment.