Skip to content

Commit

Permalink
make machines.sh build on Darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Sep 7, 2021
1 parent 305df00 commit 9564827
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 1 deletion.
38 changes: 38 additions & 0 deletions flake.lock

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

13 changes: 13 additions & 0 deletions flake.nix
Expand Up @@ -4,9 +4,13 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-21.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-darwin.url = "github:NixOS/nixpkgs/nixpkgs-21.05-darwin";

nixos-hardware.url = "github:NixOS/nixos-hardware";

darwin.url = "github:LnL7/nix-darwin";
darwin.inputs.nixpkgs.follows = "nixpkgs-darwin";

home-manager.url = "github:nix-community/home-manager/release-21.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";

Expand Down Expand Up @@ -197,5 +201,14 @@
inputs.home-manager.nixosModules.home-manager
];
};

darwinConfigurations.flame = inputs.darwin.lib.darwinSystem {
modules = [
({ pkgs, ... }: {
nix.package = pkgs.nixUnstable;
nixpkgs.overlays = mkOverlays "x86_64-darwin";
})
];
};
};
}
18 changes: 17 additions & 1 deletion machines.sh
@@ -1,4 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail

nixos-rebuild --flake . "$@"
case "$(uname -s)" in
Linux)
nixos-rebuild --flake . "$@"
;;

Darwin)
nix-shell "-p" nixUnstable --run 'nix --experimental-features "nix-command flakes" build .#darwinConfigurations.flame.system'
if test "$@" != "build"; then
./result/sw/bin/darwin-rebuild --flake . "$@"
fi
;;

*)
echo "I don't know how to build on a $(uname -s) system."
exit 1
;;
esac

0 comments on commit 9564827

Please sign in to comment.