From 32393f12c03d0a01bd7da22b3bb66d74a647d72d Mon Sep 17 00:00:00 2001 From: Elec3137 Date: Sun, 1 Feb 2026 11:46:56 -0800 Subject: [PATCH 1/4] add packages.default flake output this likely doesn't work (yet), cannot properly test because at time of writing, the app doesn't compile through `flutter run` either. --- flake.nix | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/flake.nix b/flake.nix index c4c5cc3..a167232 100644 --- a/flake.nix +++ b/flake.nix @@ -29,6 +29,20 @@ ... }: + let + src = ./.; + + # from https://discourse.nixos.org/t/is-there-a-way-to-read-a-yaml-file-and-get-back-a-set/18385/5 + fromYAML = + file: + builtins.fromJSON ( + builtins.readFile ( + pkgs.runCommand "converted-yaml.json" { } ''${pkgs.yj}/bin/yj < "${file}" > "$out"'' + ) + ); + + package = fromYAML "${src}/pubspec.yaml"; + in { _module.args.pkgs = import nixpkgs { inherit system; @@ -59,6 +73,20 @@ CPATH = lib.makeSearchPath "include" [ pkgs.glibc.dev ]; }; }; + + packages.default = pkgs.flutter.buildFlutterApplication { + inherit src; + pname = package.name; + version = package.version; + + pubspecLock = fromYAML "${src}/pubspec.lock"; + gitHashes = { + flutter_chat_ui = "sha256-4fuag7lRH5cMBFD3fUzj2K541JwXLoz8HF/4OMr3uhk="; + flutter_link_previewer = "sha256-4fuag7lRH5cMBFD3fUzj2K541JwXLoz8HF/4OMr3uhk="; + flyer_chat_text_message = "sha256-4fuag7lRH5cMBFD3fUzj2K541JwXLoz8HF/4OMr3uhk="; + window_size = "sha256-XelNtp7tpZ91QCEcvewVphNUtgQX7xrp5QP0oFo6DgM="; + }; + }; }; }; } From f72c59f79d21531aab6366ebe5727071f7fe8cb6 Mon Sep 17 00:00:00 2001 From: Elec3137 Date: Sun, 1 Feb 2026 14:13:29 -0800 Subject: [PATCH 2/4] rename fromYAML -> importYAML this is more consistent with existing nixpkgs.lib functions --- flake.nix | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/flake.nix b/flake.nix index a167232..5c2c10a 100644 --- a/flake.nix +++ b/flake.nix @@ -33,15 +33,13 @@ src = ./.; # from https://discourse.nixos.org/t/is-there-a-way-to-read-a-yaml-file-and-get-back-a-set/18385/5 - fromYAML = + importYAML = file: - builtins.fromJSON ( - builtins.readFile ( - pkgs.runCommand "converted-yaml.json" { } ''${pkgs.yj}/bin/yj < "${file}" > "$out"'' - ) + lib.importJSON ( + pkgs.runCommand "converted-yaml.json" { } ''${pkgs.yj}/bin/yj < "${file}" > "$out"'' ); - package = fromYAML "${src}/pubspec.yaml"; + package = importYAML "${src}/pubspec.yaml"; in { _module.args.pkgs = import nixpkgs { @@ -79,7 +77,7 @@ pname = package.name; version = package.version; - pubspecLock = fromYAML "${src}/pubspec.lock"; + pubspecLock = importYAML "${src}/pubspec.lock"; gitHashes = { flutter_chat_ui = "sha256-4fuag7lRH5cMBFD3fUzj2K541JwXLoz8HF/4OMr3uhk="; flutter_link_previewer = "sha256-4fuag7lRH5cMBFD3fUzj2K541JwXLoz8HF/4OMr3uhk="; From cc050f62fc8d4db67a70cd443b3b58ac58a1c078 Mon Sep 17 00:00:00 2001 From: Elec3137 Date: Sun, 1 Feb 2026 14:25:45 -0800 Subject: [PATCH 3/4] dubious (mostly style) changes in flake --- flake.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/flake.nix b/flake.nix index 5c2c10a..c4d1da3 100644 --- a/flake.nix +++ b/flake.nix @@ -40,6 +40,10 @@ ); package = importYAML "${src}/pubspec.yaml"; + + usedFlutter = (pkgs.flutter.override { extraPkgConfigPackages = [ pkgs.libsecret ]; }); + + buildInputs = [ pkgs.sqlite ]; in { _module.args.pkgs = import nixpkgs { @@ -57,23 +61,19 @@ olm git clang - (flutter.override { extraPkgConfigPackages = [ pkgs.libsecret ]; }) + usedFlutter (pkgs.writeShellScriptBin "rustup" (builtins.readFile ./nix/fake-rustup.sh)) ]; env = { - LD_LIBRARY_PATH = "${ - pkgs.lib.makeLibraryPath ([ - pkgs.sqlite - ]) - }:./build/native_assets/linux"; + LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}:./build/native_assets/linux"; CPATH = lib.makeSearchPath "include" [ pkgs.glibc.dev ]; }; }; - packages.default = pkgs.flutter.buildFlutterApplication { - inherit src; + packages.default = usedFlutter.buildFlutterApplication { + inherit src buildInputs; pname = package.name; version = package.version; From d0df1a198b0e9f66b02003c8162832ede5e905fa Mon Sep 17 00:00:00 2001 From: Elec3137 Date: Sun, 1 Feb 2026 17:12:26 -0800 Subject: [PATCH 4/4] try to use generate script the script fails with: Couldn't resolve the package 'ffigen' in 'package:ffigen/ffigen.dart'. Couldn't resolve the package 'path' in 'package:path/path.dart'. --- flake.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/flake.nix b/flake.nix index c4d1da3..0e5e7c8 100644 --- a/flake.nix +++ b/flake.nix @@ -84,6 +84,11 @@ flyer_chat_text_message = "sha256-4fuag7lRH5cMBFD3fUzj2K541JwXLoz8HF/4OMr3uhk="; window_size = "sha256-XelNtp7tpZ91QCEcvewVphNUtgQX7xrp5QP0oFo6DgM="; }; + + patchPhase = /* sh */ '' + patchShebangs ./scripts/generate.sh + ./scripts/generate.sh # note: this doesn't quit the build on fail + ''; }; }; };