about summary refs log tree commit diff
path: root/maintainers/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'maintainers/scripts')
-rw-r--r--maintainers/scripts/bootstrap-files/README.md14
-rwxr-xr-xmaintainers/scripts/bootstrap-files/refresh-tarballs.bash55
-rw-r--r--maintainers/scripts/haskell/dependencies.nix6
-rwxr-xr-xmaintainers/scripts/haskell/hydra-report.hs10
-rwxr-xr-xmaintainers/scripts/haskell/regenerate-hackage-packages.sh4
-rwxr-xr-xmaintainers/scripts/haskell/update-stackage.sh2
-rw-r--r--maintainers/scripts/luarocks-packages.csv2
-rw-r--r--maintainers/scripts/nix-generate-from-cpan.nix1
-rw-r--r--maintainers/scripts/nixpkgs-lint.nix1
9 files changed, 58 insertions, 37 deletions
diff --git a/maintainers/scripts/bootstrap-files/README.md b/maintainers/scripts/bootstrap-files/README.md
index b55878f34192..7a1a2bef867c 100644
--- a/maintainers/scripts/bootstrap-files/README.md
+++ b/maintainers/scripts/bootstrap-files/README.md
@@ -6,8 +6,9 @@ binaries (without the reliance on external inputs):
 - `bootstrap-tools`: an archive with the compiler toolchain and other
   helper tools enough to build the rest of the `nixpkgs`.
 - initial binaries needed to unpack `bootstrap-tools.*`. On `linux`
-  it's just `busybox`, on `darwin` it's `sh`, `bzip2`, `mkdir` and
-  `cpio`. These binaries can be executed directly from the store.
+  it's just `busybox`, on `darwin` it is unpack.nar.xz which contains
+  the binaries and script needed to unpack the tools. These binaries
+  can be executed directly from the store.
 
 These are called "bootstrap files".
 
@@ -74,12 +75,3 @@ There are two types of bootstrap files:
 The `.build` job contains `/on-server/` subdirectory with binaries to
 be uploaded to `tarballs.nixos.org`.
 The files are uploaded to `tarballs.nixos.org` by writers to `S3` store.
-
-## TODOs
-
-- `pkgs/stdenv/darwin` file layout is slightly different from
-  `pkgs/stdenv/linux`. Once `linux` seed update becomes a routine we can
-  bring `darwin` in sync if it's feasible.
-- `darwin` definition of `.build` `on-server/` directory layout differs
-  and should be updated.
-
diff --git a/maintainers/scripts/bootstrap-files/refresh-tarballs.bash b/maintainers/scripts/bootstrap-files/refresh-tarballs.bash
index 775d7ef1379d..e7bf27f24046 100755
--- a/maintainers/scripts/bootstrap-files/refresh-tarballs.bash
+++ b/maintainers/scripts/bootstrap-files/refresh-tarballs.bash
@@ -6,6 +6,8 @@
 #! nix-shell -p nix
 #! nix-shell -p jq
 
+set -o pipefail
+
 # How the refresher works:
 #
 # For a given list of <targets>:
@@ -15,6 +17,9 @@
 # 4. calculate hashes and craft the commit message with the details on
 #    how to upload the result to 'tarballs.nixos.org'
 
+scratch_dir=$(mktemp -d)
+trap 'rm -rf -- "${scratch_dir}"' EXIT
+
 usage() {
     cat >&2 <<EOF
 Usage:
@@ -67,14 +72,8 @@ NATIVE_TARGETS=(
     i686-unknown-linux-gnu
     x86_64-unknown-linux-gnu
     x86_64-unknown-linux-musl
-
-    # TODO: add darwin here once a few prerequisites are satisfied:
-    #   - bootstrap-files are factored out into a separate file
-    #   - the build artifacts are factored out into an `on-server`
-    #     directory. Right onw if does not match `linux` layout.
-    #
-    #aarch64-apple-darwin
-    #x86_64-apple-darwin
+    aarch64-apple-darwin
+    x86_64-apple-darwin
 )
 
 is_native() {
@@ -106,6 +105,20 @@ is_cross() {
     return 1
 }
 
+nar_sri_get() {
+    local restore_path store_path
+    ((${#@} != 2)) && die "nar_sri_get /path/to/name.nar.xz name"
+    restore_path="${scratch_dir}/$2"
+    xz -d < "$1" | nix-store --restore "${restore_path}"
+    [[ $? -ne 0 ]] && die "Failed to unpack '$1'"
+
+    store_path=$(nix-store --add "${restore_path}")
+    [[ $? -ne 0 ]] && die "Failed to add '$restore_path' to store"
+    rm -rf -- "${restore_path}"
+
+    nix-hash --to-sri "$(nix-store --query --hash "${store_path}")"
+}
+
 # collect passed options
 
 targets=()
@@ -222,6 +235,7 @@ EOF
           case "$fname" in
               bootstrap-tools.tar.xz) attr=bootstrapTools ;;
               busybox) attr=$fname ;;
+              unpack.nar.xz) attr=unpack ;;
               *) die "Don't know how to map '$fname' to attribute name. Please update me."
           esac
 
@@ -229,18 +243,31 @@ EOF
           executable_nix=
           if [[ -x "$p" ]]; then
               executable_arg="--executable"
-              executable_nix="    executable = true;"
+              executable_nix="executable = true;"
+          fi
+          unpack_nix=
+          name_nix=
+          if [[ $fname = *.nar.xz ]]; then
+              unpack_nix="unpack = true;"
+              name_nix="name = \"${fname%.nar.xz}\";"
+              sri=$(nar_sri_get "$p" "${fname%.nar.xz}")
+              [[ $? -ne 0 ]] && die "Failed to get hash of '$p'"
+          else
+              sha256=$(nix-prefetch-url $executable_arg --name "$fname" "file://$p")
+              [[ $? -ne 0 ]] && die "Failed to get the hash for '$p'"
+              sri=$(nix-hash --to-sri "sha256:$sha256")
+              [[ $? -ne 0 ]] && die "Failed to convert '$sha256' hash to an SRI form"
           fi
-          sha256=$(nix-prefetch-url $executable_arg --name "$fname" "file://$p")
-          [[ $? -ne 0 ]] && die "Failed to get the hash for '$p'"
-          sri=$(nix-hash --to-sri "sha256:$sha256")
-          [[ $? -ne 0 ]] && die "Failed to convert '$sha256' hash to an SRI form"
 
           # individual file entries
           cat <<EOF
   $attr = import <nix/fetchurl.nix> {
     url = "http://tarballs.nixos.org/${s3_prefix}/${nixpkgs_revision}/$fname";
-    hash = "${sri}";$(printf "\n%s" "${executable_nix}")
+    hash = "${sri}";$(
+    [[ -n ${executable_nix} ]] && printf "\n    %s" "${executable_nix}"
+    [[ -n ${name_nix} ]]       && printf "\n    %s" "${name_nix}"
+    [[ -n ${unpack_nix} ]]     && printf "\n    %s" "${unpack_nix}"
+)
   };
 EOF
       done
diff --git a/maintainers/scripts/haskell/dependencies.nix b/maintainers/scripts/haskell/dependencies.nix
index fd8338c0029a..5965b1ba1828 100644
--- a/maintainers/scripts/haskell/dependencies.nix
+++ b/maintainers/scripts/haskell/dependencies.nix
@@ -2,8 +2,10 @@
 let
   pkgs = import ../../.. {};
   inherit (pkgs) lib;
-  getDeps = _: pkg: {
-    deps = builtins.filter (x: x != null) (map (x: x.pname or null) (pkg.propagatedBuildInputs or []));
+  getDeps = _: pkg: let
+    pname = pkg.pname or null;
+  in {
+    deps = builtins.filter (x: x != null && x != pname) (map (x: x.pname or null) (pkg.propagatedBuildInputs or []));
     broken = (pkg.meta.hydraPlatforms or [null]) == [];
   };
 in
diff --git a/maintainers/scripts/haskell/hydra-report.hs b/maintainers/scripts/haskell/hydra-report.hs
index 8b4f798cc543..e911830e8b3e 100755
--- a/maintainers/scripts/haskell/hydra-report.hs
+++ b/maintainers/scripts/haskell/hydra-report.hs
@@ -83,7 +83,7 @@ import Prelude hiding (id)
 import Data.List (sortOn)
 import Control.Concurrent.Async (concurrently)
 import Control.Exception (evaluate)
-import qualified Data.IntMap.Strict as IntMap
+import qualified Data.IntMap.Lazy as IntMap
 import qualified Data.IntSet as IntSet
 import Data.Bifunctor (second)
 import Data.Data (Proxy)
@@ -299,7 +299,7 @@ calculateReverseDependencies depMap =
    Map.fromDistinctAscList $ zip keys (zip (rdepMap False) (rdepMap True))
  where
     -- This code tries to efficiently invert the dependency map and calculate
-    -- it’s transitive closure by internally identifying every pkg with it’s index
+    -- its transitive closure by internally identifying every pkg with its index
     -- in the package list and then using memoization.
     keys :: [PkgName]
     keys = Map.keys depMap
@@ -317,11 +317,11 @@ calculateReverseDependencies depMap =
     intDeps :: [(Int, (Bool, [Int]))]
     intDeps = zip [0..] (fmap depInfoToIdx depInfos)
 
-    rdepMap onlyUnbroken = IntSet.size <$> resultList
+    rdepMap onlyUnbroken = IntSet.size <$> IntMap.elems resultList
      where
-       resultList = go <$> [0..]
+       resultList = IntMap.fromDistinctAscList [(i, go i) | i <- [0..length keys - 1]]
        oneStepMap = IntMap.fromListWith IntSet.union $ (\(key,(_,deps)) -> (,IntSet.singleton key) <$> deps) <=< filter (\(_, (broken,_)) -> not (broken && onlyUnbroken)) $ intDeps
-       go pkg = IntSet.unions (oneStep:((resultList !!) <$> IntSet.toList oneStep))
+       go pkg = IntSet.unions (oneStep:((resultList IntMap.!) <$> IntSet.toList oneStep))
         where oneStep = IntMap.findWithDefault mempty pkg oneStepMap
 
 -- | Generate a mapping of Hydra job names to maintainer GitHub handles. Calls
diff --git a/maintainers/scripts/haskell/regenerate-hackage-packages.sh b/maintainers/scripts/haskell/regenerate-hackage-packages.sh
index 96a18aa8ed87..8f629c53102f 100755
--- a/maintainers/scripts/haskell/regenerate-hackage-packages.sh
+++ b/maintainers/scripts/haskell/regenerate-hackage-packages.sh
@@ -66,10 +66,6 @@ done
 
 HACKAGE2NIX="${HACKAGE2NIX:-hackage2nix}"
 
-# To prevent hackage2nix fails because of encoding.
-# See: https://github.com/NixOS/nixpkgs/pull/122023
-export LC_ALL=C.UTF-8
-
 config_dir=pkgs/development/haskell-modules/configuration-hackage2nix
 
 run_hackage2nix() {
diff --git a/maintainers/scripts/haskell/update-stackage.sh b/maintainers/scripts/haskell/update-stackage.sh
index 5dc52abdd668..fdb1cd184f69 100755
--- a/maintainers/scripts/haskell/update-stackage.sh
+++ b/maintainers/scripts/haskell/update-stackage.sh
@@ -8,7 +8,7 @@ set -eu -o pipefail
 # (should be capitalized like the display name)
 SOLVER=LTS
 # Stackage solver verson, if any. Use latest if empty
-VERSION=21
+VERSION=
 TMP_TEMPLATE=update-stackage.XXXXXXX
 readonly SOLVER
 readonly VERSION
diff --git a/maintainers/scripts/luarocks-packages.csv b/maintainers/scripts/luarocks-packages.csv
index 939905ab81d9..fd6c59c0b46f 100644
--- a/maintainers/scripts/luarocks-packages.csv
+++ b/maintainers/scripts/luarocks-packages.csv
@@ -95,6 +95,7 @@ magick,,,,,5.1,donovanglover
 markdown,,,,,,
 mediator_lua,,,,,,
 middleclass,,,,,,
+mimetypes,,,,,,
 mpack,,,,,,
 moonscript,https://github.com/leafo/moonscript.git,dev-1,,,,arobyn
 nlua,,,,,,teto
@@ -116,6 +117,7 @@ stdlib,,,,41.2.2,,vyp
 teal-language-server,,,http://luarocks.org/dev,,,
 telescope.nvim,,,,,5.1,
 telescope-manix,,,,,,
+tiktoken_core,,,,,,natsukium
 tl,,,,,,mephistophiles
 toml,,,,,,mrcjkb
 toml-edit,,,,,5.1,mrcjkb
diff --git a/maintainers/scripts/nix-generate-from-cpan.nix b/maintainers/scripts/nix-generate-from-cpan.nix
index bf48a5318611..a8135f4b304a 100644
--- a/maintainers/scripts/nix-generate-from-cpan.nix
+++ b/maintainers/scripts/nix-generate-from-cpan.nix
@@ -21,6 +21,7 @@ stdenv.mkDerivation {
   meta = {
     maintainers = with lib.maintainers; [ eelco ];
     description = "Utility to generate a Nix expression for a Perl package from CPAN";
+    mainProgram = "nix-generate-from-cpan";
     platforms = lib.platforms.unix;
   };
 }
diff --git a/maintainers/scripts/nixpkgs-lint.nix b/maintainers/scripts/nixpkgs-lint.nix
index 873905373af0..b400ce034b3e 100644
--- a/maintainers/scripts/nixpkgs-lint.nix
+++ b/maintainers/scripts/nixpkgs-lint.nix
@@ -19,6 +19,7 @@ stdenv.mkDerivation {
   meta = with lib; {
     maintainers = [ maintainers.eelco ];
     description = "A utility for Nixpkgs contributors to check Nixpkgs for common errors";
+    mainProgram = "nixpkgs-lint";
     platforms = platforms.unix;
   };
 }