Skip to content

chasemapper: init at 1.5.3#400088

Open
scd31 wants to merge 3 commits intoNixOS:masterfrom
scd31:add-chasemapper
Open

chasemapper: init at 1.5.3#400088
scd31 wants to merge 3 commits intoNixOS:masterfrom
scd31:add-chasemapper

Conversation

@scd31
Copy link

@scd31 scd31 commented Apr 19, 2025

Add chasemapper, which is a web-app for tracking high-altitude balloons.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Apr 19, 2025
@nix-owners nix-owners bot requested a review from natsukium April 19, 2025 14:30
@github-actions github-actions bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Apr 19, 2025
@scd31 scd31 force-pushed the add-chasemapper branch from d9bf97b to 88841e3 Compare April 19, 2025 14:46
@scd31 scd31 changed the title Add chasemapper chasemapper: init at 1.5.3 Apr 19, 2025
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it be better to install as just chasemapper without the .py?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, but it would conflict with the chasemapper directory

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what you mean... is there a chasemapper dir in $out/bin?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes there is - cp -r chasemapper $out/bin/

This folder is referenced in horusmapper.py along with the other folders that get copied

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe I addressed all feedback other than this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if it would be sensible to put everything into a non-bin folder and then just have a single line bash script at $out/bin/chasemapper that calls the python file in the non-bin folder. Would that make sense?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright this is what I decided to do ^ figured putting everything in bin was hacky

@scd31 scd31 force-pushed the add-chasemapper branch from e262aee to 45cce27 Compare April 20, 2025 02:05
@h7x4 h7x4 added the 8.has: module (new) This PR adds a module in `nixos/` label Apr 23, 2025
@scd31 scd31 force-pushed the add-chasemapper branch from 45cce27 to b61075f Compare April 26, 2025 15:50
@scd31
Copy link
Author

scd31 commented Apr 26, 2025

@drupol ty! I believe I've addressed all your feedback

@scd31 scd31 force-pushed the add-chasemapper branch 2 times, most recently from 00a3fc3 to b6136d0 Compare April 27, 2025 18:56
@scd31 scd31 force-pushed the add-chasemapper branch from b6136d0 to cac6930 Compare April 27, 2025 19:06
@scd31 scd31 force-pushed the add-chasemapper branch from cac6930 to 14be6b1 Compare April 27, 2025 19:55
@scd31 scd31 force-pushed the add-chasemapper branch 2 times, most recently from 9c576e1 to 579b7f6 Compare April 28, 2025 12:25
Copy link
Contributor

@drupol drupol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add tests for the chasemapper service? There are many examples in nixpkgs already, but feel free to ask for some help if needed.

@scd31 scd31 force-pushed the add-chasemapper branch from 579b7f6 to 3cdb4ec Compare April 28, 2025 12:44
@scd31
Copy link
Author

scd31 commented Apr 28, 2025

@drupol added a test to confirm that it starts properly and listens on the HTTP port we expect (:

Comment on lines +49 to +51
echo "#!${bash}/bin/bash" > $out/bin/chasemapper
echo $out/horusmapper.py '"$@"' >> $out/bin/chasemapper
chmod +x $out/bin/chasemapper
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to create that with writeShellApplication?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this?

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin
    cp -r chasemapper $out/
    cp -r static $out/
    cp -r templates $out/
    install horusmapper.py $out/
    cp (${
      writeShellApplication {
        name = "chasemapper";
        text = "$out/horusmapper.py \"$@\"";
      }
    }) $out/bin/chasemapper

    runHook postInstall
  '';

Not really sure how to do this properly. It's not working because $out isn't bound in the inner string

Comment on lines +2 to +14
lib,
buildPythonPackage,
fetchFromGitHub,
deprecated,
hopcroftkarp,
joblib,
matplotlib,
numpy,
scikit-learn,
scipy,
pytestCheckHook,
pythonAtLeast,
pythonOlder,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please clean all the parameters that are unused? Here and in the other files too.

hash = "sha256-C8/5x8tim6s0hWgCC7LpN1hesdVME5kpQFqDTEyXHtg=";
};

sourceRoot = "source/src";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sourceRoot = "source/src";
sourceRoot = "${finalAttrs.src.name}/src";

see #245388

meta = {
description = "CUSF standalone predictor";
homepage = "https://github.com/darksidelemm/cusf_predictor_wrapper";
license = lib.licenses.gpl3;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
license = lib.licenses.gpl3;
license = lib.licenses.gpl3Only;

deprecated

Also, some files are licensed under the gpl2Plus and others are licensed under the mit.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we want to resolve the different files having different licenses? Is it safe to use gpl3only since that's what the overarching repo is marked as?

buildPythonPackage rec {
pname = "cusfpredict";
version = "0.2.1";
format = "setuptools";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must admit I'm having a bad time with this. I had to do a patch to get poetry to work:

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail poetry.masonry.api poetry.core.masonry.api \
      --replace-fail "poetry>=" "poetry-core>="
  '';

Now it's failing with the following:

 > Checking runtime dependencies for cusfpredict-0.2.1-py3-none-any.whl
       >   - cfgrib not installed
       >   - fastkml not installed
       >   - numpy not installed
       >   - python-dateutil not installed
       >   - pytz not installed
       >   - requests not installed
       >   - shapely not installed
       >   - xarray not installed

Do I really need to add cfgrib (and possibly others) to nixpkgs to get back to the place we were in before?

Comment on lines +21 to +26
src = fetchFromGitHub {
owner = "darksidelemm";
repo = "cusf_predictor_wrapper";
rev = "f4352834a037e3e2bf01a3fd7d5a25aa482e27c6";
hash = "sha256-C8/5x8tim6s0hWgCC7LpN1hesdVME5kpQFqDTEyXHtg=";
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please share the source code with cusf-predictor-wrapper.
I think these should be combined into a single package.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would this work in practice? It's a monorepo but there seems to be two distinct projects in the repo, each with a separate build system. Can they be combined into one package? Furthermore, if you want one without the other, wouldn't you still need to build both if we combined them? Chasemapper itself only needs cusfpredict, not the wrapper

Comment on lines +205 to +218
thunderforest_api_key = lib.mkOption {
default = "none";
description = ''
ThunderForest API Key
'';
type = lib.types.str;
};
stadia_api_key = lib.mkOption {
default = "none";
description = ''
Stadia Maps API Key
'';
type = lib.types.str;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these api keys secrets? If so, please consider using api_key_file since /nix/store is a public place.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this limited by chasemapper itself? It has no way to read in an API key file afaik, and this configuration is just used to generate chasemapper's config file (which ends up in /nix/store). So I would think there's not a ton we can do about this

@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jun 9, 2025
@nixpkgs-ci nixpkgs-ci bot added the 12.first-time contribution This PR is the author's first one; please be gentle! label Jun 25, 2025
@nixpkgs-ci nixpkgs-ci bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Oct 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: python Python is a high-level, general-purpose programming language. 8.has: module (new) This PR adds a module in `nixos/` 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants