-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathflake.nix
61 lines (58 loc) · 1.71 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
brew-api = {
url = "github:BatteredBunny/brew-api";
flake = false;
};
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{ self
, nixpkgs
, flake-utils
, brew-api
, nix-darwin
, ...
}:
rec {
overlays.default = final: prev: {
brewCasks = self.packages.${final.system};
};
darwinModules.default = (import ./module.nix) { brewCasks = overlays.default; };
}
//
(flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
};
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
wget
];
};
packages = import ./casks.nix { inherit brew-api; inherit pkgs; lib = pkgs.lib; stdenv = pkgs.stdenv; };
# XXX: the check only runs successful on Darwin systems, but is provided for "eachDefaultSystem",
# including Linux; probably best to limit systems in general, since `casks.nix` is obviously
# tailored towards Darwin systems and not Linux or anything else
checks.build-examples =
let
# override darwin-rebuild to use correct Nix version
darwin-rebuild = nix-darwin.packages.${system}.darwin-rebuild;
in
pkgs.runCommandLocal "build-examples" { } ''
export HOME=$(mktemp -d)
${darwin-rebuild}/bin/darwin-rebuild build --flake ${self}/examples#somehost
mkdir "$out"
'';
}
));
}