forked from malob/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
119 lines (104 loc) · 4.22 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
{
description = "Pritam’s Nix system configs";
inputs = {
# Package sets
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixos-stable.url = "github:NixOS/nixpkgs/nixos-22.11";
# Environment/system management
darwin.url = "github:LnL7/nix-darwin";
darwin.inputs.nixpkgs.follows = "nixpkgs-unstable";
home-manager.url = "github:nix-community/home-manager";
flake-utils.url = "github:numtide/flake-utils";
emacs-overlay.url = "github:nix-community/emacs-overlay";
emacs-overlay.inputs.nixpkgs.follows = "nixpkgs-unstable";
emacs-overlay.inputs.flake-utils.follows = "flake-utils";
};
outputs = { self, darwin, home-manager, flake-utils, ... }@inputs:
let
inherit (self.lib) attrValues makeOverridable optionalAttrs singleton;
homeStateVersion = "24.05";
nixpkgsDefaults = {
config = {
allowUnfree = true;
};
overlays = attrValues self.overlays ++ [
inputs.emacs-overlay.overlays.emacs
];
};
primaryUserDefaults = {
username = "pritamkadam";
fullName = "Pritam Kadam";
email = "[email protected]";
nixConfigDirectory = "/Users/pritamkadam/.config/nixpkgs";
};
in
{
# Add some additional functions to `lib`.
lib = inputs.nixpkgs-unstable.lib.extend (_: _: {
mkDarwinSystem = import ./lib/mkDarwinSystem.nix inputs;
lsnix = import ./lib/lsnix.nix;
});
overlays = {
pkgs-unstable = _: prev: {
pkgs-unstable = import inputs.nixpkgs-unstable {
inherit (prev.stdenv) system;
inherit (nixpkgsDefaults) config;
};
};
};
darwinModules = {
pritamkadam-bootstrap = import ./darwin/bootstrap.nix;
pritamkadam-defaults = import ./darwin/defaults.nix;
pritamkadam-general = import ./darwin/general.nix;
pritamkadam-homebrew = import ./darwin/homebrew.nix;
users-primaryUser = import ./modules/darwin/users.nix;
};
homeManagerModules = {
pritamkadam-config-files = import ./home/config-files.nix;
pritamkadam-fish = import ./home/fish.nix;
pritamkadam-nu = import ./home/nu.nix;
pritamkadam-git = import ./home/git.nix;
pritamkadam-git-aliases = import ./home/git-aliases.nix;
pritamkadam-gh-aliases = import ./home/gh-aliases.nix;
pritamkadam-kitty = import ./home/kitty.nix;
pritamkadam-packages = import ./home/packages.nix;
pritamkadam-yabai = import ./home/yabai.nix;
pritamkadam-borders = import ./home/borders.nix;
home-user-info = { lib, ... }: {
options.home.user-info =
(self.darwinModules.users-primaryUser { inherit lib; }).options.users.primaryUser;
};
};
darwinConfigurations = {
# Minimal macOS configurations to bootstrap systems
bootstrap-x86 = makeOverridable darwin.lib.darwinSystem {
system = "x86_64-darwin";
modules = [ ./darwin/bootstrap.nix { nixpkgs = nixpkgsDefaults; } ];
};
bootstrap-arm = self.darwinConfigurations.bootstrap-x86.override {
system = "aarch64-darwin";
};
# My Apple Silicon macOS laptop config
MacBookPro = makeOverridable self.lib.mkDarwinSystem (primaryUserDefaults // {
modules = attrValues self.darwinModules ++ singleton {
nixpkgs = nixpkgsDefaults;
networking.computerName = "pritamkadam";
networking.hostName = "MacBookPro";
networking.knownNetworkServices = [
"Wi-Fi"
"USB 10/100/1000 LAN"
];
nix.registry.my.flake = inputs.self;
};
inherit homeStateVersion;
system = "aarch64-darwin";
homeModules = attrValues self.homeManagerModules;
});
};
} // flake-utils.lib.eachDefaultSystem (system: {
# Re-export `nixpkgs-unstable` with overlays.
# This is handy in combination with setting `nix.registry.my.flake = inputs.self`.
# Allows doing things like `nix run my#prefmanager -- watch --all`
legacyPackages = import inputs.nixpkgs-unstable (nixpkgsDefaults // { inherit system; });
});
}