-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
211 lines (189 loc) · 6.44 KB
/
Copy pathflake.nix
File metadata and controls
211 lines (189 loc) · 6.44 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
{
description = "Momoi - Advanced Wayland wallpaper daemon with multi-format support";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
flake-utils,
rust-overlay,
}:
let
# System-specific outputs
systemOutputs = flake-utils.lib.eachDefaultSystem (
system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = [
"rust-src"
"rust-analyzer"
];
};
# Build dependencies for momoi
buildInputs = with pkgs; [
wayland
wayland-protocols
libxkbcommon
vulkan-loader
vulkan-headers
libGL
ffmpeg
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-ugly
gst_all_1.gst-libav
];
nativeBuildInputs = with pkgs; [
pkg-config
cmake
rustToolchain
makeWrapper
];
# Runtime libraries needed
runtimeLibs = with pkgs; [
wayland
libxkbcommon
vulkan-loader
libGL
ffmpeg
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-ugly
gst_all_1.gst-libav
];
in
{
packages = {
default = pkgs.rustPlatform.buildRustPackage {
pname = "momoi";
version = "0.1.0";
src = pkgs.lib.cleanSource ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
inherit nativeBuildInputs buildInputs;
# Build with all features
buildFeatures = [ "all" ];
# Add runtime library paths and GStreamer plugin paths
postInstall = ''
wrapProgram $out/bin/momoi \
--prefix LD_LIBRARY_PATH : "${pkgs.lib.makeLibraryPath runtimeLibs}" \
--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "${
pkgs.lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" (
with pkgs.gst_all_1;
[
gstreamer
gst-plugins-base
gst-plugins-good
gst-plugins-bad
gst-plugins-ugly
gst-libav
]
)
}"
'';
meta = with pkgs.lib; {
description = "Momoi - Advanced Wayland wallpaper daemon with support for images, videos, and animated wallpapers";
homepage = "https://github.com/chikof/momoi";
license = licenses.mit;
platforms = platforms.linux;
mainProgram = "momoi";
};
};
};
devShells.default = pkgs.mkShell {
inherit buildInputs;
nativeBuildInputs =
nativeBuildInputs
++ (with pkgs; [
# Development tools
cargo-watch
cargo-edit
cargo-expand
rustfmt
clippy
# Debugging and profiling
gdb
valgrind
# Additional utilities
wayland-utils
vulkan-tools
]);
# Environment variables for development
RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library";
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (buildInputs ++ runtimeLibs);
PKG_CONFIG_PATH = "${pkgs.lib.makeSearchPath "lib/pkgconfig" buildInputs}";
shellHook = ''
echo "Momoi - Wayland Wallpaper Daemon"
echo "===================================="
echo "Rust version: $(rustc --version)"
echo "Cargo version: $(cargo --version)"
echo ""
echo "Available commands:"
echo " cargo build - Build the project"
echo " cargo run - Run the daemon"
echo " cargo test - Run tests"
echo " cargo watch - Watch for changes and rebuild"
echo " cargo clippy - Run linter"
echo ""
echo "To build the Nix package: nix build"
echo "To update flake: nix flake update"
echo ""
'';
};
}
);
in
systemOutputs
// {
# NixOS modules
nixosModules = {
# Default module - requires momoiFlake to be passed via specialArgs
# Usage:
# specialArgs = { momoiFlake = inputs.momoi; };
# modules = [ inputs.momoi.nixosModules.default ];
default = import ./nix/modules/nixos.nix;
# Helper for easy setup - automatically passes momoiFlake
# Usage:
# modules = [ (inputs.momoi.nixosModules.autoload { inherit inputs; }) ];
autoload =
{ inputs }:
{
imports = [ (import ./nix/modules/nixos.nix) ];
_module.args.momoiFlake = inputs.momoi;
};
};
# Home Manager modules
homeManagerModules = {
# Default module - requires momoiFlake to be passed via extraSpecialArgs
# Usage:
# extraSpecialArgs = { momoiFlake = inputs.momoi; };
# modules = [ inputs.momoi.homeManagerModules.default ];
default = import ./nix/modules/home-manager.nix;
# Helper for easy setup - automatically passes momoiFlake
# Usage:
# modules = [ (inputs.momoi.homeManagerModules.autoload { inherit inputs; }) ];
autoload =
{ inputs }:
{
imports = [ (import ./nix/modules/home-manager.nix) ];
_module.args.momoiFlake = inputs.momoi;
};
};
};
}