diff --git a/pkgs/by-name/ni/nixfmt-rfc-style/date.txt b/pkgs/by-name/ni/nixfmt-rfc-style/date.txt deleted file mode 100644 index 24a34eca600b..000000000000 --- a/pkgs/by-name/ni/nixfmt-rfc-style/date.txt +++ /dev/null @@ -1 +0,0 @@ -2025-04-04 diff --git a/pkgs/by-name/ni/nixfmt-rfc-style/generated-package.nix b/pkgs/by-name/ni/nixfmt-rfc-style/generated-package.nix index 1da633e8999d..03e7998038e4 100644 --- a/pkgs/by-name/ni/nixfmt-rfc-style/generated-package.nix +++ b/pkgs/by-name/ni/nixfmt-rfc-style/generated-package.nix @@ -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; diff --git a/pkgs/by-name/ni/nixfmt-rfc-style/package.nix b/pkgs/by-name/ni/nixfmt-rfc-style/package.nix index 90e659765b68..814d1db5af44 100644 --- a/pkgs/by-name/ni/nixfmt-rfc-style/package.nix +++ b/pkgs/by-name/ni/nixfmt-rfc-style/package.nix @@ -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 diff --git a/pkgs/by-name/ni/nixfmt-rfc-style/update.sh b/pkgs/by-name/ni/nixfmt-rfc-style/update.sh index 9213c7396452..e37006d78045 100755 --- a/pkgs/by-name/ni/nixfmt-rfc-style/update.sh +++ b/pkgs/by-name/ni/nixfmt-rfc-style/update.sh @@ -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."