nixfmt[-rfc-style]: unstable -> 1.0.0

Also:
- Updates the update script to use stable versions going forward
- Make pkgs.nixfmt the -rfc-style version and remove the warning
- Create a (delayed) warning for the -rfc-style version to encourage
switching to pkgs.nixfmt in a couple releases
- Add a release note for the above

Changed files
+66 -74
doc
release-notes
pkgs
+1
doc/release-notes/rl-2511.section.md
···
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}
-1
pkgs/by-name/ni/nixfmt-rfc-style/date.txt
···
-
2025-04-04
+3 -3
pkgs/by-name/ni/nixfmt-rfc-style/generated-package.nix pkgs/by-name/ni/nixfmt/generated-package.nix
···
}:
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;
-36
pkgs/by-name/ni/nixfmt-rfc-style/package.nix
···
-
{
-
haskell,
-
haskellPackages,
-
lib,
-
runCommand,
-
nixfmt-rfc-style,
-
}:
-
let
-
inherit (haskell.lib.compose) overrideCabal justStaticExecutables;
-
-
overrides = rec {
-
version = "unstable-${lib.fileContents ./date.txt}";
-
-
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
-
'';
-
};
-
raw-pkg = haskellPackages.callPackage ./generated-package.nix { };
-
in
-
lib.pipe raw-pkg [
-
(overrideCabal overrides)
-
justStaticExecutables
-
]
-33
pkgs/by-name/ni/nixfmt-rfc-style/update.sh
···
-
#!/usr/bin/env nix-shell
-
#!nix-shell -i bash -p cabal2nix curl jq
-
#
-
# This script will update the nixfmt-rfc-style 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"
-
date_file="${script_dir}/date.txt"
-
-
# This is the latest version of nixfmt-rfc-style branch on GitHub.
-
new_version=$(curl --silent https://api.github.com/repos/nixos/nixfmt/git/refs/heads/master | jq '.object.sha' --raw-output)
-
new_date=$(curl --silent https://api.github.com/repos/nixos/nixfmt/git/commits/"$new_version" | jq '.committer.date' --raw-output)
-
-
echo "Updating nixfmt-rfc-style to version $new_date."
-
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/${new_version}.tar.gz" \
-
>> "$derivation_file"
-
-
date --date="$new_date" -I > "$date_file"
-
-
echo "Finished."
+28
pkgs/by-name/ni/nixfmt/package.nix
···
+
{
+
haskell,
+
haskellPackages,
+
lib,
+
runCommand,
+
nixfmt,
+
}:
+
let
+
inherit (haskell.lib.compose) overrideCabal justStaticExecutables;
+
+
overrides = {
+
passthru.updateScript = ./update.sh;
+
+
teams = [ lib.teams.formatter ];
+
+
# These tests can be run with the following command.
+
#
+
# $ nix-build -A nixfmt.tests
+
passthru.tests = runCommand "nixfmt-tests" { nativeBuildInputs = [ nixfmt ]; } ''
+
nixfmt --version > $out
+
'';
+
};
+
raw-pkg = haskellPackages.callPackage ./generated-package.nix { };
+
in
+
lib.pipe raw-pkg [
+
(overrideCabal overrides)
+
justStaticExecutables
+
]
+27
pkgs/by-name/ni/nixfmt/update.sh
···
+
#!/usr/bin/env nix-shell
+
#!nix-shell -i bash -p cabal2nix curl jq
+
#
+
# 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."
+7 -1
pkgs/top-level/aliases.nix
···
nixStable = nixVersions.stable; # Added 2022-01-24
nixUnstable = throw "nixUnstable has been removed. For bleeding edge (Nix master, roughly weekly updated) use nixVersions.git, otherwise use nixVersions.latest."; # Converted to throw 2024-04-22
nix_2_3 = nixVersions.nix_2_3;
-
nixfmt = lib.warnOnInstantiate "nixfmt was renamed to nixfmt-classic. The nixfmt attribute may be used for the new RFC 166-style formatter in the future, which is currently available as nixfmt-rfc-style" nixfmt-classic; # Added 2024-03-31
+
nixfmt-rfc-style =
+
if lib.oldestSupportedReleaseIsAtLeast 2511 then
+
lib.warnOnInstantiate
+
"nixfmt-rfc-style is now the same as pkgs.nixfmt which should be used instead."
+
nixfmt # Added 2025-07-14
+
else
+
nixfmt;
# When the nixops_unstable alias is removed, nixops_unstable_minimal can be renamed to nixops_unstable.