mirror of
https://github.com/LinuxBeginnings/swww.git
synced 2026-01-11 15:00:59 -03:00
Nix: allow building swww from the source directly
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,5 @@
|
||||
target/*
|
||||
completions/*
|
||||
test_images/*
|
||||
# Nix
|
||||
result
|
||||
|
||||
53
build.nix
Normal file
53
build.nix
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
lib,
|
||||
rustPlatform,
|
||||
pkg-config,
|
||||
lz4,
|
||||
libxkbcommon,
|
||||
installShellFiles,
|
||||
scdoc,
|
||||
nix-gitignore,
|
||||
}: let
|
||||
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version;
|
||||
src = nix-gitignore.gitignoreSource [] ./.;
|
||||
in
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "swww";
|
||||
|
||||
inherit src version;
|
||||
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
|
||||
buildInputs = [
|
||||
lz4
|
||||
libxkbcommon
|
||||
];
|
||||
|
||||
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";
|
||||
};
|
||||
}
|
||||
6
default.nix
Normal file
6
default.nix
Normal file
@@ -0,0 +1,6 @@
|
||||
(import (let lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||
in fetchTarball {
|
||||
url =
|
||||
"https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||
}) { src = ./.; }).defaultNix
|
||||
78
flake.lock
generated
Normal file
78
flake.lock
generated
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1696426674,
|
||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1715447595,
|
||||
"narHash": "sha256-VsVAUQOj/cS1LCOmMjAGeRksXIAdPnFIjCQ0XLkCsT0=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "062ca2a9370a27a35c524dc82d540e6e9824b652",
|
||||
"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": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
50
flake.nix
Normal file
50
flake.nix
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
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;
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
utils,
|
||||
...
|
||||
}:
|
||||
{
|
||||
overlays.default = final: prev: {
|
||||
swww = final.callPackage ./build.nix {};
|
||||
};
|
||||
}
|
||||
// utils.lib.eachDefaultSystem (system: let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [self.overlays.default];
|
||||
};
|
||||
in {
|
||||
packages = {
|
||||
inherit (pkgs) swww;
|
||||
default = pkgs.swww;
|
||||
};
|
||||
|
||||
formatter = pkgs.alejandra;
|
||||
|
||||
devShells.default = pkgs.callPackage ({
|
||||
mkShell,
|
||||
rustc,
|
||||
cargo,
|
||||
gnumake,
|
||||
pkg-config,
|
||||
lz4,
|
||||
libxkbcommon,
|
||||
swww,
|
||||
}:
|
||||
mkShell {
|
||||
inherit (swww) nativeBuildInputs buildInputs;
|
||||
}) {};
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user