forked from nomadics9/NixOS-Flake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
168 lines (159 loc) · 5.26 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
{
description = "My NixOS configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
hardware.url = "github:nixos/nixos-hardware";
impermanence.url = "github:nix-community/impermanence";
nix-colors.url = "github:misterio77/nix-colors";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland = {
url = "git+https://github.com/hyprwm/Hyprland?submodules=1";
inputs.aquamarine.url = "github:hyprwm/aquamarine";
};
hyprwm-contrib = {
url = "github:hyprwm/contrib";
inputs.nixpkgs.follows = "nixpkgs";
};
firefox-addons = {
url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
inputs.nixpkgs.follows = "nixpkgs";
};
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = {
url = "github:mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-stable.follows = "nixpkgs";
};
firefox = {
url = "github:nix-community/flake-firefox-nightly";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs@{ self, nixpkgs, home-manager, pre-commit-hooks, nixvim, ... }:
let
inherit (self) outputs;
lib = nixpkgs.lib // home-manager.lib;
systems = [ "x86_64-linux" ];
forEachSystem = f:
lib.genAttrs systems (system: f system pkgsFor.${system});
pkgsFor = lib.genAttrs systems (system:
import nixpkgs {
inherit system;
config.allowUnfree = true;
});
addPreCommitCheck = system: {
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
nixfmt-classic.enable = true;
nil.enable = true;
shellcheck.enable = true;
black.enable = true;
deadnix = {
enable = true;
settings = {
edit = true;
noLambdaArg = true;
exclude = [ "hardware-configuration.nix" ];
};
};
statix = {
enable = true;
settings = { ignore = [ "hardware-configuration.nix" ]; };
};
};
};
};
in {
nixosModules = builtins.listToAttrs (map (x: {
name = x;
value = import (./modules/nixos + "/${x}");
}) (builtins.attrNames (builtins.readDir ./modules/nixos)));
homeModules = import ./modules/home-manager;
checks = forEachSystem (system: pkgs: addPreCommitCheck system);
packages = forEachSystem (system: pkgs: import ./pkgs { inherit pkgs; });
devShells = forEachSystem
(system: pkgs: import ./shell.nix { inherit self system pkgs; });
formatter = forEachSystem (system: pkgs: pkgs.nixfmt-classic);
nixosConfigurations = {
# Main desktop
gecko = let user = "justin";
in lib.nixosSystem {
modules = [
./hosts/gecko
home-manager.nixosModules.default
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit user self inputs outputs nixvim;
pkgs = pkgsFor.x86_64-linux;
};
users."${user}" = {
imports =
[ ./home/justin/gecko.nix ./home/common/nixpkgs.nix ];
};
};
}
{ imports = builtins.attrValues self.nixosModules; }
];
specialArgs = { inherit user self inputs outputs; };
};
# Work laptop
lnxclnt2840 = let user = "jusson";
in lib.nixosSystem {
modules = [
./hosts/lnxclnt2840
home-manager.nixosModules.default
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit user self inputs outputs nixvim;
pkgs = pkgsFor.x86_64-linux;
};
users."${user}" = {
imports =
[ ./home/jusson/lnxclnt2840.nix ./home/common/nixpkgs.nix ];
};
};
}
{ imports = builtins.attrValues self.nixosModules; }
];
specialArgs = { inherit user self inputs outputs; };
};
};
homeConfigurations = {
# Desktops
"jusson@lnxclnt2840" = lib.homeManagerConfiguration {
modules = [ ./home/jusson/lnxclnt2840.nix ./home/common/nixpkgs.nix ];
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = {
inherit self inputs outputs nixvim;
user = "jusson";
};
};
"justin@gecko" = lib.homeManagerConfiguration {
modules = [ ./home/justin/gecko.nix ./home/common/nixpkgs.nix ];
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = {
inherit self inputs outputs nixvim;
user = "justin";
};
};
};
};
}