-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
137 lines (127 loc) · 3.87 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
{
description = "Zan's Home-Manager Config";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-darwin = {
url = "github:LnL7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = {
self,
flake-utils,
home-manager,
nixpkgs,
nix-darwin,
...
}:
(flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
devShell = pkgs.mkShell {
buildInputs = with pkgs; [alejandra just];
};
defaultApp = {
type = "app";
program = "${home-manager.packages.${system}.default}/bin/home-manager";
};
# extraNodePkgs = import ./nixpkgs/node { inherit pkgs system}
}))
// (let
rawDarwinConfigurations = {
"DQJ36L2FJ1" = { pkgs, ... }: {
system.stateVersion = 5;
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
nix.package = pkgs.nixVersions.latest;
# Necessary for using flakes on this system.
nix.settings.experimental-features = "nix-command flakes";
# add myself as a trusted user
nix.settings.trusted-users = ["APreston"];
programs.zsh.enable = true;
};
"despair" = { pkgs, ... }: {
system.stateVersion = 5;
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
nix.package = pkgs.nix;
# Necessary for using flakes on this system.
nix.settings.experimental-features = "nix-command flakes";
# add myself as a trusted user
nix.settings.trusted-users = ["zan"];
programs.zsh.enable = true;
};
};
rawHomeManagerConfigurations = {
"zan@lenny" = {
system = "x86_64-linux";
username = "zan";
homeDirectory = "/home/zan";
workMachine = false;
stateVersion = "23.05";
};
"APreston@DQJ36L2FJ1" = {
system = "aarch64-darwin";
username = "APreston";
homeDirectory = "/Users/APreston";
workMachine = true;
stateVersion = "22.11";
};
"zan@despair"= {
system = "x86_64-darwin";
username = "zan";
homeDirectory = "/Users/zan";
workMachine = false;
stateVersion = "22.11";
};
};
homeManagerConfiguration = {
system,
username,
homeDirectory,
workMachine,
stateVersion,
}:
home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
inherit system;
};
modules = [
{nixpkgs.config.allowUnfree = true;}
(import ./home.nix {
inherit system username homeDirectory stateVersion workMachine home-manager;
})
];
};
in {
# Export home-manager configurations
inherit rawHomeManagerConfigurations;
homeConfigurations =
nixpkgs.lib.attrsets.mapAttrs
(userAndHost: userAndHostConfig: homeManagerConfiguration userAndHostConfig)
rawHomeManagerConfigurations;
darwinConfigurations.DQJ36L2FJ1 = nix-darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = [
rawDarwinConfigurations.DQJ36L2FJ1
{}
];
};
darwinConfigurations.despair = nix-darwin.lib.darwinSystem {
system = "x86_64-darwin";
modules = [
rawDarwinConfigurations.despair
{}
];
};
})
// {
# Re-export flake-utils, home-manager and nixpkgs as usable outputs
inherit flake-utils home-manager nixpkgs;
};
}