Skip to content

Commit

Permalink
% nix run github:astro/deadnix -- --edit --no-lambda-pattern-names
Browse files Browse the repository at this point in the history
  • Loading branch information
yvan-sraka committed Jul 24, 2023
1 parent b0290ac commit 94fb237
Show file tree
Hide file tree
Showing 244 changed files with 262 additions and 367 deletions.
4 changes: 1 addition & 3 deletions builder/haddock-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ let
'';

installPhase =
let
target-pkg-and-db = "${ghc.targetPrefix}ghc-pkg -v0 --package-db $out/package.conf.d";
in ''
''
html="dist/doc/html/${package.identifier.name}"
if [ -d "$html" ]; then
Expand Down
6 changes: 1 addition & 5 deletions builder/make-config-files.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ let
# pkg id for z-{pkg name}-z-{sublib name}. As we do not provide the
# sublib name to exactDep, as we don't have access to it at the call-site,
# we resort to a bit of globbing, which (as pkg db's should contain only
# a single package) work.

getLibComponent = dep:
dep.components.library # Regular package dependency
or dep; # or a sublib
# a single package) work. # or a sublib

# Work our suitable packageCfgDir subdirectory
isGhcjs = ghc.isGhcjs or false;
Expand Down
2 changes: 1 addition & 1 deletion ci-lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# Keep derivations and attrsets with 'recurseForDerivations'. This ensures that we match the
# derivations that Hercules will see, and prevents Hydra from trying to pick up all sorts of bad stuff
# (like attrsets that contain themselves!).
filterDerivations = filterAttrsOnlyRecursive (n: attrs: lib.isDerivation attrs || attrs.recurseForDerivations or false);
filterDerivations = filterAttrsOnlyRecursive (_n: attrs: lib.isDerivation attrs || attrs.recurseForDerivations or false);

# A version of 'filterAttrsRecursive' that doesn't recurse into derivations. This prevents us from going into an infinite
# loop with the 'out' attribute on derivations.
Expand Down
2 changes: 1 addition & 1 deletion ci.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
(system != "aarch64-linux" || (
!__elem compiler-nix-name ["ghc865" "ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921" "ghc922"]
)))
(builtins.mapAttrs (compiler-nix-name: runTests: {
(builtins.mapAttrs (_compiler-nix-name: runTests: {
inherit runTests;
}) (
# GHC version to cache and whether to run the tests against them.
Expand Down
2 changes: 1 addition & 1 deletion compiler/ghc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ let
let targetLibffi = targetPackages.libffi or libffi; in
# we need to set `dontDisableStatic` for musl for libffi to work.
if stdenv.targetPlatform.isMusl
then targetLibffi.overrideAttrs (old: { dontDisableStatic = true; })
then targetLibffi.overrideAttrs (_old: { dontDisableStatic = true; })
else targetLibffi;

targetGmp = targetPackages.gmp or gmp;
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/getting-started-flakes/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
flake-utils.lib.eachSystem [ "x86_64-linux" "x86_64-darwin" ] (system:
let
overlays = [ haskellNix.overlay
(final: prev: {
(final: _prev: {
# This overlay adds our project to pkgs
helloProject =
final.haskell-nix.project' {
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
overlays = [ allOverlays.combined ]
++ (if checkMaterialization then
[
(final: prev: {
(_final: prev: {
haskell-nix = prev.haskell-nix // {
checkMaterialization = true;
};
Expand Down
2 changes: 1 addition & 1 deletion hix/init/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
flake-utils.lib.eachSystem supportedSystems (system:
let
overlays = [ haskellNix.overlay
(final: prev: {
(final: _prev: {
hixProject =
final.haskell-nix.hix.project {
src = ./.;
Expand Down
2 changes: 1 addition & 1 deletion hix/project/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
flake-utils.lib.eachSystem [ "EVAL_SYSTEM" ] (system:
let
overlays = [ haskellNix.overlay
(final: prev: {
(final: _prev: {
hixProject =
final.haskell-nix.hix.project {
inherit src;
Expand Down
4 changes: 2 additions & 2 deletions lib/cabal-project-parser.nix
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ let
# --shar256: 003lm3pm0000hbfmii7xcdd9v20000flxf7gdl2pyxia7p014i8z
# will be trated like a field and returned here
# (used in call-cabal-project-to-nix.nix to create a fixed-output derivation)
extractSourceRepoPackageData = cabalProjectFileName: sha256map: repo:
extractSourceRepoPackageData = _cabalProjectFileName: sha256map: repo:
let
refOrRev =
if builtins.match "[0-9a-f]{40}" repo.tag != null
Expand Down Expand Up @@ -128,7 +128,7 @@ let
# This works because `cabal configure` does not include any of the `/nix/sore/`
# paths in the `plan.json` (so materialized plan-nix will still work as expeced).
# See tests/unit.nix for examples of input and output.
parseRepositoryBlock = evalPackages: cabalProjectFileName: sha256map: inputMap: cabal-install: nix-tools: block:
parseRepositoryBlock = evalPackages: _cabalProjectFileName: sha256map: inputMap: cabal-install: nix-tools: block:
let
lines = pkgs.lib.splitString "\n" block;
# The first line will contain the repository name.
Expand Down
4 changes: 1 addition & 3 deletions lib/call-cabal-project-to-nix.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, runCommand, cacert, index-state-hashes, haskellLib }@defaults:
{ pkgs, runCommand, cacert, index-state-hashes, haskellLib }:
{ name ? src.name or null # optional name for better error messages
, src
, materialized-dir ? ../materialized
Expand Down Expand Up @@ -148,8 +148,6 @@ in let
then index-state
else pkgs.lib.last (builtins.attrNames index-state-hashes);

pkgconfPkgs = import ./pkgconf-nixpkgs-map.nix pkgs;

# If a hash was not specified find a suitable cached index state to
# use that will contain all the packages we need. By using the
# first one after the desired index-state we can avoid recalculating
Expand Down
2 changes: 1 addition & 1 deletion lib/call-stack-to-nix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
, checkMaterialization ? null # If true the nix files will be generated used to check plan-sha256 and material
, nix-tools
, evalPackages
, ... }@args:
, ... }:
let
inherit (evalPackages) runCommand;
inherit (evalPackages.haskell-nix) mkCacheFile materialize haskellLib;
Expand Down
10 changes: 1 addition & 9 deletions lib/clean-cabal-component.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ let
# Keep the trailing slash if there was one.
+ (if lib.hasSuffix "/" path then "/" else "");
isAbsolutePath = path: lib.hasPrefix "/" path;
isRelativePath = path: !(isAbsolutePath path);
normalizePath = path:
(if isAbsolutePath path
then "/"
Expand All @@ -48,13 +47,6 @@ let
else a + "/" + b
);
# Like normalizePath but with a trailing / when needed
normalizeDir = dir:
let p = normalizePath dir;
in if p == "" || p == "/"
then ""
else if lib.hasSuffix "/" p
then p
else p + "/";
in
if srcStr' == null || package.detailLevel != "FullDetails"
then src
Expand Down Expand Up @@ -117,7 +109,7 @@ in
rPath = lib.strings.substring (srcStrLen + 1) (lib.strings.stringLength path - srcStrLen - 1) path;
# This is a handy way to find out why different files are included
# traceReason = reason: v: if v then builtins.trace (rPath + " : " + reason) true else false;
traceReason = reason: v: v;
traceReason = _reason: v: v;
in
traceReason "directory is needed" (
lib.any (d: lib.strings.hasPrefix (rPath + "/") d) dirsNeeded)
Expand Down
4 changes: 2 additions & 2 deletions lib/clean-git.nix
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ then
caller = "cleanGit";
name = (if name == null then "" else name + "-") + "gitSubmoduleFiles";
inherit src;
filter = path: type:
filter = path: _type:
elem path pathsNeeded
||
lib.any (i: (lib.hasSuffix i path)) [
Expand Down Expand Up @@ -184,7 +184,7 @@ then
path == origSrcSubDir + "/.git"
|| lib.hasPrefix (origSrcSubDir + "/.git/") path;

filter = path: type:
filter = path: _type:
hasAttr (toString path) whitelist_set
|| (keepGitDir && isGitDirPath path);
in
Expand Down
2 changes: 1 addition & 1 deletion lib/clean-source-haskell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{ lib }:

rec {
haskellSourceFilter = name: type:
haskellSourceFilter = name: _type:
let baseName = baseNameOf (toString name);
in ! (
# Filter out cabal build products.
Expand Down
2 changes: 1 addition & 1 deletion lib/clean-source-with.nix
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
origSrcSubDir = toString origSrc + origSubDir;
parentFilter = if isFiltered || isFilteredEx
then path: type: src.filter path type
else path: type: true;
else _path: _type: true;
filter' = path: type:
# Respect the parent filter
parentFilter path type && (
Expand Down
13 changes: 0 additions & 13 deletions lib/cover-project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,6 @@ let

ghc = project.pkg-set.config.ghc.package;

libs = lib.unique (lib.concatMap (r: r.mixLibraries) coverageReports);

writeArr = name: arr: pkgs.writeText name (lib.concatStringsSep "\n" arr);

mixDirs =
map
(l: "${l}/share/hpc/vanilla/mix/${l.identifier.name}-${l.identifier.version}")
libs;
mixDirsFile = writeArr "mixdirs" mixDirs;

srcDirs = map (l: l.srcSubDirPath) libs;
srcDirsFile = writeArr "srcdirs" srcDirs;

allCoverageReport = haskellLib.coverageReport {
name = "all";
checks = lib.flatten (lib.concatMap
Expand Down
12 changes: 6 additions & 6 deletions lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ in {
config.package.buildable # Set manually in a module (allows whole packages to be disabled)
&& comp.buildable # Set based on `buildable` in `.cabal` files
&& comp.planned; # Set if the component was in the `plan.json`
buildableAttrs = lib.filterAttrs (n: isBuildable);
buildableAttrs = lib.filterAttrs (_n: isBuildable);
libComp = if comps.library == null || !(isBuildable comps.library)
then {}
else lib.mapAttrs applyLibrary (removeAttrs comps (subComponentTypes ++ [ "setup" ]));
Expand All @@ -98,12 +98,12 @@ in {
# Was there a reference to the package source in the `cabal.project` or `stack.yaml` file.
# This is used to make the default `packages` list for `shellFor`.
isLocalPackage = p: p.isLocal or false;
selectLocalPackages = lib.filterAttrs (n: p: p != null && isLocalPackage p);
selectLocalPackages = lib.filterAttrs (_n: p: p != null && isLocalPackage p);

# if it's a project package it has a src attribute set with an origSubDir attribute.
# project packages are a subset of localPackages
isProjectPackage = p: p.isProject or false;
selectProjectPackages = lib.filterAttrs (n: p: p != null && isLocalPackage p && isProjectPackage p);
selectProjectPackages = lib.filterAttrs (_n: p: p != null && isLocalPackage p && isProjectPackage p);

# Format a componentId as it should appear as a target on the
# command line of the setup script.
Expand Down Expand Up @@ -156,14 +156,14 @@ in {
# to: tests.mypackage.unit-tests
#
collectComponents = group: packageSel: haskellPackages:
let packageToComponents = name: package:
let packageToComponents = _name: package:
# look for the components with this group if there are any
let components = package.components.${group} or {};
# set recurseForDerivations unless it's a derivation itself (e.g. the "library" component) or an empty set
in if lib.isDerivation components || components == {}
then components
else recurseIntoAttrs components;
packageFilter = name: package: (package.isHaskell or false) && packageSel package;
packageFilter = _name: package: (package.isHaskell or false) && packageSel package;
filteredPkgs = lib.filterAttrs packageFilter haskellPackages;
# at this point we can filter out packages that don't have any of the given kind of component
packagesByComponent = lib.filterAttrs (_: components: components != {}) (lib.mapAttrs packageToComponents filteredPkgs);
Expand All @@ -182,7 +182,7 @@ in {
#
# This can be used to collect all the test runs in your project, so that can be run in CI.
collectChecks = packageSel: haskellPackages:
let packageFilter = name: package: (package.isHaskell or false) && packageSel package;
let packageFilter = _name: package: (package.isHaskell or false) && packageSel package;
in recurseIntoAttrs (lib.mapAttrs (_: p: p.checks) (lib.filterAttrs packageFilter haskellPackages));

# Equivalent to collectChecks with (_: true) as selection function.
Expand Down
6 changes: 2 additions & 4 deletions lib/import-and-filter-project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ let
filter = src.filter or (_: _: true);
};
# The sub directory containing the cabal.project or stack.yaml file
projectSubDir' = src.origSubDir or ""; # With leading /
projectSubDir = pkgs.lib.strings.removePrefix "/" projectSubDir'; # Without /
projectSubDir'' = if projectSubDir == "" then "" else projectSubDir + "/"; # With trailing /
projectSubDir' = src.origSubDir or ""; # With leading / # Without / # With trailing /
project = import "${projectNix}${projectSubDir'}";
in project // {
extras = hackage: let old = (project.extras hackage).packages; in {
packages = pkgs.lib.attrsets.mapAttrs (name: value:
packages = pkgs.lib.attrsets.mapAttrs (_name: value:
if builtins.isFunction value
then value
else {...}@args: with pkgs.lib.strings;
Expand Down
2 changes: 1 addition & 1 deletion lib/pkgconf-nixpkgs-map.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pkgs:
# Only include derivations that exist in the current pkgs.
# This allows us to use this mapping to be used in allPkgConfigWrapper.
# See ./overlas
lookupAttrsIn = x: __mapAttrs (pname: names:
lookupAttrsIn = x: __mapAttrs (_pname: names:
# The first entry is should be used for the version by allPkgConfigWrapper
# so we need it to be present.
if __length names != 0 && x ? ${__head names}
Expand Down
4 changes: 2 additions & 2 deletions lib/project-overlays.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
}: {

# TODO: remove by end of 2022.
devshell = final: prev: {
devshell = final: _prev: {
devshell = builtins.trace "WARNING: `projectOverlays.devshell` is deprecated in favor of `haskellLib.devshellFor`"
(haskellLib.devshellFor final.shell);
};

# Provides easily accessible attrset for each type of
# components belonging to the project packages.
projectComponents = final: prev: {
projectComponents = final: _prev: {
# local project packages:
packages = haskellLib.selectProjectPackages final.hsPkgs;
# set of all exes (as first level entries):
Expand Down
4 changes: 2 additions & 2 deletions lib/stack-cache-generator.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
, nix-tools
, evalPackages
, ...
}@args:
}:
let
inherit (evalPackages) runCommand;
inherit (evalPackages.haskell-nix) haskellLib;
Expand All @@ -35,7 +35,7 @@ let
# Filter just the stack yaml file and any resolver yaml file it points to.
maybeCleanedSource = haskellLib.cleanSourceWith {
inherit src;
filter = path: type:
filter = path: _type:
let
origSrc = if src ? _isLibCleanSourceWith then src.origSrc else src;
origSubDir = if src ? _isLibCleanSourceWithEx then src.origSubDir else "";
Expand Down
2 changes: 1 addition & 1 deletion materialized/alex-3.2.7.1/default.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion materialized/bootstrap/ghc8107/alex/default.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion materialized/bootstrap/ghc8107/happy-1.19.12/default.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion materialized/bootstrap/ghc8107/hscolour/default.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion materialized/bootstrap/ghc844/alex/default.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion materialized/bootstrap/ghc844/happy-1.19.11/default.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion materialized/bootstrap/ghc844/happy-1.19.12/default.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion materialized/bootstrap/ghc844/hscolour/default.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 94fb237

Please sign in to comment.