snowfallorg / nix-software-center

A simple gtk4/libadwaita software center to easily install and manage nix packages
GNU General Public License v3.0
560 stars 16 forks source link

Build errors #2

Closed geckolinux closed 1 year ago

geckolinux commented 1 year ago

Hi there, thanks very much for creating this, I'm excited to try it. These are the build errors that I'm seeing on NixOS 22.05 without Flakes:

Found ninja-1.10.2 at /nix/store/wfdrrpzvxslxzq1jc024xkp3n74wwgcn-ninja-1.10.2/bin/ninja
meson: enabled parallel building
building
build flags: -j1 -l1
[1/6] Generating data/dev.vlinkz.NixSoftwareCenter.desktop with a custom command
[2/6] Generating data/dev.vlinkz.NixSoftwareCenter.metainfo.xml with a custom command
[3/6] Generating data/dev.vlinkz.NixSoftwareCenter.policy with a custom command
[4/6] Generating src/resources_gresource with a custom command
xml-stripblanks preprocessing requested, but XMLLINT is not set, and xmllint is not in PATH
[4/6] Generating src/cargo-build with a custom command
error: package `pango v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#9fe7e5ce)` cannot be built because it requires rustc 1.63 or newer, while the currently active rustc version is 1.60.0
FAILED: src/nix-software-center 
/nix/store/p643r4aczmzb0dhyrx3dj592f0s5v7xj-coreutils-9.0/bin/env CARGO_HOME=/build/mmimyrzqc5cnhvjvdsyj86p6anj3xrp5-source/build/cargo-home /nix/store/2gwhsd2jcz90zni0pwlhhfbmfbflixws-cargo-1.60.0/bin/cargo build --manifest-path /build/mmimyrzqc5cnhvjvdsyj86p6anj3xrp5-source/Cargo.toml --target-dir /build/mmimyrzqc5cnhvjvdsyj86p6anj3xrp5-source/build/src --release && cp src/release/nix-software-center src/nix-software-center
ninja: build stopped: subcommand failed.
error: builder for '/nix/store/iw2xfb1b0yg9wydsq0443a3m3h52qz7p-nix-software-center-0.0.1.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/7733kcrwqf39km1sc711ilfqf91rzkyv-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/3d3g50y11wkz51w8g1zz8608fdh8vpsi-nixos-system-nixos-22.05.2992.45b56b5321a.drv' failed to build

This is how I define the package:


# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, lib, ... }:
let
  nix-software-center = (import (pkgs.fetchFromGitHub {
    owner = "vlinkz";
    repo = "nix-software-center";
    rev = "0.0.1";
    sha256 = "sha256-uolXh0z6gRBUZIXVSGyLn3swogz7VHvCwKCr02BejTQ";
  })) {};
in
davidak commented 1 year ago

I got a similar error with the same method:

...
The Meson build system
Version: 0.61.2
Source dir: /build/mmimyrzqc5cnhvjvdsyj86p6anj3xrp5-source
Build dir: /build/mmimyrzqc5cnhvjvdsyj86p6anj3xrp5-source/build
Build type: native build
Project name: nix-software-center
Project version: 0.0.1
Rust compiler for the host machine: rustc -C linker=gcc (rustc 1.60.0)
Rust linker for the host machine: rustc -C linker=gcc ld.bfd 2.38
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /nix/store/5ffg1jkxhw1dwry3vn8rx0dxq9n85daa-pkg-config-wrapper-0.29.2/bin/pkg-config (0.29.2)
Run-time dependency openssl found: YES 1.1.1q
Run-time dependency glib-2.0 found: YES 2.72.3
Run-time dependency gio-2.0 found: YES 2.72.3
Run-time dependency gtk4 found: YES 4.6.6
Run-time dependency libadwaita-1 found: YES 1.2.rc
Run-time dependency polkit-gobject-1 found: YES 0.120
Program glib-compile-resources found: YES (/nix/store/cdnr7322gs5kcr99m3qb9fivz0lwnan9-glib-2.72.3-dev/bin/glib-compile-resources)
Program glib-compile-schemas found: YES (/nix/store/cdnr7322gs5kcr99m3qb9fivz0lwnan9-glib-2.72.3-dev/bin/glib-compile-schemas)
Program desktop-file-validate found: YES (/nix/store/fm38ij9i9bs5lj1axm21r6m7q77xr0a2-desktop-file-utils-0.26/bin/desktop-file-validate)
Program appstream-util found: YES (/nix/store/ygg8wg2dylmfgb4j5bxk1gk5r5hv9h0x-appstream-glib-0.7.18-dev/bin/appstream-util)
Program cargo found: YES (/nix/store/2gwhsd2jcz90zni0pwlhhfbmfbflixws-cargo-1.60.0/bin/cargo)
Configuring dev.vlinkz.NixSoftwareCenter.desktop.in using configuration
Configuring dev.vlinkz.NixSoftwareCenter.metainfo.xml.in using configuration
Configuring dev.vlinkz.NixSoftwareCenter.policy.in using configuration
Configuring dev.vlinkz.NixSoftwareCenter.gschema.xml using configuration
Found pkg-config: /nix/store/5ffg1jkxhw1dwry3vn8rx0dxq9n85daa-pkg-config-wrapper-0.29.2/bin/pkg-config (0.29.2)
Program glib-compile-resources found: YES (/nix/store/cdnr7322gs5kcr99m3qb9fivz0lwnan9-glib-2.72.3-dev/bin/glib-compile-resources)
Configuring config.rs using configuration
Message: Building in release mode
Message: Building in release mode
Dependency gio-2.0 found: YES 2.72.3 (cached)
Program glib-compile-schemas found: YES (/nix/store/cdnr7322gs5kcr99m3qb9fivz0lwnan9-glib-2.72.3-dev/bin/glib-compile-schemas)
Dependency gtk4 found: YES 4.6.6 (cached)
WARNING: pkgconfig variable 'gtk4_update_icon_cache' not defined for dependency gtk4.
Program gtk4-update-icon-cache found: YES (/nix/store/1z5h6yj1fbl7igw9dig13v7d99nlkqfb-gtk4-4.6.6/bin/gtk4-update-icon-cache)
Did not find CMake 'cmake'
Found CMake: NO
Build-time dependency desktop-file-utils found: NO (tried pkgconfig and cmake)
Program update-desktop-database found: YES (/nix/store/fm38ij9i9bs5lj1axm21r6m7q77xr0a2-desktop-file-utils-0.26/bin/update-desktop-database)
Build targets in project: 9

nix-software-center 0.0.1

  User defined options
    auto_features: enabled
    bindir       : /nix/store/1bc6rclr9hs6awp29rsplfrriaajayfl-nix-software-center-0.0.1/bin
    buildtype    : plain
    includedir   : /nix/store/1bc6rclr9hs6awp29rsplfrriaajayfl-nix-software-center-0.0.1/include
    infodir      : /nix/store/1bc6rclr9hs6awp29rsplfrriaajayfl-nix-software-center-0.0.1/share/info
    libdir       : /nix/store/1bc6rclr9hs6awp29rsplfrriaajayfl-nix-software-center-0.0.1/lib
    libexecdir   : /nix/store/1bc6rclr9hs6awp29rsplfrriaajayfl-nix-software-center-0.0.1/libexec
    localedir    : /nix/store/1bc6rclr9hs6awp29rsplfrriaajayfl-nix-software-center-0.0.1/share/locale
    mandir       : /nix/store/1bc6rclr9hs6awp29rsplfrriaajayfl-nix-software-center-0.0.1/share/man
    prefix       : /nix/store/1bc6rclr9hs6awp29rsplfrriaajayfl-nix-software-center-0.0.1
    sbindir      : /nix/store/1bc6rclr9hs6awp29rsplfrriaajayfl-nix-software-center-0.0.1/sbin
    wrap_mode    : nodownload

Found ninja-1.10.2 at /nix/store/wfdrrpzvxslxzq1jc024xkp3n74wwgcn-ninja-1.10.2/bin/ninja
meson: enabled parallel building
building
build flags: -j16 -l16
[0/6] Generating src/cargo-build with a custom command
error: package `gio v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#9fe7e5ce)` cannot be built because it requires rustc 1.63 or newer, while the currently active rustc version is 1.60.0
[1/6] Generating src/resources_gresource with a custom command
xml-stripblanks preprocessing requested, but XMLLINT is not set, and xmllint is not in PATH
[4/6] Generating data/dev.vlinkz.NixSoftwareCenter.policy with a custom command
FAILED: src/nix-software-center 
/nix/store/p643r4aczmzb0dhyrx3dj592f0s5v7xj-coreutils-9.0/bin/env CARGO_HOME=/build/mmimyrzqc5cnhvjvdsyj86p6anj3xrp5-source/build/cargo-home /nix/store/2gwhsd2jcz90zni0pwlhhfbmfbflixws-cargo-1.60.0/bin/cargo build --manifest-path /build/mmimyrzqc5cnhvjvdsyj86p6anj3xrp5-source/Cargo.toml --target-dir /build/mmimyrzqc5cnhvjvdsyj86p6anj3xrp5-source/build/src --release && cp src/release/nix-software-center src/nix-software-center
ninja: build stopped: subcommand failed.
error: builder for '/nix/store/1sqrx1dhl89xxzwrs57c771azrgglpd2-nix-software-center-0.0.1.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/yx55xm2xl397msg0hk89hgxzxwmbsrg7-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/av8wy0sqa77832azs5ajyx0fwv61j3xr-nixos-system-gaming-22.05.3201.bcc68429a50.drv' failed to build
vlinkz commented 1 year ago

I think the reason for the error is that you're using NixOS 22.05 stable without flakes, and the rust version is too old to compile some of the dependencies. I'll look into possible workarounds

davidak commented 1 year ago

Still fails btw:

...
   Compiling nsc-helper v0.1.0 (/build/7fg3ni5dyg1giw67gm32v7v7j6sap5f6-source/nsc-helper)
    Finished release [optimized] target(s) in 11.55s
[4/6] Generating data/dev.vlinkz.NixSoftwareCenter.policy with a custom command
[5/6] Generating src/cargo-build with a custom command
error: package `spdx v0.10.0` cannot be built because it requires rustc 1.65.0 or newer, while the currently active rustc version is 1.64.0
FAILED: src/nix-software-center 
/nix/store/gn5515zj8skk23jvrrljirgxr10fw9az-coreutils-9.1/bin/env CARGO_HOME=/build/7fg3ni5dyg1giw67gm32v7v7j6sap5f6-source/build/cargo-home /nix/store/325blkx2nd4iy38snay1cps2kqcrsbd1-cargo-1.64.0/bin/cargo build --manifest-path /build/7fg3ni5dyg1giw67gm32v7v7j6sap5f6-source/Cargo.toml --target-dir /build/7fg3ni5dyg1giw67gm32v7v7j6sap5f6-source/build/src --release && cp src/release/nix-software-center src/nix-software-center
ninja: build stopped: subcommand failed.
error: builder for '/nix/store/4qgki8gg6c3r5k5xff128jmbxx5rpsq2-nix-software-center-0.1.1.drv' failed with exit code 1

(64ef8b1bb08fe27863743ea5f135391c7fd287a3)

Zahrun commented 1 year ago

I figured out that rust 1.66 is also already packaged in 22.11, but not used by default. So, as a workaround, I modified default.nix to use that specific version of rust in https://github.com/Zahrun/nix-software-center/commit/8097b317fd1d5d0fd2d4d7b666086edd9ff8d129. There might be a better way to select the rust version, and maybe allow it to be set as an override or an overlay or something, but I don't know how to do that, and for the time being this workaround allows to build in nixos-22.11:

nix-software-center = (import (pkgs.fetchFromGitHub {
    owner = "zahrun";
    repo = "nix-software-center";
    rev = "8097b317fd1d5d0fd2d4d7b666086edd9ff8d129";
    sha256 = "sha256-ZVtw/ChkS3sSA4qm6CSvZQxXeES+PQwXmgaZxddixQo=";
  })) {};

I did the same for nixos-conf-editor in https://github.com/Zahrun/nixos-conf-editor/commit/03eac62c40003516fa256be64df265a088958ae9:

nixos-conf-editor = (import (pkgs.fetchFromGitHub {
    owner = "vlinkz";
    repo = "nixos-conf-editor";
    rev = "03eac62c40003516fa256be64df265a088958ae9";
    sha256 = "sha256-Nb9IgSdgZQ4GllGStsINL1KfLzX2XxEAEhr8tEWBr4c=";
  })) {};

Please note that this workaround will not work in unstable because rustPackages_1_66 does not exist any longer there, so this is to use only in 22.11.

EDIT: This also works:

{ config, pkgs, ... }:
let
  unstable = import (builtins.fetchTarball {
    url = "https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz";
  }) {config = config.nixpkgs.config;};
  nix-software-center = import (pkgs.fetchFromGitHub {
    owner = "vlinkz";
    repo = "nix-software-center";
    rev = "0.1.1";
    sha256 = "0frigabszyfkphfbsniaa1d546zm8a2gx0cqvk2fr2qfa71kd41n";
  }) {pkgs = unstable;};
in
{
  environment.systemPackages = with pkgs; [
    nix-software-center
  ];
}

And similarly

nixos-conf-editor = import (pkgs.fetchFromGitHub {
    owner = "vlinkz";
    repo = "nixos-conf-editor";
    rev = "0.1.1";
    sha256 = "sha256-TeDpfaIRoDg01FIP8JZIS7RsGok/Z24Y3Kf+PuKt6K4=";
  }) {pkgs = unstable;};