-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
155 lines (125 loc) · 4.23 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
{
description = "uima's nixos config";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11";
# nixpkgs-local.url = "git+file:///home/uima/src/nixpkgs";
systems.url = "github:nix-systems/default-linux";
pre-commit-hooks.url = "github:cachix/git-hooks.nix";
treefmt-nix.url = "github:numtide/treefmt-nix";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nur.url = "github:nix-community/NUR";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.url = "github:mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
impermanence.url = "github:nix-community/impermanence";
stylix.url = "github:danth/stylix";
stylix.inputs.nixpkgs.follows = "nixpkgs";
arkenfox.url = "github:dwarfmaster/arkenfox-nixos";
arkenfox.inputs.nixpkgs.follows = "nixpkgs";
nixcord.url = "github:kaylorben/nixcord";
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
nixos-wsl.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{
self,
nixpkgs,
home-manager,
systems,
treefmt-nix,
...
}@inputs:
let
inherit (self) outputs;
lib = nixpkgs.lib // home-manager.lib;
# Generate attrset for each system
forAllSystems = lib.genAttrs (import systems);
inputPkgsFor =
pkgs:
forAllSystems (
system:
import pkgs {
inherit system;
config.allowUnfree = true;
}
);
# Nixpkgs for each system
nixpkgsFor = inputPkgsFor nixpkgs;
# Eval the treefmt modules from ./treefmt.nix
treefmtEval = forAllSystems (system: treefmt-nix.lib.evalModule nixpkgsFor.${system} ./treefmt.nix);
# SpecialArgs that share between nixosConfig and homeConfig
specialArgs = forAllSystems (system: {
inherit inputs outputs;
pkgs-stable = (inputPkgsFor inputs.nixpkgs-stable).${system};
# pkgs-local = (inputPkgsFor inputs.nixpkgs-local).${system};
});
nixosConfig =
{ modules, system }:
lib.nixosSystem {
pkgs = nixpkgsFor.${system};
specialArgs = specialArgs.${system};
modules = modules ++ [
outputs.nixosModules
home-manager.nixosModules.home-manager
{
home-manager = {
sharedModules = [ outputs.homeManagerModules ];
extraSpecialArgs = specialArgs.${system};
};
}
];
};
homeConfig =
{ modules, system }:
lib.homeManagerConfiguration {
pkgs = nixpkgsFor.${system};
extraSpecialArgs = specialArgs.${system};
modules = modules ++ [ outputs.homeManagerModules ];
};
in
{
inherit lib;
nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager;
nixosConfigurations = {
uicom = nixosConfig {
modules = [ ./hosts/uicom ];
system = "x86_64-linux";
};
araizen = nixosConfig {
modules = [ ./hosts/araizen ];
system = "x86_64-linux";
};
};
# TODO: not tested yet
homeConfigurations = {
"uima@uicom" = homeConfig {
modules = [ ./users/uima/uicom ];
system = "x86_64-linux";
};
};
overlays = import ./overlays { inherit inputs outputs; };
packages = forAllSystems (system: import ./pkgs { pkgs = nixpkgsFor.${system}; });
templates = import ./templates;
formatter = forAllSystems (system: treefmtEval.${system}.config.build.wrapper);
devShells = forAllSystems (
system:
import ./shell.nix {
pkgs = nixpkgsFor.${system};
pre-commit-check = self.checks.${system}.pre-commit-check;
}
);
checks = forAllSystems (system: {
formatting = treefmtEval.${system}.config.build.check self;
pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
# treefmt.enable = true;
};
};
});
};
}