Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ let

programs.keep-sorted.enable = true;

# This uses nixfmt-rfc-style underneath,
# This uses nixfmt underneath,
# the default formatter for Nix code.
# See https://github.com/NixOS/nixfmt
programs.nixfmt.enable = true;
Expand Down
1 change: 1 addition & 0 deletions doc/release-notes/rl-2511.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
this release sets the default march level to `la64v1.0`, covering the desktop and server processors of 3X5000
and newer series. However, embedded chips without LSX (Loongson SIMD eXtension), such as 2K0300 SoC, are not
supported. `pkgsCross.loongarch64-linux-embedded` can be used to build software and systems for these platforms.
- The official Nix formatter `nixfmt` is now stable and available as `pkgs.nixfmt`, deprecating the temporary `pkgs.nixfmt-rfc-style` attribute. The classic `nixfmt` will stay available for some more time as `pkgs.nixfmt-classic`.

## Backward Incompatibilities {#sec-nixpkgs-release-25.11-incompatibilities}

Expand Down
4 changes: 2 additions & 2 deletions maintainers/scripts/auto-rebase/test/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let
stdenvNoCC
gitMinimal
treefmt
nixfmt-rfc-style
nixfmt
;
in

Expand All @@ -27,7 +27,7 @@ stdenvNoCC.mkDerivation {
nativeBuildInputs = [
gitMinimal
treefmt
nixfmt-rfc-style
nixfmt
];
patchPhase = ''
patchShebangs .
Expand Down
2 changes: 1 addition & 1 deletion maintainers/scripts/haskell/regenerate-hackage-packages.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p coreutils haskellPackages.cabal2nix-unstable git nixfmt-rfc-style -I nixpkgs=.
#! nix-shell -i bash -p coreutils haskellPackages.cabal2nix-unstable git -I nixpkgs=.

set -euo pipefail

Expand Down
2 changes: 1 addition & 1 deletion maintainers/scripts/haskell/update-cabal2nix-unstable.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p coreutils curl jq gnused haskellPackages.cabal2nix-unstable nixfmt-rfc-style -I nixpkgs=.
#! 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.
Expand Down
7 changes: 6 additions & 1 deletion maintainers/scripts/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import json
import os
import re
import shlex
import subprocess
import sys
import tempfile
Expand Down Expand Up @@ -235,7 +236,11 @@ async def run_update_script(
f"UPDATE_NIX_PNAME={package['pname']}",
f"UPDATE_NIX_OLD_VERSION={package['oldVersion']}",
f"UPDATE_NIX_ATTR_PATH={package['attrPath']}",
*update_script_command,
# Run all update scripts in the Nixpkgs development shell to get access to formatters and co.
"nix-shell",
nixpkgs_root + "/shell.nix",
"--run",
" ".join([ shlex.quote(s) for s in update_script_command ]),
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
cwd=worktree,
Expand Down
3 changes: 2 additions & 1 deletion pkgs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,8 @@ Update scripts are to be invoked by the [automatic package update script](../mai
You can run `nix-shell maintainers/scripts/update.nix` in the root of Nixpkgs repository for information on how to use it.
`update.nix` offers several modes for selecting packages to update, and it will execute update scripts for all matched packages that have an `updateScript` attribute.

Each update script will be passed the following environment variables:
Update scripts will be run inside the [Nixpkgs development shell](../shell.nix), providing access to some useful tools for CI.
Furthermore each update script will be passed the following environment variables:

- [`UPDATE_NIX_NAME`] – content of the `name` attribute of the updated package
- [`UPDATE_NIX_PNAME`] – content of the `pname` attribute of the updated package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pkgs.mkShell {

packages = [
pkgs.bash
pkgs.nixfmt-rfc-style
pkgs.nixfmt
];

EMACS2NIX = src;
Expand Down
4 changes: 2 additions & 2 deletions pkgs/build-support/dotnet/add-nuget-deps/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
lib,
replaceVarsWith,
nuget-to-nix,
nixfmt-rfc-style,
nixfmt,
nuget-to-json,
cacert,
fetchNupkg,
Expand Down Expand Up @@ -90,7 +90,7 @@ attrs
replacements = {
binPath = lib.makeBinPath [
nuget-to-nix
nixfmt-rfc-style
nixfmt
nuget-to-json
];
};
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/vm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ rec {
nativeBuildInputs = [
buildPackages.perl
buildPackages.dpkg
buildPackages.nixfmt-rfc-style
buildPackages.nixfmt
];
}
''
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/br/bruijn/update.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p coreutils cabal2nix curl jq nixfmt-rfc-style
#!nix-shell -i bash -p coreutils cabal2nix curl jq

set -euo pipefail

Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/cr/creek/update.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash common-updater-scripts gnused nixfmt-rfc-style
#!nix-shell -i bash -p bash common-updater-scripts gnused

latest_tag=$(list-git-tags --url=https://github.com/nmeum/creek | sed 's/^v//' | tail -n 1)

Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/dp/dprint/plugins/update-plugins.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i python -p nix nixfmt-rfc-style 'python3.withPackages (pp: [ pp.requests ])'
#!nix-shell -i python -p nix 'python3.withPackages (pp: [ pp.requests ])'

import json
import os
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/ej/ejabberd/update.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=./. -i bash -p curl jq common-updater-scripts "rebar3WithPlugins {globalPlugins = [beamPackages.rebar3-nix];}" erlang autoconf automake nixfmt-rfc-style
#!nix-shell -I nixpkgs=./. -i bash -p curl jq common-updater-scripts "rebar3WithPlugins {globalPlugins = [beamPackages.rebar3-nix];}" erlang autoconf automake
#shellcheck shell=bash

set -eu -o pipefail
Expand Down
4 changes: 2 additions & 2 deletions pkgs/by-name/el/elm-land/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
writeShellScript,
nix-update,
elm2nix,
nixfmt-rfc-style,
nixfmt,
}:

buildNpmPackage rec {
Expand Down Expand Up @@ -53,7 +53,7 @@ buildNpmPackage rec {
cp "$(nix-build -A "$UPDATE_NIX_ATTR_PATH".src)/projects/cli/src/codegen/elm.json" elm.json
trap 'rm -rf elm.json registry.dat &> /dev/null' EXIT
${lib.getExe elm2nix} convert > pkgs/by-name/el/elm-land/elm-srcs.nix
${lib.getExe nixfmt-rfc-style} pkgs/by-name/el/elm-land/elm-srcs.nix
${lib.getExe nixfmt} pkgs/by-name/el/elm-land/elm-srcs.nix
${lib.getExe elm2nix} snapshot
cp registry.dat pkgs/by-name/el/elm-land/registry.dat
'';
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/fl/flow-control/update.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash common-updater-scripts gnused nixfmt-rfc-style
#!nix-shell -i bash -p bash common-updater-scripts gnused

latest_tag=$(list-git-tags --url=https://github.com/neurocyte/flow | sed 's/^v//' | tail -n 1)

Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/gr/gren/update.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p cabal2nix curl jq nixfmt-rfc-style
#!nix-shell -i bash -p cabal2nix curl jq

set -euo pipefail

Expand Down
4 changes: 2 additions & 2 deletions pkgs/by-name/li/livekit-libwebrtc/gclient2nix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
nix-prefetch-git,
nix,
coreutils,
nixfmt-rfc-style,
nixfmt,
makeWrapper,
}:
# Based on https://github.com/milahu/gclient2nix
Expand All @@ -19,7 +19,7 @@ let
nix-prefetch-git
nix
coreutils
nixfmt-rfc-style
nixfmt
];
in
buildPythonPackage {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/ms/msgraph-cli/update.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl gnused nixfmt-rfc-style common-updater-scripts
#!nix-shell -i bash -p curl gnused common-updater-scripts
set -eEuo pipefail
[ -z "${DEBUG:-}" ] || set -x
cd "${BASH_SOURCE[0]%/*}"
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/mu/music-assistant/update-providers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=./. -i python3 -p "music-assistant.python.withPackages (ps: music-assistant.dependencies ++ (with ps; [ jinja2 packaging ]))" -p pyright ruff isort nixfmt-rfc-style
#!nix-shell -I nixpkgs=./. -i python3 -p "music-assistant.python.withPackages (ps: music-assistant.dependencies ++ (with ps; [ jinja2 packaging ]))" -p pyright ruff isort
import asyncio
import json
import os.path
Expand Down
4 changes: 2 additions & 2 deletions pkgs/by-name/ni/nil/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
rustPlatform,
fetchFromGitHub,
nix,
nixfmt-rfc-style,
nixfmt,
nix-update-script,
}:

Expand All @@ -25,7 +25,7 @@ rustPlatform.buildRustPackage rec {

env = {
CFG_RELEASE = version;
CFG_DEFAULT_FORMATTER = lib.getExe nixfmt-rfc-style;
CFG_DEFAULT_FORMATTER = lib.getExe nixfmt;
};

# might be related to https://github.com/NixOS/nix/issues/5884
Expand Down
1 change: 0 additions & 1 deletion pkgs/by-name/ni/nixfmt-rfc-style/date.txt

This file was deleted.

33 changes: 0 additions & 33 deletions pkgs/by-name/ni/nixfmt-rfc-style/update.sh

This file was deleted.

4 changes: 2 additions & 2 deletions pkgs/by-name/ni/nixfmt-tree/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
lib,
runCommand,
treefmt,
nixfmt-rfc-style,
nixfmt,
nixfmt-tree,
git,
writableTmpDirAsHomeHook,

settings ? { },
runtimeInputs ? [ ],
nixfmtPackage ? nixfmt-rfc-style,
nixfmtPackage ? nixfmt,

# NOTE: `runtimePackages` is deprecated. Use `nixfmtPackage` and/or `runtimeInputs`.
runtimePackages ? [ nixfmtPackage ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
}:
mkDerivation {
pname = "nixfmt";
version = "0.6.0";
version = "1.0.0";
src = fetchzip {
url = "https://github.com/nixos/nixfmt/archive/65af4b69133d19f534d97746c97c2d5b464f43b4.tar.gz";
sha256 = "0l0w3janvss1n1j7qkcml97zndm2jm2gbrzzs9d8l0ixnrw0cd5r";
url = "https://github.com/nixos/nixfmt/archive/v1.0.0.tar.gz";
sha256 = "0iy2p893b2b5y4mvhy0d62675a7nd8fc6jm9mr32v9h2baj9ii3p";
};
isLibrary = true;
isExecutable = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,22 @@
haskellPackages,
lib,
runCommand,
nixfmt-rfc-style,
nixfmt,
}:
let
inherit (haskell.lib.compose) overrideCabal justStaticExecutables;

overrides = rec {
version = "unstable-${lib.fileContents ./date.txt}";

overrides = {
passthru.updateScript = ./update.sh;

teams = [ lib.teams.formatter ];

preBuild = ''
echo -n 'nixpkgs-${version}' > .version
'';

# These tests can be run with the following command.
#
# $ nix-build -A nixfmt-rfc-style.tests
passthru.tests =
runCommand "nixfmt-rfc-style-tests" { nativeBuildInputs = [ nixfmt-rfc-style ]; }
''
nixfmt --version > $out
'';
# $ nix-build -A nixfmt.tests
passthru.tests = runCommand "nixfmt-tests" { nativeBuildInputs = [ nixfmt ]; } ''
nixfmt --version > $out
'';
};
raw-pkg = haskellPackages.callPackage ./generated-package.nix { };
in
Expand Down
27 changes: 27 additions & 0 deletions pkgs/by-name/ni/nixfmt/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p cabal2nix curl jq
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we're also not specifying a nixpkgs revision in our own update script.

If there's no easy way to get the pinned nixpkgs here, should we at least have -I nixpkgs=. like many other scripts have?

The downside of using . is we're more likely to depend on a package that isn't built by hydra, so perhaps using the user's NIX_PATH is preferable after all.

#
# This script will update the nixfmt 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 )"
derivation_file="${script_dir}/generated-package.nix"

release_tag=$(curl --silent https://api.github.com/repos/NixOS/nixfmt/releases/latest | jq '.tag_name' --raw-output)

echo "Updating nixfmt to version $release_tag."
echo "Running cabal2nix and outputting to ${derivation_file}..."

cat > "$derivation_file" << EOF
# This file has been autogenerate with cabal2nix.
# Update via ./update.sh
EOF

cabal2nix --jailbreak \
"https://github.com/nixos/nixfmt/archive/${release_tag}.tar.gz" \
>> "$derivation_file"

echo "Finished."
2 changes: 1 addition & 1 deletion pkgs/by-name/oa/oama/update.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p haskell.packages.ghc910.cabal2nix nix-prefetch-git curl jq nixfmt-rfc-style
#!nix-shell -i bash -p haskell.packages.ghc910.cabal2nix nix-prefetch-git curl jq

set -euo pipefail

Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/ri/river-bedload/update-build-zig-zon.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash jq nixfmt-rfc-style zon2nix
#!nix-shell -i bash -p bash jq zon2nix

commit=$(nix-instantiate --eval -A river-bedload.src.rev | jq --raw-output)

Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/ri/river/update.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash common-updater-scripts gnused nixfmt-rfc-style zon2nix
#!nix-shell -i bash -p bash common-updater-scripts gnused zon2nix

latest_tag=$(list-git-tags --url=https://codeberg.org/river/river | sed 's/^v//' | sort --version-sort | tail --lines=1)

Expand Down
4 changes: 2 additions & 2 deletions pkgs/by-name/tr/treefmt/tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
runCommand,
testers,
treefmt,
nixfmt-rfc-style,
nixfmt,
}:
let
inherit (treefmt) buildConfig withConfig;
Expand All @@ -29,7 +29,7 @@ let

nixfmtExamplePackage = withConfig {
settings = nixfmtExampleConfig;
runtimeInputs = [ nixfmt-rfc-style ];
runtimeInputs = [ nixfmt ];
};
in
{
Expand Down
Loading
Loading