-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
161 lines (137 loc) · 4.07 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
# Test as eg.
# nixos-rebuild build-vm --flake .#vimes-vm
{
description = "Declares my host configurations";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
home-manager.url = "github:nix-community/home-manager/release-24.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nthorne-zsh = {
url = "github:nthorne/nthorne-zsh-environment";
flake = false;
};
nixvim = {
url = "github:nix-community/nixvim";
# If you are not running an unstable channel of nixpkgs, select the corresponding branch of nixvim.
# url = "github:nix-community/nixvim/nixos-23.05";
# TODO: This should be enabled, but does not build currently..
#inputs.nixpkgs.follows = "nixpkgs";
};
stylix.url = "github:danth/stylix";
};
outputs = {
self,
nixpkgs,
unstable,
home-manager,
stylix,
...
} @ inputs: let
# Pin nixpkgs in the flake registry to what we use for the system
pin-registries = {...}: {
nix = {
registry = {
nixpkgs.flake = nixpkgs;
nixpkgs-unstable.flake = unstable;
};
};
};
pkgs-unstable = import unstable {
inherit system;
config.allowUnfree = true;
};
system = "x86_64-linux";
vimes-modules = [
./configuration.nix
./work/hardware-config/hardware-config-generated.nix
./work/adaptation.nix
{
_module.args = {
unstable = pkgs-unstable;
};
}
stylix.nixosModules.stylix
pin-registries
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.nthorne = import ./home-manager/home.nix;
home-manager.extraSpecialArgs.flake-inputs =
inputs
// {
hostname = "vimes";
system = "${system}";
};
}
];
nixlaptop-modules = [
./configuration.nix
./hardware-configuration.nix
./laptop/adaptation.nix
stylix.nixosModules.stylix
pin-registries
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.nthorne = import ./home-manager/home.nix;
home-manager.extraSpecialArgs.flake-inputs =
inputs
// {
hostname = "nixlaptop";
system = "${system}";
};
}
];
wifiDevice = "wlp0s20f3";
in {
formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style;
nixosConfigurations.vimes = nixpkgs.lib.nixosSystem {
system = "${system}";
modules = vimes-modules;
};
nixosConfigurations.nixlaptop = nixpkgs.lib.nixosSystem {
system = "${system}";
modules = nixlaptop-modules;
};
# Theese are for testing purposes
nixosConfigurations.vimes-vm = nixpkgs.lib.nixosSystem {
system = system;
modules =
vimes-modules
++ [
(
{...}: {
#services.openssh.enable = true;
#services.openssh.permitRootLogin = "yes";
#users.extraUsers.root.password = "";
users.extraUsers."nthorne".password = "nthorne";
users.mutableUsers = false;
systemd.services = {
"network-link-${wifiDevice}".wantedBy = nixpkgs.lib.mkForce [];
"network-addresses-${wifiDevice}".wantedBy = nixpkgs.lib.mkForce [];
};
}
)
];
};
nixosConfigurations.nixlaptop-vm = nixpkgs.lib.nixosSystem {
system = system;
modules =
nixlaptop-modules
++ [
(
{...}: {
#services.openssh.enable = true;
#services.openssh.permitRootLogin = "yes";
#users.extraUsers.root.password = "";
users.extraUsers."nthorne".password = "nthorne";
users.mutableUsers = false;
}
)
];
};
};
}