-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathflake.nix
40 lines (35 loc) · 1.14 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{
description = "Lima-based, Rosetta 2-enabled, Apple silicon (macOS/Darwin)-hosted Linux builder";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixos-generators, nixpkgs }:
let
darwinSystem = "aarch64-darwin";
linuxSystem = builtins.replaceStrings [ "darwin" ] [ "linux" ] darwinSystem;
lib = nixpkgs.lib;
in {
packages."${linuxSystem}" =
let
arguments = { inherit linuxSystem nixos-generators nixpkgs; };
pkgs = nixpkgs.legacyPackages."${linuxSystem}";
in {
default = pkgs.callPackage ./package.nix (arguments // { onDemand = false; });
on-demand = pkgs.callPackage ./package.nix (arguments // { onDemand = true; });
};
devShells."${darwinSystem}".default =
let
pkgs = nixpkgs.legacyPackages."${darwinSystem}";
in pkgs.mkShell {
packages = [ pkgs.lima ];
};
darwinModules.default = import ./module.nix {
images = self.packages."${linuxSystem}";
inherit linuxSystem;
};
};
}