!RbXGJhHMsnQcNIDFWN:nixos.org

Haskell in Nixpkgs/NixOS

659 Members
For discussions and questions about Haskell with Nix, cabal2nix and haskellPackages in nixpkgs | Current Docs: https://nixos.org/manual/nixpkgs/unstable/#haskell | Current PR: https://github.com/nixos/nixpkgs/pulls?q=is%3Apr+is%3Aopen+head%3Ahaskell-updates | Maintainer Docs: https://github.com/NixOS/nixpkgs/blob/haskell-updates/pkgs/development/haskell-modules/HACKING.md | More Nix: #community:nixos.org | More Haskell: #haskell-space:matrix.org | Merger Schedule: https://cloud.maralorn.de/apps/calendar/p/H6migHmKX7xHoTFa/dayGridMonth/now | Join #haskell.nix:libera.chat for question about the alternative haskell.nix infrastructure131 Servers

Load older messages


SenderMessageTime
8 Jul 2025
@dmjio:matrix.orgdmjio

is there a function to parse a flake lockfile into a set?

let sources = parseFlakeLock (builtins.readFile ./flake.lock);

something like this

16:07:35
@ners:nixos.devnersYes, in fact flake-compat is based on this principle. See examples here: https://github.com/nix-community/flake-compat16:13:58
@ners:nixos.devners *

Yes, in fact flake-compat is based on this principle. See examples here: https://github.com/nix-community/flake-compat

Basically: builtins.fromJSON (builtins.readFile ./flake.lock);

16:14:48
@dmjio:matrix.orgdmjio

so I'm just doing this rn

  # fetch from flake.lock
  with (builtins.fromJSON (builtins.readFile ../flake.lock));
  fetchFromFlakeLock = args:
    fetchFromGitHub {
      inherit (args.locked) owner repo rev;
      hash = args.locked.narHash;
    };
  servant = fetchFromFlake (nodes.servant);
19:50:58
@dmjio:matrix.orgdmjio does fetchFromFlakeLock already exist somewhere 19:51:18
@dmjio:matrix.orgdmjiookay will check it out, we'll see19:54:50
@dmjio:matrix.orgdmjio Also, is there a way to generate a flake.nix on the fly, similar to how callCabal2nix works 19:55:07
@dmjio:matrix.orgdmjionot all my repos have flakes and I'd have to add it to each one basically19:55:29
@dmjio:matrix.orgdmjio but I'm going to just override the nixpkgs with nixpkgs.follows anyways 19:55:39
@dmjio:matrix.orgdmjiootherwise the flakes will be mutually recursive20:02:12
@dmjio:matrix.orgdmjio* otherwise the flakes will be mutually recursive (some of them)20:02:23
@dmjio:matrix.orgdmjio Also 21:19:51
@dmjio:matrix.orgdmjio Who is the CEO of Flakeroku 21:19:57
@dmjio:matrix.orgdmjio What is the flake heroku equivalent 21:20:15
@sellout:matrix.orgselloutI’m having a hell of a time caching this one project, I think it must be related to Haskell / IFD. I follow the Cachix instructions for caching build & runtime deps (https://docs.cachix.org/pushing#pushing-build-and-runtime-dependencies), I do that on all three supported systems, and then I expect in this CI run (https://github.com/sellout/unison/actions/runs/16144540250), that it won’t have to build anything. But that’s never what happens. You can see the two macOS runs are 2-3 hours, and the linux one gets “canceled” for some reason I can’t deduce (but not before trying to build a ton of stuff). It’s on this branch (https://github.com/sellout/unison/tree/update-nix), but I feel like I run into this every time I update Nix at all. When I run it on a different machine locally, I just see “evaluating derivation '…#all'” for ages before anything else happens, which is what makes me think it’s IFD.22:58:47
@vigress9:matrix.org@vigress9:matrix.org left the room.23:21:02
9 Jul 2025
@jonhermansen:matrix.orgjonhermansen joined the room.01:18:54
@prsteele:matrix.orgPatrick Steele Does anyone have an example of how to structure a flake to allow builds to run with profiling enabled? If I add -prof to my cabal file, I get Failed to load dynamic interface file for Prelude errors, even in a simple project with no dependencies. 02:18:05
@prsteele:matrix.orgPatrick SteeleMy flake is https://pastebin.com/hUxz89uA right now. I've tried various incantations from https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/haskell.section.md to try to coerce profiling to work.02:20:01
@prsteele:matrix.orgPatrick Steele I'm wondering whether my use of pkgs.haskellPackages, as opposed to e.g. pkgs.haskell.packages.ghc984, is somehow an issue 02:21:34
@eldritchcookie:matrix.orgeldritchcookiefor those that use the nixpkgs haskell infrastructure on ghc 9.12.2 do you have rename capability with hls? i am trying to narrow down where the issue is and while it seems that version 2.11.0.0 has full support i was unable to find if the version 2.10.0.0 has the hls-rename-plugin 11:35:17
@b:chreekat.netchreekati've thought about this12:33:53
@maralorn:maralorn.demaralornI am pretty sure unison uses haskell.nix yes, that is a ton of IFD. However of course building the exact derivation twice should work.14:04:09
@maralorn:maralorn.demaralornOn which plattform is this?14:04:32
@maralorn:maralorn.demaralornGenerally the nixpkgs infrastructure is already profiling enabled no intervention required.14:05:09
@maralorn:maralorn.demaralornMaybe however you don’t want to use -prof and instead --enable-library-profiling. Not sure.14:05:54
@maralorn:maralorn.demaralorn Yeah, 2.10 had a lot of plugins disabled on 9.12 and had that documented wrongly in the support matrix in their user guide. 14:07:00
@sellout:matrix.orgsellout Yeah, building the derivation twice on the same machine works. The trouble (I think) is figuring out what to push to the cache so that when a fresh machine (e.g., CI runner) does nix build .#all, it can relatively quickly download the cached all closure. But (again, I think) it ends up building the world just to evaluate all.drv, when it should be able to pull all.drv from the cache as well … which, uh, I guess makes it clear that I should just need to push all.drv as well … which I’m pretty sure I have been. So now some more digging to see how I messed that up. 16:48:52
@sellout:matrix.orgsellout I know the Cachix incantation removes the .drvs before pushing, but I had added those back in. 16:49:42
@sellout:matrix.orgselloutThanks for the response – it at least gives me more to explore.16:51:15

There are no newer messages yet.


Back to Room ListRoom Version: 6