-
Notifications
You must be signed in to change notification settings - Fork 3
/
flake.nix
83 lines (77 loc) · 2.66 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{
description = "birkhoff's darwin configuration";
inputs = {
# nixpkgs set
nixpkgs-master.url = "github:NixOS/nixpkgs/master";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixpkgs-23.11-darwin";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
# Environment managers
darwin.url = "github:lnl7/nix-darwin";
darwin.inputs.nixpkgs.follows = "nixpkgs-unstable";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs-unstable";
};
outputs = { self, darwin, home-manager, ... }@inputs:
# https://github.com/malob/nixpkgs/blob/61d4809925a523296278885ff8a75d3776a5c813/flake.nix#L34
let
inherit (inputs.nixpkgs-unstable.lib) attrValues makeOverridable mkForce optionalAttrs singleton;
nixpkgsDefaults = {
config = {
allowUnfree = true;
};
overlays = attrValues self.overlays ++ singleton (
final: prev: (optionalAttrs (prev.stdenv.system == "aarch64-darwin") {
# Sub in x86 version of packages that don't build on Apple Silicon.
inherit (final.pkgs-x86)
agda
idris2
;
}) // {
# Add other overlays here if needed.
}
);
};
in
{
overlays = {
# Overlays to add different versions `nixpkgs` into package set
pkgs-master = _: prev: {
pkgs-master = import inputs.nixpkgs-master {
inherit (prev.stdenv) system;
inherit (nixpkgsDefaults) config;
};
};
pkgs-stable = _: prev: {
pkgs-stable = import inputs.nixpkgs-stable {
inherit (prev.stdenv) system;
inherit (nixpkgsDefaults) config;
};
};
pkgs-unstable = _: prev: {
pkgs-unstable = import inputs.nixpkgs-unstable {
inherit (prev.stdenv) system;
inherit (nixpkgsDefaults) config;
};
};
apple-silicon = _: prev: optionalAttrs (prev.stdenv.system == "aarch64-darwin") {
# Add access to x86 packages system is running Apple Silicon
pkgs-x86 = import inputs.nixpkgs-unstable {
system = "x86_64-darwin";
inherit (nixpkgsDefaults) config;
};
};
tweaks = _: _: {
# Add temporary overrides here
};
};
darwinConfigurations = {
AlessandroMBP = darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = [
./hosts/AlessandroMBP { nixpkgs = nixpkgsDefaults; }
home-manager.darwinModules.home-manager
];
};
};
};
}