forked from AlexNabokikh/nix-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
130 lines (115 loc) · 3.71 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
{
description = "NixOS and nix-darwin configs for my machines";
inputs = {
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11";
# Home manager
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
# NixOS profiles to optimize settings for different hardware
hardware.url = "github:nixos/nixos-hardware";
# Global catppuccin theme
catppuccin.url = "github:catppuccin/nix";
# NixOS Spicetify
spicetify-nix = {
url = "github:Gerg-L/spicetify-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# Nix Darwin (for MacOS machines)
darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
# Homebrew
nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew";
zsh-autosuggestions = {
url = "github:zsh-users/zsh-autosuggestions";
flake = false;
};
zsh-history-substring-search = {
url = "github:zsh-users/zsh-history-substring-search";
flake = false;
};
};
outputs = {
self,
catppuccin,
darwin,
home-manager,
nix-homebrew,
nixpkgs,
zsh-autosuggestions,
zsh-history-substring-search,
...
} @ inputs: let
inherit (self) outputs;
# Define user configurations
users = {
fs = {
avatar = ./files/avatar/face.png;
email = "[email protected]";
fullName = "Fabrice Semti";
gitKey = "YOUR_GIT_KEY";
name = "fs";
sshKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBJpVWYmXPpqVmlHdixDR//vdfD+sryvYmpH2Dj1/Otx [email protected]"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDl0ivGFV8D/M53/qvRRkfxkKgY3635xDiiLQwFgrWon [email protected]"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIX2Y3nmVHNxNCNV+WXHeBEcXFS0XYDnNWxzm9oAIyFa [email protected]"
];
};
};
# Function for NixOS system configuration
mkNixosConfiguration = hostname: username:
nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs outputs hostname;
userConfig = users.${username};
};
modules = [./hosts/${hostname}/configuration.nix];
};
# Function for nix-darwin system configuration
mkDarwinConfiguration = hostname: username:
darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = {
inherit inputs outputs hostname;
userConfig = users.${username};
};
modules = [
./hosts/${hostname}/configuration.nix
home-manager.darwinModules.home-manager
nix-homebrew.darwinModules.nix-homebrew
];
};
# Function for Home Manager configuration
mkHomeConfiguration = system: username: hostname:
home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {inherit system;};
extraSpecialArgs = {
inherit inputs outputs;
userConfig = users.${username};
};
modules = [
./home/${username}/${hostname}.nix
catppuccin.homeManagerModules.catppuccin
];
};
in {
nixosConfigurations = {
"nixos" = mkNixosConfiguration "nixos" "fs";
};
darwinConfigurations = {
"macvm-fs" = mkDarwinConfiguration "macvm-fs" "fs";
"macpro-fs" = mkDarwinConfiguration "macpro-fs" "fs";
};
homeConfigurations = {
"fs@nixos" = mkHomeConfiguration "x86_64-linux" "fs" "nixos";
"fs@macvm-fs" = mkHomeConfiguration "aarch64-darwin" "fs" "macvm-fs";
"fs@macpro-fs" = mkHomeConfiguration "aarch64-darwin" "fs" "macpro-fs";
};
overlays = import ./overlays {inherit inputs;};
};
}