-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
137 lines (120 loc) · 3.96 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
{
description = "My NixOS configuration";
nixConfig = {
extra-experimental-features = "nix-command flakes";
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
hardware.url = "github:NixOS/nixos-hardware";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs.nixpkgs.follows = "nixpkgs";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-colors.url = "github:misterio77/nix-colors";
spicetify-nix = {
url = "github:Gerg-L/spicetify-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
vscode-server.url = "github:nix-community/nixos-vscode-server";
};
outputs =
{
self,
nixpkgs,
home-manager,
deploy-rs,
...
}@inputs:
let
inherit (self) outputs;
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
# Helper functions
mkSystem =
hostname: system: modules:
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs outputs;
};
modules = modules ++ [ ./hosts/${hostname} ];
};
mkHome =
username: hostname: system: extraModules:
home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system};
extraSpecialArgs = {
inherit inputs outputs;
};
modules = [ ./home/${username}/${hostname}.nix ] ++ extraModules;
};
# Common configurations
wslConfig = [ ./home/jamie/wsl.nix ];
in
{
nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager;
overlays = import ./overlays;
packages = forAllSystems (system: import ./pkgs { pkgs = nixpkgs.legacyPackages.${system}; });
devShells = forAllSystems (system: {
default = nixpkgs.legacyPackages.${system}.callPackage ./shell.nix { };
});
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style);
nixosConfigurations = {
jamie-desktop = mkSystem "jamie-desktop" "x86_64-linux" [ ];
rpi = mkSystem "rpi" "aarch64-linux" [ ];
jamie-hyperv = mkSystem "jamie-hyperv" "x86_64-linux" [ ];
alfred = mkSystem "alfred" "x86_64-linux" [ ];
};
homeConfigurations = {
"jamie@jamie-desktop" = mkHome "jamie" "wsl" "x86_64-linux" [ ];
"jamie@rpi" = mkHome "jamie" "rpi" "aarch64-linux" [ ];
"jamie@jamie-hyperv" = mkHome "jamie" "jamie-hyperv" "x86_64-linux" [ ];
"jamie@alfred" = mkHome "jamie" "alfred" "x86_64-linux" [ ];
"jamie@generic" = mkHome "jamie" "generic" "x86_64-linux" [ ];
"jamie@jamagee-desktop" = mkHome "jamie" "wsl" "x86_64-linux" [ ];
"jamie@JAMAGEE-SURFACE" = mkHome "jamie" "wsl" "x86_64-linux" [ ];
};
deploy = {
fastConnection = true;
magicRollback = false;
sshOpts = [ "-t" ];
nodes = {
rpi = {
hostname = "rpi.tailnet-0b15.ts.net";
sshOpts = [
"-p"
"2222"
];
profiles = {
system = {
user = "root";
path = deploy-rs.lib.aarch64-linux.activate.nixos self.nixosConfigurations.rpi;
};
home = {
user = "jamie";
path = deploy-rs.lib.aarch64-linux.activate.home-manager self.homeConfigurations."jamie@rpi";
};
};
};
};
};
# Add basic checks
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
};
}