-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
161 lines (145 loc) · 4.82 KB
/
flake.nix
File metadata and controls
161 lines (145 loc) · 4.82 KB
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
{
description = "Thomas Eckert's dotfiles";
inputs = {
# Core nixpkgs - using unstable for latest packages
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
# Home Manager for dotfile management
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
# nix-darwin for macOS system configuration
darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
# Flake utilities
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, home-manager, darwin, flake-utils }:
let
# Supported systems
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
# Helper to generate attrs for each system
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
# Get pkgs for a specific system
pkgsFor = system: import nixpkgs {
inherit system;
config.allowUnfree = true;
};
# User configuration
username = "thomaseckert";
homeDirectory = system:
if nixpkgs.lib.hasSuffix "darwin" system
then "/Users/${username}"
else "/home/${username}";
in {
# ============================================================
# Packages - Go CLI tools
# ============================================================
packages = forAllSystems (system:
let pkgs = pkgsFor system;
in {
# Individual tools
dotfiles-tools = pkgs.callPackage ./nix/packages/go-tools.nix { };
# Default package
default = self.packages.${system}.dotfiles-tools;
# Kubernetes tools volume
k8s-tools-volume = pkgs.callPackage ./nix/kubernetes/default.nix {
inherit (self.packages.${system}) dotfiles-tools;
};
}
);
# ============================================================
# Development Shell
# ============================================================
devShells = forAllSystems (system:
let pkgs = pkgsFor system;
in {
default = pkgs.callPackage ./nix/packages/devshell.nix { };
}
);
# ============================================================
# Home Manager Configurations
# ============================================================
homeConfigurations = {
# macOS configuration (full dev setup)
"thomaseckert@macos" = home-manager.lib.homeManagerConfiguration {
pkgs = pkgsFor "aarch64-darwin";
extraSpecialArgs = {
inherit self;
isDarwin = true;
isLinux = false;
};
modules = [
./nix/home
{
home = {
username = username;
homeDirectory = homeDirectory "aarch64-darwin";
stateVersion = "24.05";
};
}
];
};
# Linux configuration (for Spark containers)
"thomaseckert@linux" = home-manager.lib.homeManagerConfiguration {
pkgs = pkgsFor "x86_64-linux";
extraSpecialArgs = {
inherit self;
isDarwin = false;
isLinux = true;
};
modules = [
./nix/linux
{
home = {
username = username;
homeDirectory = homeDirectory "x86_64-linux";
stateVersion = "24.05";
};
}
];
};
};
# ============================================================
# Darwin (macOS) System Configurations
# ============================================================
darwinConfigurations = {
# Apple Silicon Mac
"Thomas-MacBook-Pro" = darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = {
inherit self username;
};
modules = [
./nix/darwin
home-manager.darwinModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "backup";
extraSpecialArgs = {
inherit self;
isDarwin = true;
isLinux = false;
};
users.${username} = import ./nix/home;
};
}
];
};
};
# ============================================================
# Flake checks
# ============================================================
checks = forAllSystems (system:
let pkgs = pkgsFor system;
in {
# Verify Go tools build
go-tools = self.packages.${system}.dotfiles-tools;
}
);
};
}