-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
191 lines (159 loc) · 5.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
{
description = "NixOS modules supporting my development environments";
inputs = {
nixos-hardware.url = "github:nixos/nixos-hardware";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
alternaut-vim = {
url = "github:PsychoLlama/alternaut.vim";
flake = false;
};
navitron-nvim = {
url = "github:PsychoLlama/navitron.nvim";
flake = false;
};
deja-view-vim = {
url = "github:PsychoLlama/deja-view.vim";
flake = false;
};
teleport-vim = {
url = "github:PsychoLlama/teleport.vim";
flake = false;
};
tree-sitter-remix.url = "github:PsychoLlama/tree-sitter-remix";
};
outputs =
flake-inputs@{
self,
nixos-hardware,
nixpkgs,
nixpkgs-unstable,
tree-sitter-remix,
home-manager,
...
}:
let
lib = import ./lib flake-inputs;
# Packages with unfree licenses. To be replaced with libre alternatives.
evilPackages = [ "copilot.vim" ];
# The list of systems supported by nixpkgs and hydra.
defaultSystems = [
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
"x86_64-linux"
];
importPkgs =
system:
import nixpkgs {
inherit system;
overlays = [
tree-sitter-remix.overlays.custom-grammars
self.overlays.latest-packages
self.overlays.vim-plugins
];
config = {
allowUnfreePredicate = pkg: lib.elem (lib.getName pkg) evilPackages;
};
};
# { system -> pkgs }
pkgsBySystem = lib.genAttrs defaultSystems importPkgs;
# (system: pkgs: a) -> { system -> a }
eachSystem = lib.flip lib.mapAttrs pkgsBySystem;
in
{
nixpkgs = pkgsBySystem;
lib = lib.dotfiles // {
inherit eachSystem;
};
nixosModules = {
editor-platform = ./platforms/editor/modules;
editor-configs = ./platforms/editor/modules/psychollama;
home-manager-platform = ./platforms/home-manager/modules;
home-manager-configs = ./platforms/home-manager/modules/psychollama;
nixos-platform = ./platforms/nixos/modules;
nixos-configs = ./platforms/nixos/modules/psychollama;
};
overlays = {
latest-packages = import ./lib/overlays/latest-packages.nix flake-inputs;
vim-plugins = import ./lib/overlays/vim-plugins.nix flake-inputs;
};
nixosConfigurations = lib.dotfiles.hosts.nixos {
ava = {
pkgs = pkgsBySystem.x86_64-linux;
modules = [
nixos-hardware.nixosModules.lenovo-thinkpad-p1-gen3
nixpkgs.nixosModules.notDetected
./hosts/ava
];
};
};
homeConfigurations = lib.dotfiles.hosts.home-manager {
overlord = {
pkgs = pkgsBySystem.x86_64-linux;
modules = [ ./hosts/tars ];
};
};
templates = {
project = {
description = "Flake environment with no assumptions";
path = ./templates/project;
};
js = {
description = "Flake environment for building JavaScript projects";
path = ./templates/js;
};
rust = {
description = "Flake environment for building Rust projects";
path = ./templates/rust;
};
};
packages = eachSystem (
system: pkgs: rec {
nixos-configs-doc = pkgs.callPackage lib.dotfiles.generateMarkdownDocs {
platform = "nixos";
prefix = "psychollama.";
modules = [
home-manager.nixosModules.home-manager
self.nixosModules.nixos-platform
self.nixosModules.nixos-configs
];
};
editor-configs-doc = pkgs.callPackage lib.dotfiles.generateMarkdownDocs {
prefix = "psychollama.";
modules = [
self.nixosModules.editor-platform
self.nixosModules.editor-configs
];
};
docs-website =
pkgs.runCommand "generate-docs-website"
{
buildInputs = [ pkgs.mdbook ];
}
''
cp --no-preserve=mode --recursive "${self.outPath}/docs" docs/
cp "${nixos-configs-doc}/options.md" docs/src/nixos.md
cp "${editor-configs-doc}/options.md" docs/src/editor.md
ls -lAh docs
mdbook build docs/ --dest-dir "$out"
'';
editor = lib.dotfiles.buildEditor {
inherit pkgs;
modules = [
self.nixosModules.editor-configs
{ psychollama.profiles.full.enable = true; }
];
};
}
);
};
}