generated from ryantm/home-manager-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
210 lines (188 loc) · 7.04 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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# TODO: Organize flakes better for easy overlays
# - https://github.com/lanice/nixhome/blob/c7067ad78ee9ddbae61e12ffad9f9211ad631be2/flake.nix
{
description = "Home-manager configuration as a flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# FIXME: Is there any advantage to use the dev channel instead of what nixpkgs follows?
#nix-ld ={
# url = "github:Mic92/nix-ld";
# inputs.nixpkgs.follows = "nixpkgs";
#};
hardware.url = "github:nixos/nixos-hardware";
home-manager = {
# TODO Extract release from nixpkgs.url
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager-unstable ={
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
# TODO: Remove nixos-generators and iso image gen
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
# NixOS WSL Support
nixos-wsl = {
url = "github:nix-community/nixos-wsl";
inputs.nixpkgs.follows = "nixpkgs";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
lanzaboote = {
url = "github:nix-community/lanzaboote/v0.4.1";
inputs.nixpkgs.follows = "nixpkgs";
};
# For accessing `deploy-rs`'s utility Nix functions
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
nixgl = {
url = "github:guibou/nixGL";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
# Nix User Repository
nur = {
url = "github:nix-community/NUR";
#inputs.nixpkgs.follows = "nixpkgs";
};
# Hyprland
hypr-contrib.url = "github:hyprwm/contrib";
hyprpicker.url = "github:hyprwm/hyprpicker";
hyprland = {
url = "github:hyprwm/Hyprland";
inputs.nixpkgs.follows = "nixpkgs";
};
waybar-taskwarrior = {
url = "github:DestinyofYeet/waybar-taskwarrior.rs";
# url = "path:///home/ole/github/waybar-taskwarrior.rs";
inputs.nixpkgs.follows = "nixpkgs";
};
zen-browser.url = "github:0xc000022070/zen-browser-flake";
# RustUp toolchain
rust-overlay.url = "github:oxalica/rust-overlay";
# Secrets
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# FHS wrappers for Xilinx and Matlab tools
nix-xilinx.url = "gitlab:doronbehar/nix-xilinx";
nix-matlab.url = "gitlab:doronbehar/nix-matlab";
# WindowsApp and other misc, checkout at: https://github.com/emmanuelrosa/erosanix
erosanix = {
url = "github:emmanuelrosa/erosanix";
inputs.nixpkgs.follows = "nixpkgs";
};
alacritty-theme.url = "github:alexghr/alacritty-theme.nix";
waveforms = {
url = "github:liff/waveforms-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
# Looks
stylix = {
url = "github:danth/stylix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, home-manager, deploy-rs, alacritty-theme, nixgl, ... }@inputs:
# Remove polybar-pipewire overlay
let
inherit (self) outputs;
# TODO: Is this necessary? Perhaps for accessing home-manager.lib.homeManagerConfiguration easier
lib = nixpkgs.lib // home-manager.lib;
systems = [ "aarch64-linux" "x86_64-linux" ];
forEachSystem = f: lib.genAttrs systems (system: f pkgsFor.${system});
pkgsFor = lib.genAttrs systems (system: import nixpkgs {
inherit system;
config = {
allowUnfree = true;
};
});
nixGlOverlay = { ... }: {nixpkgs.overlays = [nixgl.overlay];};
alacritty-theme-Overlay = { ... }: {nixpkgs.overlays = [ alacritty-theme.overlays.default ];};
deploy-rs-cache-enable = { pkgs, ... }: {
nixpkgs.overlays = [
deploy-rs.overlay # or deploy-rs.overlays.default
(self: super: { deploy-rs = { inherit (pkgs) deploy-rs; lib = super.deploy-rs.lib; }; })
];
};
#nurOverlay = { lib, ... }: {nixpkgs.overlays = [nur.overlay];};
mkHomeConfiguration = hostModule: system: home-manager.lib.homeManagerConfiguration {
pkgs = pkgsFor.${system};
modules = [
(inputs.home-manager-unstable + "/modules/programs/cavalier.nix")
hostModule
alacritty-theme-Overlay
# TODO Add nixGlOverlay only to non NixOS
nixGlOverlay
deploy-rs-cache-enable
#nurOverlay
];
extraSpecialArgs = {
inherit inputs outputs;
# TODO: One day maybe when I'll have my own nix derviations organized
#inherit declarative-cachix;
};
};
in
{
inherit lib;
nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager;
# TODO: Add templates for languages of interest to minimize time spent on boiler plate code and project init
# Inspire yourself from: https://github.com/Misterio77/nix-config/tree/main/templates
#templates = import ./templates;
overlays = import ./overlays {inherit inputs outputs;};
packages = forEachSystem (pkgs: import ./pkgs { inherit pkgs inputs; });
devShells = forEachSystem (pkgs: import ./shell.nix {inherit pkgs;});
formatter = forEachSystem (pkgs: pkgs.nixpkgs-fmt);
homeConfigurations = {
cristi = mkHomeConfiguration ./home/cristi.nix "x86_64-linux";
work = mkHomeConfiguration ./home/work.nix "x86_64-linux";
tiny = mkHomeConfiguration ./home/tiny.nix "x86_64-linux";
uoe = mkHomeConfiguration ./home/uoe.nix "x86_64-linux";
};
nixosConfigurations = {
precision = lib.nixosSystem {
modules = [ ./hosts/precision];
specialArgs = { inherit inputs outputs; };
};
hydrax = lib.nixosSystem {
modules = [./hosts/hydrax];
specialArgs = { inherit inputs outputs; };
};
uoe = lib.nixosSystem {
modules = [./hosts/uoe];
specialArgs = { inherit inputs outputs; };
};
iso_secure_boot = lib.nixosSystem {
system = "x86_64-linux";
modules = [
(nixpkgs + "/nixos/modules/installer/cd-dvd/installation-cd-minimal.ni")
./hosts/iso_secure_boot/configuration.nix
];
specialArgs = { inherit inputs outputs; };
};
};
deploy.nodes.hydrax = {
hostname = "hydrax.go.ro";
profiles.system = {
sshUser = "root";
sshOpts = [ "-p 5022" ];
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.hydrax;
};
};
# This is highly advised, and will prevent many possible mistakes
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
};
}