Gleam + Relm4 foreign node POC over Erlang distribution
0

Configure Feed

Select the types of activity you want to include in your feed.

gleamtk / flake.nix
3.6 kB 111 lines
1{ 2 description = "gleamtk Gleam controller + Relm4 foreign node (Erlang distribution POC)"; 3 4 inputs = { 5 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 6 }; 7 8 outputs = 9 { self, nixpkgs }: 10 let 11 systems = [ 12 "x86_64-linux" 13 "aarch64-linux" 14 ]; 15 forAllSystems = nixpkgs.lib.genAttrs systems; 16 in 17 { 18 packages = forAllSystems ( 19 system: 20 let 21 pkgs = nixpkgs.legacyPackages.${system}; 22 gleamtk-ui = pkgs.rustPlatform.buildRustPackage { 23 pname = "gleamtk-ui"; 24 version = "0.1.0"; 25 src = ./ui; 26 cargoLock.lockFile = ./ui/Cargo.lock; 27 28 nativeBuildInputs = with pkgs; [ 29 pkg-config 30 wrapGAppsHook4 31 ]; 32 33 buildInputs = with pkgs; [ 34 gtk4 35 libadwaita 36 adwaita-icon-theme 37 hicolor-icon-theme 38 ]; 39 40 meta = with pkgs.lib; { 41 description = "Relm4 foreign node controlled by Gleam over Erlang distribution"; 42 license = licenses.mit; 43 mainProgram = "gleamtk-ui"; 44 platforms = platforms.linux; 45 }; 46 }; 47 in 48 { 49 inherit gleamtk-ui; 50 default = gleamtk-ui; 51 } 52 ); 53 54 apps = forAllSystems (system: { 55 default = { 56 type = "app"; 57 program = "${self.packages.${system}.gleamtk-ui}/bin/gleamtk-ui"; 58 }; 59 ui = { 60 type = "app"; 61 program = "${self.packages.${system}.gleamtk-ui}/bin/gleamtk-ui"; 62 }; 63 }); 64 65 devShells = forAllSystems ( 66 system: 67 let 68 pkgs = nixpkgs.legacyPackages.${system}; 69 in 70 { 71 default = pkgs.mkShell { 72 name = "gleamtk"; 73 packages = with pkgs; [ 74 gleam 75 beam.packages.erlang_27.erlang 76 rebar3 77 rustc 78 cargo 79 rustfmt 80 clippy 81 pkg-config 82 gtk4 83 libadwaita 84 gsettings-desktop-schemas 85 adwaita-icon-theme 86 hicolor-icon-theme 87 just 88 ]; 89 90 # wrapGAppsHook rewrites packaged bins; bare `cargo run` still needs 91 # schema/icon paths from the shell (see shellHook). 92 nativeBuildInputs = with pkgs; [ wrapGAppsHook4 ]; 93 94 shellHook = '' 95 export ERL_EPMD_ADDRESS=127.0.0.1 96 export GSETTINGS_SCHEMAS_PATH="${pkgs.gtk4}/share/gsettings-schemas/${pkgs.gtk4.name}:${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.libadwaita}/share/gsettings-schemas/${pkgs.libadwaita.name}''${GSETTINGS_SCHEMAS_PATH:+:$GSETTINGS_SCHEMAS_PATH}" 97 export XDG_DATA_DIRS="${pkgs.gsettings-desktop-schemas}/share:${pkgs.gtk4}/share:${pkgs.libadwaita}/share:${pkgs.adwaita-icon-theme}/share:${pkgs.hicolor-icon-theme}/share''${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" 98 echo "gleamtk dev shell" 99 echo " just ui # start Relm4 foreign node" 100 echo " just gleam # start Gleam controller" 101 echo " just run # ui in bg + gleam (needs display)" 102 echo " just smoke # headless dist handshake test" 103 echo " nix build # package gleamtk-ui" 104 ''; 105 }; 106 } 107 ); 108 109 formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style); 110 }; 111}