-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
155 lines (136 loc) · 4.1 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
{
description = "Personal NixOS config";
nixConfig = {
extra-substituters = ["https://hyprland.cachix.org" "https://nix-community.cachix.org"];
extra-trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="];
};
inputs = {
# Nix Ecosystem
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
systems.url = "github:nix-systems/default-linux";
nur.url = "github:nix-community/NUR";
# Tools
colmena = {
url = "github:zhaofengli/colmena/direct-flake-eval";
inputs.stable.follows = "nixpkgs-stable";
};
# Services
hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1";
home-manager = {
url = "github:thestachelfisch/home-manager/fix/psd";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
# TODO: Add to dev shells only
zig = {
url = "github:mitchellh/zig-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
zls = {
url = "github:zigtools/zls/0.13.0";
inputs.nixpkgs.follows = "nixpkgs";
inputs.zig-overlay.follows = "zig";
};
};
outputs = {
self,
nixpkgs,
home-manager,
nur,
systems,
hyprland,
colmena,
nixos-wsl,
...
} @ inputs: let
inherit (self) outputs;
lib = nixpkgs.lib // home-manager.lib;
forEachSystem = f: lib.genAttrs (import systems) (system: f pkgsFor.${system});
pkgsFor = lib.genAttrs (import systems) (
system:
import nixpkgs {
inherit system;
config.allowUnfree = true;
}
);
in {
inherit lib;
nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager;
overlays = import ./overlays {inherit inputs outputs;};
packages = forEachSystem (pkgs: import ./pkgs {inherit pkgs;});
devShells = forEachSystem (pkgs: import ./shell.nix {inherit pkgs;});
formatter = forEachSystem (pkgs: pkgs.alejandra);
## NixOS Configurations
# Set for every system
nixosConfigurations = {
#Framework Laptop
framework = lib.nixosSystem {
modules = [
nur.modules.nixos.default
./hosts/framework
];
specialArgs = {
inherit inputs outputs;
};
};
# WSL Environment
wsl = lib.nixosSystem {
modules = [
nixos-wsl.nixosModules.default
nur.modules.nixos.default
./hosts/wsl
];
specialArgs = {
inherit inputs outputs;
};
};
};
## Home-Manager Configurations
# Set only for systems that are interacted with manually
homeConfigurations = {
"thestachelfisch@framework" = home-manager.lib.homeManagerConfiguration {
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = {inherit inputs outputs;};
modules = [
inputs.nur.nixosModules.nur
./hosts/framework/home.nix
];
};
"thestachelfisch@wsl" = home-manager.lib.homeManagerConfiguration {
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = {inherit inputs outputs;};
modules = [./hosts/wsl/home.nix];
};
};
## Remote Servers
# Set only for systems that are remotely-deployed to
colmenaHive = colmena.lib.makeHive self.outputs.colmena;
colmena = {
meta = {
description = "Remote Machines Managed exclusively remotely";
nixpkgs = pkgsFor.x86_64-linux;
specialArgs = {
inherit inputs outputs;
};
};
malachite = {
deployment = {
targetHost = "malachite.thestachelfisch.dev";
targetUser = "thestachelfisch";
buildOnTarget = true;
tags = ["arm" "oci"];
};
imports = [
./hosts/malachite
];
};
};
};
}