Debian Codegraph @

.nix-helpers/nixpkgs.nix

raw
1 # This file pins the version of nixpkgs to a known good version. The nixpkgs is
2 # imported with an overlay adding Termonad. It is imported from various other
3 # files.
4
5 { # A path to nixpkgs. This will be imported. If null, use a known-working
6 # nixpkgs version.
7 nixpkgs ? null
8 , # Additional overlays to apply when importing nixpkgs.
9 additionalOverlays ? []
10 , # String representing a GHC version to use. Normally something like
11 # "ghc865". If null, then use a known-working GHC version.
12 compiler ? null
13 , # Build all the examples bundled with termonad. Normally this is only used
14 # in CI for testing that the examples all still compile.
15 buildExamples ? false
16 , # Enable SIXEL support in VTE.
17 #
18 # Setting this to true builds the VTE library with SIXEL enabled. Note that
19 # this uses a special version of VTE that may still have issues. This is
20 # necessary because VTE doesn't yet support SIXEL by default in their release
21 # versions. See https://github.com/cdepillabout/termonad/pull/221 and
22 # https://github.com/cdepillabout/termonad/pull/219 for more information and
23 # examples of what SIXEL looks like in Termonad.
24 #
25 # Also, see https://gitlab.gnome.org/GNOME/vte/-/issues/253 which seems to be
26 # the upstream VTE issue for the SIXEL implementation.
27 #
28 # TODO: Remove this option when the upstream VTE releases officially support
29 # SIXEL.
30 enableSixelSupport ? false
31 , # This is only used for `termonadShell`.
32 #
33 # If this is `true`, Hoogle will also index the Termonad libraries,
34 # however this will mean the environment will need to be rebuilt every
35 # time the termonad source changes.
36 indexTermonad ? false
37 , # Extra Haskell packages that will be visible by Termonad when it compiles
38 # itself. See ./termonad-with-packages.nix for an example of how to use
39 # this.
40 extraHaskellPackages ? null
41 }:
42
43 let
44 flake-lock = builtins.fromJSON (builtins.readFile ../flake.lock);
45
46 nixpkgsSrc =
47 if isNull nixpkgs
48 then
49 builtins.fetchTarball {
50 url = "https://github.com/NixOS/nixpkgs/archive/${flake-lock.nodes.nixpkgs.locked.rev}.tar.gz";
51 sha256 = flake-lock.nodes.nixpkgs.locked.narHash;
52 }
53 else nixpkgs;
54
55 haskellPackagesOverlays = import ./overlays.nix;
56
57 # This overlay sets some of the options use we at development time. This
58 # overlay is basically an easy way to pass options to `./overlays.nix`
59 # without having to do it explicitly.
60 termonadOptionsOverlay = self: super: {
61 termonadCompilerVersion =
62 if isNull compiler then super.termonadCompilerVersion else compiler;
63
64 termonadBuildExamples = buildExamples;
65
66 termonadIndexTermonad = indexTermonad;
67
68 termonadExtraHaskellPackages =
69 if isNull extraHaskellPackages then super.termonadExtraHaskellPackages else extraHaskellPackages;
70
71 termonadEnableSixelSupport = enableSixelSupport;
72 };
73
74 in
75
76 import nixpkgsSrc {
77 overlays =
78 haskellPackagesOverlays ++ [ termonadOptionsOverlay ] ++ additionalOverlays;
79 }