Compare commits

...

6 Commits

6 changed files with 152 additions and 118 deletions

View File

@@ -52,63 +52,63 @@ let
typelibPath = pkgs: lib.concatStringsSep ":" (builtins.map (p: "${lib.getLib p}/lib/girepository-1.0") pkgs);
# `cargo` which adds the correct env vars and `--target` flag when invoked from meson build scripts
crossCargo = let
inherit (final.pkgsBuildHost) cargo;
inherit (final.rust.envVars) setEnv rustHostPlatformSpec;
in (final.pkgsBuildBuild.writeShellScriptBin "cargo" ''
targetDir=target
isFlavored=
outDir=
profile=
# crossCargo = let
# inherit (final.pkgsBuildHost) cargo;
# inherit (final.rust.envVars) setEnv rustHostPlatformSpec;
# in (final.pkgsBuildBuild.writeShellScriptBin "cargo" ''
# targetDir=target
# isFlavored=
# outDir=
# profile=
cargoArgs=("$@")
nextIsOutDir=
nextIsProfile=
nextIsTargetDir=
for arg in "''${cargoArgs[@]}"; do
if [[ -n "$nextIsOutDir" ]]; then
nextIsOutDir=
outDir="$arg"
elif [[ -n "$nextIsProfile" ]]; then
nextIsProfile=
profile="$arg"
elif [[ -n "$nextIsTargetDir" ]]; then
nextIsTargetDir=
targetDir="$arg"
elif [[ "$arg" = "build" ]]; then
isFlavored=1
elif [[ "$arg" = "--out-dir" ]]; then
nextIsOutDir=1
elif [[ "$arg" = "--profile" ]]; then
nextIsProfile=1
elif [[ "$arg" = "--release" ]]; then
profile=release
elif [[ "$arg" = "--target-dir" ]]; then
nextIsTargetDir=1
fi
done
# cargoArgs=("$@")
# nextIsOutDir=
# nextIsProfile=
# nextIsTargetDir=
# for arg in "''${cargoArgs[@]}"; do
# if [[ -n "$nextIsOutDir" ]]; then
# nextIsOutDir=
# outDir="$arg"
# elif [[ -n "$nextIsProfile" ]]; then
# nextIsProfile=
# profile="$arg"
# elif [[ -n "$nextIsTargetDir" ]]; then
# nextIsTargetDir=
# targetDir="$arg"
# elif [[ "$arg" = "build" ]]; then
# isFlavored=1
# elif [[ "$arg" = "--out-dir" ]]; then
# nextIsOutDir=1
# elif [[ "$arg" = "--profile" ]]; then
# nextIsProfile=1
# elif [[ "$arg" = "--release" ]]; then
# profile=release
# elif [[ "$arg" = "--target-dir" ]]; then
# nextIsTargetDir=1
# fi
# done
extraFlags=()
# extraFlags=()
# not all subcommands support flavored arguments like `--target`
if [ -n "$isFlavored" ]; then
# pass the target triple to cargo so it will cross compile
# and fix so it places outputs in the same directory as non-cross, see: <https://doc.rust-lang.org/cargo/guide/build-cache.html>
extraFlags+=(
--target "${rustHostPlatformSpec}"
-Z unstable-options
)
if [ -z "$outDir" ]; then
extraFlags+=(
--out-dir "$targetDir"/''${profile:-debug}
)
fi
fi
# # not all subcommands support flavored arguments like `--target`
# if [ -n "$isFlavored" ]; then
# # pass the target triple to cargo so it will cross compile
# # and fix so it places outputs in the same directory as non-cross, see: <https://doc.rust-lang.org/cargo/guide/build-cache.html>
# extraFlags+=(
# --target "${rustHostPlatformSpec}"
# -Z unstable-options
# )
# if [ -z "$outDir" ]; then
# extraFlags+=(
# --out-dir "$targetDir"/''${profile:-debug}
# )
# fi
# fi
exec ${setEnv} "${lib.getExe cargo}" "$@" "''${extraFlags[@]}"
'').overrideAttrs {
inherit (cargo) meta;
};
# exec ${setEnv} "${lib.getExe cargo}" "$@" "''${extraFlags[@]}"
# '').overrideAttrs {
# inherit (cargo) meta;
# };
in with final; {
# binutils = prev.binutils.override {
# # fix that resulting binary files would specify build #!sh as their interpreter.
@@ -152,6 +152,10 @@ in with final; {
# binutils = binutils-unwrapped;
# };
# envelope = prev.envelope.override {
# cargo = crossCargo;
# };
# 2025/07/27: upstreaming is unblocked
# emacs = prev.emacs.override {
# nativeComp = false; # will be renamed to `withNativeCompilation` in future
@@ -159,10 +163,6 @@ in with final; {
# # <https://www.gnu.org/software/autoconf/manual/autoconf-2.63/html_node/Runtime.html>
# };
envelope = prev.envelope.override {
cargo = crossCargo; #< fixes openssl not being able to find its library
};
# 2025/07/27: upstreaming is unblocked
# firejail = prev.firejail.overrideAttrs (upstream: {
# # firejail executes its build outputs to produce the default filter list.
@@ -295,7 +295,7 @@ in with final; {
# ];
# });
lemoa = prev.lemoa.override { cargo = crossCargo; };
# lemoa = prev.lemoa.override { cargo = crossCargo; };
# libsForQt5 = prev.libsForQt5.overrideScope (self: super: {
# # 2025/07/27: upstreaming is blocked on qtsvg
@@ -349,45 +349,45 @@ in with final; {
# 2025/07/27: upstreaming is unblocked by deps; but turns out to not be this simple
# ncftp = addNativeInputs [ bintools ] prev.ncftp;
# 2025/08/26: upstreaming is unblocked
newsflash = (prev.newsflash.override {
cargo = crossCargo;
}).overrideAttrs (upstream: {
postPatch = (upstream.postPatch or "") + ''
rm build.rs
# 2025/08/27: upstreaming is unblocked, implemented on desko branch `pr-newsflash-cross`
# newsflash = (prev.newsflash.override {
# cargo = crossCargo;
# }).overrideAttrs (upstream: {
# postPatch = (upstream.postPatch or "") + ''
# rm build.rs
export OUT_DIR=$(pwd)
# export OUT_DIR=$(pwd)
# from build.rs:
glib-compile-resources --sourcedir=data/resources --target=icons.gresource data/resources/icons.gresource.xml
glib-compile-resources --sourcedir=data/resources --target=styles.gresource data/resources/styles.gresource.xml
substitute data/io.gitlab.news_flash.NewsFlash.appdata.xml.in.in \
data/resources/io.gitlab.news_flash.NewsFlash.appdata.xml \
--replace-fail '@appid@' 'io.gitlab.news_flash.NewsFlash'
glib-compile-resources --sourcedir=data/resources --target=appdata.gresource data/resources/appdata.gresource.xml
'';
# # from build.rs:
# glib-compile-resources --sourcedir=data/resources --target=icons.gresource data/resources/icons.gresource.xml
# glib-compile-resources --sourcedir=data/resources --target=styles.gresource data/resources/styles.gresource.xml
# substitute data/io.gitlab.news_flash.NewsFlash.appdata.xml.in.in \
# data/resources/io.gitlab.news_flash.NewsFlash.appdata.xml \
# --replace-fail '@appid@' 'io.gitlab.news_flash.NewsFlash'
# glib-compile-resources --sourcedir=data/resources --target=appdata.gresource data/resources/appdata.gresource.xml
# '';
env = let
ccForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc";
cxxForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++";
ccForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
cxxForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++";
rustBuildPlatform = stdenv.buildPlatform.rust.rustcTarget;
rustTargetPlatform = stdenv.hostPlatform.rust.rustcTarget;
in (upstream.env or {}) // {
# taken from <pkgs/build-support/rust/hooks/default.nix>
# fixes "cargo:warning=aarch64-unknown-linux-gnu-gcc: error: unrecognized command-line option -m64"
# XXX: these aren't necessarily valid environment variables: the referenced nix file is more clever to get them to work.
"CC_${rustBuildPlatform}" = "${ccForBuild}";
"CXX_${rustBuildPlatform}" = "${cxxForBuild}";
"CC_${rustTargetPlatform}" = "${ccForHost}";
"CXX_${rustTargetPlatform}" = "${cxxForHost}";
# fails to fix "Failed to find OpenSSL development headers."
# OPENSSL_NO_VENDOR = 1;
# OPENSSL_LIB_DIR = "${lib.getLib openssl}/lib";
# OPENSSL_DIR = "${lib.getDev openssl}";
};
});
# env = let
# ccForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc";
# cxxForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++";
# ccForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
# cxxForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++";
# rustBuildPlatform = stdenv.buildPlatform.rust.rustcTarget;
# rustTargetPlatform = stdenv.hostPlatform.rust.rustcTarget;
# in (upstream.env or {}) // {
# # taken from <pkgs/build-support/rust/hooks/default.nix>
# # fixes "cargo:warning=aarch64-unknown-linux-gnu-gcc: error: unrecognized command-line option -m64"
# # XXX: these aren't necessarily valid environment variables: the referenced nix file is more clever to get them to work.
# "CC_${rustBuildPlatform}" = "${ccForBuild}";
# "CXX_${rustBuildPlatform}" = "${cxxForBuild}";
# "CC_${rustTargetPlatform}" = "${ccForHost}";
# "CXX_${rustTargetPlatform}" = "${cxxForHost}";
# # fails to fix "Failed to find OpenSSL development headers."
# # OPENSSL_NO_VENDOR = 1;
# # OPENSSL_LIB_DIR = "${lib.getLib openssl}/lib";
# # OPENSSL_DIR = "${lib.getDev openssl}";
# };
# });
# fixes "properties/gresource.xml: Permission denied"
# - by providing glib-compile-resources
@@ -675,11 +675,11 @@ in with final; {
# # '';
# });
# 2025/08/26: upstreaming is unblocked, but not as simple as the glycin-loaders approach!
snapshot = prev.snapshot.override {
# fixes "error: linker `cc` not found"
cargo = crossCargo;
};
# 2025/08/26: upstreaming is unblocked; implemented on desko `pr-snapshot-cross` branch
# snapshot = prev.snapshot.override {
# # fixes "error: linker `cc` not found"
# cargo = crossCargo;
# };
# 2025/08/26: upstreaming is unblocked; patched on desko branch `pr-spot-cross`
# spot = prev.spot.override {

View File

@@ -9,9 +9,11 @@
libsoup_3,
meson,
ninja,
nix-update-script,
openssl,
pkg-config,
python3,
rust,
rustPlatform,
rustc,
stdenv,
@@ -19,20 +21,21 @@
wrapGAppsHook4,
}:
stdenv.mkDerivation {
stdenv.mkDerivation (finalAttrs: {
pname = "envelope";
version = "0.1.0-unstable-2024-09-13";
version = "0.1.0-unstable-2025-05-17";
src = fetchFromGitLab {
domain = "gitlab.gnome.org";
owner = "felinira";
repo = "envelope";
rev = "11ce86da13793787a25e48ca23322b33fcf8bf34"; # last commit before libadwaita 1.6
hash = "sha256-EX309RhisBx27TscMsibEvqCSCUSukTgf4Xs1Vws4YY=";
rev = "e2a8a56aa9b68d82486b99790b86322715d2a6db";
hash = "sha256-osVShCaKKoGhxWCjaYcMkOji8e0oETgDaDpCAfHauwQ=";
};
cargoDeps = rustPlatform.importCargoLock {
lockFile = ./Cargo.lock;
cargoDeps = rustPlatform.fetchCargoVendor {
inherit (finalAttrs) pname version src;
hash = "sha256-8pK8cw9nYJmmybYRL+PUCK8FvUUPbyFp7oYYF461KPc=";
};
nativeBuildInputs = [
@@ -58,10 +61,21 @@ stdenv.mkDerivation {
postPatch = ''
patchShebangs --build build-aux/meson-cargo-manifest.py
# versions prior to c3f5ed4f (2024-10-13) didn't embed Cargo.lock
cp ${./Cargo.lock} Cargo.lock
substituteInPlace src/meson.build \
--replace-fail \
"'src' / rust_target / meson.project_name()" \
"'src' / '${stdenv.hostPlatform.rust.cargoShortTarget}' / rust_target / meson.project_name()"
'';
env."CC_${stdenv.buildPlatform.rust.rustcTarget}" = rust.envVars.ccForBuild; #< fixes cross build of sql-macros proc-macro
env.CARGO_BUILD_TARGET = stdenv.hostPlatform.rust.rustcTargetSpec;
env.OPENSSL_NO_VENDOR = true; #< speculative, to use the nixos openssl
env.RUSTC_BOOTSTRAP = 1; #< fixes 'error[E0554]: `#![feature]` may not be used on the stable release channel'
# env.LIBSQLITE3_SYS_USE_PKG_CONFIG = 1; #< TODO: use nixos libsqlite instead of pre-packaged one
passthru.updateScript = nix-update-script { };
meta = with lib; {
description = "a mobile-first email client for the GNOME ecosystem";
homepage = "https://gitlab.gnome.org/felinira/envelope/";
@@ -70,4 +84,4 @@ stdenv.mkDerivation {
platforms = platforms.linux;
mainProgram = "envelope";
};
}
})

View File

@@ -33,6 +33,12 @@ stdenv.mkDerivation rec {
hash = "sha256-ALoxT+RLL4omJ7quWDJVdXgevaO8i8q/29FFFudIRV4=";
};
postPatch = ''
substituteInPlace src/meson.build --replace-fail \
"'target' / rust_target / meson.project_name()" \
"'target' / '${stdenv.hostPlatform.rust.cargoShortTarget}' / rust_target / meson.project_name()"
'';
nativeBuildInputs = [
cargo
desktop-file-utils
@@ -49,6 +55,8 @@ stdenv.mkDerivation rec {
openssl
];
env.CARGO_BUILD_TARGET = stdenv.hostPlatform.rust.rustcTargetSpec;
passthru.updateScript = gitUpdater {
rev-prefix = "v";
};

View File

@@ -14,8 +14,8 @@
mkNixpkgs ? import ./mkNixpkgs.nix {},
}:
mkNixpkgs {
rev = "465ab8f0977d05657b1b4adc6e7e06fe4db04c0c";
sha256 = "sha256-yHIaDRjaBtRjYbm1ByhRqsAnMncLTG/uDDHHC2wXBMY=";
version = "unstable-2025-08-26";
rev = "2882c071a83fa909c4c3d171f65c71000e90f9fb";
sha256 = "sha256-q5G/GIlkYheWnM667b/mm1sVWK9FpncwQU8vdMIcJE0=";
version = "unstable-2025-08-27";
branch = "master";
}

View File

@@ -62,6 +62,12 @@ in
hash = "sha256-B7s2aNVony+G7FW2PaR7FVO7zzWa7SiLONWRGrsXA3A=";
})
(fetchpatch' {
name = "gmobile: set strictDeps, fix cross compilation";
saneCommit = "223b327fcc0775212bcc30a0bfb57c90ce5e3251";
hash = "sha256-ww6oAJF/AA6GhqJ1nS3QhHHcH7xiZUcNOKKvtE6NkGQ=";
})
(fetchpatch' {
# desko nixpkgs branch: `pr-papers-cross`
name = "papers: fix cross compilation";
@@ -91,10 +97,16 @@ in
})
(fetchpatch' {
name = "coincurve: fix build";
# saneCommit = "cd118a2491e613f0d4dd8673a6ac17a0094dd987";
prUrl = "https://github.com/NixOS/nixpkgs/pull/437180";
hash = "sha256-u/dLLLG7Keamd5sZyXnSEpXWFRnX2dITt2lNSiO3Ux8=";
# desko nixpkgs branch: `pr-snapshot-cross`
name = "snapshot: fix cross compilation";
saneCommit = "9bf01eef452d46c2990cdc872017f1015892ea7d";
hash = "sha256-F6RwprsXOWjk/xNHtBqQWge5edLGJeQUrupKZ1MNphU=";
})
(fetchpatch' {
name = "newsflash: fix cross compilation";
saneCommit = "0453c58e9acf42c4ba52f3fda21d7e51139c0141";
hash = "sha256-lLdPik9Iw9Cl7ZdAJIeKsbAfB7eyf57HEQpe3A0NHhM=";
})
# (fetchpatch' {

View File

@@ -7,8 +7,8 @@ let
src = fetchFromGitHub {
owner = "nix-community";
repo = "nixpkgs-wayland";
rev = "2898b0f9932858f1c13af0fa14948d7a863591c4";
hash = "sha256-zEMC/0SVpVZEIhapL+malHbr3R1YvWQEZh+IjIamGhE=";
rev = "e17d5ee5c85384d098637971e18829d5580a3102";
hash = "sha256-ldfBNHSQcL9D05Ctkulnq657n6U3QQa4HB2Ym21fEyw=";
};
flake = import "${src}/flake.nix";
evaluated = flake.outputs {
@@ -25,7 +25,7 @@ let
in src.overrideAttrs (base: {
# attributes required by update scripts
pname = "nixpkgs-wayland";
version = "0-unstable-2025-08-26";
version = "0-unstable-2025-08-27";
src = src;
# passthru only nixpkgs-wayland's own packages -- not the whole nixpkgs-with-nixpkgs-wayland-as-overlay: