-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
190 lines (173 loc) · 6.27 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
rec {
description = "Home Manager configuration of ankit";
inputs = {
# Specify the source of Home Manager and Nixpkgs.
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs_working_openwebui.url = "github:nixos/nixpkgs/4633a7c72337ea8fd23a4f2ba3972865e3ec685d";
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";
kit.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";
};
helix_master = {
url = "github:helix-editor/helix";
# NOTE: do not follow inputs, otherwise the cache will be of no use and
# the sun will go out of fashion before nix-build switch finishes.
# I know it'll be more network/space usage, but time is of essense.
# inputs.nixpkgs.follows = "nixpkgs";
# inputs.flake-utils.follows = "flake-utils";
};
nur = {
url = "github:nix-community/NUR";
inputs.nixpkgs.follows = "nixpkgs";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
# TODO: This has been fixed in https://github.com/NixOS/nix/pull/10089
# Bring relevant code in this repo itself
#
# Nix doesn't have good support for importing flakes within same repo.
# if imported using path:... syntax, it uses narHash which might be missing
# from other developers machine.
# The way of merging inputs together and calling `outputs` directly works *until* inputs have duplicates
# So using seperate repo for this stuff. Ideally `dotfiles` repo can be used where you first push than nix flake update, but that seems confusing.
# To update use `nix flake lock --update-input volume_control_rs`
volume_control_rs = {
url = "github:nkitsaini/hive?dir=volume_control";
inputs.nixpkgs.follows = "nixpkgs";
inputs.utils.follows = "flake-utils";
};
};
outputs =
{
self,
nixpkgs,
nixos-hardware,
home-manager,
nixvim,
nixpkgs_working_openwebui,
nur,
disko,
...
}@inputs:
let
mkSystem =
{
hostname,
extraModules ? [ ],
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;
inherit pkgs_working_openwebui;
};
modules = [
./devices/${hostname}
home-manager.nixosModules.home-manager
inputs.nur.modules.nixos.default
disko.nixosModules.disko
(
{ inputs, ... }:
{
nix.settings = {
substituters = nixConfig.extra-substituters;
trusted-public-keys = nixConfig.extra-trusted-public-keys;
};
}
)
] ++ extraModules;
};
system = "x86_64-linux";
pkgs = import nixpkgs {
system = system;
overlays = [
inputs.nur.overlay
inputs.nixgl.overlay
];
config = {
allowUnfree = true;
allowUnfreePredicate = _: true;
};
};
pkgs_working_openwebui = import nixpkgs_working_openwebui {
system = system;
};
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 ];
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;
};
};
# ===== 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"; };
};
nixConfig = {
extra-substituters = [ "https://helix.cachix.org" ];
extra-trusted-public-keys = [ "helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs=" ];
};
}