From 215f36ea35dee882e3adc130cc452e4948e0db39 Mon Sep 17 00:00:00 2001 From: Tobias Berger Date: Fri, 12 Jan 2024 21:31:29 +0100 Subject: [PATCH] setup for nix --- .envrc | 6 ++++++ .gitignore | 2 ++ flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 17 +++++++++++++++++ generate_patch.sh | 1 + shell.nix | 20 ++++++++++++++++++++ 6 files changed, 73 insertions(+) create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix create mode 100755 generate_patch.sh create mode 100644 shell.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..ce94604 --- /dev/null +++ b/.envrc @@ -0,0 +1,6 @@ +watch_file shell.nix +watch_file flake.lock + +# try to use flakes, if it fails use normal nix (ie. shell.nix) +use flake || use nix +eval "$shellHook" diff --git a/.gitignore b/.gitignore index 0dde90e..1244a83 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ dwl *-protocol.h .ccls-cache config.h +.direnv +custom_dwl.patch diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..6b5b308 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1704722960, + "narHash": "sha256-mKGJ3sPsT6//s+Knglai5YflJUF2DGj7Ai6Ynopz0kI=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "317484b1ead87b9c1b8ac5261a8d2dd748a0492d", + "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..98eb852 --- /dev/null +++ b/flake.nix @@ -0,0 +1,17 @@ +{ + description = "ToDooDoo"; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + }; + outputs = { self, nixpkgs }: + let + supportedSystems = [ "x86_64-linux" ]; + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + pkgsFor = nixpkgs.legacyPackages; + in { + devShells = forAllSystems (system: { + default = pkgsFor.${system}.callPackage ./shell.nix { }; + }); + }; +} + diff --git a/generate_patch.sh b/generate_patch.sh new file mode 100755 index 0000000..b7d695f --- /dev/null +++ b/generate_patch.sh @@ -0,0 +1 @@ +git diff v0.5 > custom_dwl.patch diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..89553df --- /dev/null +++ b/shell.nix @@ -0,0 +1,20 @@ +{ pkgs ? import { }, lib }: +let packages = with pkgs; [ + pkg-config + wayland + wayland-protocols + wlroots + libxkbcommon + libinput + pixman + ]; +in +pkgs.mkShell { + inherit packages; + nativeBuildInputs = packages; + buildInputs = packages; + env = { + LIBCLANG_PATH = "${pkgs.libclang.lib}/lib"; + LD_LIBRARY_PATH = "${lib.makeLibraryPath packages}"; + }; +}