-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
112 lines (99 loc) · 3.01 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
{
description = "NixOS and Home Manager Configuration Flake for my Hosts";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
nixos-wsl = {
url = "github:nix-community/NixOS-WSL/main";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
stylix = {
url = "github:danth/stylix/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-vscode-extensions = {
url = "github:nix-community/nix-vscode-extensions";
inputs.nixpkgs.follows = "nixpkgs";
};
arion = {
url = "github:hercules-ci/arion";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
walker = {
url = "github:abenz1267/walker";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
home-manager,
...
} @ inputs: let
inherit (self) outputs;
lib = nixpkgs.lib.extend (final: prev: (import ./lib final) // home-manager.lib);
packages = inputs.nixpkgs.legacyPackages;
mkSystem = {
system ? "x86_64-linux",
systemConfig,
userConfigs ? null,
}:
nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs outputs lib;
};
modules =
[
{nixpkgs.hostPlatform = system;}
./modules/nixos
systemConfig
]
++ lib.lists.optionals (userConfigs != null) [
home-manager.nixosModules.home-manager
{
home-manager.sharedModules = [./modules/home-manager ./hosts/shared/home.nix];
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = {inherit inputs outputs lib;};
home-manager.users = userConfigs;
}
];
};
mkHome = {
system ? "x86_64-linux",
cfgPath,
}:
home-manager.lib.homeManagerConfiguration {
pkgs = packages.${system};
extraSpecialArgs = {inherit inputs outputs lib;};
modules = [
./modules/home-manager
./hosts/shared/home.nix
cfgPath
];
};
in {
overlays = import ./overlays {
inherit inputs;
};
nixosConfigurations = {
wsl2 = mkSystem {systemConfig = ./hosts/wsl2/configuration.nix;};
thinkpad = mkSystem {systemConfig = ./hosts/thinkpad/configuration.nix;};
desktop = mkSystem {systemConfig = ./hosts/desktop/configuration.nix;};
};
homeConfigurations = {
wsl2 = mkHome {cfgPath = ./hosts/wsl2/home.nix;};
thinkpad = mkHome {cfgPath = ./hosts/thinkpad/home.nix;};
desktop = mkHome {cfgPath = ./hosts/desktop/home.nix;};
};
};
}