-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
96 lines (86 loc) · 2.18 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
{
description = "Zero Darwin System Flake :)";
nixConfig = {
};
inputs = {
## -- nixpkgs
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
## -- Platform
#### ---- MacOS
darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-formatter-pack = {
url = "github:Gerschtli/nix-formatter-pack";
inputs.nixpkgs.follows = "nixpkgs";
};
#### ---- Home
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
### neovim
nixvim = {
url = "github:nix-community/nixvim";
# If using a stable channel you can use `url = "github:nix-community/nixvim/nixos-<version>"`
};
};
outputs = inputs @ {
self,
darwin,
home-manager,
nixpkgs,
nixvim,
flake-utils,
nix-formatter-pack,
}: let
username = "zero";
system = "aarch64-darwin"; # aarch64-darwin or x86_64-darwin
hostname = "Zeros-MacBook-Pro-2";
specialArgs =
inputs
// {
inherit username hostname;
};
forAllSystems = nixpkgs.lib.genAttrs [
"aarch64-linux"
"i686-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
in {
formatter = forAllSystems (
system:
nix-formatter-pack.lib.mkFormatter {
pkgs = nixpkgs.legacyPackages.${system};
config.tools = {
deadnix.enable = true;
nixpkgs-fmt.enable = true;
statix.enable = true;
};
}
);
darwinConfigurations."${hostname}" = darwin.lib.darwinSystem {
inherit system specialArgs;
modules = [
./modules/darwin
home-manager.darwinModules.home-manager
{
home-manager = {
backupFileExtension = ".nixbacked";
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {inherit inputs username;};
users.zero.imports = [
./modules/home-manager
nixvim.homeManagerModules.nixvim
];
};
}
];
};
darwinPackages = self.darwinConfigurations."${hostname}".pkgs;
};
}