-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
123 lines (102 loc) · 3.62 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
{
description = "MrZeLee Darwin system flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-24.11-darwin";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
# Home Manager
home-manager.url = "github:nix-community/home-manager/release-24.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# Add the mvd repository from GitHub
mvd.url = "github:MrZeLee/mvd";
};
outputs =
inputs@{ self
, nix-darwin
, nixpkgs
, nixpkgs-unstable
, home-manager
, mvd
, ...
}:
let
# Automatically select the system based on current machine
system = builtins.currentSystem;
pkgs = import nixpkgs { inherit system; };
pkgs-unstable = import nixpkgs-unstable { inherit system; };
# macospkgs = import nixpkgs { system = "aarch64-darwin"; };
# ---- SYSTEM SETTINGS ---- #
systemSettingsFn = { system }@attrs: attrs // {
hostname = builtins.getEnv "HOSTNAME";
timezone = "Europe/Lisbon";
locale = "en_US.UTF-8";
};
userSettings = rec {
username = builtins.getEnv "USER";
name = "MrZeLee";
email = "[email protected]";
dotfilesDir = "~/.dotfiles";
term = "wezterm";
editor = "nvim";
# font = "Hack";
# fontPkg = macospkgs.nerdfonts;
};
# Set Git commit hash for darwin-version.
configurationRevision = self.rev or self.dirtyRev or null;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
stateVersion = 4;
in
{
# Build darwin flake using:
# $ darwin-rebuild build --flake .#MrZeLees-MacBook-Pro
darwinConfigurations = {
"macos" =
let
specialArgs = {
inherit userSettings;
systemSettings = systemSettingsFn { system = system; };
mvdPackage = pkgs.callPackage (mvd + "/default.nix") { };
pkgs-unstable = pkgs-unstable;
};
in
nix-darwin.lib.darwinSystem {
inherit specialArgs;
modules = [
./modules/apps.nix
./modules/system.nix
./modules/nix-core.nix
{
users.users.${userSettings.username} = {
home = "/Users/${userSettings.username}";
# Set the default shell explicitly
shell = "${pkgs.zsh}/bin/zsh";
};
# Disable zsh configuration from being automatically managed
programs.zsh = {
enable = true; # Keep Zsh enabled
enableGlobalCompInit = false;
};
system.configurationRevision = configurationRevision;
system.stateVersion = stateVersion;
# Add trusted-users setting here
nix.settings = {
# download-buffer-size = "500M";
trusted-users = [ "root" "${userSettings.username}" ];
};
}
home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
# home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = specialArgs;
home-manager.users.${userSettings.username} = import ./home;
}
];
};
};
# Expose the package set, including overlays, for convenience.
darwinPackages = pkgs;
};
}