-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
201 lines (178 loc) · 5.8 KB
/
flake.nix
File metadata and controls
201 lines (178 loc) · 5.8 KB
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
192
193
194
195
196
197
198
199
200
201
rec {
description = "Home Manager configuration of ankit";
inputs = {
# Specify the source of Home Manager and Nixpkgs.
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
nixgl = {
url = "github:nix-community/nixGL";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
kit = {
url = "path:modules";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:nix-community/nixvim"; # This is one that works with current nixpkgs lock. Will need to update this when nixpkgs is updated.
# I just searched git log of nixvim for commit hash of current nixpkgs
# If using a stable channel you can use `url = "github:nix-community/nixvim/nixos-<version>"`
inputs.nixpkgs.follows = "nixpkgs";
};
# doom-emacs is a configuration framework for GNU Emacs.
doomemacs = {
url = "github:doomemacs/doomemacs";
flake = false;
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nur = {
url = "github:nix-community/NUR";
inputs.nixpkgs.follows = "nixpkgs";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
volume_control_rs = {
url = "path:softwares/volume_control";
inputs.nixpkgs.follows = "nixpkgs";
inputs.utils.follows = "flake-utils";
};
};
outputs =
{
self,
nixpkgs,
nixos-hardware,
home-manager,
nixvim,
nur,
disko,
...
}@inputs:
let
mkSystem =
{
hostname,
extraModules ? [ ],
autoIncludeDeviceModule ? true,
username ? "kit",
}:
nixpkgs.lib.nixosSystem {
# NOTE: Change this to aarch64-linux if you are on ARM
inherit system;
specialArgs = {
inherit inputs;
inherit system;
inherit hostname;
inherit username;
};
modules = [
home-manager.nixosModules.home-manager
inputs.nur.modules.nixos.default
disko.nixosModules.disko
inputs.kit.nixosModules.default
(
{ inputs, ... }:
{
nix.settings = {
substituters = nixConfig.extra-substituters;
trusted-public-keys = nixConfig.extra-trusted-public-keys;
};
home-manager.sharedModules = [
inputs.kit.hm.default
];
}
)
]
++ extraModules
++ (if (autoIncludeDeviceModule) then [ ./devices/${hostname} ] else [ ]);
};
system = "x86_64-linux";
pkgs = import nixpkgs {
system = system;
overlays = [
inputs.nur.overlays.default
inputs.nixgl.overlay
];
config = {
allowUnfree = true;
allowUnfreePredicate = _: true;
};
};
in
{
devShells.${system}.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
git-crypt
];
};
# ===== Home-manager only configs
homeConfigurations."shifu" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
# Specify your home configuration modules here, for example,
# the path to your home.nix.
modules = [
./devices/shifu/home.nix
inputs.kit.hm.default
];
extraSpecialArgs = {
inherit inputs;
inherit system;
# wezterm didn't work with only vulkan, zed didn't work with only GL.
# But can't include vulkan as it can break non-gui packages due to llvm lib in `LD_LIBRARY_PATH`. So open-gl globally, and vulkan for specific packages after: https://github.com/nix-community/home-manager/pull/5355, right now it is manual: `nixgl-vulkan-run ....`
nixGLCommandPrefix = "${pkgs.nixgl.nixGLIntel}/bin/nixGLIntel ";
disableSwayLock = true;
};
};
homeConfigurations."shifu_remote" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
# Specify your home configuration modules here, for example,
# the path to your home.nix.
modules = [
./devices/shifu_remote/home.nix
inputs.kit.hm.default
];
extraSpecialArgs = {
inherit inputs;
inherit system;
};
};
# ===== Nixos configs
nixosConfigurations.monkey = mkSystem {
hostname = "monkey";
extraModules = [ nixos-hardware.nixosModules.lenovo-thinkpad-e14-amd ];
};
nixosConfigurations.iso = mkSystem { hostname = "iso"; };
nixosConfigurations.deepak = mkSystem {
hostname = "deepak";
username = "deepak";
};
nixosConfigurations.akanksha = mkSystem {
hostname = "akanksha";
username = "akanksha";
};
# TODO: disko config remaining
nixosConfigurations.oogway = mkSystem { hostname = "oogway"; };
# TODO: following configs to be in similar fashion as `monkey`
# i.e.
# 1. use fixed users,
# 2. rename configuration.nix -> default.nix
# 3. have home-manager config imported through default.nix
# 4. manage disk through disko
# ... or something I missed
nixosConfigurations.crane = mkSystem {
hostname = "crane";
autoIncludeDeviceModule = false;
extraModules = [ ./devices/crane ];
};
};
nixConfig = {
extra-substituters = [ "https://helix.cachix.org" ];
extra-trusted-public-keys = [ "helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs=" ];
};
}