use oxalica/rust-overlay in nix flake

allows us to use latest rust version
This commit is contained in:
Vortriz
2025-06-17 11:18:52 +05:30
parent 66d270f446
commit 7e6c4f61a0
4 changed files with 148 additions and 134 deletions

View File

@@ -9,7 +9,7 @@ version = "0.10.3-master"
authors = ["Leonardo Gibrowski Faé <leonardo.fae44@gmail.com>"]
edition = "2021"
license-file = "LICENSE"
rust-version = "1.87"
rust-version = "1.87.0"
[workspace.dependencies]
common = { path = "common" }

View File

@@ -1,57 +0,0 @@
{
lib,
rustPlatform,
pkg-config,
lz4,
libxkbcommon,
installShellFiles,
scdoc,
nix-gitignore,
wayland-scanner,
wayland-protocols,
}: let
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).workspace.package.version;
src = nix-gitignore.gitignoreSource [] ./.;
in
rustPlatform.buildRustPackage {
pname = "swww";
inherit src version;
cargoLock.lockFile = ./Cargo.lock;
buildInputs = [
lz4
libxkbcommon
wayland-scanner
wayland-protocols
];
doCheck = false; # Integration tests do not work in sandbox environment
nativeBuildInputs = [
pkg-config
installShellFiles
scdoc
];
postInstall = ''
for f in doc/*.scd; do
local page="doc/$(basename "$f" .scd)"
scdoc < "$f" > "$page"
installManPage "$page"
done
installShellCompletion --cmd swww \
--bash completions/swww.bash \
--fish completions/swww.fish \
--zsh completions/_swww
'';
meta = {
description = "Efficient animated wallpaper daemon for wayland, controlled at runtime";
license = lib.licenses.gpl3;
platforms = lib.platforms.linux;
mainProgram = "swww";
};
}

99
flake.lock generated
View File

@@ -16,45 +16,7 @@
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1748460289,
"narHash": "sha256-7doLyJBzCllvqX4gszYtmZUToxKvMUrg45EUWaUYmBg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "96ec055edbe5ee227f28cdbc3f1ddf1df5965102",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": "nixpkgs",
"utils": "utils"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
@@ -71,6 +33,65 @@
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1749903597,
"narHash": "sha256-jp0D4vzBcRKwNZwfY4BcWHemLGUs4JrS3X9w5k/JYDA=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "41da1e3ea8e23e094e5e3eeb1e6b830468a7399e",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1750041667,
"narHash": "sha256-/8F9L6T9w/Fx1D6L+BtWIXg5m9F6jwOFg6uhZpKnM/0=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "d72bd8c9fda03c9834ea89d7a5a21c7880b79277",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

124
flake.nix
View File

@@ -1,52 +1,102 @@
{
description = "swww, A Solution to your Wayland Wallpaper Woes";
# Nixpkgs / NixOS version to use.
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.utils.url = "github:numtide/flake-utils";
inputs.flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
utils,
flake-utils,
rust-overlay,
...
}:
{
overlays.default = final: prev: {
swww = final.callPackage ./build.nix {};
};
overlays.default = final: prev: {inherit (self.packages.${prev.system}) swww;};
}
// utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [self.overlays.default];
};
in {
packages = {
inherit (pkgs) swww;
default = pkgs.swww;
};
// flake-utils.lib.eachDefaultSystem (
system: let
inherit (nixpkgs) lib;
formatter = pkgs.alejandra;
pkgs = import nixpkgs {
inherit system;
overlays = [(import rust-overlay)];
};
devShells.default = pkgs.callPackage ({
mkShell,
rustc,
cargo,
gnumake,
pkg-config,
lz4,
libxkbcommon,
wayland,
wayland-protocols,
swww,
}:
mkShell {
inherit (swww) nativeBuildInputs buildInputs;
}) {};
});
cargo-toml = lib.importTOML ./Cargo.toml;
inherit (cargo-toml.workspace.package) rust-version;
rust = pkgs.rust-bin.stable.${rust-version}.default;
rustPlatform = pkgs.makeRustPlatform {
cargo = rust;
rustc = rust;
};
in {
packages = {
swww = rustPlatform.buildRustPackage {
pname = "swww";
src = pkgs.nix-gitignore.gitignoreSource [] ./.;
inherit (cargo-toml.workspace.package) version;
cargoLock.lockFile = ./Cargo.lock;
buildInputs = with pkgs; [
lz4
libxkbcommon
wayland-scanner
wayland-protocols
];
doCheck = false; # Integration tests do not work in sandbox environment
nativeBuildInputs = with pkgs; [
pkg-config
installShellFiles
scdoc
];
postInstall = ''
for f in doc/*.scd; do
local page="doc/$(basename "$f" .scd)"
scdoc < "$f" > "$page"
installManPage "$page"
done
installShellCompletion --cmd swww \
--bash completions/swww.bash \
--fish completions/swww.fish \
--zsh completions/_swww
'';
meta = {
description = "Efficient animated wallpaper daemon for wayland, controlled at runtime";
license = lib.licenses.gpl3;
platforms = lib.platforms.linux;
mainProgram = "swww";
};
};
default = self.packages.${system}.swww;
};
formatter = pkgs.alejandra;
devShells.default = pkgs.mkShell {
inputsFrom = [self.packages.${system}.swww];
packages = [pkgs.rust-bin.stable.${rust-version}.default];
};
}
);
}