Commit Graph

8 Commits

Author SHA1 Message Date
NAHO
c8d4dabc43 pkgs: remove optional builtins prefixes from prelude functions
Remove optional builtins prefixes from prelude functions by running:

    builtins=(
      abort
      baseNameOf
      break
      derivation
      derivationStrict
      dirOf
      false
      fetchGit
      fetchMercurial
      fetchTarball
      fetchTree
      fromTOML
      import
      isNull
      map
      null
      placeholder
      removeAttrs
      scopedImport
      throw
      toString
      true
    )

    fd \
      --type file \
      . \
      pkgs \
      --exec-batch sed --in-place --regexp-extended "
        s/\<builtins\.($(
          printf '%s\n' "${builtins[@]}" |
            paste --delimiter '|' --serial -
        ))\>/\1/g
      "

    nix fmt
2025-10-04 19:02:37 +02:00
Jan Tojnar
6403eb8f4b _experimental-update-script-combinators.sequence: Loosen attrPath constraint
We only allow a single value for `attrPath` across all sequenced update scripts.
But previously `null` (representing `passthru.updateScript.attrPath` not being defined) was counted as one value.
This would prevent us from explicitly specifying `attrPath` in `gnome.updateScript` in the next commit.

Let’s ignore update scripts without specified `attrPath` attribute for the purpose of this check.
2025-03-03 00:46:17 +01:00
Peder Bergebakken Sundt
5aba99242e treewide: fix typos in comments
Made with

```shell
git restore .
fd '\.nix$' pkgs/ --type f -j1 -x bash -xc "$(cat <<"EOF"
    typos --no-check-filenames --write-changes "$1"
    git diff --exit-code "$1" && exit
    #( git diff "$1" | grep -qE "^\+ +[^# ]") && git restore "$1"
    count1="$( bat --language nix --diff --style changes "$1" --theme "Monokai Extended" --color always | aha --no-header | grep -E '^<span style="color:olive;">~</span> ' | wc -l )"
    count2="$( bat --language nix --diff --style changes "$1" --theme "Monokai Extended" --color always | aha --no-header | grep -E '^<span style="color:olive;">~</span> (<span style="color:#f8f8f2;"> *</span>)?<span style="color:#75715e;">.*</span>$' | wc -l )"
    [[ $count1 -ne $count2 ]] && git restore "$1"
EOF
)" -- {}
```

and filtered with `GIT_DIFF_OPTS='--unified=15' git -c interactive.singleKey=true add --patch`

I initially tried using the tree-sitter cli, python bindings and even ast-grep through various means, but this is what I ended up with.
2025-02-24 10:44:41 +01:00
Silvan Mosberger
4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00
Emily
49606d943a _experimental-update-script-combinators.sequence: handle silent scripts
Co-authored-by: Jan Tojnar <jtojnar@gmail.com>
2024-10-24 15:04:56 +01:00
Jan Tojnar
3c78e0ce04 _experimental-update-script-combinators.sequence: Terminate on failure
Before:

    nix-repl> (_experimental-update-script-combinators.sequence [["false"] ["echo" "work"]]).command
    [ "sh" "-c" "'false';'echo' 'work'" ]

After:

    nix-repl> (_experimental-update-script-combinators.sequence [["false"] ["echo" "work"]]).command
    [ "sh" "-ec" "'false';'echo' 'work'" ]
2024-07-13 15:47:27 +02:00
Jan Tojnar
9137e671a2 update-script-combinators.copyAttrOutputToFile: init
Useful for storing generated files into Nixpkgs repo as a part of an update script to avoid a build time dependency.
2022-09-07 14:23:28 +02:00
Jan Tojnar
7d6b5d171a update-script-combinators: experimental init
The sequence combinator will be useful for updating packages consisting of multiple sources.
2022-09-07 14:23:28 +02:00