-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
184 lines (174 loc) · 6.82 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
{
# Nix configurations; flake initially based on
# https://github.com/Misterio77/nix-starter-configs
# (See also https://github.com/misterio77/nix-config)
description = "My personal nix config";
inputs = {
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
# You can access packages and modules from different nixpkgs revs
# at the same time. Here's an working example:
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# Also see the 'unstable-packages' overlay at 'overlays/default.nix'.
# Home manager
home-manager.url = "github:nix-community/home-manager/release-24.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
hardware.url = "github:nixos/nixos-hardware";
microvm.url = "github:astro/microvm.nix";
microvm.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
samh-shared.url = "github:samh/nix-config-shared";
samh-shared.inputs.nixpkgs.follows = "nixpkgs";
samh-shared.inputs.home-manager.follows = "home-manager";
samh-shared.inputs.nixpkgs-unstable.follows = "nixpkgs-unstable";
};
outputs = {
self,
nixpkgs,
home-manager,
hardware,
microvm,
...
} @ inputs: let
inherit (self) outputs;
# Supported systems for your flake packages, shell, etc.
systems = [
"aarch64-linux"
"i686-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
# This is a function that generates an attribute by calling a function you
# pass to it, with each system as an argument
forAllSystems = nixpkgs.lib.genAttrs systems;
in {
# Your custom packages
# Acessible through 'nix build', 'nix shell', etc
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
# Formatter for your nix files, available through 'nix fmt'
# Other options beside 'alejandra' include 'nixpkgs-fmt'
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
# Your custom packages and modifications, exported as overlays
overlays = import ./overlays {inherit inputs;};
# Reusable nixos modules you might want to export
# These are usually stuff you would upstream into nixpkgs
nixosModules = import ./modules/nixos;
# Reusable home-manager modules you might want to export
# These are usually stuff you would upstream into home-manager
homeManagerModules = import ./modules/home-manager;
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
# (defaults to system hostname if not specified, and if
# /etc/nixos/flake.nix exists then that will be used without
# needing the "--flake" option).
nixosConfigurations = {
# Framework Laptop
fwnixos = nixpkgs.lib.nixosSystem {
# Pass flake inputs to our config. This means that the 'inputs' and
# 'outputs' variables defined in this file are accessible by our
# modules if they declare 'inputs' and 'outputs' as arguments.
specialArgs = {inherit inputs outputs;};
modules = [
# A collection of NixOS modules covering hardware quirks.
# https://github.com/NixOS/nixos-hardware
hardware.nixosModules.framework-12th-gen-intel
# Include the microvm host module
# https://astro.github.io/microvm.nix/host.html
microvm.nixosModules.host
# > Our main nixos configuration file <
./hosts/framework/configuration.nix
];
};
# Desktop PC - Gigabyte Z390 Designare + Intel Core i7-9700k (2019)
nixos-2022-desktop = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [
./hosts/desktop-z390-9700k/configuration.nix
];
};
# Dell Inspiron 11 (Mom's Old Laptop)
laptop-inspiron11 = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [
./hosts/laptop-inspiron11/configuration.nix
];
};
# New Storage Server - Z77 + Intel Core i5-3770k (2012)
yoshi = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [
./hosts/yoshi/configuration.nix
];
};
# Dell OptiPlex 7050 Micro - Intel Core i5 i5-6600T (purchased 2023)
kirby = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [
./hosts/kirby/configuration.nix
];
};
# Test VM on my desktop PC
goomba = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [
./hosts/goomba/configuration.nix
];
};
# VFIO Gaming VM on my desktop PC
bowser = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [
./hosts/bowser/configuration.nix
];
};
# Sec VM on laptop
stalfos = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [
./hosts/stalfos/configuration.nix
];
};
# Old PC - Q6600
birdo = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [
./hosts/birdo/configuration.nix
];
};
# Router - Dell OptiPlex 5080 SFF - Intel Core i5-10500 (purchased 2023)
lakitu = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [
./hosts/lakitu/configuration.nix
];
};
};
# Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname'
# If you don't have home-manager installed, try
# `nix shell nixpkgs#home-manager`.
homeConfigurations = {
# Looks like the homeConfigurations can be host-specific, such
# as samh@yoshi, or just "samh".
# If I have both, is the host-specific one used?
"samh@nixos-2022-desktop" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
extraSpecialArgs = {inherit inputs outputs;};
modules = [./home-manager/nixos-2022-desktop.nix];
};
"samh@fwnixos" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
extraSpecialArgs = {inherit inputs outputs;};
modules = [./home-manager/fwnixos.nix];
};
"samh" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
extraSpecialArgs = {inherit inputs outputs;};
# > Our main home-manager configuration file <
modules = [./home-manager/generic.nix];
};
};
};
}