Skip to content

Commit

Permalink
Format legacy nix files
Browse files Browse the repository at this point in the history
  • Loading branch information
turion committed Jan 8, 2025
1 parent fb21fcb commit 0b844de
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 23 deletions.
3 changes: 2 additions & 1 deletion all-ghcs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ let
getGHCVersionFromEnvAssignment = envAssignment: builtins.elemAt (builtins.split "=" envAssignment) 2;
supportedGHCVersions = builtins.map getGHCVersionFromEnvAssignment travisJobEnvAssignments;
buildClayWith = version: import ./default.nix { compiler = version; };
in builtins.map buildClayWith supportedGHCVersions
in
builtins.map buildClayWith supportedGHCVersions
3 changes: 2 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
let
compilerWithDefault = if compiler == "" then "ghc884" else compiler;
release = import ./release.nix { compiler = compilerWithDefault; };
in { inherit (release) clay examples; }
in
{ inherit (release) clay examples; }
36 changes: 18 additions & 18 deletions release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,27 @@ let
generatedOverrides = haskellPackagesNew: haskellPackagesOld:
let
toPackage = file: _: {
name = builtins.replaceStrings [ ".nix" ] [ "" ] file;
name = builtins.replaceStrings [ ".nix" ] [ "" ] file;
value = haskellPackagesNew.callPackage (./. + "/nix/${file}") { };
};
in
pkgs.lib.mapAttrs' toPackage (builtins.readDir ./nix);
pkgs.lib.mapAttrs' toPackage (builtins.readDir ./nix);

makeOverrides =
function: names: haskellPackagesNew: haskellPackagesOld:
let
toPackage = name: {
inherit name;
value = function haskellPackagesOld.${name};
};
in
builtins.listToAttrs (map toPackage names);
let
toPackage = name: {
inherit name;
value = function haskellPackagesOld.${name};
};
in
builtins.listToAttrs (map toPackage names);

composeExtensionsList =
pkgs.lib.fold pkgs.lib.composeExtensions (_: _: {});
pkgs.lib.fold pkgs.lib.composeExtensions (_: _: { });

# More exotic overrides go here
manualOverrides = haskellPackagesNew: haskellPackagesOld: {
};
manualOverrides = haskellPackagesNew: haskellPackagesOld: { };

config = {
packageOverrides = pkgs: rec {
Expand All @@ -46,7 +45,7 @@ let
"${compiler}" = pkgs.haskell.packages."${compiler}".override {
overrides = composeExtensionsList [
generatedOverrides
(makeOverrides pkgs.haskell.lib.dontCheck dontCheckPackages )
(makeOverrides pkgs.haskell.lib.dontCheck dontCheckPackages)
(makeOverrides pkgs.haskell.lib.doJailbreak doJailbreakPackages)
(makeOverrides pkgs.haskell.lib.dontHaddock dontHaddockPackages)
manualOverrides
Expand All @@ -60,8 +59,9 @@ let
pkgs = import (builtins.fetchTarball (import ./nix/nixpkgs.nix)) { inherit config; };

in
{ clay = pkgs.haskell.packages.${compiler}.clay;
examples = pkgs.haskell.packages.${compiler}.callCabal2nix "examples" ./examples {};
cabal = pkgs.haskellPackages.cabal-install;
pkgs = pkgs;
}
{
clay = pkgs.haskell.packages.${compiler}.clay;
examples = pkgs.haskell.packages.${compiler}.callCabal2nix "examples" ./examples { };
cabal = pkgs.haskellPackages.cabal-install;
pkgs = pkgs;
}
7 changes: 4 additions & 3 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{ compiler ? "ghc884" }:

let
release = (import ./release.nix {inherit compiler;});
in release.pkgs.lib.overrideDerivation release.clay.env (oldAttrs: rec {
nativeBuildInputs = (oldAttrs.nativeBuildInputs or []) ++ [
release = (import ./release.nix { inherit compiler; });
in
release.pkgs.lib.overrideDerivation release.clay.env (oldAttrs: rec {
nativeBuildInputs = (oldAttrs.nativeBuildInputs or [ ]) ++ [
release.cabal
release.pkgs.haskellPackages.cabal2nix
];
Expand Down

0 comments on commit 0b844de

Please sign in to comment.