-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
164 lines (146 loc) · 4.64 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
{
description = "NixOS configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland.url = "github:hyprwm/Hyprland";
hyprland-plugins = {
url = "github:hyprwm/hyprland-plugins";
inputs.hyprland.follows = "hyprland";
};
hyprsplit = {
url = "github:shezdy/hyprsplit";
inputs.hyprland.follows = "hyprland";
};
plasma-manager = {
url = "github:nix-community/plasma-manager/trunk";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
# up-to-date vscode extensions:
nix-vscode-extensions = {
url = "github:nix-community/nix-vscode-extensions";
inputs.nixpkgs.follows = "nixpkgs";
};
# tools to facilitate running unpatched binaries:
nix-alien = {
url = "github:thiagokokada/nix-alien";
inputs.nixpkgs.follows = "nixpkgs";
};
# »The Nix User Repository (NUR) is a community-driven meta repository for Nix packages«
# I use it to access the firefox addons provided by `rycee`.
nur = {
url = github:nix-community/NUR;
inputs.nixpkgs.follows = "nixpkgs";
};
stylix = {
url = "github:danth/stylix";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-matlab-ld = {
url = "github:manuelbb-upb/nix-matlab-ld";
inputs.nixpkgs.follows = "nixpkgs";
};
# hypridle = {
# url = "github:hyprwm/hypridle";
# inputs.nixpkgs.follows = "nixpkgs";
# };
#split-monitor-workspaces = {
# url = "github:Duckonaut/split-monitor-workspaces";
# inputs.hyprland.follows = "hyprland"; # <- make sure this line is present for the plugin to work as intended
#};
/*
scientific-fhs = {
url = "github:manuelbb-upb/scientific-fhs/flake_module";
};
nix-matlab = {
url = "gitlab:doronbehar/nix-matlab";
inputs.nixpkgs.follows = "nixpkgs";
};
*/
};
outputs = inputs@{
self,
nixpkgs,
home-manager,
hyprland,
hyprland-plugins,
plasma-manager,
nur,
hyprsplit,
stylix,
nix-matlab-ld,
nix-alien,
#scientific-fhs,
# hyprpanel,
#split-monitor-workspaces,
#nix-matlab,
...
}:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
# some of my machines {are/have been} docked to displaylink docks
# these need special video drivers.
# first, fetch proprietary source for displaylink driver
displaylink_src = pkgs.fetchurl {
url = "https://www.synaptics.com/sites/default/files/exe_files/2024-10/DisplayLink%20USB%20Graphics%20Software%20for%20Ubuntu6.1-EXE.zip";
name = "displaylink-610.zip";
hash = "sha256-RJgVrX+Y8Nvz106Xh+W9N9uRLC2VO00fBJeS8vs7fKw=";
};
# then, prepare an overlay for `nixpkgs` using the source
displaylink_overlay = (final: prev: {
displaylink = prev.displaylink.overrideAttrs (new: old: {
version = "6.1.0-17";
src = displaylink_src;
});
});
in
{
# for multi-machine/multi-host tips see
# https://discourse.nixos.org/t/flakes-how-to-automatically-set-machine-hostname-to-nixosconfiguration-name/45217
nixosConfigurations = pkgs.lib.genAttrs [
"manuel-p14sg5"
"manuel-t14g1"
] (hostname: nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit self;
};
modules = [
({self, ...}: {
# pass overlays for additional or modified packages:
nixpkgs.overlays = [
displaylink_overlay
nur.overlays.default
# hyprpanel.overlay
];
})
stylix.nixosModules.stylix
./${hostname}/configuration.nix
{
# make `inputs` available in for module in `configuration.nix`
_module.args = { inherit inputs hostname; };
}
# generate home-manager configuration for `hostname`
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.backupFileExtension = builtins.toString(builtins.currentTime) + ".hmbackup"; # this is impure
home-manager.sharedModules = [
plasma-manager.homeManagerModules.plasma-manager
];
home-manager.users.manuel = import ./${hostname}/home.nix;
# Optionally, use home-manager.extraSpecialArgs to pass
# arguments to home.nix
home-manager.extraSpecialArgs = {
inherit inputs;
};
}
];
});
};
}