-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
219 lines (203 loc) · 6.06 KB
/
Copy pathflake.nix
File metadata and controls
219 lines (203 loc) · 6.06 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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
{
description = "NixOS configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-local = {
url = "path:/home/btngana/coding/nix/nixpkgs";
flake = false;
};
btngana-forge = {
url = "path:/home/btngana/coding/nix/btngana-nix-forge";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/release-26.05";
inputs.nixpkgs.follows = "nixpkgs";
};
spicetify-nix = {
url = "github:Gerg-L/spicetify-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-wsl = {
url = "github:nix-community/NixOS-WSL/main";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland = {
url = "github:hyprwm/Hyprland";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
noctalia = {
url = "github:noctalia-dev/noctalia-shell";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
antigravity-nix = {
url = "github:jacopone/antigravity-nix";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
helium = {
url = "github:schembriaiden/helium-browser-nix-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
nixpkgs-unstable,
nixpkgs-local,
nixos-wsl,
home-manager,
...
}@inputs:
let
system = "x86_64-linux";
username = "btngana";
configPath = "/home/${username}/dotfiles";
overlays = (import ./overlays) ++ [
(
final: prev:
import ./packages {
pkgs = final;
}
)
inputs.antigravity-nix.overlays.default
inputs.helium.overlays.default
];
pkgs = import nixpkgs {
inherit system overlays;
config.allowUnfree = true;
};
pkgsUnstable = import nixpkgs-unstable {
inherit system overlays;
config.allowUnfree = true;
};
pkgsLocal = import nixpkgs-local {
inherit system overlays;
config.allowUnfree = true;
};
specialArgs = {
inherit
inputs
pkgsLocal
pkgsUnstable
system
username
configPath
;
};
# replace nixpkgs modules with local ones
# for local nixpkgs development
replaceModules =
modulePaths:
[ { disabledModules = modulePaths; } ]
++ map (p: "${nixpkgs-local}/nixos/modules/${p}") modulePaths;
mkSystem =
host: extraModules: extraSpecialArgs:
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = specialArgs // extraSpecialArgs;
modules = [
{ nixpkgs.pkgs = pkgs; }
./hosts/${host}/configuration.nix
./modules
inputs.hyprland.nixosModules.default
]
++ replaceModules [
# "programs/gpu-screen-recorder.nix"
]
++ extraModules;
};
mkHome =
profile:
home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = specialArgs;
modules = [
./home
./home/shared.nix
./hosts/${profile}/home.nix
inputs.spicetify-nix.homeManagerModules.default
inputs.noctalia.homeModules.default
];
};
in
{
nixosConfigurations = {
desktop-nixos = mkSystem "desktop" [ ] { };
laptop-nixos = mkSystem "laptop" [ ] { };
wsl-nixos = mkSystem "wsl" [ nixos-wsl.nixosModules.default ] { };
# using nixos home manager module here for the iso
# as i cannot use home-manager indpendent mode
iso-nixos = mkSystem "iso" [
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = specialArgs // {
username = "nixos";
};
users.nixos = {
imports = [
./hosts/iso/home.nix
./home
inputs.spicetify-nix.homeManagerModules.default
];
};
};
}
] { username = "nixos"; };
};
homeConfigurations = {
"${username}@desktop-nixos" = mkHome "desktop";
"${username}@laptop-nixos" = mkHome "laptop";
"${username}@wsl-nixos" = mkHome "wsl";
};
# for building packages with nix build .#packageName
packages.${system} =
import ./packages {
pkgs = pkgs;
}
// {
update-local-packages = pkgs.writeShellApplication {
name = "update-local-packages";
runtimeInputs = [
pkgs.nix
pkgs.git
pkgs.nix-update
];
text = ''
#bash
set -Eeu
root="$(git rev-parse --show-toplevel)"
cd "$root"/packages
packages=(
gpu-screen-recorder
gpu-screen-recorder-notification
gpu-screen-recorder-ui
)
for pkg in "''${packages[@]}"; do
echo "--- updating $pkg ---"
nix-update --flake --use-update-script "$pkg" || echo " (failed, continuing)"
done
if [[ -f "update-git-commits.txt" ]]; then
rm "update-git-commits.txt"
fi
'';
};
};
apps.${system}.update-local-packages = {
type = "app";
program = "${self.packages.${system}.update-local-packages}/bin/update-local-packages";
};
devShells.${system}.default = pkgs.mkShell {
name = "dotfiles";
# Required for qmlls to find the correct type declarations
shellHook = ''
#bash
export QML_IMPORT_PATH=${pkgs.kdePackages.qtdeclarative}/lib/qt-6/qml/:${pkgs.quickshell}/lib/qt-6/qml/:$PWD/home/apps/quickshell/config/
'';
};
};
}