-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
131 lines (118 loc) · 3.24 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
{
description = "Pierrot's dotfiles";
nixConfig = {
extra-substituters = [
"https://nix-community.cachix.org"
# GPU related stuff.
"https://cuda-maintainers.cachix.org"
"https://ploop.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
"ploop.cachix.org-1:i6+Fqarsbf5swqH09RXOEDvxy7Wm7vbiIXu4A9HCg1g="
];
};
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
# Weekly updated nix-index database.
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
# My Neovim derivation.
nvim-nix = {
url = "github:pierrot-lc/nvim-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# My Librewolf derivation.
librewolf-nix = {
url = "github:pierrot-lc/librewolf-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# Some private informations.
private = {
url = "git+ssh://[email protected]/pierrot-lc/dotfiles-private";
inputs.nixpkgs.follows = "nixpkgs";
};
# Extra packages.
# ...
};
outputs = inputs @ {
self,
nixpkgs,
home-manager,
...
}: let
system = "x86_64-linux";
lib = nixpkgs.lib;
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
};
overlays = [
# ...
];
};
# Mappings of specific configurations for each hosts. It is used in
# `concatMapAttrs` which needs an attribute set to work so we add dumb
# values.
hosts = {
"big-tower" = null;
"t15" = null;
"x250" = null;
};
nixosConfigurationsParser = {
"big-tower" = ./hosts/big-tower/configuration.nix;
"t15" = ./hosts/t15/configuration.nix;
"x250" = ./hosts/x250/configuration.nix;
};
optionsParser = {
"big-tower" = ./hosts/big-tower/options.nix;
"t15" = ./hosts/t15/options.nix;
"x250" = ./hosts/x250/options.nix;
};
in {
nixosConfigurations =
lib.attrsets.concatMapAttrs (host: _: {
${host} = lib.nixosSystem {
inherit system;
specialArgs = {
private = inputs.private;
};
modules = [
./configuration
./options
inputs.private.secrets
nixosConfigurationsParser.${host}
optionsParser.${host}
];
};
})
hosts;
homeConfigurations =
lib.attrsets.concatMapAttrs (host: _: {
"pierrot-lc@${host}" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = {
username = "pierrot-lc";
private = inputs.private;
};
modules = [
./home
./options
inputs.librewolf-nix.hmModules.${system}.default
inputs.nix-index-database.hmModules.nix-index
inputs.nvim-nix.hmModules.${system}.default
optionsParser.${host}
];
};
})
hosts;
};
}