From 7951106beefd007cca9c9e657dfcd474ae0a7274 Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Sat, 29 Jun 2024 18:01:40 +0900 Subject: [PATCH] nix: initialise flake with Fyne native dependencies Fyne has various cgo dependencies, the flake provides their dependencies as well as a build script in a dev shell. Signed-off-by: Ophestra Umiker --- flake.lock | 27 ++++++++++++++++++++++++++ flake.nix | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..98f71cb --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1717179513, + "narHash": "sha256-vboIEwIQojofItm2xGCdZCzW96U85l9nDW3ifMuAIdM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "63dacb46bf939521bdc93981b4cbb7ecb58427a0", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "24.05", + "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..f524148 --- /dev/null +++ b/flake.nix @@ -0,0 +1,57 @@ +{ + description = "Fyne build script"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/24.05"; + }; + + outputs = { self, nixpkgs }: + let + supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ]; + forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system); + in + { + devShells = forAllSystems + (system: + let + pkgs = import nixpkgs { + inherit system; + }; + in + { + default = with pkgs; mkShell + ({ + packages = [ + clang + ] ++ (if stdenv.isLinux then [ + (pkgs.writeShellScriptBin "build" '' + go build -v -o /tmp/rpcfetch ./fetch + # wayland support is partially broken at the moment + #go build -v -tags wayland -o /tmp/wl-rpcfetch ./fetch + '') + vulkan-headers + libxkbcommon + wayland + xorg.libX11 + xorg.libXcursor + xorg.libXfixes + xorg.libXrandr + xorg.libXinerama + xorg.libXi + xorg.libXxf86vm + glfw-wayland + pkg-config + ] else if stdenv.isDarwin then [ + darwin.apple_sdk_11_0.frameworks.Foundation + darwin.apple_sdk_11_0.frameworks.Metal + darwin.apple_sdk_11_0.frameworks.QuartzCore + darwin.apple_sdk_11_0.frameworks.AppKit + darwin.apple_sdk_11_0.MacOSX-SDK + ] else [ ]); + } // (if stdenv.isLinux then { + LD_LIBRARY_PATH = "${vulkan-loader}/lib"; + } else { })); + } + ); + }; +} \ No newline at end of file