Nix support

src/call-idle-handler.c change due to build failures because of -wall -werror
This commit is contained in:
bluepython508
2025-03-04 17:14:37 +00:00
parent 744ce4b1eb
commit a5e4b682fe
8 changed files with 101 additions and 2 deletions

1
.envrc Normal file
View File

@@ -0,0 +1 @@
use flake

2
.gitignore vendored
View File

@@ -2,3 +2,5 @@ protocol/*.c
protocol/*.h
*.o
riverguile
/result
/.direnv

View File

@@ -1,6 +1,6 @@
SCANNER := wayland-scanner
PREFIX=/usr/local
PREFIX=${out}
BINDIR=$(PREFIX)/bin
DATADIR=$(PREFIX)/share
MODULEDIR=$(DATADIR)/guile/3.0

40
default.nix Normal file
View File

@@ -0,0 +1,40 @@
{pkgs ? import <nixpkgs> {}}:
pkgs.stdenv.mkDerivation {
name = "riverguile";
src = pkgs.fetchgit {
url = "https://git.sr.ht/~leon_plickat/riverguile/";
rev = "744ce4b1eb5950d0dc795d64bfac6b7738eec6f1";
hash = "sha256-80XVaq+17Vu+DAs7pjt3cu5wiK37680A7S6qIulPRLc=";
};
patches = [
(pkgs.writeText "nix-build.patch" ''
diff --git a/Makefile b/Makefile
index 915f7ac..ff2b3c2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
SCANNER := wayland-scanner
-PREFIX=/usr/local
+PREFIX=''${out}
BINDIR=$(PREFIX)/bin
DATADIR=$(PREFIX)/share
MODULEDIR=$(DATADIR)/guile/3.0
diff --git a/src/call-idle-handler.c b/src/call-idle-handler.c
index 727656e..b4d4474 100644
--- a/src/call-idle-handler.c
+++ b/src/call-idle-handler.c
@@ -8,7 +8,7 @@ static void *call_idle_handler_inner (void *data)
struct Call_idle_handler_parameters *params =
(struct Call_idle_handler_parameters *)data;
- SCM event;
+ SCM event = { 0 };
switch (params->event)
{
case IDLE: event = scm_from_utf8_symbol("idle"); break;
'')
];
buildInputs = with pkgs; [wayland-scanner wayland guile];
nativeBuildInputs = [pkgs.pkg-config];
}

39
flake.lock generated Normal file
View File

@@ -0,0 +1,39 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1741513245,
"narHash": "sha256-7rTAMNTY1xoBwz0h7ZMtEcd8LELk9R5TzBPoHuhNSCk=",
"path": "/nix/store/g4ppspdl4fy7hnp4jgjl4ll03v7i08w3-source",
"rev": "e3e32b642a31e6714ec1b712de8c91a3352ce7e1",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"systems": "systems"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"id": "systems",
"type": "indirect"
}
}
},
"root": "root",
"version": 7
}

13
flake.nix Normal file
View File

@@ -0,0 +1,13 @@
{
outputs = { nixpkgs, systems, ... }: let
lib = nixpkgs.lib;
eachSystem = f: lib.genAttrs (import systems) (system: f { pkgs = nixpkgs.legacyPackages.${system}; });
in {
packages = eachSystem (p: {
default = import ./. p;
});
devShells = eachSystem (p: {
default = import ./. p;
});
};
}

4
shell.nix Normal file
View File

@@ -0,0 +1,4 @@
{ pkgs ? import <nixpkgs> {} }: pkgs.mkShell {
inputsFrom = [(import ./. {inherit pkgs;})];
packages = [pkgs.clang-tools];
}

View File

@@ -8,7 +8,7 @@ static void *call_idle_handler_inner (void *data)
struct Call_idle_handler_parameters *params =
(struct Call_idle_handler_parameters *)data;
SCM event;
SCM event = { 0 };
switch (params->event)
{
case IDLE: event = scm_from_utf8_symbol("idle"); break;