-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
123 lines (96 loc) · 3.51 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
{
description = "My amazing NixOS config! Very WIP.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05";
nixos-hardware.url = "github:huantianad/nixos-hardware/master";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
home-manager-stable.url = "github:nix-community/home-manager/release-24.05";
home-manager-stable.inputs.nixpkgs.follows = "nixpkgs-stable";
aw-watcher-custom.url = "github:huantianad/aw-watcher-custom";
aw-watcher-custom.inputs.nixpkgs.follows = "nixpkgs";
nixinate.url = "github:matthewcroughan/nixinate";
nixinate.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.inputs.nixpkgs-stable.follows = "nixpkgs-stable";
minifluxng.url = "sourcehut:~bwolf/miniflux.nix";
minifluxng.inputs.nixpkgs.follows = "nixpkgs";
nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
nix-vscode-extensions.inputs.nixpkgs.follows = "nixpkgs";
lanzaboote.url = "github:nix-community/lanzaboote/v0.4.1";
lanzaboote.inputs.nixpkgs.follows = "nixpkgs";
nix-index-database.url = "github:nix-community/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
nix-gaming.url = "github:fufexan/nix-gaming";
nix-gaming.inputs.nixpkgs.follows = "nixpkgs";
glaumar.url = "github:glaumar/nur";
glaumar.inputs.nixpkgs.follows = "nixpkgs";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs @ {
self,
nixpkgs,
...
}: let
defaultSystem = "x86_64-linux";
allOverlays = [self.overlay] ++ (lib.attrValues self.overlays);
mkPkgs = pkgsArg: systemArg:
import pkgsArg {
system = systemArg;
config.allowUnfree = true;
overlays = allOverlays;
};
pkgs = mkPkgs nixpkgs defaultSystem;
lib = nixpkgs.lib.extend (self: super: {
my = import ./lib {
inherit pkgs inputs;
lib = self;
};
});
mapHosts = path: nixpkgsType: system: let
table =
{
unstable = {
nixpkgs = nixpkgs;
home-manager = inputs.home-manager;
};
stable = {
nixpkgs = inputs.nixpkgs-stable;
home-manager = inputs.home-manager-stable;
};
}
.${nixpkgsType};
thisPkgs = mkPkgs table.nixpkgs system;
thisLib = table.nixpkgs.lib.extend (self: super: {
my = import ./lib {
inherit inputs;
pkgs = thisPkgs;
lib = self;
};
});
in
thisLib.my.mapHosts path
{
nixosSystem = table.nixpkgs.lib.nixosSystem;
system = system;
home-manager = table.home-manager;
overlays = allOverlays;
};
in {
lib = lib.my;
nixosModules = lib.my.mapModulesRec ./modules import;
nixosConfigurations =
(mapHosts ./hosts/unstable/x86_64-linux "unstable" "x86_64-linux")
// (mapHosts ./hosts/stable/x86_64-linux "stable" "x86_64-linux")
// (mapHosts ./hosts/stable/aarch64-linux "stable" "aarch64-linux");
apps = inputs.nixinate.nixinate."${defaultSystem}" self;
packages."${defaultSystem}" = import ./packages {inherit pkgs;};
overlay = final: prev: {
my = self.packages."${defaultSystem}";
};
overlays = lib.my.mapModules ./overlays import;
};
}