Skip to content

Commit

Permalink
lint / check includes / updated help
Browse files Browse the repository at this point in the history
  • Loading branch information
Archim Jhunjhunwala committed Dec 1, 2024
1 parent 53917a4 commit 6c73eed
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 6 deletions.
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

89 changes: 89 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
description = "A simple C program using jansson built with Nix flakes";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};

outputs = { self, nixpkgs }: {
packages = nixpkgs.lib.genAttrs [ "aarch64-darwin" "x86_64-linux" ] (system:
let pkgs = import nixpkgs { inherit system; };
in rec {
wideriver = pkgs.stdenv.mkDerivation {
pname = "wideriver";
version = "1.0";

src = ./.;

nativeBuildInputs = with pkgs; [
wayland-scanner
];
buildInputs = with pkgs; [
clang
wayland
wayland-scanner
wlr-protocols
wlroots
pkg-config
];

buildPhase = ''
make
'';

installFlags = [ "PREFIX=$(out)" ];

installPhase = ''
mkdir -p $out/bin
cp wideriver $out/bin/
'';

meta = with pkgs.lib; {
description = "A simple program using jansson";
license = licenses.mit;
maintainers = [ maintainers.yourname ];
platforms = platforms.unix;
};
};
});

devShell = nixpkgs.lib.genAttrs [ "aarch64-darwin" "x86_64-linux" ] (system:
let pkgs = import nixpkgs { inherit system; };
in pkgs.mkShell {
nativeBuildInputs = with pkgs; [
wayland-scanner
];
buildInputs = with pkgs; [
clang
clang-tools # Includes clangd
cmocka
include-what-you-use
valgrind
wayland
wayland-scanner
wlr-protocols
wlroots
pkg-config
];

shellHook = ''
echo "Development environment loaded."
'';
});

defaultPackage = {
aarch64-darwin = self.packages.aarch64-darwin.wideriver;
x86_64-linux = self.packages.x86_64-linux.wideriver;
};

defaultApp = {
forAllSystems = nixpkgs.lib.mapAttrs' (system: pkg: {
inherit system;
defaultApp = {
type = "app";
program = "${pkg.wideriver}/bin/wideriver";
};
}) self.packages;
};
};
}
1 change: 1 addition & 0 deletions result
1 change: 0 additions & 1 deletion src/cmd.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>

Expand Down
3 changes: 1 addition & 2 deletions src/enum.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <unistd.h>
#include <strings.h>

#include <stddef.h>
#include "enum.h"

struct NameVal {
Expand Down
5 changes: 3 additions & 2 deletions src/layout.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>

#include "river-layout-v3.h"
Expand Down Expand Up @@ -57,8 +58,8 @@ const char *layout_image(const struct Demand* const demand, const struct Tag* co

// nix run .#wideriver -- --layout left --ratio-master 0.5 --count-wide-left 0 --border-width 3 --border-color-focused 0xe0def4 --border-color-unfocused 0x6e6a86 --layout-format "{r}\n{l}\n{c}"
const char *description_info(const struct Demand* const demand, const struct Tag* const tag) {
double ratio;
int count;
double ratio = 0;
int count = 0;
const char *image = layout_image(demand, tag);
switch(tag->layout_cur) {
case LEFT:
Expand Down
3 changes: 2 additions & 1 deletion src/log.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#include <errno.h>
#include <stdbool.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <time.h>

#include "__stdarg_va_arg.h"

#include "enum.h"

#include "log.h"
Expand Down
2 changes: 2 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <sys/signalfd.h>
#include <unistd.h>
#include <wayland-client-core.h>
#include "asm-generic/errno-base.h"
#include "sys/poll.h"

#include "args.h"
#include "displ.h"
Expand Down
2 changes: 2 additions & 0 deletions src/usage.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ void usage(const int status) {
" --log-threshold %s|%s|%s|%s %s\n"
" --version\n"
"\n"
" --layout-format format {l} = layout image {c} = count, {r} = ratio"
"\n"
"COMMANDS, sent via riverctl(1):\n"
"\n"
" --layout %s|%s|%s|%s|%s|%s\n"
Expand Down

0 comments on commit 6c73eed

Please sign in to comment.