Skip to content

Update flake.nix #139

Description

@sajith

I am trying a thing, and wanted to document what I am doing, and possibly improve things a bit.

The flake.nix file on this repository supports Haskell development, and I was wondering if we can also add various versions of Python to it. That would be a rather easy and reliable way to test zfec locally against all the versions of Python that we can support (if you don't mind Nix), as opposed to using pyenv, uv python etc. To be clear, those who prefer pyenv or uv could still continue using them. I happen to think that since Python, C, and Haskell are all involved, Nix offers the nicer solution.

On an old computer with a recent NixOS (nixos-version reports 26.05.20260523.64c08a7 (Yarara)), I ran nix develop and that kicked off a download of about 9GB of stuff and attempted to build some/most of that stuff, thus almost killing my computer. This probably is because flake.nix uses a four-year old version of nixpkgs, the packages from which has since been very likely evicted from Nix binary caches:

nixpkgs.url = github:nixos/nixpkgs/?ref=nixos-22.11;

I changed that line to use nixos-26.05 and compilerVersion to "ghc910" (from "ghc8107"), but that did not give me a nix develop shell:

evaluation warning: 'system' has been renamed to/replaced by 'stdenv.hostPlatform.system'
error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37|   strict = derivationStrict drvAttrs;
             |            ^
           38|

       … while evaluating derivation 'ghc-shell-for-packages-0'
         whose name attribute is located at /nix/store/i936ws2xplkqgbzkxkacqqq2dpag3ndf-source/pkgs/stdenv/generic/make-derivation.nix:647:11

       … while evaluating attribute 'shellHook' of derivation 'ghc-shell-for-packages-0'
         at /nix/store/qb4i8fph4f9sgv20jcr18pkaxi83x3in-source/lib.nix:47:7:
           46|     default = hsPkgs.shellFor {
           47|       shellHook = ''
             |       ^
           48|         # Pre-commit

       … while evaluating the option `installationScript':

       … while evaluating definitions from `/nix/store/g73hxz7blh5v6xfdcma2lm35rpwfbgrp-source/modules/pre-commit.nix':

       … while evaluating the option `hooks.alejandra.raw':

       … while evaluating definitions from `/nix/store/g73hxz7blh5v6xfdcma2lm35rpwfbgrp-source/modules/pre-commit.nix':

       … while evaluating the option `hooks.alejandra.entry':

       … while evaluating definitions from `/nix/store/g73hxz7blh5v6xfdcma2lm35rpwfbgrp-source/modules/hooks.nix':

       … while evaluating the option `tools':

       … while evaluating definitions from `<unknown-file>':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: evaluation aborted with the following error message: 'lib.customisation.callPackageWith: Function called without required argument "python39Packages" at /nix/store/g73hxz7blh5v6xfdcma2lm35rpwfbgrp-source/nix/tools.nix:35, did you mean "python3Packages", "python27Packages" or "python2Packages"?'

This is from:

hs-flake-utils.url = "git+https://whetstone.private.storage/jcalderone/hs-flake-utils.git?ref=main";

....which in turn pulls in a bunch of other older stuff from flake-utils and pre-commit-hooks(now called git-hooks). Since hs-flake-utils has not been worked on in a while, I think these are the options:

  1. Fork it and make a one line change to make it work with the newer nixpkgs. But there are some arguments against flake-utils, and hs-flake-utils in particular is tailored to Least Authority's needs (at the time, I think), not for general adoption.
  2. Replace hs-flake-utils (and flake-utils) with the more modern and more actively maintained haskell-flake, with or without flake-parts.
  3. Do not use 1 or 2; use only what is available in nixpkgs.

Right now I don't know which approach I prefer.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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