Skip to content

Commit a68485f

Browse files
committed
Simplify flake.nix and use config.cudaSupport
1 parent be9d67c commit a68485f

File tree

6 files changed

+46
-93
lines changed

6 files changed

+46
-93
lines changed

flake.nix

Lines changed: 38 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,6 @@
4747
}@inputs:
4848
let
4949
system = "x86_64-linux";
50-
pkgs-unstable = import nixpkgs-unstable {
51-
inherit system;
52-
config.allowUnfree = true;
53-
overlays = [ nixgl.overlay ];
54-
};
55-
specialArgs = {
56-
inherit inputs pkgs-unstable;
57-
};
5850

5951
meta = {
6052
dir = "/home/lukas/nixos";
@@ -69,52 +61,56 @@
6961
time = {
7062
zone = "Europe/Vienna";
7163
};
64+
cuda = false;
7265
};
73-
in
74-
{
75-
nixosConfigurations = {
76-
vega = nixpkgs.lib.nixosSystem {
77-
inherit system;
78-
specialArgs = specialArgs // {
79-
meta = meta // {
80-
hypr = {
81-
monitors = [
82-
"DP-2, [email protected], 0x0, 1"
83-
"HDMI-A-1, [email protected], 1920x0, 1"
84-
];
85-
};
66+
67+
nixosSystem =
68+
module: overrideMeta:
69+
let
70+
updatedMeta = meta // overrideMeta;
71+
pkgs-unstable = import nixpkgs-unstable {
72+
inherit system;
73+
74+
config = {
75+
allowUnfree = true;
76+
cudaSupport = updatedMeta.cuda;
8677
};
87-
};
88-
modules = [ ./hosts/desktops/vega ];
89-
};
9078

91-
orion = nixpkgs.lib.nixosSystem {
79+
overlays = [ nixgl.overlay ];
80+
};
81+
specialArgs = {
82+
inherit inputs pkgs-unstable;
83+
};
84+
in
85+
nixpkgs.lib.nixosSystem {
9286
inherit system;
9387
specialArgs = specialArgs // {
94-
meta = meta // {
95-
hypr = {
96-
monitors = [ "eDP-1, [email protected], 0x0, 1" ];
97-
};
98-
};
88+
meta = updatedMeta;
9989
};
100-
modules = [ ./hosts/desktops/orion ];
90+
modules = [ module ];
10191
};
102-
103-
sirius = nixpkgs.lib.nixosSystem {
104-
inherit system;
105-
specialArgs = specialArgs // {
106-
inherit meta;
92+
in
93+
{
94+
nixosConfigurations = {
95+
vega = nixosSystem ./hosts/desktops/vega {
96+
cuda = true;
97+
hypr = {
98+
monitors = [
99+
"DP-2, [email protected], 0x0, 1"
100+
"HDMI-A-1, [email protected], 1920x0, 1"
101+
];
107102
};
108-
modules = [ ./hosts/servers/sirius ];
109103
};
110104

111-
pollux = nixpkgs.lib.nixosSystem {
112-
inherit system;
113-
specialArgs = specialArgs // {
114-
inherit meta;
105+
orion = nixosSystem ./hosts/desktops/orion {
106+
hypr = {
107+
monitors = [ "eDP-1, [email protected], 0x0, 1" ];
115108
};
116-
modules = [ ./hosts/servers/pollux ];
117109
};
110+
111+
sirius = nixosSystem ./hosts/servers/sirius { };
112+
113+
pollux = nixosSystem ./hosts/servers/pollux { };
118114
};
119115
};
120116
}

hosts/desktops/orion/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
../default.nix
66
./hardware-configuration.nix
77

8-
../../../modules/ollama.nix
8+
../../../modules/llms.nix
99
];
1010

1111
networking.hostName = "orion";

hosts/desktops/vega/default.nix

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
../default.nix
66
./hardware-configuration.nix
77

8-
../../../modules/ollama.nix
8+
../../../modules/llms.nix
99
];
1010

1111
networking.hostName = "vega";
@@ -56,52 +56,4 @@
5656
environment.systemPackages = [
5757
pkgs.ffmpeg
5858
];
59-
60-
systemd =
61-
let
62-
script = channel: duration: ''
63-
dir="/home/lukas/tutils/recordings/$(date +'%Y/%m/%d')/${channel}"
64-
mkdir -p "$dir"
65-
66-
out_file="$dir/$(date +'%H-%M').ts"
67-
68-
printf "Recording ${duration} to %s\n" "$out_file"
69-
printf "Started at %s\n" "$(date)"
70-
71-
${pkgs.ffmpeg}/bin/ffmpeg -headers "Referer: https://tuwel.tuwien.ac.at\r\n" \
72-
-t "${duration}" \
73-
-i "https://live-cdn-2.video.tuwien.ac.at/lecturetube-live/${channel}/playlist.m3u8" \
74-
-c copy "$out_file"
75-
76-
printf "Finished at %s\n" "$(date)"
77-
'';
78-
79-
service = channel: duration: {
80-
description = "lecture-${channel}-${duration}";
81-
script = script channel duration;
82-
serviceConfig = {
83-
Type = "oneshot";
84-
User = "lukas";
85-
};
86-
};
87-
88-
timer = unit: calendar: {
89-
wantedBy = [ "timers.target" ];
90-
timerConfig = {
91-
OnCalendar = calendar;
92-
Unit = unit;
93-
};
94-
};
95-
in
96-
{
97-
services = {
98-
"audimax-7200" = service "bau178a-gm-1-audi-max" "7200";
99-
};
100-
101-
timers = {
102-
"monday-08am" = timer "audimax-7200.service" "Mon 08:00";
103-
"monday-12am" = timer "audimax-7200.service" "Mon 12:00";
104-
"monday-14am" = timer "audimax-7200.service" "Mon 14:00";
105-
};
106-
};
10759
}

modules/desktop/hyprland.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
egl-wayland
3636

37-
ueberzugpp
37+
(ueberzugpp.override { enableOpencv = false; }) # TODO: fix cuda issues
3838

3939
hyprsunset
4040
];

modules/ollama.nix renamed to modules/llms.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ in
1717
};
1818
};
1919

20+
environment.systemPackages = [
21+
pkgs-unstable.llama-cpp
22+
];
23+
2024
# services.open-webui = {
2125
# enable = true;
2226
# package = pkgs-unstable.open-webui;

modules/nixos/nix.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
nixpkgs.config = {
3737
allowUnfree = true;
38+
cudaSupport = meta.cuda;
3839
};
3940

4041
programs.nix-ld = {

0 commit comments

Comments
 (0)