From 6ca94e833b301225df615e73a462c299fb4e79d1 Mon Sep 17 00:00:00 2001 From: Dzmitry Shuysky Date: Sun, 23 Apr 2023 22:28:38 +0200 Subject: [PATCH] build(nix): add required packages and tools to dev shell --- flake.nix | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/flake.nix b/flake.nix index 4e54613..ccf18df 100644 --- a/flake.nix +++ b/flake.nix @@ -13,18 +13,26 @@ }; outputs = { self, nixpkgs }: { + pkgs = import nixpkgs { system = "x86_64-linux"; }; + + nativeBuildInputs = with self.pkgs; [ clang gnumake pkg-config which libxml2 ]; + buildInputs = with self.pkgs; [ gtk3 librsvg glib ]; + defaultPackage.x86_64-linux = self.packages.gtkChess; - packages.gtkChess = - with import nixpkgs { system = "x86_64-linux"; }; - stdenv.mkDerivation { - name = "GTK-Chess"; - version = "dev"; - src = ./.; - nativeBuildInputs = [ clang gnumake pkg-config which libxml2 ]; - buildInputs = [ gtk3 librsvg glib ]; - buildPhase = "make all"; - installPhase = "mkdir -p $out/bin; cp GTKChess $out/bin"; - }; + packages.gtkChess = with self.pkgs; stdenv.mkDerivation { + name = "GTK-Chess"; + version = "dev"; + src = ./.; + nativeBuildInputs = self.nativeBuildInputs; + buildInputs = self.buildInputs; + buildPhase = "make all"; + installPhase = "mkdir -p $out/bin; cp GTKChess $out/bin"; + }; + + devShells.x86_64-linux.default = with self.pkgs; mkShell { + buildInputs = [ cppcheck ] ++ self.nativeBuildInputs ++ self.buildInputs; + }; }; + }