From 152fe358e855dd1876ac84e2dd96e16c69716414 Mon Sep 17 00:00:00 2001 From: Pavel Anpin Date: Tue, 26 Nov 2024 09:29:44 -0300 Subject: [PATCH] haskell: attempt at fixing the build --- flake.lock | 75 ++++++++++++----------------- flake.nix | 3 ++ modules/kernels/haskell/default.nix | 70 +++++++++++++++++++-------- 3 files changed, 86 insertions(+), 62 deletions(-) diff --git a/flake.lock b/flake.lock index 078ede2d..a3acb246 100644 --- a/flake.lock +++ b/flake.lock @@ -101,8 +101,12 @@ ], "hls": "hls", "nix-filter": "nix-filter", - "nixpkgs24_05": "nixpkgs24_05", - "nixpkgsMaster": "nixpkgsMaster" + "nixpkgs24_05": [ + "nixpkgs-stable" + ], + "nixpkgsMaster": [ + "nixpkgs-master" + ] }, "locked": { "lastModified": 1732424181, @@ -210,66 +214,50 @@ "type": "github" } }, - "nixpkgs-stable": { + "nixpkgs-master": { "locked": { - "lastModified": 1731797254, - "narHash": "sha256-df3dJApLPhd11AlueuoN0Q4fHo/hagP75LlM5K1sz9g=", + "lastModified": 1732618334, + "narHash": "sha256-Vdc4jOgaW6XMowzQctZVWzdQKDVbvCmmA5UcxBm7Bc0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e8c38b73aeb218e27163376a2d617e61a2ad9b59", + "rev": "0040c97904deb1f79ad12e233d12bc6fa22f7640", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-24.05", + "ref": "master", "repo": "nixpkgs", "type": "github" } }, - "nixpkgs-stable_2": { + "nixpkgs-stable": { "locked": { - "lastModified": 1730741070, - "narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=", - "owner": "NixOS", + "lastModified": 1731797254, + "narHash": "sha256-df3dJApLPhd11AlueuoN0Q4fHo/hagP75LlM5K1sz9g=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "d063c1dd113c91ab27959ba540c0d9753409edf3", + "rev": "e8c38b73aeb218e27163376a2d617e61a2ad9b59", "type": "github" }, "original": { - "owner": "NixOS", + "owner": "nixos", "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" } }, - "nixpkgs24_05": { - "locked": { - "lastModified": 1732409442, - "narHash": "sha256-8m5aa8HwKBLeopyHMB3fJeHQJq/9vuDKrnnUkmFHpI4=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "1d4675689f3de9fbc08e8d5587c4726a50c262d1", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "release-24.05", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgsMaster": { + "nixpkgs-stable_2": { "locked": { - "lastModified": 1732411344, - "narHash": "sha256-cbJyv5iyJHMBbuHJEb0tK9dmnzh3v3otzSgrik8R+os=", + "lastModified": 1730741070, + "narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "77be1499afb12fb7ae19ac8bf43b456168ddb0b8", + "rev": "d063c1dd113c91ab27959ba540c0d9753409edf3", "type": "github" }, "original": { "owner": "NixOS", - "ref": "master", + "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" } @@ -321,11 +309,11 @@ "opam2json": "opam2json" }, "locked": { - "lastModified": 1732269046, - "narHash": "sha256-5pJnuc8rEdE/5F6XVZA5qckuvSCvvasRCOf0n63QR8M=", + "lastModified": 1732617437, + "narHash": "sha256-jj25fziYrES8Ix6HkfSiLzrN6MZjiwlHUxFSIuLRjgE=", "owner": "tweag", "repo": "opam-nix", - "rev": "8de7b9aee12862823abd9bd5b66ddf0e7984e0f0", + "rev": "ea8b9cb81fe94e1fc45c6376fcff15f17319c445", "type": "github" }, "original": { @@ -353,11 +341,11 @@ "opam-repository": { "flake": false, "locked": { - "lastModified": 1731099738, - "narHash": "sha256-cJTrYwJzIW1/bmO4mITWTwbk5IHbFwz/yDypLdy4lc4=", + "lastModified": 1732612513, + "narHash": "sha256-kju4NWEQo4xTxnKeBIsmqnyxIcCg6sNZYJ1FmG/gCDw=", "owner": "ocaml", "repo": "opam-repository", - "rev": "eecf6d033c6c13a6bda9b445601ddcbaa09dd288", + "rev": "3d52b66b04788999a23f22f0d59c2dfc831c4f32", "type": "github" }, "original": { @@ -459,6 +447,7 @@ "ihaskell": "ihaskell", "nix-dart": "nix-dart", "nixpkgs": "nixpkgs_2", + "nixpkgs-master": "nixpkgs-master", "nixpkgs-stable": "nixpkgs-stable", "npmlock2nix": "npmlock2nix", "opam-nix": "opam-nix", @@ -474,11 +463,11 @@ ] }, "locked": { - "lastModified": 1732328983, - "narHash": "sha256-RHt12f/slrzDpSL7SSkydh8wUE4Nr4r23HlpWywed9E=", + "lastModified": 1732588352, + "narHash": "sha256-J2/hxOO1VtBA/u+a+9E+3iJpWT3xsBdghgYAVfoGCJo=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "ed8aa5b64f7d36d9338eb1d0a3bb60cf52069a72", + "rev": "414e748aae5c9e6ca63c5aafffda03e5dad57ceb", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index b52b98c5..a80aedd0 100644 --- a/flake.nix +++ b/flake.nix @@ -10,11 +10,14 @@ inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; inputs.nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05"; + inputs.nixpkgs-master.url = "github:nixos/nixpkgs/master"; inputs.flake-compat.url = "github:edolstra/flake-compat"; inputs.flake-compat.flake = false; inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.ihaskell.url = "github:ihaskell/ihaskell"; inputs.ihaskell.inputs.flake-utils.follows = "flake-utils"; + inputs.ihaskell.inputs.nixpkgsMaster.follows = "nixpkgs-master"; + inputs.ihaskell.inputs.nixpkgs24_05.follows = "nixpkgs-stable"; inputs.nix-dart.url = "github:djacu/nix-dart"; inputs.nix-dart.inputs.nixpkgs.follows = "nixpkgs"; inputs.nix-dart.inputs.flake-utils.follows = "flake-utils"; diff --git a/modules/kernels/haskell/default.nix b/modules/kernels/haskell/default.nix index 8c22d104..c207e81f 100644 --- a/modules/kernels/haskell/default.nix +++ b/modules/kernels/haskell/default.nix @@ -13,7 +13,7 @@ ... }: let requiredRuntimePackages = [ - config.nixpkgs.haskell.compiler.${config.haskellCompiler} + # config.nixpkgs.haskell.compiler.${config.haskellCompiler} ]; args = {inherit self system lib config name kernelName requiredRuntimePackages;}; kernelModule = import ./../../kernel.nix args; @@ -36,30 +36,30 @@ env = haskellKernelPkg { packages = extraHaskellPackages; rtsopts = extraHaskellFlags; + extraEnvironmentBinaries = allRuntimePackages; }; - - kernelspec = let - wrappedEnv = - pkgs.runCommand "wrapper-${env.name}" - {nativeBuildInputs = [pkgs.makeWrapper];} - '' - mkdir -p $out/bin - for i in ${env}/bin/*; do - filename=$(basename $i) - ln -s ${env}/bin/$filename $out/bin/$filename - wrapProgram $out/bin/$filename \ - --set PATH "${pkgs.lib.makeSearchPath "bin" allRuntimePackages}" - done - ''; - in - wrappedEnv; + # kernelspec = let + # wrappedEnv = + # pkgs.runCommand "wrapper-${env.name}" + # {nativeBuildInputs = [pkgs.makeWrapper];} + # '' + # mkdir -p $out/bin + # for i in ${env}/bin/*; do + # filename=$(basename $i) + # ln -s ${env}/bin/$filename $out/bin/$filename + # wrapProgram $out/bin/$filename \ + # --set PATH "${pkgs.lib.makeSearchPath "bin" allRuntimePackages}" + # done + # ''; + # in + # wrappedEnv; in { - inherit name displayName; + inherit name displayName env; language = "haskell"; # See https://github.com/IHaskell/IHaskell/pull/1191 # argv = kernelspec.argv ++ ["--codemirror" "Haskell"]; - env = kernelspec; + # env = kernelspec; codemirrorMode = "Haskell"; logo64 = ./logo-64x64.png; } @@ -118,6 +118,38 @@ (import (config.ihaskell + "/nix/overlay-9.8.nix")) (import (config.ihaskell + "/nix/overlay-9.6.nix")) (import (config.ihaskell + "/nix/overlay-9.10.nix")) + (sel: sup: { + haskell = + sup.haskell + // { + packages = + sup.haskell.packages + // { + ghc910 = sup.haskell.packages.ghc910.override { + overrides = self: super: { + # ghc-syntax-highlighter = self.ghc-syntax-highlighter; + # ghc-lib-parser = self.ghc-lib-parser_9_8_3_20241022; + # ghc-lib-parser-ex = self.ghc-lib-parser-ex_9_8_0_2; + ghc-syntax-highlighter = self.ghc-syntax-highlighter_0_0_12_0; + uuid-types = self.uuid-types_1_0_6; + uuid = self.uuid_1_3_16; + # https://github.com/ndmitchell/hlint/issues/1593 + hlint = + self + .hlint_3_8 + .overrideAttrs (old: { + src = sel.fetchFromGitHub { + owner = "ndmitchell"; + repo = "hlint"; + rev = "7aafde56f6bc526aedb95fb282d8fd2b4ea290cc"; + sha256 = "sha256-B5aO6pec+Cpxelv7+Mlt1FWjLGwsQCXI0thjCMpXqeE="; + }; + }); + }; + }; + }; + }; + }) ]) .callPackage "${config.ihaskell}/nix/release.nix" { compiler = config.haskellCompiler;