-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
190 lines (165 loc) · 5.07 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
{
description = "Home Manager configuration of Kosumi";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
nurpkgs.url = "github:nix-community/NUR";
# for macos
# nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-24.11-darwin";
# nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-unstable";
# nix-darwin = {
# url = "github:lnl7/nix-darwin";
# inputs.nixpkgs.follows = "nixpkgs-darwin";
# };
# NixOS profiles to optimize settings for different hardware.
# nixos-hardware.url = "github:NixOS/nixos-hardware/master";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
homeage = {
url = "github:jordanisaacs/homeage";
inputs.nixpkgs.follows = "nixpkgs";
};
# agenix = {
# inputs.nixpkgs.follows = "nixpkgs";
# url = "github:yaxitech/ragenix";
# };
#Declarative disk partitioning and formatting using nix
# disko = {
# inputs.nixpkgs.follows = "nixpkgs";
# url = "github:nix-community/disko";
# };
# add git hooks to format nix code before commit
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# haumea = {
# url = "github:nix-community/haumea/v0.2.2";
# inputs.nixpkgs.follows = "nixpkgs";
# };
# rycee-nurpkgs = {
# url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
# inputs.nixpkgs.follows = "nixpkgs";
# };
neovim-flake = {
# url = "github:notashelf/neovim-flake";
url = "github:KaminariOS/neovim-flake/master";
# neovim-flake pushes its binaries to the cache using its own nixpkgs version
# if we instead use ours, we'd be rebuilding all plugins from scratch
inputs.nixpkgs.follows = "nixpkgs";
};
# Fish shell
fish-bobthefish-theme = {
url = "github:gvolpe/theme-bobthefish";
flake = false;
};
fish-keytool-completions = {
url = "github:ckipp01/keytool-fish-completions";
flake = false;
};
# Github Markdown ToC generator
gh-md-toc = {
url = "github:ekalinin/github-markdown-toc";
flake = false;
};
# LaTeX stuff
tex2nix = {
#url = github:Mic92/tex2nix;
url = "github:gvolpe/tex2nix"; # fork with nixFlakes fix
inputs.nixpkgs.follows = "nixpkgs";
};
stylix = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:danth/stylix";
};
};
outputs = {
self,
nixpkgs,
pre-commit-hooks,
...
} @ inputs: let
forDefaultSystems = inputs.nixpkgs.lib.genAttrs [
"aarch64-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
forLinuxSystems = inputs.nixpkgs.lib.genAttrs [
"aarch64-linux"
"x86_64-linux"
];
forAllHosts = inputs.nixpkgs.lib.genAttrs [
"savior"
"portable"
"redmoon"
];
in {
formatter = forDefaultSystems (system: inputs.nixpkgs.legacyPackages.${system}.alejandra);
packages = forDefaultSystems (system: {
homeConfigurations = import ./outputs/home-conf.nix {
inherit inputs system;
};
nixosConfigurations = import ./outputs/nixos-conf.nix {
inherit inputs system;
};
});
checks = forDefaultSystems (
system: {
# eval-tests per system
# eval-tests = allSystems.${system}.evalTests == {};
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ".";
hooks = {
alejandra.enable = !true; # formatter
# Source code spell checker
typos = {
enable = true;
settings = {
write = true; # Automatically fix typos
configPath = "./.typos.toml"; # relative to the flake root
};
};
prettier = {
enable = false;
settings = {
write = true; # Automatically format files
configPath = "./.prettierrc.yaml"; # relative to the flake root
};
};
# deadnix.enable = true; # detect unused variable bindings in `*.nix`
# statix.enable = true; # lints and suggestions for Nix code(auto suggestions)
};
};
}
);
# Development Shells
devShells = forDefaultSystems (
system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
default = pkgs.mkShell {
packages = with pkgs; [
# fix https://discourse.nixos.org/t/non-interactive-bash-errors-from-flake-nix-mkshell/33310
bashInteractive
# fix `cc` replaced by clang, which causes nvim-treesitter compilation error
gcc
# Nix-related
alejandra
deadnix
statix
# spell checker
typos
# code formatter
# nodePackages.prettier
];
name = "dots";
shellHook = ''
${self.checks.${system}.pre-commit-check.shellHook}
'';
};
}
);
};
}