push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
{
mkDerivation,
base,
containers,
emojis,
fetchgit,
hedgehog,
lib,
optparse-applicative,
parsec,
template-haskell,
text,
}:
mkDerivation {
pname = "dconf2nix";
version = "0.1.1";
src = fetchgit {
url = "https://github.com/gvolpe/dconf2nix.git";
sha256 = "0frqnq7ryr4gvkbb67n0615d9h1blps2kp55ic05n7wxyh26adgz";
rev = "2fc3b0dfbbce9f1ea2ee89f3689a7cb95b33b63f";
fetchSubmodules = true;
};
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [
base
containers
emojis
optparse-applicative
parsec
text
];
executableHaskellDepends = [ base ];
testHaskellDepends = [
base
containers
hedgehog
parsec
template-haskell
text
];
description = "Convert dconf files to Nix, as expected by Home Manager";
license = lib.licenses.asl20;
mainProgram = "dconf2nix";
}

View File

@@ -0,0 +1,36 @@
{
haskell,
haskellPackages,
lib,
runCommand,
}:
let
dconf2nix = haskell.lib.compose.justStaticExecutables (
haskell.lib.compose.overrideCabal (oldAttrs: {
maintainers = (oldAttrs.maintainers or [ ]) ++ [
lib.maintainers.gvolpe
];
}) haskellPackages.dconf2nix
);
in
dconf2nix.overrideAttrs (oldAttrs: {
passthru = (oldAttrs.passthru or { }) // {
updateScript = ./update.sh;
# These tests can be run with the following command.
#
# $ nix-build -A dconf2nix.passthru.tests
tests =
runCommand "dconf2nix-tests"
{
nativeBuildInputs = [
dconf2nix
];
}
''
dconf2nix > $out
'';
};
})

View File

@@ -0,0 +1,26 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p cabal2nix curl jq
#
# This script will update the dconf2nix derivation to the latest version using
# cabal2nix.
set -eo pipefail
# This is the directory of this update.sh script.
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# dconf2nix derivation created with cabal2nix.
dconf2nix_derivation_file="${script_dir}/dconf2nix.nix"
# This is the current revision of dconf2nix in Nixpkgs.
old_version="$(sed -En 's/.*\bversion = "(.*?)".*/\1/p' "$dconf2nix_derivation_file")"
# This is the latest release version of dconf2nix on GitHub.
new_version=$(curl --silent "https://api.github.com/repos/gvolpe/dconf2nix/releases" | jq '.[0].tag_name' --raw-output)
echo "Updating dconf2nix from old version $old_version to new version $new_version."
echo "Running cabal2nix and outputting to ${dconf2nix_derivation_file}..."
cabal2nix --revision "$new_version" "https://github.com/gvolpe/dconf2nix.git" > "$dconf2nix_derivation_file"
echo "Finished."

View File

@@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain

View File

@@ -0,0 +1,28 @@
{
mkDerivation,
base,
containers,
lib,
}:
mkDerivation {
pname = "ghc-settings-edit";
version = "0.1.0";
src = builtins.path {
path = ./.;
name = "source";
filter = path: _: (baseNameOf path) != "default.nix";
};
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [
base
containers
];
license = [
lib.licenses.mit
lib.licenses.bsd3
];
description = "Tool for editing GHC's settings file";
mainProgram = "ghc-settings-edit";
}

View File

@@ -0,0 +1,22 @@
cabal-version: 2.2
name: ghc-settings-edit
version: 0.1.0
synopsis: Tool for editing GHC's settings file
-- TODO: description for hackage
-- TODO: category for hackage
license: MIT AND BSD-3-Clause
author: sternenseemann
-- FIXME: must be email for potential Hackage upload
maintainer: @NixOS/haskell
copyright: © 2024 The Nixpkgs/NixOS contributors
stability: experimental
build-type: Simple
bug-reports: https://github.com/NixOS/nixpkgs/issues
executable ghc-settings-edit
default-language: Haskell2010
-- TODO: bounds for hackage
build-depends: base
, containers
main-is: ghc-settings-edit.lhs
hs-source-dirs: .

View File

@@ -0,0 +1,109 @@
ghc-settings-edit is a small tool for changing certain fields in the settings
file that is part of every GHC installation (usually located at
lib/ghc-$version/lib/settings or lib/ghc-$version/settings). This is sometimes
necessary because GHC's build process leaks the tools used at build time into
the final settings file. This is fine, as long as the build and host platform
of the GHC build is the same since it will be possible to execute the tools
used at build time at run time. In case we are cross compiling GHC itself,
the settings file needs to be changed so that the correct tools are used in the
final installation. The GHC build system itself doesn't allow for this due to
its somewhat peculiar bootstrapping mechanism.
This tool was originally written by sternenseemann and is licensed under the MIT
license (as is nixpkgs) as well as the BSD 3 Clause license since it incorporates
some code from GHC. It is primarily intended for use in nixpkgs, so it should be
considered unstable: No guarantees about the stability of its command line
interface are made at this time.
> -- SPDX-License-Identifier: MIT AND BSD-3-Clause
> {-# LANGUAGE LambdaCase #-}
> module Main where
ghc-settings-edit requires no additional dependencies to the ones already
required to bootstrap GHC. This means that it only depends on GHC and core
libraries shipped with the compiler (base and containers). This property should
be preserved going forward as to not needlessly complicate bootstrapping GHC
in nixpkgs. Additionally, a wide range of library versions and thus GHC versions
should be supported (via CPP if necessary).
> import Control.Monad (foldM)
> import qualified Data.Map.Lazy as Map
> import System.Environment (getArgs, getProgName)
> import Text.Read (readEither)
Note that the containers dependency is needed to represent the contents of the
settings file. In theory, [(String, String)] (think lookup) would suffice, but
base doesn't provide any facilities for updating such lists. To avoid needlessly
reinventing the wheel here, we depend on an extra core library.
> type SettingsMap = Map.Map String String
ghc-settings-edit accepts the following arguments:
- The path to the settings file which is edited in place.
- For every field in the settings file to be updated, two arguments need to be
passed: the name of the field and its new value. Any number of these pairs
may be provided. If a field is missing from the given settings file,
it won't be added (see also below).
> usage :: String -> String
> usage name = "Usage: " ++ name ++ " FILE [KEY NEWVAL [KEY2 NEWVAL2 ...]]"
The arguments and the contents of the settings file are fed into the performEdits
function which implements the main logic of ghc-settings-edit (except IO).
> performEdits :: [String] -> String -> Either String String
> performEdits editArgs settingsString = do
First, the settings file is parsed and read into the SettingsMap structure. For
parsing, we can simply rely read, as GHC uses the familiar Read/Show format
(plus some formatting) for storing its settings. This is the main reason
ghc-settings-edit is written in Haskell: We don't need to roll our own parser.
> settingsMap <- Map.fromList <$> readEither settingsString
We also need to parse the remaining command line arguments (after the path)
which means splitting them into pairs of arguments describing the individual
edits. We use the chunkList utility function from GHC for this which is vendored
below. Since it doesn't guarantee that all sublists have the exact length given,
we'll have to check the length of the returned “pairs” later.
> let edits = chunkList 2 editArgs
Since each edit is a transformation of the SettingsMap, we use a fold to go
through the edits. The Either monad allows us to bail out if one is malformed.
The use of Map.adjust ensures that fields that aren't present in the original
settings file aren't added since the corresponding GHC installation wouldn't
understand them. Note that this is done silently which may be suboptimal:
It could be better to fail.
> show . Map.toList <$> foldM applyEdit settingsMap edits
> where
> applyEdit :: SettingsMap -> [String] -> Either String SettingsMap
> applyEdit m [key, newValue] = Right $ Map.adjust (const newValue) key m
> applyEdit _ _ = Left "Uneven number of edit arguments provided"
main just wraps performEdits and takes care of reading from and writing to the
given file.
> main :: IO ()
> main =
> getArgs >>= \case
> (settingsFile:edits) -> do
> orig <- readFile settingsFile
> case performEdits edits orig of
> Right edited -> writeFile settingsFile edited
> Left errorMsg -> error errorMsg
> _ -> do
> name <- getProgName
> error $ usage name
As mentioned, chunkList is taken from GHC, specifically GHC.Utils.Misc of GHC
verson 9.8.2. We don't depend on the ghc library directly (which would be
possible in theory) since there are no stability guarantees or deprecation
windows for the ghc's public library.
> -- | Split a list into chunks of /n/ elements
> chunkList :: Int -> [a] -> [[a]]
> chunkList _ [] = []
> chunkList n xs = as : chunkList n bs where (as,bs) = splitAt n xs

View File

@@ -0,0 +1,13 @@
diff --git a/hadrian/src/Settings/Default.hs b/hadrian/src/Settings/Default.hs
index 0b743788ec..a7ff841609 100644
--- a/hadrian/src/Settings/Default.hs
+++ b/hadrian/src/Settings/Default.hs
@@ -249,7 +249,7 @@ defaultExtraArgs =
defaultHaddockExtraArgs :: Args
defaultHaddockExtraArgs = builder (Haddock BuildPackage) ?
- mconcat [ arg "--hyperlinked-source", arg "--hoogle", arg "--quickjump" ]
+ mconcat [ arg "--hoogle", arg "--quickjump" ]
-- | Default source arguments, e.g. optimisation settings.

View File

@@ -0,0 +1,12 @@
diff --git a/hadrian/src/Settings/Builders/Haddock.hs b/hadrian/src/Settings/Builders/Haddock.hs
index 902b2f85e2..429a441c3b 100644
--- a/hadrian/src/Settings/Builders/Haddock.hs
+++ b/hadrian/src/Settings/Builders/Haddock.hs
@@ -57,7 +57,6 @@ haddockBuilderArgs = mconcat
, arg $ "--odir=" ++ takeDirectory output
, arg $ "--dump-interface=" ++ output
, arg "--html"
- , arg "--hyperlinked-source"
, arg "--hoogle"
, arg "--quickjump"
, arg $ "--title=" ++ pkgName pkg ++ "-" ++ version

View File

@@ -0,0 +1,19 @@
{
mkDerivation,
base,
lib,
# GHC source tree to build ghc-toolchain from
ghcSrc,
ghcVersion,
}:
mkDerivation {
pname = "ghc-platform";
version = ghcVersion;
src = ghcSrc;
postUnpack = ''
sourceRoot="$sourceRoot/libraries/ghc-platform"
'';
libraryHaskellDepends = [ base ];
description = "Platform information used by GHC and friends";
license = lib.licenses.bsd3;
}

View File

@@ -0,0 +1,33 @@
{
mkDerivation,
base,
directory,
filepath,
ghc-platform,
lib,
process,
text,
transformers,
# GHC source tree to build ghc-toolchain from
ghcVersion,
ghcSrc,
}:
mkDerivation {
pname = "ghc-toolchain";
version = ghcVersion;
src = ghcSrc;
postUnpack = ''
sourceRoot="$sourceRoot/utils/ghc-toolchain"
'';
libraryHaskellDepends = [
base
directory
filepath
ghc-platform
process
text
transformers
];
description = "Utility for managing GHC target toolchains";
license = lib.licenses.bsd3;
}

View File

@@ -0,0 +1,97 @@
# See also ./make-hadrian.nix
{
mkDerivation,
base,
bytestring,
Cabal,
containers,
directory,
extra,
filepath,
lib,
mtl,
parsec,
shake,
text,
transformers,
unordered-containers,
cryptohash-sha256,
base16-bytestring,
writeText,
# Dependencies that are not on Hackage and only used in certain Hadrian versions
ghc-platform ? null,
ghc-toolchain ? null,
# GHC source tree to build hadrian from
ghcSrc,
ghcVersion,
# GHC we are using to bootstrap hadrian (stage0)
bootGhcVersion,
# Customization
userSettings ? null,
}:
mkDerivation {
pname = "hadrian";
version = ghcVersion;
src = ghcSrc;
postUnpack = ''
sourceRoot="$sourceRoot/hadrian"
'';
# Overwrite UserSettings.hs with a provided custom one
postPatch = lib.optionalString (userSettings != null) ''
install -m644 "${writeText "UserSettings.hs" userSettings}" src/UserSettings.hs
'';
configureFlags = [
# avoid QuickCheck dep which needs shared libs / TH
"-f-selftest"
# Building hadrian with -O1 takes quite some time with little benefit.
# Additionally we need to recompile it on every change of UserSettings.hs.
# See https://gitlab.haskell.org/ghc/ghc/-/merge_requests/1190
"-O0"
];
jailbreak =
# Ignore bound directory >= 1.3.9.0, unless the bootstrapping GHC ships it
# which is the case for >= 9.12. Upstream uses this to avoid a race condition
# that only seems to affect Windows. We never build GHC natively on Windows.
# See also https://gitlab.haskell.org/ghc/ghc/-/issues/24382,
# https://gitlab.haskell.org/ghc/ghc/-/commit/a2c033cf826,
# https://gitlab.haskell.org/ghc/ghc/-/commit/7890f2d8526…
(
lib.versionOlder bootGhcVersion "9.12"
&& (
(lib.versionAtLeast ghcVersion "9.6.7" && lib.versionOlder ghcVersion "9.7")
|| lib.versionAtLeast ghcVersion "9.11"
)
);
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [
base
bytestring
Cabal
containers
directory
extra
filepath
mtl
parsec
shake
text
transformers
unordered-containers
]
++ lib.optionals (lib.versionAtLeast ghcVersion "9.7") [
cryptohash-sha256
base16-bytestring
]
++ lib.optionals (lib.versionAtLeast ghcVersion "9.9") [
ghc-platform
ghc-toolchain
];
passthru = {
# Expose »private« dependencies if any
inherit ghc-platform ghc-toolchain;
};
description = "GHC build system";
license = lib.licenses.bsd3;
}

View File

@@ -0,0 +1,71 @@
# Hadrian is the build system used to (exclusively) build GHC. It can
# (theoretically) be used starting with GHC 9.4 and is required since 9.6. It is
# developed in the GHC source tree and specific to the GHC version it is released
# with, i.e. Hadrian always needs to be built from the same GHC source tree as
# the GHC we want to build.
#
# This fact makes it impossible to integrate Hadrian into our Haskell package
# sets which are also used to bootstrap GHC, since a package set can bootstrap
# multiple GHC versions (usually two major versions). A bootstrap set would need
# knowledge of the GHC it would eventually bootstrap which would make the logic
# unnecessarily complicated.
#
# Luckily Hadrian is, while annoying to bootstrap, relatively simple. Specifically
# all it requires to build is (relative to the GHC we are trying to build) a
# build->build GHC and build->build Haskell packages. We can get all of this
# from bootPkgs which is already passed to the GHC expression.
#
# The solution is the following: The GHC expression passes its source tree and
# version along with some parameters to this function (./make-hadrian.nix)
# which acts as a common expression builder for all Hadrian version as well as
# related packages that are managed in the GHC source tree. Its main job is to
# expose all possible compile time customization in a common interface and
# take care of all differences between Hadrian versions.
{
bootPkgs,
lib,
}:
{
# GHC source tree and version to build hadrian & friends from.
# These are passed on to the actual package expressions.
ghcSrc,
ghcVersion,
# Contents of a non-default UserSettings.hs to use when building hadrian, if any.
# Should be a string or null.
userSettings ? null,
}:
let
callPackage' =
f: args:
bootPkgs.callPackage f (
{
inherit ghcSrc ghcVersion;
}
// args
);
ghc-platform = callPackage' ./ghc-platform.nix { };
ghc-toolchain = callPackage' ./ghc-toolchain.nix {
inherit ghc-platform;
};
in
callPackage' ./hadrian.nix (
{
inherit userSettings;
# Taking `ghc` as an input may be too confusing
bootGhcVersion = bootPkgs.ghc.version;
}
// lib.optionalAttrs (lib.versionAtLeast ghcVersion "9.9") {
# Starting with GHC 9.9 development, additional in tree packages are required
# to build hadrian. (Hackage-released conditional dependencies are handled
# in ./hadrian.nix without requiring intervention here.)
inherit ghc-platform ghc-toolchain;
}
// lib.optionalAttrs (lib.versionAtLeast ghcVersion "9.11") {
# See https://gitlab.haskell.org/ghc/ghc/-/commit/145a6477854d4003a07573d5e7ffa0c9a64ae29c
Cabal = bootPkgs.Cabal_3_14_2_0;
}
)

View File

@@ -0,0 +1,178 @@
{
lib,
stdenv,
haskellPackages,
haskell,
# Which GHC versions this hls can support.
# These are looked up in nixpkgs as `pkgs.haskell.packages."ghc${version}`.
# Run
# $ nix-instantiate --eval -E 'with import <nixpkgs> {}; builtins.attrNames pkgs.haskell.packages'
# to list for your nixpkgs version.
supportedGhcVersions ? [
(lib.strings.replaceStrings [ "." ] [ "" ] (lib.versions.majorMinor haskellPackages.ghc.version))
],
# Whether to build hls with the dynamic run-time system.
# See https://haskell-language-server.readthedocs.io/en/latest/troubleshooting.html#static-binaries for more information.
dynamic ? true,
# Which formatters are supported. Pass `[]` to remove all formatters.
#
# Maintainers: if a new formatter is added, add it here and down in knownFormatters
supportedFormatters ? [
"ormolu"
"fourmolu"
"floskell"
"stylish-haskell"
],
}:
# make sure the user only sets GHC versions that actually exist
assert supportedGhcVersions != [ ];
assert lib.asserts.assertEachOneOf "supportedGhcVersions" supportedGhcVersions (
lib.pipe haskell.packages [
lib.attrNames
(lib.filter (lib.hasPrefix "ghc"))
(map (lib.removePrefix "ghc"))
]
);
let
# A mapping from formatter name to
# - cabal flag to disable
# - formatter-specific packages that can be stripped from the build of hls if it is disabled
knownFormatters = {
ormolu = {
cabalFlag = "ormolu";
packages = [
"hls-ormolu-plugin"
];
};
fourmolu = {
cabalFlag = "fourmolu";
packages = [
"hls-fourmolu-plugin"
];
};
floskell = {
cabalFlag = "floskell";
packages = [
"hls-floskell-plugin"
];
};
stylish-haskell = {
cabalFlag = "stylishhaskell";
packages = [
"hls-stylish-haskell-plugin"
];
};
};
in
# make sure any formatter that is set is actually supported by us
assert lib.asserts.assertEachOneOf "supportedFormatters" supportedFormatters (
lib.attrNames knownFormatters
);
#
# The recommended way to override this package is
#
# pkgs.haskell-language-server.override { supportedGhcVersions = [ "90" "92"]; }
#
# for example. Read more about this in the haskell-language-server section of the nixpkgs manual.
#
let
inherit (haskell.lib.compose)
justStaticExecutables
overrideCabal
enableCabalFlag
disableCabalFlag
;
getPackages = version: haskell.packages."ghc${version}";
# Given the list of `supportedFormatters`, remove every formatter that we know of (knownFormatters)
# by disabling the cabal flag and also removing the formatter libraries.
removeUnnecessaryFormatters =
let
# only formatters that were not requested
unwanted = lib.pipe knownFormatters [
(lib.filterAttrs (fmt: _: !(lib.elem fmt supportedFormatters)))
lib.attrsToList
];
# all flags to disable
flags = map (fmt: fmt.value.cabalFlag) unwanted;
# all dependencies to remove from hls
deps = lib.concatMap (fmt: fmt.value.packages) unwanted;
# remove nulls from a list
stripNulls = lib.filter (x: x != null);
# remove all unwanted dependencies of formatters we dont want
stripDeps = overrideCabal (drv: {
libraryHaskellDepends = lib.pipe (drv.libraryHaskellDepends or [ ]) [
# the existing list may contain nulls, so lets strip them first
stripNulls
(lib.filter (dep: !(lib.elem dep.pname deps)))
];
});
in
drv: lib.pipe drv ([ stripDeps ] ++ map disableCabalFlag flags);
tunedHls =
hsPkgs:
lib.pipe hsPkgs.haskell-language-server (
[
(haskell.lib.compose.overrideCabal (old: {
enableSharedExecutables = dynamic;
${if !dynamic then "postInstall" else null} = ''
${old.postInstall or ""}
remove-references-to -t ${hsPkgs.ghc} $out/bin/haskell-language-server
'';
}))
((if dynamic then enableCabalFlag else disableCabalFlag) "dynamic")
removeUnnecessaryFormatters
]
++ lib.optionals (!dynamic) [
justStaticExecutables
]
);
targets =
version:
let
packages = getPackages version;
in
[ "haskell-language-server-${packages.ghc.version}" ];
makeSymlinks =
version:
lib.concatMapStringsSep "\n" (
x: "ln -s ${tunedHls (getPackages version)}/bin/haskell-language-server $out/bin/${x}"
) (targets version);
in
stdenv.mkDerivation {
pname = "haskell-language-server";
version = haskellPackages.haskell-language-server.version;
buildCommand = ''
mkdir -p $out/bin
ln -s ${tunedHls (getPackages (builtins.head supportedGhcVersions))}/bin/haskell-language-server-wrapper $out/bin/haskell-language-server-wrapper
${lib.concatMapStringsSep "\n" makeSymlinks supportedGhcVersions}
'';
meta = haskellPackages.haskell-language-server.meta // {
maintainers = [ lib.maintainers.maralorn ];
longDescription = ''
This package provides the executables ${
lib.concatMapStringsSep ", " (x: lib.concatStringsSep ", " (targets x)) supportedGhcVersions
} and haskell-language-server-wrapper.
You can choose for which ghc versions to install hls with pkgs.haskell-language-server.override { supportedGhcVersions = [ "90" "92" ]; }.
'';
};
}

View File

@@ -0,0 +1,48 @@
{
lib,
stdenv,
writeScriptBin,
makeWrapper,
buildEnv,
ghcWithPackages,
jupyter,
packages,
}:
let
ihaskellEnv = ghcWithPackages (
self:
[
self.ihaskell
self.ihaskell-blaze
self.ihaskell-diagrams
]
++ packages self
);
ihaskellSh = writeScriptBin "ihaskell-notebook" ''
#! ${stdenv.shell}
export GHC_PACKAGE_PATH="$(${ihaskellEnv}/bin/ghc --print-global-package-db):$GHC_PACKAGE_PATH"
export PATH="${
lib.makeBinPath [
ihaskellEnv
jupyter
]
}''${PATH:+:}$PATH"
${ihaskellEnv}/bin/ihaskell install -l $(${ihaskellEnv}/bin/ghc --print-libdir) && ${jupyter}/bin/jupyter notebook
'';
in
buildEnv {
name = "ihaskell-with-packages";
nativeBuildInputs = [ makeWrapper ];
paths = [
ihaskellEnv
jupyter
];
postBuild = ''
ln -s ${ihaskellSh}/bin/ihaskell-notebook $out/bin/
for prg in $out/bin"/"*;do
if [[ -f $prg && -x $prg ]]; then
wrapProgram $prg --set PYTHONPATH "$(echo ${jupyter}/lib/*/site-packages)"
fi
done
'';
}

View File

@@ -0,0 +1,49 @@
diff --git a/src/Main.hs b/src/Main.hs
index 61da2f3..39e5c9b 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -73,11 +73,14 @@ main = do
config' <- sequence config
dir <- P.getDataDir
exitWith <=< lambdabotMain modulesInfo $
- [dataDir ==> dir, lbVersion ==> P.version] ++ config'
+ [dataDir ==> dir, lbVersion ==> P.version] ++ configInfo ++ config'
-- special online target for ghci use
online :: [String] -> IO ()
online strs = do
dir <- P.getDataDir
- void $ lambdabotMain modulesInfo
- [dataDir ==> dir, lbVersion ==> P.version, onStartupCmds ==> strs]
+ void $ lambdabotMain modulesInfo $
+ [dataDir ==> dir, lbVersion ==> P.version, onStartupCmds ==> strs] ++ configInfo
+
+configInfo :: [DSum Config Identity]
+configInfo = @config@
diff --git a/src/Modules.hs b/src/Modules.hs
index 036ea1f..eaafa50 100644
--- a/src/Modules.hs
+++ b/src/Modules.hs
@@ -14,10 +14,15 @@ import Lambdabot.Plugin.Reference
import Lambdabot.Plugin.Social
modulesInfo :: Modules
-modulesInfo = $(modules $ corePlugins
- ++ haskellPlugins
- ++ ["irc", "localtime", "topic"] -- ircPlugins
- ++ ["dummy", "fresh", "todo"] -- miscPlugins
- ++ ["bf", "dice", "elite", "filter", "quote", "slap", "unlambda", "vixen"] -- noveltyPlugins
- ++ referencePlugins
- ++ socialPlugins)
+modulesInfo =
+ $(modules $
+ let oldDefaultModules =
+ corePlugins
+ ++ haskellPlugins
+ ++ ["irc", "localtime", "topic"] -- ircPlugins
+ ++ ["dummy", "fresh", "todo"] -- miscPlugins
+ ++ ["bf", "dice", "elite", "filter", "quote", "slap", "unlambda", "vixen"] -- noveltyPlugins
+ ++ referencePlugins
+ ++ socialPlugins
+ in @modules@
+ )

View File

@@ -0,0 +1,49 @@
{
lib,
haskellLib,
makeWrapper,
haskellPackages,
mueval,
withDjinn ? true,
aspell ? null,
packages ? (pkgs: [ ]),
modules ? "oldDefaultModules",
configuration ? "[]",
}:
let
allPkgs = pkgs: mueval.defaultPkgs pkgs ++ [ pkgs.lambdabot-trusted ] ++ packages pkgs;
mueval' = mueval.override {
inherit haskellPackages;
packages = allPkgs;
};
bins = lib.makeBinPath (
[
mueval'
(haskellPackages.ghcWithHoogle allPkgs)
haskellPackages.unlambda
haskellPackages.brainfuck
]
++ lib.optional withDjinn haskellPackages.djinn
++ lib.optional (aspell != null) aspell
);
modulesStr = lib.replaceStrings [ "\n" ] [ " " ] modules;
configStr = lib.replaceStrings [ "\n" ] [ " " ] configuration;
in
haskellLib.overrideCabal (self: {
patches = (self.patches or [ ]) ++ [ ./custom-config.patch ];
postPatch = (self.postPatch or "") + ''
substituteInPlace src/Main.hs \
--replace '@config@' '${configStr}'
substituteInPlace src/Modules.hs \
--replace '@modules@' '${modulesStr}'
'';
buildTools = (self.buildTools or [ ]) ++ [ makeWrapper ];
postInstall = (self.postInstall or "") + ''
wrapProgram $out/bin/lambdabot \
--prefix PATH ":" '${bins}'
'';
}) haskellPackages.lambdabot

View File

@@ -0,0 +1,93 @@
{
mkDerivation,
HsOpenSSL,
QuickCheck,
aeson,
async,
base,
bytestring,
containers,
crypton-connection,
directory,
hpack,
hspec,
hspec-discover,
hspec-expectations,
http-client,
http-client-openssl,
http-conduit,
lib,
megaparsec,
network-uri,
optparse-applicative,
parser-combinators,
quickcheck-instances,
retry,
text,
unix,
unordered-containers,
utf8-string,
dotenv,
fetchFromGitHub,
}:
mkDerivation rec {
pname = "vaultenv";
version = "0.19.0";
src = fetchFromGitHub {
owner = "channable";
repo = "vaultenv";
rev = "v${version}";
hash = "sha256-x3c9TKrCF3tsEFofYAXfK6DWdirEUxWWTttNqU/sJSc=";
};
buildTools = [ hpack ];
prePatch = ''
substituteInPlace package.yaml \
--replace -Werror ""
'';
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [
HsOpenSSL
aeson
async
base
bytestring
containers
crypton-connection
directory
dotenv
http-client
http-client-openssl
http-conduit
megaparsec
network-uri
optparse-applicative
optparse-applicative
parser-combinators
retry
text
unix
unordered-containers
utf8-string
];
testHaskellDepends = executableHaskellDepends ++ [
QuickCheck
directory
hspec
hspec-discover
hspec-expectations
quickcheck-instances
];
preConfigure = "hpack";
homepage = "https://github.com/channable/vaultenv#readme";
description = "Runs processes with secrets from HashiCorp Vault";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [
lnl7
manveru
];
}