-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nixfmt-classic: Stop using the hackage package
Removes dependency on the hackage package so we can finally fix NixOS/nixfmt#161 and also moves the entire package to pkgs/by-name.
- Loading branch information
Showing
5 changed files
with
91 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# This file has been autogenerate with cabal2nix. | ||
# Update via ./update.sh | ||
{ | ||
mkDerivation, | ||
base, | ||
cmdargs, | ||
directory, | ||
fetchgit, | ||
filepath, | ||
lib, | ||
megaparsec, | ||
parser-combinators, | ||
safe-exceptions, | ||
scientific, | ||
text, | ||
unix, | ||
}: | ||
mkDerivation { | ||
pname = "nixfmt"; | ||
version = "0.6.0"; | ||
src = fetchgit { | ||
url = "https://github.com/NixOS/nixfmt.git"; | ||
sha256 = "0yh1baanifnv5fl3d7ixkgaki7ka1big0kxkiv4h5rik6zkqfyqz"; | ||
rev = "7e9e06eefed52d6d698b828ee83b83ea5c163f3b"; | ||
fetchSubmodules = true; | ||
}; | ||
isLibrary = true; | ||
isExecutable = true; | ||
libraryHaskellDepends = [ | ||
base | ||
megaparsec | ||
parser-combinators | ||
scientific | ||
text | ||
]; | ||
executableHaskellDepends = [ | ||
base | ||
cmdargs | ||
directory | ||
filepath | ||
safe-exceptions | ||
text | ||
unix | ||
]; | ||
jailbreak = true; | ||
homepage = "https://github.com/serokell/nixfmt"; | ||
description = "An opinionated formatter for Nix"; | ||
license = lib.licenses.mpl20; | ||
mainProgram = "nixfmt"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
haskell, | ||
haskellPackages, | ||
lib, | ||
}: | ||
let | ||
inherit (haskell.lib.compose) overrideCabal justStaticExecutables; | ||
|
||
overrides.passthru.updateScript = ./update.sh; | ||
raw-pkg = haskellPackages.callPackage ./generated-package.nix { }; | ||
in | ||
lib.pipe raw-pkg [ | ||
(overrideCabal overrides) | ||
justStaticExecutables | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env nix-shell | ||
#!nix-shell -i bash -p cabal2nix curl jq | ||
# | ||
# This script will update the nixfmt-classic 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" | ||
latest_version="$(curl --silent 'https://api.github.com/repos/NixOS/nixfmt/releases/latest' | jq --raw-output '.tag_name')" | ||
|
||
echo "Updating nixfmt-classic 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 'https://github.com/NixOS/nixfmt.git' --revision "${latest_version}" --jailbreak >> "${derivation_file}" | ||
nixfmt "${derivation_file}" | ||
|
||
echo "Finished." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters