-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
161 lines (143 loc) · 4.94 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
{
description = "Personal NixOs flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland = {
url = "github:hyprwm/Hyprland";
inputs.nixpkgs.follows = "nixpkgs";
};
# hyprlock is part of the hyprland overlay, but i want it up to date for testing
hyprlock = {
url = "github:PaideiaDilemma/hyprlock?ref=greetdLogin";
inputs.nixpkgs.follows = "nixpkgs";
inputs.hyprlang.follows = "hyprland";
inputs.hyprutils.follows = "hyprland";
};
hyprland-contrib = {
url = "github:hyprwm/contrib";
inputs.nixpkgs.follows = "hyprland/nixpkgs";
};
lazyvim = {
url = "github:PaideiaDilemma/LazyVim";
flake = false;
};
# Simplify once lazy trees are available https://github.com/NixOS/nix/pull/6530
wlclipmgr = {
url = "git+https://www.github.com/PaideiaDilemma/wlclipmgr?submodules=1";
#inputs.nixpkgs.follows = "nixpkgs"; // does not find procps for some reason
};
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
# Community packages; used for Firefox extensions
nur.url = "github:nix-community/nur";
nixos-wsl.url = "github:nix-community/NixOS-WSL";
waybar = {
url = "github:Alexays/Waybar";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
home-manager,
...
} @ inputs: let
overlays = [
inputs.nur.overlays.default
inputs.hyprland.overlays.default
inputs.hyprlock.overlays.default
(import ./overlays/deepin-cursors.nix)
(import ./overlays/patchelfdd-overlay.nix)
(import ./overlays/python-packages-overlay.nix)
(import ./overlays/scripts-overlay.nix)
(final: prev: {
git-moduletree = inputs.git-moduletree.packages.${prev.system}.default;
})
(final: prev: {
waybar = inputs.waybar.packages.${prev.system}.default;
})
];
mkNixos = hardware: host: homeVariant: username: system:
nixpkgs.lib.nixosSystem rec {
inherit system;
specialArgs = {
inherit inputs;
inherit overlays;
};
modules = [
./hardware/${hardware}.nix
./host
./host/variants/${host}.nix
home-manager.nixosModules.home-manager
({...}: {
nix.registry.nixpkgs.flake = nixpkgs;
users.users.${username} = {
isNormalUser = true;
extraGroups = ["wheel" "networkmanager" "audio" "video" "input" "dialout"];
};
users.users.root.password = "nixos";
networking.hostName = "${hardware}";
})
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = specialArgs;
home-manager.users.${username} = {...}: {
imports = [
inputs.hyprland.homeManagerModules.default
./home
./home/variants/${homeVariant}.nix
];
hyprhome.username = username;
};
}
];
};
mkHome = homeVariant: username: pkgs:
home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = {
inherit inputs;
};
modules = [
inputs.hyprland.homeManagerModules.default
({...}: {
imports = [./home ./home/variants/${homeVariant}.nix];
hyprhome.username = username;
nixpkgs = {
config.allowUnfree = true;
inherit overlays;
};
})
];
};
in {
nixosConfigurations = {
iso = mkNixos "minimal" "minimal" "minimal" "max" "x86_64-linux";
vm = mkNixos "vm1" "minimal" "minimal" "max" "x86_64-linux";
laptop = mkNixos "laptop" "default" "laptop" "max" "x86_64-linux";
desktop = mkNixos "desktop" "desktop" "desktop" "max" "x86_64-linux";
# currently it is handier for the username to just be "nixos"
# https://discourse.nixos.org/t/set-default-user-in-wsl2-nixos-distro/38328/3
wsl = mkNixos "minimal" "wsl" "wsl" "nixos" "x86_64-linux";
};
# allow home-manager switch --flake .#configuration to work
homeConfigurations = {
"max@vm" = mkHome "minimal" "max" nixpkgs.legacyPackages.x86_64-linux;
"max@laptop" = mkHome "laptop" "max" nixpkgs.legacyPackages.x86_64-linux;
"max@desktop" = mkHome "desktop" "max" nixpkgs.legacyPackages.x86_64-linux;
"nixos@wsl" = mkHome "wsl" "nixos" nixpkgs.legacyPackages.x86_64-linux;
};
devShells.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.mkShell {
name = "dotnix";
packages = with nixpkgs.legacyPackages.x86_64-linux; [
alejandra
git
];
};
formatter = nixpkgs.legacyPackages.x86_64-linux.alejandra;
};
}