diff --git a/.github/actions/haskell/action.yml b/.github/actions/haskell/action.yml index 9e1e47b07..999db253f 100644 --- a/.github/actions/haskell/action.yml +++ b/.github/actions/haskell/action.yml @@ -9,13 +9,13 @@ runs: name: Setup Haskell id: setup-haskell with: - ghc-version: 9.2.5 + ghc-version: 9.4.4 - name: Verify Haskell version shell: bash run: | cabal --version ghc --version - [[ $(ghc --numeric-version) == 9.2.5 ]] + [[ $(ghc --numeric-version) == 9.4.4 ]] file "$(which cabal)" file "$(which ghc)" - name: Cache ~/.cabal/store diff --git a/.github/workflows/Build release (lamdera-community).yml b/.github/workflows/Build release (lamdera-community).yml index 4df7f795e..1c8d57b15 100644 --- a/.github/workflows/Build release (lamdera-community).yml +++ b/.github/workflows/Build release (lamdera-community).yml @@ -19,7 +19,7 @@ jobs: runner: [ self-hosted, macOS, ARM64 ] archive-label: macOS-arm64 ghc: - version: "9.2.5" + version: "9.4.4" build-platform: aarch64-apple-darwin name: release-${{ matrix.build.name }} diff --git a/.gitpod.yml b/.gitpod.yml index 8a0c5d286..122a937e4 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -7,8 +7,8 @@ tasks: init: | curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_MINIMAL=1 sh source "$GHCUP_INSTALL_BASE_PREFIX/.ghcup/env" - ghcup install ghc 9.2.5 - ghcup set ghc 9.2.5 + ghcup install ghc 9.4.4 + ghcup set ghc 9.4.4 ghcup install cabal cabal update ./dev/build.sh diff --git a/Dockerfile b/Dockerfile index 552228156..50ce768ab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM alpine:latest as build -ENV GHC_VERSION 9.2.5 +ENV GHC_VERSION 9.4.4 ENV LANG C.UTF-8 diff --git a/README.md b/README.md index f46a9ef05..1575b31f6 100644 --- a/README.md +++ b/README.md @@ -305,8 +305,8 @@ git clone https://github.com/avh4/elm-format.git cd elm-format # initial setup -ghcup install ghc 9.2.5 -ghcup set ghc 9.2.5 +ghcup install ghc 9.4.4 +ghcup set ghc 9.4.4 cabal install hpack # build diff --git a/Shakefile/src/Shakefiles/Haskell.hs b/Shakefile/src/Shakefiles/Haskell.hs index eca12a0d2..339f4c98e 100644 --- a/Shakefile/src/Shakefiles/Haskell.hs +++ b/Shakefile/src/Shakefiles/Haskell.hs @@ -112,7 +112,7 @@ cabalProject name sourceFiles sourcePatterns deps testPatterns testDeps = cabalBuildDir :: String -> Action FilePath cabalBuildDir projectName = do version <- readFile' ("_build/cabal" projectName "version") - return $ "dist-newstyle" "build" Shakefiles.Platform.cabalInstallOs "ghc-9.2.5" projectName ++ "-" ++ version + return $ "dist-newstyle" "build" Shakefiles.Platform.cabalInstallOs "ghc-9.4.4" projectName ++ "-" ++ version executable :: String -> String -> String -> Rules () diff --git a/Shakefile/src/Shakefiles/Haskell/Hpc.hs b/Shakefile/src/Shakefiles/Haskell/Hpc.hs index 87ae5c689..3fc3cdef8 100644 --- a/Shakefile/src/Shakefiles/Haskell/Hpc.hs +++ b/Shakefile/src/Shakefiles/Haskell/Hpc.hs @@ -15,10 +15,10 @@ mergeTixFiles tixs out = do rules :: String -> Rules () rules gitSha = do let hpcConfig = - [ "--hpcdir=./dist-newstyle/_coverage/build/x86_64-linux/ghc-9.2.5/elm-format-0.8.7/hpc/vanilla/mix/elm-format" - , "--hpcdir=./dist-newstyle/_coverage/build/x86_64-linux/ghc-9.2.5/avh4-lib-0.0.0.1/hpc/vanilla/mix/avh4-lib-0.0.0.1" - , "--hpcdir=./dist-newstyle/_coverage/build/x86_64-linux/ghc-9.2.5/elm-format-lib-0.0.0.1/hpc/vanilla/mix/elm-format-lib-0.0.0.1" - , "--hpcdir=./dist-newstyle/_coverage/build/x86_64-linux/ghc-9.2.5/elm-format-markdown-0.0.0.1/hpc/vanilla/mix/elm-format-markdown-0.0.0.1" + [ "--hpcdir=./dist-newstyle/_coverage/build/x86_64-linux/ghc-9.4.4/elm-format-0.8.7/hpc/vanilla/mix/elm-format" + , "--hpcdir=./dist-newstyle/_coverage/build/x86_64-linux/ghc-9.4.4/avh4-lib-0.0.0.1/hpc/vanilla/mix/avh4-lib-0.0.0.1" + , "--hpcdir=./dist-newstyle/_coverage/build/x86_64-linux/ghc-9.4.4/elm-format-lib-0.0.0.1/hpc/vanilla/mix/elm-format-lib-0.0.0.1" + , "--hpcdir=./dist-newstyle/_coverage/build/x86_64-linux/ghc-9.4.4/elm-format-markdown-0.0.0.1/hpc/vanilla/mix/elm-format-markdown-0.0.0.1" , "--srcdir=." , "--srcdir=avh4-lib" , "--srcdir=elm-format-lib" diff --git a/avh4-lib/avh4-lib.cabal b/avh4-lib/avh4-lib.cabal index ae2196b7f..844f6e0b6 100644 --- a/avh4-lib/avh4-lib.cabal +++ b/avh4-lib/avh4-lib.cabal @@ -1,6 +1,6 @@ cabal-version: 2.2 --- This file has been generated from package.yaml by hpack version 0.35.1. +-- This file has been generated from package.yaml by hpack version 0.35.2. -- -- see: https://github.com/sol/hpack @@ -49,7 +49,7 @@ library , mtl >=2.2.2 && <3 , pooled-io >=0.0.2 && <0.1 , process >=1.6.13.2 && <2 - , relude >=1.1.0.0 && <1.2 + , relude >=1.1.0.0 && <1.3 , text >=2.0 && <3 default-language: Haskell2010 @@ -94,9 +94,8 @@ test-suite al-tests , mtl >=2.2.2 && <3 , pooled-io >=0.0.2 && <0.1 , process >=1.6.13.2 && <2 - , relude >=1.1.0.0 && <1.2 + , relude >=1.1.0.0 && <1.3 , tasty >=1.2 && <2 - , tasty-hspec >=1.2.0.1 && <1.3 , tasty-hunit >=0.10.0.1 && <0.11 , text >=2.0 && <3 default-language: Haskell2010 diff --git a/avh4-lib/package.yaml b/avh4-lib/package.yaml index 6cedc4773..f5d1de2bd 100644 --- a/avh4-lib/package.yaml +++ b/avh4-lib/package.yaml @@ -34,7 +34,7 @@ dependencies: mtl: ">= 2.2.2 && < 3" pooled-io: ">= 0.0.2 && < 0.1" process: ">= 1.6.13.2 && < 2" - relude: ">= 1.1.0.0 && < 1.2" + relude: ">= 1.1.0.0 && < 1.3" text: ">= 2.0 && < 3" @@ -52,7 +52,6 @@ tests: dependencies: tasty: ">= 1.2 && < 2" - tasty-hspec: ">= 1.2.0.1 && < 1.3" tasty-hunit: ">= 0.10.0.1 && < 0.11" build-tools: diff --git a/cabal.project b/cabal.project index 2ac6ff1fa..c612be3f3 100644 --- a/cabal.project +++ b/cabal.project @@ -5,7 +5,7 @@ packages: ./elm-format-test-lib, ./ ./Shakefile -with-compiler: ghc-9.2.5 +with-compiler: ghc-9.4.4 constraints: -- ansi-terminal-0.11.1 has issues with Win32-2.10.* (which is packaged with ghc-9.0) diff --git a/cabal.project.freeze b/cabal.project.freeze index ed45c69fa..0c294a426 100644 --- a/cabal.project.freeze +++ b/cabal.project.freeze @@ -4,7 +4,7 @@ constraints: any.Glob ==0.10.2, any.OneTuple ==0.3.1, any.QuickCheck ==2.14.2, any.StateVar ==1.2.2, - any.aeson ==2.1.1.0, + any.aeson ==2.1.2.1, any.ansi-terminal ==0.11, ansi-terminal -example, any.ansi-wl-pprint ==0.6.9, @@ -12,35 +12,36 @@ constraints: any.Glob ==0.10.2, any.array ==0.5.4.0, any.assoc ==1.0.2, any.attoparsec ==0.14.4, - any.base ==4.16.4.0, + any.base ==4.17.0.0, any.base-compat ==0.12.2, any.base-compat-batteries ==0.12.2, - any.base-orphans ==0.8.7, - any.bifunctors ==5.5.14, + any.base-orphans ==0.8.8.2, + any.bifunctors ==5.5.15, any.bimap ==0.5.0, - any.binary ==0.8.9.0, + any.binary ==0.8.9.1, any.bytestring ==0.11.3.1, any.call-stack ==0.4.0, any.clock ==0.8.3, any.colour ==2.3.6, any.comonad ==5.0.8, any.concurrent-split ==0.0.1.1, - any.containers ==0.6.5.1, + any.conduit ==1.3.4.3, + any.containers ==0.6.6, any.contravariant ==1.5.5, any.data-fix ==0.3.2, - any.deepseq ==1.4.6.1, - any.directory ==1.3.6.2, + any.deepseq ==1.4.8.0, + any.directory ==1.3.7.1, any.distributive ==0.6.2.1, any.dlist ==1.0, - any.exceptions ==0.10.4, + any.exceptions ==0.10.5, any.extra ==1.7.12, any.filepath ==1.4.2.2, any.filepattern ==0.1.3, - any.generically ==0.1, - any.ghc-bignum ==1.2, - any.ghc-boot-th ==9.2.5, - any.ghc-prim ==0.8.0, - any.hashable ==1.4.1.0, + any.generically ==0.1.1, + any.ghc-bignum ==1.3, + any.ghc-boot-th ==9.4.4, + any.ghc-prim ==0.9.0, + any.hashable ==1.4.2.0, any.haskell-lexer ==1.1.1, any.heaps ==0.4, any.hspec ==2.10.10, @@ -48,23 +49,26 @@ constraints: any.Glob ==0.10.2, any.hspec-discover ==2.10.10, any.hspec-expectations ==0.8.2, any.hspec-golden ==0.2.0.1, - any.indexed-traversable ==0.1.2, - any.indexed-traversable-instances ==0.1.1.1, + any.indexed-traversable ==0.1.2.1, + any.indexed-traversable-instances ==0.1.1.2, any.integer-logarithms ==1.0.3.1, any.js-dgtable ==0.5.2, any.js-flot ==0.8.3, any.js-jquery ==3.3.1, + any.libyaml ==0.1.2, any.logict ==0.8.0.0, + any.mono-traversable ==1.0.15.3, any.mtl ==2.2.2, any.optparse-applicative ==0.17.0.0, optparse-applicative +process, - any.pooled-io ==0.0.2.2, + any.pooled-io ==0.0.2.3, any.pretty ==1.1.3.6, - any.primitive ==0.7.3.0, + any.primitive ==0.7.4.0, any.process ==1.6.16.0, any.quickcheck-io ==0.2.0, any.random ==1.2.1.1, - any.relude ==1.1.0.0, + any.relude ==1.2.0.0, + any.resourcet ==1.2.6, any.rts ==1.0.2, any.scientific ==0.3.7.0, any.semialign ==1.2.0.1, @@ -74,8 +78,9 @@ constraints: any.Glob ==0.10.2, any.smallcheck ==1.2.1, any.split ==0.2.3.5, any.splitmix ==0.1.0.4, - any.stm ==2.5.0.2, + any.stm ==2.5.1.0, any.strict ==0.4.0.1, + any.system-cxx-std-lib ==1.0, any.tagged ==0.8.6.1, any.tasty ==1.4.3, tasty +unix, @@ -84,22 +89,25 @@ constraints: any.Glob ==0.10.2, any.tasty-hunit ==0.10.0.3, any.tasty-quickcheck ==0.10.2, any.tasty-smallcheck ==0.8.2, - any.template-haskell ==2.18.0.0, - any.text ==2.0.1, + any.template-haskell ==2.19.0.0, + any.text ==2.0.2, any.text-short ==0.1.5, any.tf-random ==0.5, - any.th-abstraction ==0.4.5.0, + any.th-abstraction ==0.5.0.0, any.these ==1.1.1.1, - any.time ==1.11.1.1, + any.time ==1.12.2, any.time-compat ==1.9.6.1, any.transformers ==0.5.6.2, any.transformers-compat ==0.7.2, - any.unix ==2.7.2.2, + any.unix ==2.7.3, + any.unliftio-core ==0.2.1.0, any.unordered-containers ==0.2.19.1, any.unsafe ==0.0, any.utf8-string ==1.0.2, any.utility-ht ==0.0.16, any.uuid-types ==1.0.5, any.vector ==0.12.3.1, - any.witherable ==0.4.2 -index-state: hackage.haskell.org 2023-03-08T17:09:46Z + any.vector-algorithms ==0.8.0.4, + any.witherable ==0.4.2, + any.yaml ==0.11.11.0 +index-state: hackage.haskell.org 2023-04-12T20:00:51Z diff --git a/default.nix b/default.nix index a509ca673..f6cd987d9 100644 --- a/default.nix +++ b/default.nix @@ -1,4 +1,4 @@ -{ sources ? import ./nix/sources.nix, compiler ? "ghc925" }: +{ sources ? import ./nix/sources.nix, compiler ? "ghc944" }: let gitignore = import sources."gitignore.nix" { }; @@ -7,8 +7,8 @@ let haskellPackageOverrides = pkgs: self: super: with pkgs.haskell.lib; rec { hedgehog = self.hedgehog_1_2; - relude = overrideCabal super.relude (orig: { doCheck = false; }); - text = self.text_2_0_1; + relude = overrideCabal super.relude_1_2_0_0 (orig: { doCheck = false; }); + text = self.text_2_0_2; unordered-containers = overrideCabal super.unordered-containers (orig: { doCheck = false; }); }; @@ -18,8 +18,8 @@ let let inherit (pkgs) lib; - aeson = self.aeson_2_1_1_0; - text = self.text_2_0_1; + aeson = self.aeson_2_1_2_1; + text = self.text_2_0_2; mkPkg = name: path: args: overrideCabal (self.callCabal2nix name path args) (orig: { @@ -51,9 +51,8 @@ let avh4-lib = mkPkg "avh4-lib" ./avh4-lib { inherit text; }; elm-format-lib = mkPkg "elm-format-lib" ./elm-format-lib { inherit aeson text; }; - elm-format-test-lib = mkPkg "elm-format-test-lib" ./elm-format-test-lib { - inherit text; - }; + elm-format-test-lib = + mkPkg "elm-format-test-lib" ./elm-format-test-lib { inherit text; }; elm-format-markdown = mkPkg "elm-format-markdown" ./elm-format-markdown { inherit text; }; }; @@ -81,9 +80,9 @@ let # This is the haskell package set that includes elm-format and all its dependencies haskellPackages = mkHaskellPackages pkgs; - # This is a haskell package set for the same ghc version that does not have any package overries + # This is a haskell package set for the same ghc version that does not have our project package overries # (Because our override aren't compatible with haskell-language-server, etc) - haskellTools = pkgs.haskell.packages."${compiler}"; + haskellTools = import ./nix/tools.nix { inherit sources compiler; }; in { elm-format = haskellPackages.elm-format; dist = { diff --git a/elm-format-lib/elm-format-lib.cabal b/elm-format-lib/elm-format-lib.cabal index 5fe99a143..524f15b37 100644 --- a/elm-format-lib/elm-format-lib.cabal +++ b/elm-format-lib/elm-format-lib.cabal @@ -1,6 +1,6 @@ cabal-version: 2.2 --- This file has been generated from package.yaml by hpack version 0.35.1. +-- This file has been generated from package.yaml by hpack version 0.35.2. -- -- see: https://github.com/sol/hpack @@ -99,7 +99,7 @@ library , elm-format-markdown , mtl >=2.2.2 && <3 , optparse-applicative >=0.17.0.0 && <0.18 - , relude >=1.1.0.0 && <1.2 + , relude >=1.1.0.0 && <1.3 , text >=2.0 && <3 default-language: Haskell2010 @@ -206,7 +206,7 @@ test-suite efl-tests , hspec >=2.7.4 && <3 , mtl >=2.2.2 && <3 , optparse-applicative >=0.17.0.0 && <0.18 - , relude >=1.1.0.0 && <1.2 + , relude >=1.1.0.0 && <1.3 , split >=0.2.3.4 && <0.3 , tasty >=1.2 && <2 , tasty-hspec >=1.2.0.1 && <1.3 diff --git a/elm-format-lib/package.yaml b/elm-format-lib/package.yaml index 65ab7b325..9295ce9b1 100644 --- a/elm-format-lib/package.yaml +++ b/elm-format-lib/package.yaml @@ -35,7 +35,7 @@ dependencies: containers: ">= 0.6.5.1 && < 0.7" mtl: ">= 2.2.2 && < 3" optparse-applicative: ">= 0.17.0.0 && < 0.18" - relude: ">= 1.1.0.0 && < 1.2" + relude: ">= 1.1.0.0 && < 1.3" text: ">= 2.0 && < 3" avh4-lib: {} elm-format-markdown: {} diff --git a/elm-format.cabal b/elm-format.cabal index d9cf0dc16..ac6dd9067 100644 --- a/elm-format.cabal +++ b/elm-format.cabal @@ -1,6 +1,6 @@ cabal-version: 2.2 --- This file has been generated from package.yaml by hpack version 0.35.1. +-- This file has been generated from package.yaml by hpack version 0.35.2. -- -- see: https://github.com/sol/hpack @@ -53,7 +53,7 @@ executable elm-format , bytestring >=0.11.3.0 && <0.12 , elm-format-lib , optparse-applicative >=0.17.0.0 && <0.18 - , relude >=1.1.0.0 && <1.2 + , relude >=1.1.0.0 && <1.3 , text >=2.0 && <3 default-language: Haskell2010 @@ -96,7 +96,7 @@ test-suite elm-format-tests , hspec >=2.7.4 && <3 , optparse-applicative >=0.17.0.0 && <0.18 , quickcheck-io >=0.2.0 && <0.3 - , relude >=1.1.0.0 && <1.2 + , relude >=1.1.0.0 && <1.3 , tasty >=1.2 && <2 , tasty-hspec >=1.2.0.1 && <1.3 , tasty-hunit >=0.10.0.1 && <0.11 diff --git a/nix/sources.json b/nix/sources.json index 256aecbad..9dabb50bb 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -17,10 +17,10 @@ "homepage": "", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3954218cf613eba8e0dcefa9abe337d26bc48fd0", - "sha256": "0bagqy53mknghz112swzb7zyjc07kfvam2wmc919bq0jxv8vj2i6", + "rev": "6b70761ea8c896aff8994eb367d9526686501860", + "sha256": "08np8p4h040jq4p2jlps99z38lhwg3yr2q64dqh8rbhq1kx6jzpm", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/3954218cf613eba8e0dcefa9abe337d26bc48fd0.tar.gz", + "url": "https://github.com/NixOS/nixpkgs/archive/6b70761ea8c896aff8994eb367d9526686501860.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } } diff --git a/nix/sources.nix b/nix/sources.nix index 9a01c8acf..fe3dadf7e 100644 --- a/nix/sources.nix +++ b/nix/sources.nix @@ -10,33 +10,34 @@ let let name' = sanitizeName name + "-src"; in - if spec.builtin or true then - builtins_fetchurl { inherit (spec) url sha256; name = name'; } - else - pkgs.fetchurl { inherit (spec) url sha256; name = name'; }; + if spec.builtin or true then + builtins_fetchurl { inherit (spec) url sha256; name = name'; } + else + pkgs.fetchurl { inherit (spec) url sha256; name = name'; }; fetch_tarball = pkgs: name: spec: let name' = sanitizeName name + "-src"; in - if spec.builtin or true then - builtins_fetchTarball { name = name'; inherit (spec) url sha256; } - else - pkgs.fetchzip { name = name'; inherit (spec) url sha256; }; + if spec.builtin or true then + builtins_fetchTarball { name = name'; inherit (spec) url sha256; } + else + pkgs.fetchzip { name = name'; inherit (spec) url sha256; }; fetch_git = name: spec: let ref = - if spec ? ref then spec.ref else + spec.ref or ( if spec ? branch then "refs/heads/${spec.branch}" else - if spec ? tag then "refs/tags/${spec.tag}" else - abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"; - submodules = if spec ? submodules then spec.submodules else false; + if spec ? tag then "refs/tags/${spec.tag}" else + abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!" + ); + submodules = spec.submodules or false; submoduleArg = let nixSupportsSubmodules = builtins.compareVersions builtins.nixVersion "2.4" >= 0; emptyArgWithWarning = - if submodules == true + if submodules then builtins.trace ( @@ -44,15 +45,15 @@ let + "but your nix's (${builtins.nixVersion}) builtins.fetchGit " + "does not support them" ) - {} - else {}; + { } + else { }; in - if nixSupportsSubmodules - then { inherit submodules; } - else emptyArgWithWarning; + if nixSupportsSubmodules + then { inherit submodules; } + else emptyArgWithWarning; in - builtins.fetchGit - ({ url = spec.repo; inherit (spec) rev; inherit ref; } // submoduleArg); + builtins.fetchGit + ({ url = spec.repo; inherit (spec) rev; inherit ref; } // submoduleArg); fetch_local = spec: spec.path; @@ -86,16 +87,16 @@ let hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath; hasThisAsNixpkgsPath = == ./.; in - if builtins.hasAttr "nixpkgs" sources - then sourcesNixpkgs - else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then - import {} - else - abort - '' - Please specify either (through -I or NIX_PATH=nixpkgs=...) or - add a package called "nixpkgs" to your sources.json. - ''; + if builtins.hasAttr "nixpkgs" sources + then sourcesNixpkgs + else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then + import { } + else + abort + '' + Please specify either (through -I or NIX_PATH=nixpkgs=...) or + add a package called "nixpkgs" to your sources.json. + ''; # The actual fetching function. fetch = pkgs: name: spec: @@ -115,13 +116,13 @@ let # the path directly as opposed to the fetched source. replace = name: drv: let - saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name; + saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name; ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}"; in - if ersatz == "" then drv else - # this turns the string into an actual Nix path (for both absolute and - # relative paths) - if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}"; + if ersatz == "" then drv else + # this turns the string into an actual Nix path (for both absolute and + # relative paths) + if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}"; # Ports of functions for older nix versions @@ -132,7 +133,7 @@ let ); # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 - range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1); + range = first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1); # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); @@ -143,43 +144,46 @@ let concatStrings = builtins.concatStringsSep ""; # https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331 - optionalAttrs = cond: as: if cond then as else {}; + optionalAttrs = cond: as: if cond then as else { }; # fetchTarball version that is compatible between all the versions of Nix builtins_fetchTarball = { url, name ? null, sha256 }@attrs: let inherit (builtins) lessThan nixVersion fetchTarball; in - if lessThan nixVersion "1.12" then - fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) - else - fetchTarball attrs; + if lessThan nixVersion "1.12" then + fetchTarball ({ inherit url; } // (optionalAttrs (name != null) { inherit name; })) + else + fetchTarball attrs; # fetchurl version that is compatible between all the versions of Nix builtins_fetchurl = { url, name ? null, sha256 }@attrs: let inherit (builtins) lessThan nixVersion fetchurl; in - if lessThan nixVersion "1.12" then - fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) - else - fetchurl attrs; + if lessThan nixVersion "1.12" then + fetchurl ({ inherit url; } // (optionalAttrs (name != null) { inherit name; })) + else + fetchurl attrs; # Create the final "sources" from the config mkSources = config: - mapAttrs ( - name: spec: - if builtins.hasAttr "outPath" spec - then abort - "The values in sources.json should not have an 'outPath' attribute" - else - spec // { outPath = replace name (fetch config.pkgs name spec); } - ) config.sources; + mapAttrs + ( + name: spec: + if builtins.hasAttr "outPath" spec + then + abort + "The values in sources.json should not have an 'outPath' attribute" + else + spec // { outPath = replace name (fetch config.pkgs name spec); } + ) + config.sources; # The "config" used by the fetchers mkConfig = { sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null - , sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile) + , sources ? if sourcesFile == null then { } else builtins.fromJSON (builtins.readFile sourcesFile) , system ? builtins.currentSystem , pkgs ? mkPkgs sources system }: rec { @@ -191,4 +195,4 @@ let }; in -mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); } +mkSources (mkConfig { }) // { __functor = _: settings: mkSources (mkConfig settings); } diff --git a/nix/tools.nix b/nix/tools.nix new file mode 100644 index 000000000..a2c6cca08 --- /dev/null +++ b/nix/tools.nix @@ -0,0 +1,29 @@ +{ sources ? import ./sources.nix, compiler }: + +let + haskellToolsOverrides = pkgs: self: super: + with pkgs.haskell.lib; rec { + # ghcid-0.8.8 + ghcid = self.callCabal2nix "ghcid" (builtins.fetchGit { + url = "https://github.com/ndmitchell/ghcid.git"; + rev = "c38cdc97cd9470bb9025ea334d88d451bf1d8400"; + }) { fsnotify = self.fsnotify_0_4_1_0; }; + + # string-qq's tests depend on text < 1.3 + string-qq = overrideCabal super.string-qq (orig: { doCheck = false; }); + }; + + haskellToolsPkgs = import sources.nixpkgs { + config = { + packageOverrides = pkgs: rec { + haskell = pkgs.haskell // { + packages = pkgs.haskell.packages // { + tools = pkgs.haskell.packages."${compiler}".override { + overrides = haskellToolsOverrides pkgs; + }; + }; + }; + }; + }; + }; +in haskellToolsPkgs.haskell.packages.tools diff --git a/package.yaml b/package.yaml index bd18f27e7..5eb27b61a 100644 --- a/package.yaml +++ b/package.yaml @@ -40,7 +40,7 @@ dependencies: base: ">= 4.15.0.0 && < 5" bytestring: ">= 0.11.3.0 && < 0.12" optparse-applicative: ">= 0.17.0.0 && < 0.18" - relude: ">= 1.1.0.0 && < 1.2" + relude: ">= 1.1.0.0 && < 1.3" text: ">= 2.0 && < 3" avh4-lib: {} elm-format-lib: {} diff --git a/package/nix/build.sh b/package/nix/build.sh index 04cbc6eea..baac62835 100755 --- a/package/nix/build.sh +++ b/package/nix/build.sh @@ -23,8 +23,7 @@ else fi popd -cabal2nix --no-haddock --flag='--ghc-option=-Wno-error=unused-packages' https://github.com/avh4/elm-format --revision "$REV" --subpath avh4-lib \ - | sed -e 's#-f--ghc-option=#--ghc-option=#;s#-wno-#-Wno-#' \ +cabal2nix --no-haddock https://github.com/avh4/elm-format --revision "$REV" --subpath avh4-lib \ > nixpkgs/pkgs/development/compilers/elm/packages/avh4-lib.nix cabal2nix --no-haddock https://github.com/avh4/elm-format --revision "$REV" --subpath elm-format-lib > nixpkgs/pkgs/development/compilers/elm/packages/elm-format-lib.nix cabal2nix --no-haddock https://github.com/avh4/elm-format --revision "$REV" --subpath elm-format-test-lib > nixpkgs/pkgs/development/compilers/elm/packages/elm-format-test-lib.nix