-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
150 lines (138 loc) · 4.03 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
{
description = "S1rDev10us' dotfiles";
inputs = {
nixpkgs.url = "nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
stylix = {
url = "github:danth/stylix/release-24.05";
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
};
};
nixos-wsl = {
url = "github:nix-community/NixOS-WSL/main";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-compat = {
url = "github:inclyc/flake-compat";
flake = false;
};
ags = {
url = "github:Aylur/ags";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-hardware.url = "github:NixOs/nixos-hardware";
anyrun = {
url = "github:anyrun-org/anyrun";
inputs.nixpkgs.follows = "nixpkgs";
};
firefox-extensions = {
url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
ags,
...
} @ inputs: let
inherit (self) outputs;
lib = nixpkgs.lib;
libx = import ./utils (parameters
// {
inherit nixpkgs lib options;
});
hosts = libx.allFrom ./hosts;
# hosts = lib.filter (machine: ! (lib.elem machine ["hydra"])) (libx.allFrom ./hosts);
users = libx.allFrom ./users;
parameters = {
inherit inputs outputs libx;
};
options = libx.allModulesFrom ./options;
allSystems = lib.systems.flakeExposed;
forAllSystems = f:
lib.genAttrs allSystems (system:
f {
inherit system;
systemPkgs = nixpkgs.legacyPackages.${system};
});
in {
templates = lib.genAttrs (libx.allFrom ./resources/templates) (template: let
templateFolder = ./resources/templates/${template};
templateFlake = templateFolder + "/flake.nix";
in {
path = templateFolder;
description = let
templateFlakeExists = builtins.pathExists templateFlake;
placeholderDescription = "Template for ${template}";
in
if templateFlakeExists
then ({description = placeholderDescription;} // import templateFlake).description
else placeholderDescription;
});
nixosConfigurations =
lib.genAttrs hosts
(
host: let
evaluatedOptions = libx.getHostSettings host;
in
libx.makeHost {
inherit host;
evaluatedOptions = evaluatedOptions.config;
stateVersion = evaluatedOptions.config.stateVersion;
specialArgs = parameters;
}
);
homeConfigurations = builtins.listToAttrs (lib.flatten (builtins.map
(
host: let
hostOptions = libx.getHostSettings host;
in (builtins.map
(user: let
evaluatedOptions = libx.getHomeSettings host user;
in {
name = user + "@" + host;
value = libx.makeHome {
inherit host user;
evaluatedOptions = evaluatedOptions.config;
stateVersion = evaluatedOptions.config.stateVersion;
specialArgs = parameters;
};
})
(builtins.filter (user: hostOptions.config.users.${user}.enable) users))
)
hosts));
devShells = forAllSystems ({
systemPkgs,
system,
...
}: {
default = systemPkgs.mkShell {
packages = with systemPkgs; [
just
alejandra
nodejs_22
];
shellHook = ''
echo "linking types"
ln -sf ${ags.packages.${system}.default}/share/com.github.Aylur.ags/types ./resources/ags-dots/
'';
};
});
packages = forAllSystems ({
systemPkgs,
system,
}: rec {
ags = systemPkgs.callPackage ./resources/ags-dots/default.nix {
ags = inputs.ags.packages.${system}.default;
};
onhomenetwork = systemPkgs.callPackage ./resources/pkgs/onhomenetwork/default.nix {};
});
};
}