-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
executable file
·185 lines (156 loc) · 7.42 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
{
inputs = {
# 23.11
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.11";
# Unstable
# nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; # TODO: this is a YOLO fix for https://github.com/nix-community/home-manager/issues/5991, I have already spent too much time on this
#* notice that it's nixpkgs.unstable not nixos.unstable
# Darwin
darwin.url = "github:LnL7/nix-darwin";
darwin.inputs.nixpkgs.follows = "nixpkgs";
# Impermanence
impermanence.url = "github:Nix-community/impermanence";
# secret management
sops-nix.url = "github:mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.inputs.nixpkgs-stable.follows = "nixpkgs";
# Home Manager
home-manager.url = "github:nix-community/home-manager/master";
home-manager-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# NixOS-Hardware (for machine-specific fixes)
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
# nixos-hardware-b550-stopgap.url = "github:NixOS/nixos-hardware/master/gigabyte"; # TODO: fix flake.nix on nixos-hardware
# Musnix
musnix.url = "github:musnix/musnix";
# populate nix index
nix-index-database.url = "github:nix-community/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
#Stylix
# stylix.url = "github:danth/stylix";
};
outputs = {
self,
nixpkgs,
nixpkgs-stable, # https://nixos-and-flakes.thiscute.world/nixos-with-flakes/downgrade-or-upgrade-packages
darwin,
home-manager,
nixos-hardware,
nix-index-database,
# nixos-hardware-b550-stopgap, # TODO: fix flake.nix on nixos-hardware repo
musnix,
...
} @ inputs:
{
# Reusable nixos modules you might want to export
# nixosModules = import ./___modules; # there are better names for this, but this is de-facto standard
# homeManagerModules = import ./modules/home-manager
overlays = import ./___overlays {inherit inputs;};
hardware = import nixos-hardware;
# nire-durandal (workstation)
# `sudo nixos-rebuild switch --flake .#nire-durandal`
# `nh os switch --hostname nire-durandal ~/nixos/`
nixosConfigurations."nire-durandal" = nixpkgs.lib.nixosSystem {
specialArgs = inputs; # send inputs to modules (is this actually the right description?)
system = "x86_64-linux";
modules = [
./system-config/nire-durandal-configuration.nix
nix-index-database.nixosModules.nix-index
# inputs.musnix.nixosModules.musnix
# inputs.nixos-hardware.nixosModules.b550 # TODO: fix flake on nixos-hardware repo
# inputs.stylix.nixosModules.stylix
# TODO: stylix
];
};
# `home-manager switch --flake .#elly@nire-durandal`
# `nh home switch --configuration elly@nire-durandal ~/nixos/`
homeConfigurations."elly@nire-durandal" = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs { # Home manger requires a pkgs instance
system = "x86_64-linux";
config = { allowUnfree = true; };
};
extraSpecialArgs = inputs; # Pass flake inputs to our config
modules = [
./home-manager/user-elly/home-nire-durandal.nix # home manager entrypoint
];
};
# nire-lysithea (macbook)
# TODO: FIXME `sudo nixos-rebuild switch --flake .#nire-durandal`
# TODO: FIXME `nh os switch --hostname nire-durandal ~/nixos/`
darwinConfigurations."nire-lysithea" = darwin.lib.darwinSystem {
specialArgs = { inherit inputs ; };
system = "aarch64-darwin";
modules = [
./system-config/nire-lysithea-configuration.nix
# nix-index-database.darwinModules.nix-index
# TODO: stylix
# inputs.stylix.darwinModules.stylix
home-manager.darwinModules.home-manager
{
home-manager = {
users.elly = import ./home-manager/user-elly/home-nire-lysithea.nix;
};
users.users.elly.home = "/Users/elly";
}
# nix-index-database.hmModules.nix-index
# { programs.nix-index-database.comma.enable = true; }
# todo: fix this
];
# Expose the package set, including overlays, for convenience.
# TODO: fixme
# darwinPackages = self.darwinConfigurations."nire-lysithea".pkgs;
};
# elly@nire-lysithea
# homeConfigurations."[email protected]" = home-manager.lib.homeManagerConfiguration {
# pkgs = import nixpkgs {
# system = "aarch64-darwin";
# config = {
# allowUnfree = true;
# useGlobalPkgs = true;
# useUserPackages = true;
# };
# };
# extraSpecialArgs = inputs;
# modules = [
# ./home-manager/user-elly/home-nire-lysithea.nix # Elly home manager config
# nix-index-database.hmModules.nix-index
# { programs.nix-index-database.comma.enable = true; }
# ];
# };
# nire-galatea (thinkpad)
# `sudo nixos-rebuild switch --flake .#nire-galatea`
# `nh os switch --hostname nire-galatea ~/nixos/`
nixosConfigurations."nire-galatea" = nixpkgs.lib.nixosSystem {
specialArgs = inputs; # send inputs to modules (is this true?)
system = "x86_64-linux";
modules = [
./system-config/hosts/nire-galatea/_host-nire-galatea.config.nix
nix-index-database.nixosModules.nix-index
];
};
# `home-manager switch --flake .#elly@nire-galatea`
# `nh home switch --configuration elly@nire-galatea ~/nixos/`
homeConfigurations."elly@nire-galatea" = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs { # Home manger requires a pkgs instance
system = "x86_64-linux";
config = { allowUnfree = true; };
};
extraSpecialArgs = inputs; # Pass flake inputs to our config
modules = [
./home-manager/user-elly/home-nire-galatea.nix # Elly's home manager config
];
};
};
}
# NOTE: for nix-index to work with flake installs, you must `nix profile install` something
# see: https://github.com/nix-community/nix-index/issues/167
# `nix profile install nixpkgs#hello
################################################################################
# NOTE FOR ZSH
# https://www.reddit.com/r/NixOS/comments/1539s44/using_flakes_for_configurationnix/
# https://stackoverflow.com/questions/12303805/oh-my-zsh-hash-pound-symbol-bad-pattern-or-match-not-found/57380936#57380936
# this fixes nix-flakes
# disable -p '#'
# otherwise `nixos-rebuild --flake .#hostname` will not get evaluated correctly.
################################################################################