-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
105 lines (89 loc) · 2.87 KB
/
flake.nix
File metadata and controls
105 lines (89 loc) · 2.87 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
{
description = "A desktop sticky image viewer for Wayland";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
version = "0.1.1";
in
{
packages.default = pkgs.stdenv.mkDerivation {
pname = "rspin";
inherit version;
src = pkgs.fetchurl {
url = "https://github.com/dashu041120/rspin/releases/download/v${version}/rspin-${version}-x86_64-linux.tar.gz";
sha256 = "1as5xjq9z4gdvpp2zh235626f5ndlsha245jl51rb1wk8b0pc64z";
};
nativeBuildInputs = [ pkgs.makeWrapper ];
buildInputs = [
pkgs.wayland
pkgs.libxkbcommon
];
unpackPhase = ''
tar xzf $src
cd rspin-${version}-x86_64-linux
'';
installPhase = ''
mkdir -p $out/bin
cp rspin $out/bin/
chmod +x $out/bin/rspin
# Wrap the binary to ensure runtime dependencies are available
wrapProgram $out/bin/rspin \
--prefix LD_LIBRARY_PATH : ${pkgs.lib.makeLibraryPath [
pkgs.wayland
pkgs.libxkbcommon
pkgs.vulkan-loader
pkgs.libGL
]}
# Install documentation
mkdir -p $out/share/doc/rspin
cp README.md $out/share/doc/rspin/
'';
meta = with pkgs.lib; {
description = "A desktop sticky image viewer for Wayland";
homepage = "https://github.com/dashu041120/rspin";
license = licenses.mit;
platforms = [ "x86_64-linux" ];
maintainers = [ ];
};
};
apps.default = {
type = "app";
program = "${self.packages.${system}.default}/bin/rspin";
};
# Development shell for building from source
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
# Rust toolchain
rustc
cargo
rustfmt
clippy
# Build dependencies
pkg-config
# Runtime dependencies
wayland
libxkbcommon
vulkan-loader
libGL
# Optional tools
wl-clipboard
];
shellHook = ''
echo "🦀 rspin development environment"
echo "Usage:"
echo " cargo build - Build the project"
echo " cargo run -- <args> - Run rspin"
echo " cargo test - Run tests"
echo ""
echo "Example:"
echo " cargo run -- /path/to/image.png"
'';
};
}
);
}