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

Also:
- Updates the update script to use stable versions going forward

(cherry picked from commit b3bc1e31d0)
This commit is contained in:
Silvan Mosberger
2025-07-14 13:23:16 +02:00
committed by Wolfgang Walther
parent c51f78dc65
commit 46d9dd6b8a
4 changed files with 10 additions and 25 deletions

View File

@@ -1 +0,0 @@
2025-04-04

View File

@@ -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;

View File

@@ -8,25 +8,17 @@
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
'';
passthru.tests = runCommand "nixfmt-tests" { nativeBuildInputs = [ nixfmt-rfc-style ]; } ''
nixfmt --version > $out
'';
};
raw-pkg = haskellPackages.callPackage ./generated-package.nix { };
in

View File

@@ -8,15 +8,11 @@ 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)
release_tag=$(curl --silent https://api.github.com/repos/NixOS/nixfmt/releases/latest | jq '.tag_name' --raw-output)
echo "Updating nixfmt-rfc-style to version $new_date."
echo "Updating nixfmt-rfc-style to version $release_tag."
echo "Running cabal2nix and outputting to ${derivation_file}..."
cat > "$derivation_file" << EOF
@@ -25,9 +21,7 @@ cat > "$derivation_file" << EOF
EOF
cabal2nix --jailbreak \
"https://github.com/nixos/nixfmt/archive/${new_version}.tar.gz" \
"https://github.com/nixos/nixfmt/archive/${release_tag}.tar.gz" \
>> "$derivation_file"
date --date="$new_date" -I > "$date_file"
echo "Finished."