-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
96 lines (85 loc) · 2.4 KB
/
flake.nix
File metadata and controls
96 lines (85 loc) · 2.4 KB
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
{
description = "macOS Nix setup with nix-darwin, home-manager, and Homebrew";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew";
homebrew-core = {
url = "github:Homebrew/homebrew-core";
flake = false;
};
homebrew-cask = {
url = "github:Homebrew/homebrew-cask";
flake = false;
};
devshells.url = "github:kalifun/devshells";
};
outputs = inputs @ {
self,
darwin,
home-manager,
nix-homebrew,
homebrew-core,
homebrew-cask,
devshells,
...
}: let
mkHost = {
username,
hostname,
system,
}:
darwin.lib.darwinSystem {
inherit system;
specialArgs = {
inherit inputs self username hostname system;
};
modules = [
./hosts/${hostname}
nix-homebrew.darwinModules.nix-homebrew
{
nix-homebrew = {
enable = true;
autoMigrate = true;
enableRosetta = false;
user = username;
taps = {
"homebrew/homebrew-core" = homebrew-core;
"homebrew/homebrew-cask" = homebrew-cask;
};
mutableTaps = true;
};
}
home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
# 已有 ~/.config/nvim 等目录时,否则 checkLinkTargets 失败会中止整段 HM 激活(Rime 等也不会跑)
home-manager.backupFileExtension = "hm-backup";
home-manager.extraSpecialArgs = {
inherit inputs self username hostname system;
};
home-manager.users.${username} = import ./home/${username};
}
];
};
in {
darwinConfigurations.darwin-arm64-main = mkHost {
username = "kalifun";
hostname = "darwin-arm64-main";
system = "aarch64-darwin";
};
darwinConfigurations.darwin-x86_64-legacy = mkHost {
username = "kalifun";
hostname = "darwin-x86_64-legacy";
system = "x86_64-darwin";
};
};
}