Skip to content

Commit

Permalink
Merge staging-next into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored May 8, 2021
2 parents a81b23c + b4416b5 commit 2c85188
Show file tree
Hide file tree
Showing 102 changed files with 7,605 additions and 6,458 deletions.
12 changes: 7 additions & 5 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,13 @@
/pkgs/development/tools/poetry2nix @adisbladis

# Haskell
/pkgs/development/compilers/ghc @cdepillabout @sternenseemann
/pkgs/development/haskell-modules @cdepillabout @sternenseemann
/pkgs/development/haskell-modules/default.nix @cdepillabout @sternenseemann
/pkgs/development/haskell-modules/generic-builder.nix @cdepillabout @sternenseemann
/pkgs/development/haskell-modules/hoogle.nix @cdepillabout @sternenseemann
/doc/languages-frameworks/haskell.section.md @cdepillabout @sternenseemann @maralorn
/maintainers/scripts/haskell @cdepillabout @sternenseemann @maralorn
/pkgs/development/compilers/ghc @cdepillabout @sternenseemann @maralorn
/pkgs/development/haskell-modules @cdepillabout @sternenseemann @maralorn
/pkgs/test/haskell @cdepillabout @sternenseemann @maralorn
/pkgs/top-level/release-haskell.nix @cdepillabout @sternenseemann @maralorn
/pkgs/top-level/haskell-packages.nix @cdepillabout @sternenseemann @maralorn

# Perl
/pkgs/development/interpreters/perl @volth @stigtsp
Expand Down
3 changes: 3 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@

"6.topic: haskell":
- doc/languages-frameworks/haskell.section.md
- maintainers/scripts/haskell/**/*
- pkgs/development/compilers/ghc/**/*
- pkgs/development/haskell-modules/**/*
- pkgs/development/tools/haskell/**/*
- pkgs/test/haskell/**/*
- pkgs/top-level/haskell-packages.nix
- pkgs/top-level/release-haskell.nix

"6.topic: kernel":
- pkgs/build-support/kernel/**/*
Expand Down
37 changes: 37 additions & 0 deletions maintainers/scripts/haskell/regenerate-hackage-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p coreutils haskellPackages.cabal2nix-unstable git nix -I nixpkgs=.

# This script is used to regenerate nixpkgs' Haskell package set, using a tool
# called hackage2nix. hackage2nix looks at the config files in
# pkgs/development/haskell-modules/configuration-hackage2nix and generates
# a Nix expression for package version specified there, using the Cabal files
# from the Hackage database (available under all-cabal-hashes) and its
# companion tool cabal2nix.
#
# Related scripts are update-hackage.sh, for updating the snapshot of the
# Hackage database used by hackage2nix, and update-cabal2nix-unstable.sh,
# for updating the version of hackage2nix used to perform this task.

set -euo pipefail

extraction_derivation='with import ./. {}; runCommand "unpacked-cabal-hashes" { } "tar xf ${all-cabal-hashes} --strip-components=1 --one-top-level=$out"'
unpacked_hackage="$(nix-build -E "$extraction_derivation" --no-out-link)"
config_dir=pkgs/development/haskell-modules/configuration-hackage2nix

hackage2nix \
--hackage "$unpacked_hackage" \
--preferred-versions <(for n in "$unpacked_hackage"/*/preferred-versions; do cat "$n"; echo; done) \
--nixpkgs "$PWD" \
--config "$config_dir/main.yaml" \
--config "$config_dir/stackage.yaml" \
--config "$config_dir/broken.yaml" \
--config "$config_dir/transitive-broken.yaml"

if [[ "${1:-}" == "--do-commit" ]]; then
git add pkgs/development/haskell-modules/hackage-packages.nix
git commit -F - << EOF
hackage-packages.nix: Regenerate based on current config
This commit has been generated by maintainers/scripts/haskell/regenerate-hackage-packages.sh
EOF
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p coreutils nix gnused -I nixpkgs=.
echo -e $(nix-instantiate --eval --strict maintainers/scripts/haskell/transitive-broken-packages.nix) | sed 's/\"//' > pkgs/development/haskell-modules/configuration-hackage2nix/transitive-broken.yaml
21 changes: 21 additions & 0 deletions maintainers/scripts/haskell/transitive-broken-packages.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
let
nixpkgs = import ../../..;
inherit (nixpkgs {}) pkgs lib;
getEvaluating = x:
builtins.attrNames (
lib.filterAttrs (
_: v: (builtins.tryEval (v.outPath or null)).success && lib.isDerivation v && !v.meta.broken
) x
);
brokenDeps = lib.subtractLists
(getEvaluating pkgs.haskellPackages)
(getEvaluating (nixpkgs { config.allowBroken = true; }).haskellPackages);
in
''
# This file is automatically generated by
# maintainers/scripts/haskell/regenerate-transitive-broken-packages.sh
# It is supposed to list all haskellPackages that cannot evaluate because they
# depend on a dependency marked as broken.
dont-distribute-packages:
${lib.concatMapStringsSep "\n" (x: " - ${x}") brokenDeps}
''
17 changes: 17 additions & 0 deletions maintainers/scripts/haskell/update-cabal2nix-unstable.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p coreutils curl jq gnused haskellPackages.cabal2nix-unstable -I nixpkgs=.

# Updates cabal2nix-unstable to the latest master of the nixos/cabal2nix repository.
# See regenerate-hackage-packages.sh for details on the purpose of this script.

set -euo pipefail

# fetch current master HEAD from Github
head_info="$(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/NixOS/cabal2nix/branches/master)"
# extract commit hash
commit="$(jq -r .commit.sha <<< "$head_info")"
# extract commit timestamp and convert to date
date="$(date "--date=$(jq -r .commit.commit.committer.date <<< "$head_info")" +%F)"
# generate nix expression from cabal file, replacing the version with the commit date
echo '# This file defines cabal2nix-unstable, used by maintainers/scripts/haskell/regenerate-hackage-packages.sh.' > pkgs/development/haskell-modules/cabal2nix-unstable.nix
cabal2nix "https://github.com/NixOS/cabal2nix/archive/$commit.tar.gz" | sed -e 's/version = ".*"/version = "'"unstable-$date"'"/' >> pkgs/development/haskell-modules/cabal2nix-unstable.nix
35 changes: 35 additions & 0 deletions maintainers/scripts/haskell/update-hackage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p nix curl jq nix-prefetch-github git gnused -I nixpkgs=.

# See regenerate-hackage-packages.sh for details on the purpose of this script.

set -euo pipefail

pin_file=pkgs/data/misc/hackage/pin.json
current_commit="$(jq -r .commit $pin_file)"
old_date="$(jq -r .msg $pin_file | sed 's/Update from Hackage at //')"
git_info="$(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/commercialhaskell/all-cabal-hashes/branches/hackage)"
head_commit="$(echo "$git_info" | jq -r .commit.sha)"
commit_msg="$(echo "$git_info" | jq -r .commit.commit.message)"
new_date="$(echo "$commit_msg" | sed 's/Update from Hackage at //')"

if [ "$current_commit" != "$head_commit" ]; then
url="https://github.com/commercialhaskell/all-cabal-hashes/archive/$head_commit.tar.gz"
hash="$(nix-prefetch-url "$url")"
jq -n \
--arg commit "$head_commit" \
--arg hash "$hash" \
--arg url "$url" \
--arg commit_msg "$commit_msg" \
'{commit: $commit, url: $url, sha256: $hash, msg: $commit_msg}' \
> $pin_file
fi

if [[ "${1:-}" == "--do-commit" ]]; then
git add pkgs/data/misc/hackage/pin.json
git commit -F - << EOF
all-cabal-hashes: $old_date -> $new_date
This commit has been generated by maintainers/scripts/haskell/update-hackage.sh
EOF
fi
68 changes: 68 additions & 0 deletions maintainers/scripts/haskell/update-stackage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p nix curl jq nix-prefetch-github git gnused gnugrep -I nixpkgs=.

set -eu -o pipefail

tmpfile=$(mktemp "update-stackage.XXXXXXX")
# shellcheck disable=SC2064

stackage_config="pkgs/development/haskell-modules/configuration-hackage2nix/stackage.yaml"

trap "rm ${tmpfile} ${tmpfile}.new" 0
touch "$tmpfile" "$tmpfile.new" # Creating files here so that trap creates no errors.

curl -L -s "https://stackage.org/nightly/cabal.config" >"$tmpfile"
old_version=$(grep "# Stackage Nightly" $stackage_config | sed -E 's/.*([0-9]{4}-[0-9]{2}-[0-9]{2}).*/\1/')
version=$(sed -rn "s/^--.*http:..(www.)?stackage.org.snapshot.nightly-//p" "$tmpfile")

if [[ "$old_version" == "$version" ]]; then
echo "No new stackage version"
exit 0 # Nothing to do
fi

# Create a simple yaml version of the file.
sed -r \
-e '/^--/d' \
-e 's|^constraints:||' \
-e 's|^ +| - |' \
-e 's|,$||' \
-e '/installed$/d' \
-e '/^$/d' \
< "${tmpfile}" | sort --ignore-case >"${tmpfile}.new"

cat > $stackage_config << EOF
# Stackage Nightly $version
# This file is auto-generated by
# maintainers/scripts/haskell/update-stackage.sh
default-package-overrides:
EOF

# Drop restrictions on some tools where we always want the latest version.
sed -r \
-e '/ cabal-install /d' \
-e '/ cabal2nix /d' \
-e '/ cabal2spec /d' \
-e '/ distribution-nixpkgs /d' \
-e '/ git-annex /d' \
-e '/ hindent /d' \
-e '/ hledger/d' \
-e '/ hlint /d' \
-e '/ hoogle /d' \
-e '/ hopenssl /d' \
-e '/ jailbreak-cabal /d' \
-e '/ json-autotype/d' \
-e '/ language-nix /d' \
-e '/ shake /d' \
-e '/ ShellCheck /d' \
-e '/ stack /d' \
-e '/ weeder /d' \
< "${tmpfile}.new" >> $stackage_config

if [[ "${1:-}" == "--do-commit" ]]; then
git add $config_file
git commit -F - << EOF
Stackage Nightly: $old_version -> $version
This commit has been generated by maintainers/scripts/haskell/update-stackage.sh
EOF
fi
9 changes: 9 additions & 0 deletions maintainers/team-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ with lib.maintainers; {
scope = "Maintain GNOME desktop environment and platform.";
};

haskell = {
members = [
maralorn
cdepillabout
sternenseemann
];
scope = "Maintain Haskell packages and infrastructure.";
};

home-assistant = {
members = [
fab
Expand Down
7 changes: 0 additions & 7 deletions nixos/modules/installer/sd-card/sd-image-aarch64.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@
# - ttyAMA0: for QEMU's -machine virt
boot.kernelParams = ["console=ttyS0,115200n8" "console=ttyAMA0,115200n8" "console=tty0"];

boot.initrd.availableKernelModules = [
# Allows early (earlier) modesetting for the Raspberry Pi
"vc4" "bcm2835_dma" "i2c_bcm2835"
# Allows early (earlier) modesetting for Allwinner SoCs
"sun4i_drm" "sun8i_drm_hdmi" "sun8i_mixer"
];

sdImage = {
populateFirmwareCommands = let
configTxt = pkgs.writeText "config.txt" ''
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/installer/sd-card/sd-image.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ in
imports = [
(mkRemovedOptionModule [ "sdImage" "bootPartitionID" ] "The FAT partition for SD image now only holds the Raspberry Pi firmware files. Use firmwarePartitionID to configure that partition's ID.")
(mkRemovedOptionModule [ "sdImage" "bootSize" ] "The boot files for SD image have been moved to the main ext4 partition. The FAT partition now only holds the Raspberry Pi firmware files. Changing its size may not be required.")
../../profiles/all-hardware.nix
];

options.sdImage = {
Expand Down
57 changes: 56 additions & 1 deletion nixos/modules/profiles/all-hardware.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,66 @@ in
# VMware support.
"mptspi" "vmxnet3" "vsock"
] ++ lib.optional platform.isx86 "vmw_balloon"
++ lib.optionals (!platform.isAarch64) [ # not sure where else they're missing
++ lib.optionals (!platform.isAarch64 && !platform.isAarch32) [ # not sure where else they're missing
"vmw_vmci" "vmwgfx" "vmw_vsock_vmci_transport"

# Hyper-V support.
"hv_storvsc"
] ++ lib.optionals (pkgs.stdenv.isAarch32 || pkgs.stdenv.isAarch64) [
# Most of the following falls into two categories:
# - early KMS / early display
# - early storage (e.g. USB) support

# Allows using framebuffer configured by the initial boot firmware
"simplefb"

# Allwinner support

# Required for early KMS
"sun4i-drm"
"sun8i-mixer" # Audio, but required for kms

# PWM for the backlight
"pwm-sun4i"

# Broadcom

"vc4"
] ++ lib.optionals pkgs.stdenv.isAarch64 [
# Most of the following falls into two categories:
# - early KMS / early display
# - early storage (e.g. USB) support

# Broadcom

"pcie-brcmstb"

# Rockchip
"dw-hdmi"
"dw-mipi-dsi"
"rockchipdrm"
"rockchip-rga"
"phy-rockchip-pcie"
"pcie-rockchip-host"

# Misc. uncategorized hardware

# Used for some platform's integrated displays
"panel-simple"
"pwm-bl"

# Power supply drivers, some platforms need them for USB
"axp20x-ac-power"
"axp20x-battery"
"pinctrl-axp209"
"mp8859"

# USB drivers
"xhci-pci-renesas"

# Misc "weak" dependencies
"analogix-dp"
"analogix-anx6345" # For DP or eDP (e.g. integrated display)
];

# Include lots of firmware.
Expand Down
57 changes: 32 additions & 25 deletions nixos/modules/services/hardware/brltty.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ with lib;
let
cfg = config.services.brltty;

targets = [
"default.target" "multi-user.target"
"rescue.target" "emergency.target"
];

genApiKey = pkgs.writers.writeDash "generate-brlapi-key" ''
if ! test -f /etc/brlapi.key; then
echo -n generating brlapi key...
${pkgs.brltty}/bin/brltty-genkey -f /etc/brlapi.key
echo done
fi
'';

in {

options = {
Expand All @@ -18,33 +31,27 @@ in {
};

config = mkIf cfg.enable {

systemd.services.brltty = {
description = "Braille Device Support";
unitConfig = {
Documentation = "http://mielke.cc/brltty/";
DefaultDependencies = "no";
RequiresMountsFor = "${pkgs.brltty}/var/lib/brltty";
};
serviceConfig = {
ExecStart = "${pkgs.brltty}/bin/brltty --no-daemon";
Type = "notify";
TimeoutStartSec = 5;
TimeoutStopSec = 10;
Restart = "always";
RestartSec = 30;
Nice = -10;
OOMScoreAdjust = -900;
ProtectHome = "read-only";
ProtectSystem = "full";
SystemCallArchitectures = "native";
};
wants = [ "systemd-udev-settle.service" ];
after = [ "local-fs.target" "systemd-udev-settle.service" ];
before = [ "sysinit.target" ];
wantedBy = [ "sysinit.target" ];
users.users.brltty = {
description = "BRLTTY daemon user";
group = "brltty";
};
users.groups = {
brltty = { };
brlapi = { };
};

systemd.services."brltty@".serviceConfig =
{ ExecStartPre = "!${genApiKey}"; };

# Install all upstream-provided files
systemd.packages = [ pkgs.brltty ];
systemd.tmpfiles.packages = [ pkgs.brltty ];
services.udev.packages = [ pkgs.brltty ];
environment.systemPackages = [ pkgs.brltty ];

# Add missing WantedBys (see issue #81138)
systemd.paths.brltty.wantedBy = targets;
systemd.paths."brltty@".wantedBy = targets;
};

}
Loading

0 comments on commit 2c85188

Please sign in to comment.