Skip to content
This repository was archived by the owner on Oct 31, 2025. It is now read-only.

Commit aeaf82e

Browse files
authored
Merge pull request #449 from Vortriz/main
use oxalica/rust-overlay in nix flake
2 parents 66d270f + 7e6c4f6 commit aeaf82e

File tree

4 files changed

+134
-120
lines changed

4 files changed

+134
-120
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ version = "0.10.3-master"
99
authors = ["Leonardo Gibrowski Faé <[email protected]>"]
1010
edition = "2021"
1111
license-file = "LICENSE"
12-
rust-version = "1.87"
12+
rust-version = "1.87.0"
1313

1414
[workspace.dependencies]
1515
common = { path = "common" }

build.nix

Lines changed: 0 additions & 57 deletions
This file was deleted.

flake.lock

Lines changed: 44 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 89 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,102 @@
11
{
22
description = "swww, A Solution to your Wayland Wallpaper Woes";
33

4-
# Nixpkgs / NixOS version to use.
5-
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
6-
inputs.utils.url = "github:numtide/flake-utils";
7-
inputs.flake-compat = {
8-
url = "github:edolstra/flake-compat";
9-
flake = false;
4+
inputs = {
5+
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
flake-compat = {
8+
url = "github:edolstra/flake-compat";
9+
flake = false;
10+
};
11+
rust-overlay = {
12+
url = "github:oxalica/rust-overlay";
13+
inputs.nixpkgs.follows = "nixpkgs";
14+
};
1015
};
1116

1217
outputs = {
1318
self,
1419
nixpkgs,
15-
utils,
20+
flake-utils,
21+
rust-overlay,
1622
...
1723
}:
1824
{
19-
overlays.default = final: prev: {
20-
swww = final.callPackage ./build.nix {};
21-
};
25+
overlays.default = final: prev: {inherit (self.packages.${prev.system}) swww;};
2226
}
23-
// utils.lib.eachDefaultSystem (system: let
24-
pkgs = import nixpkgs {
25-
inherit system;
26-
overlays = [self.overlays.default];
27-
};
28-
in {
29-
packages = {
30-
inherit (pkgs) swww;
31-
default = pkgs.swww;
32-
};
33-
34-
formatter = pkgs.alejandra;
35-
36-
devShells.default = pkgs.callPackage ({
37-
mkShell,
38-
rustc,
39-
cargo,
40-
gnumake,
41-
pkg-config,
42-
lz4,
43-
libxkbcommon,
44-
wayland,
45-
wayland-protocols,
46-
swww,
47-
}:
48-
mkShell {
49-
inherit (swww) nativeBuildInputs buildInputs;
50-
}) {};
51-
});
27+
// flake-utils.lib.eachDefaultSystem (
28+
system: let
29+
inherit (nixpkgs) lib;
30+
31+
pkgs = import nixpkgs {
32+
inherit system;
33+
overlays = [(import rust-overlay)];
34+
};
35+
36+
cargo-toml = lib.importTOML ./Cargo.toml;
37+
inherit (cargo-toml.workspace.package) rust-version;
38+
rust = pkgs.rust-bin.stable.${rust-version}.default;
39+
40+
rustPlatform = pkgs.makeRustPlatform {
41+
cargo = rust;
42+
rustc = rust;
43+
};
44+
in {
45+
packages = {
46+
swww = rustPlatform.buildRustPackage {
47+
pname = "swww";
48+
49+
src = pkgs.nix-gitignore.gitignoreSource [] ./.;
50+
inherit (cargo-toml.workspace.package) version;
51+
52+
cargoLock.lockFile = ./Cargo.lock;
53+
54+
buildInputs = with pkgs; [
55+
lz4
56+
libxkbcommon
57+
wayland-scanner
58+
wayland-protocols
59+
];
60+
61+
doCheck = false; # Integration tests do not work in sandbox environment
62+
63+
nativeBuildInputs = with pkgs; [
64+
pkg-config
65+
installShellFiles
66+
scdoc
67+
];
68+
69+
postInstall = ''
70+
for f in doc/*.scd; do
71+
local page="doc/$(basename "$f" .scd)"
72+
scdoc < "$f" > "$page"
73+
installManPage "$page"
74+
done
75+
76+
installShellCompletion --cmd swww \
77+
--bash completions/swww.bash \
78+
--fish completions/swww.fish \
79+
--zsh completions/_swww
80+
'';
81+
82+
meta = {
83+
description = "Efficient animated wallpaper daemon for wayland, controlled at runtime";
84+
license = lib.licenses.gpl3;
85+
platforms = lib.platforms.linux;
86+
mainProgram = "swww";
87+
};
88+
};
89+
90+
default = self.packages.${system}.swww;
91+
};
92+
93+
formatter = pkgs.alejandra;
94+
95+
devShells.default = pkgs.mkShell {
96+
inputsFrom = [self.packages.${system}.swww];
97+
98+
packages = [pkgs.rust-bin.stable.${rust-version}.default];
99+
};
100+
}
101+
);
52102
}

0 commit comments

Comments
 (0)