From 27f18d0a4561c1d67bb13f21667a1a1197a21629 Mon Sep 17 00:00:00 2001 From: mae Date: Fri, 1 Nov 2024 22:55:23 +0100 Subject: [PATCH] Project setup --- .clang-format | 0 .gitignore | 3 +++ default.nix | 8 ++++++++ flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 21 +++++++++++++++++++++ meson.build | 6 ++++++ shell.nix | 5 +++++ src/main.c | 12 ++++++++++++ 8 files changed, 82 insertions(+) create mode 100644 .clang-format create mode 100644 .gitignore create mode 100644 default.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 meson.build create mode 100644 shell.nix create mode 100644 src/main.c diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..e69de29 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bda0908 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +result/ +build/ +.cache/ diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..149b040 --- /dev/null +++ b/default.nix @@ -0,0 +1,8 @@ +{ stdenv, meson, ninja, pkg-config }: stdenv.mkDerivation { + name = "kobo-color-inputdev"; + nativeBuildInputs = [ + meson + ninja + ]; + src = ./.; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..873d3e5 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1730200266, + "narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "807e9154dcb16384b1b765ebe9cd2bba2ac287fd", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..e2bd257 --- /dev/null +++ b/flake.nix @@ -0,0 +1,21 @@ +{ + description = "Small binary rewriting events from kobo libra colour to be used as a desktop libinput device"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + }; + + outputs = { self, nixpkgs }: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { inherit system; }; + in + { + packages.${system} = + { + kobo-color-inputdev = pkgs.callPackage ./default.nix { }; + default = self.packages.${system}.kobo-color-inputdev; + }; + devShells.${system}.default = import ./shell.nix { inherit pkgs; }; + }; +} diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..d904a53 --- /dev/null +++ b/meson.build @@ -0,0 +1,6 @@ +project('kobo-color-inputdev', 'c', + version : '0.1', + default_options : ['warning_level=3']) + +exe = executable('kobo-color-inputdev', 'src/main.c', + install : true) diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..da14068 --- /dev/null +++ b/shell.nix @@ -0,0 +1,5 @@ +{ pkgs ? import { } }: +pkgs.mkShell { + packages = with pkgs; [ libevent clang-tools ]; + inputsFrom = [ (pkgs.callPackage ./default.nix { }) ]; +} diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..6366a2f --- /dev/null +++ b/src/main.c @@ -0,0 +1,12 @@ +#include + +#define PROJECT_NAME "kobo-color-inputdev" + +int main(int argc, char **argv) { + if(argc != 1) { + printf("%s takes no arguments.\n", argv[0]); + return 1; + } + printf("This is project %s.\n", PROJECT_NAME); + return 0; +}