From afa014524145df3c6231fc014c052e40805492ce Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 23 Aug 2023 11:08:54 +0800 Subject: [PATCH] packaging --- flake.nix | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/flake.nix b/flake.nix index a35ee4a..3666de1 100644 --- a/flake.nix +++ b/flake.nix @@ -6,20 +6,30 @@ outputs = { self, nixpkgs }: let pkgs = import nixpkgs { system = "x86_64-linux"; }; - in { + imgui_dir = "${pkgs.imgui}/include/imgui"; + in rec { + packages.x86_64-linux.microsa = pkgs.stdenv.mkDerivation { + name = "microsa"; + src = self; + nativeBuildInputs = [ pkgs.pkg-config ]; + propagatedBuildInputs = [ pkgs.wayland pkgs.glfw-wayland pkgs.libffi ]; + preBuild = '' + export IMGUI_DIR=${imgui_dir} + ''; + installPhase = '' + mkdir -p $out/bin + cp microsa $out/bin + ''; + }; devShell.x86_64-linux = pkgs.mkShell { name = "microsa-dev-shell"; buildInputs = [ pkgs.gnumake pkgs.gcc - pkgs.pkg-config - pkgs.wayland - pkgs.glfw-wayland - pkgs.libffi - ]; - shellHook = '' - export IMGUI_DIR=${pkgs.imgui}/include/imgui - ''; + ] ++ packages.x86_64-linux.microsa.nativeBuildInputs + ++ packages.x86_64-linux.microsa.propagatedBuildInputs; + shellHook = packages.x86_64-linux.microsa.preBuild; }; + defaultPackage.x86_64-linux = packages.x86_64-linux.microsa; }; }