Skip to content

Is realising the package strictly necessary? Could not requiring it make this tool usable for packaging stuff in nixpkgs? #9

@das-g

Description

@das-g

nix-playground could probably be useful also in initial packaging of software in nixpkgs, namely for trying out how the upstream source code has to be patched to get everything to work, without having to manage clones of the upstream repos manually. However, for that it'd be useful to be able to check out the source code without requiring a successful realisation of the package, as the package definition might be in-progress and therefore the build might not succeed, yet.

example: packaging Thymio Suite

Example: developing a patch presumably needed for packaging Thymio Suite

I try to package Thymio Suite.

To that end, I've created in my local clone of nixpkgs the file pkgs/by-name/th/thymio-suite/package.nix with the following work-in-progress content:

{
  cmake,
  fetchFromGitHub,
  mesa,
  ninja,
  stdenv,
  qt5
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "thymio-suite";
  version = "2.4.0";

  src = fetchFromGitHub {
    owner = "Mobsya";
    repo = "aseba";
    rev = finalAttrs.version;
    hash = "sha256-GSBYhWUOVmNDXNwL9cjhozlH6rH6ZW6ZUnc6ZPvRy+I=";
    fetchSubmodules = true;
  };

  nativeBuildInputs = [ cmake qt5.wrapQtAppsHook ];

  builtInputs = [ mesa ];
})

Let's try it, to let error messages drive our further packaging:

nix-build -A thymio-suite

This fails with

CMake Error at enki/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 has been removed from CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.

  Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.

Alright. Seems like I need to patch
https://github.com/Mobsya/enki/blob/3795c47c85fd65edb10fb5dcc9144c5fa6971b20/CMakeLists.txt#L1
in the Git submodule. (I don't yet know whether that's actually true, but that's what I wanted to try next.)

I don't care to decide where to put the upstream source on my file system (and remembering to delete it when I don't need it anymore). I remembered that there was a tool for automating this and decided to try it:

nix run nixpkgs#nix-playground -- checkout .#thymio-suite

Unfortunately, because this tries to realise the (not-yet finished) package, this fails with the very same error that I wanted to tackle with the help of this tool.

Is there a reason nix-playground must realise the package in question? The source code should be available without that, I'd assume.

Is this something that could be changed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions