Repository: nix-community/nixpkgs-fmt
Pull request #247 (2021-05-15 13:30:28)

fix CI
`nix-build` was not building the project, due to how flake-compat's output is
structured.

Since flake-compat is awkward to use, replace it with something more
liteweight. Also take this opportunity to replace nixpkgs-mozilla and re-think
how flake and non-flake work together.

NOTE: this changes the nix API for non-flake users.


Patch:
diff --git a/Cargo.lock b/Cargo.lock
index 1dba1de..ba909a9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,10 +1,12 @@
 # This file is automatically @generated by Cargo.
 # It is not intended for manual editing.
+version = 3
+
 [[package]]
 name = "aho-corasick"
-version = "0.7.10"
+version = "0.7.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada"
+checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
 dependencies = [
  "memchr",
 ]
@@ -31,9 +33,9 @@ dependencies = [
 
 [[package]]
 name = "autocfg"
-version = "1.0.0"
+version = "1.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
+checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
 
 [[package]]
 name = "bitflags"
@@ -43,18 +45,18 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
 
 [[package]]
 name = "bstr"
-version = "0.2.12"
+version = "0.2.16"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2889e6d50f394968c8bf4240dc3f2a7eb4680844d27308f798229ac9d4725f41"
+checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279"
 dependencies = [
  "memchr",
 ]
 
 [[package]]
 name = "bumpalo"
-version = "3.2.0"
+version = "3.6.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1f359dc14ff8911330a51ef78022d376f25ed00248912803b58f00cb1c27f742"
+checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe"
 
 [[package]]
 name = "cbitset"
@@ -71,11 +73,17 @@ version = "0.1.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
 
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
 [[package]]
 name = "clap"
-version = "2.33.0"
+version = "2.33.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
+checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
 dependencies = [
  "ansi_term",
  "atty",
@@ -92,7 +100,7 @@ version = "0.1.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "b8d976903543e0c48546a91908f21588a680a8c8f984df9a5d69feccb2b2a211"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
  "wasm-bindgen",
 ]
 
@@ -111,34 +119,24 @@ dependencies = [
  "crossbeam-utils 0.6.6",
 ]
 
-[[package]]
-name = "crossbeam-channel"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cced8691919c02aac3cb0a1bc2e9b73d89e832bf9a06fc579d4e71b68a2da061"
-dependencies = [
- "crossbeam-utils 0.7.2",
- "maybe-uninit",
-]
-
 [[package]]
 name = "crossbeam-utils"
 version = "0.6.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
  "lazy_static",
 ]
 
 [[package]]
 name = "crossbeam-utils"
-version = "0.7.2"
+version = "0.8.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
+checksum = "4feb231f0d4d6af81aed15928e58ecf5816aa62a2393e2c82f46973e92a9a278"
 dependencies = [
  "autocfg",
- "cfg-if",
+ "cfg-if 1.0.0",
  "lazy_static",
 ]
 
@@ -150,15 +148,15 @@ checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8"
 
 [[package]]
 name = "fnv"
-version = "1.0.6"
+version = "1.0.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
+checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
 
 [[package]]
 name = "globset"
-version = "0.4.5"
+version = "0.4.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7ad1da430bd7281dde2576f44c84cc3f0f7b475e7202cd503042dff01a8c8120"
+checksum = "c152169ef1e421390738366d2f796655fec62621dabbd0fd476f905934061e4a"
 dependencies = [
  "aho-corasick",
  "bstr",
@@ -175,21 +173,20 @@ checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
 
 [[package]]
 name = "hermit-abi"
-version = "0.1.8"
+version = "0.1.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1010591b26bbfe835e9faeabeb11866061cc7dcebffd56ad7d0942d0e61aefd8"
+checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c"
 dependencies = [
  "libc",
 ]
 
 [[package]]
 name = "ignore"
-version = "0.4.13"
+version = "0.4.17"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d692f1fdb7a67fad17cb4d3dbe3fc9c4d50d3113349251678db987b225ccabba"
+checksum = "b287fb45c60bb826a0dc68ff08742b9d88a2fea13d6e0c286b3172065aaf878c"
 dependencies = [
- "crossbeam-channel 0.4.2",
- "crossbeam-utils 0.7.2",
+ "crossbeam-utils 0.8.4",
  "globset",
  "lazy_static",
  "log",
@@ -203,9 +200,9 @@ dependencies = [
 
 [[package]]
 name = "itoa"
-version = "0.4.5"
+version = "0.4.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e"
+checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
 
 [[package]]
 name = "lazy_static"
@@ -215,36 +212,30 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
 
 [[package]]
 name = "libc"
-version = "0.2.68"
+version = "0.2.94"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dea0c0405123bba743ee3f91f49b1c7cfb684eef0da0a50110f758ccf24cdff0"
+checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e"
 
 [[package]]
 name = "log"
-version = "0.4.8"
+version = "0.4.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
+checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
 dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
 ]
 
-[[package]]
-name = "maybe-uninit"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
-
 [[package]]
 name = "memchr"
-version = "2.3.3"
+version = "2.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
+checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
 
 [[package]]
 name = "memoffset"
-version = "0.6.1"
+version = "0.6.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87"
+checksum = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d"
 dependencies = [
  "autocfg",
 ]
@@ -260,7 +251,7 @@ name = "nixpkgs-fmt"
 version = "1.2.0"
 dependencies = [
  "clap",
- "crossbeam-channel 0.3.9",
+ "crossbeam-channel",
  "ignore",
  "rnix",
  "rowan",
@@ -282,48 +273,53 @@ dependencies = [
 
 [[package]]
 name = "num-traits"
-version = "0.2.11"
+version = "0.2.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
+checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
 dependencies = [
  "autocfg",
 ]
 
+[[package]]
+name = "once_cell"
+version = "1.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3"
+
 [[package]]
 name = "proc-macro2"
-version = "1.0.9"
+version = "1.0.26"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435"
+checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec"
 dependencies = [
  "unicode-xid",
 ]
 
 [[package]]
 name = "quote"
-version = "1.0.3"
+version = "1.0.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f"
+checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
 dependencies = [
  "proc-macro2",
 ]
 
 [[package]]
 name = "regex"
-version = "1.3.5"
+version = "1.5.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8900ebc1363efa7ea1c399ccc32daed870b4002651e0bed86e72d501ebbe0048"
+checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
 dependencies = [
  "aho-corasick",
  "memchr",
  "regex-syntax",
- "thread_local",
 ]
 
 [[package]]
 name = "regex-syntax"
-version = "0.6.17"
+version = "0.6.25"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae"
+checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
 
 [[package]]
 name = "rnix"
@@ -338,8 +334,9 @@ dependencies = [
 
 [[package]]
 name = "rowan"
-version = "0.12.5"
-source = "git+https://github.com/rust-analyzer/rowan#109885a86b7a095f637927944003add60d2f7ef3"
+version = "0.12.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1b36e449f3702f3b0c821411db1cbdf30fb451726a9456dce5dabcd44420043"
 dependencies = [
  "countme",
  "hashbrown",
@@ -357,9 +354,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
 
 [[package]]
 name = "ryu"
-version = "1.0.3"
+version = "1.0.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "535622e6be132bccd223f4bb2b8ac8d53cda3c7a6394944d3b2b33fb974f9d76"
+checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
 
 [[package]]
 name = "same-file"
@@ -372,15 +369,15 @@ dependencies = [
 
 [[package]]
 name = "serde"
-version = "1.0.105"
+version = "1.0.126"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e707fbbf255b8fc8c3b99abb91e7257a622caeb20a9818cbadbeeede4e0932ff"
+checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03"
 
 [[package]]
 name = "serde_json"
-version = "1.0.48"
+version = "1.0.64"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9371ade75d4c2d6cb154141b9752cf3781ec9c05e0e5cf35060e1e70ee7b9c25"
+checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
 dependencies = [
  "itoa",
  "ryu",
@@ -401,9 +398,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
 
 [[package]]
 name = "syn"
-version = "1.0.17"
+version = "1.0.72"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03"
+checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -430,42 +427,42 @@ dependencies = [
 
 [[package]]
 name = "thread_local"
-version = "1.0.1"
+version = "1.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
+checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd"
 dependencies = [
- "lazy_static",
+ "once_cell",
 ]
 
 [[package]]
 name = "unicode-width"
-version = "0.1.7"
+version = "0.1.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479"
+checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
 
 [[package]]
 name = "unicode-xid"
-version = "0.2.0"
+version = "0.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
+checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
 
 [[package]]
 name = "unindent"
-version = "0.1.5"
+version = "0.1.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "63f18aa3b0e35fed5a0048f029558b1518095ffe2a0a31fb87c93dece93a4993"
+checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7"
 
 [[package]]
 name = "vec_map"
-version = "0.8.1"
+version = "0.8.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
+checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
 
 [[package]]
 name = "walkdir"
-version = "2.3.1"
+version = "2.3.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d"
+checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
 dependencies = [
  "same-file",
  "winapi",
@@ -474,19 +471,19 @@ dependencies = [
 
 [[package]]
 name = "wasm-bindgen"
-version = "0.2.59"
+version = "0.2.74"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3557c397ab5a8e347d434782bcd31fc1483d927a6826804cec05cc792ee2519d"
+checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd"
 dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
  "wasm-bindgen-macro",
 ]
 
 [[package]]
 name = "wasm-bindgen-backend"
-version = "0.2.59"
+version = "0.2.74"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e0da9c9a19850d3af6df1cb9574970b566d617ecfaf36eb0b706b6f3ef9bd2f8"
+checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900"
 dependencies = [
  "bumpalo",
  "lazy_static",
@@ -499,9 +496,9 @@ dependencies = [
 
 [[package]]
 name = "wasm-bindgen-macro"
-version = "0.2.59"
+version = "0.2.74"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0f6fde1d36e75a714b5fe0cffbb78978f222ea6baebb726af13c78869fdb4205"
+checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4"
 dependencies = [
  "quote",
  "wasm-bindgen-macro-support",
@@ -509,9 +506,9 @@ dependencies = [
 
 [[package]]
 name = "wasm-bindgen-macro-support"
-version = "0.2.59"
+version = "0.2.74"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "25bda4168030a6412ea8a047e27238cadf56f0e53516e1e83fec0a8b7c786f6d"
+checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -522,9 +519,9 @@ dependencies = [
 
 [[package]]
 name = "wasm-bindgen-shared"
-version = "0.2.59"
+version = "0.2.74"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc9f36ad51f25b0219a3d4d13b90eb44cd075dff8b6280cca015775d7acaddd8"
+checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f"
 
 [[package]]
 name = "wee_alloc"
@@ -532,7 +529,7 @@ version = "0.4.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
  "libc",
  "memory_units",
  "winapi",
@@ -540,9 +537,9 @@ dependencies = [
 
 [[package]]
 name = "winapi"
-version = "0.3.8"
+version = "0.3.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
 dependencies = [
  "winapi-i686-pc-windows-gnu",
  "winapi-x86_64-pc-windows-gnu",
@@ -556,9 +553,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
 
 [[package]]
 name = "winapi-util"
-version = "0.1.3"
+version = "0.1.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ccfbf554c6ad11084fb7517daca16cfdcaccbdadba4fc336f032a8b12c2ad80"
+checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
 dependencies = [
  "winapi",
 ]
diff --git a/Cargo.toml b/Cargo.toml
index d4ef9a3..69ee3bd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -28,11 +28,8 @@ clap = "2.33.0"
 serde_json = "1.0"
 
 [dependencies.rowan]
-version = "0.12.5"
+version = "0.12.6"
 features = [ "serde1" ]
 
 [dev-dependencies]
 unindent = "0.1.3"
-
-[patch.crates-io]
-rowan = { git = "https://github.com/rust-analyzer/rowan" }
diff --git a/default.nix b/default.nix
index b600a15..5c00b99 100644
--- a/default.nix
+++ b/default.nix
@@ -1,11 +1,70 @@
-{ system ? builtins.currentSystem }:
+{ system ? builtins.currentSystem
+, inputs ? import ./flake.lock.nix { }
+}:
 let
-  flake-compat = builtins.fetchurl {
-    url = "https://raw.githubusercontent.com/edolstra/flake-compat/99f1c2157fba4bfe6211a321fd0ee43199025dbf/default.nix";
-    sha256 = "1vas5z58901gavy5d53n1ima482yvly405jp9l8g07nr4abmzsyb";
+  nixpkgs = import inputs.nixpkgs {
+    inherit system;
+    config = { };
+    overlays = [
+      (import "${inputs.naersk}/overlay.nix")
+      (import inputs.fenix)
+    ];
   };
+
+  rustToolchain = with nixpkgs.fenix;
+    combine [
+      minimal.rustc
+      minimal.cargo
+      targets."wasm32-unknown-unknown".latest.rust-std
+    ];
+
+  naersk = nixpkgs.naersk.override {
+    cargo = rustToolchain;
+    rustc = rustToolchain;
+  };
+
+  # This is a magic shell that can be both built and loaded as a nix-shell.
+  mkShell = { name ? "shell", packages ? [ ], shellHook ? "" }:
+    let
+      drv = nixpkgs.buildEnv {
+        inherit name;
+        # TODO: also add the shellHook as an activation script?
+        paths = packages;
+      };
+    in
+    drv.overrideAttrs (old: {
+      nativeBuildInputs = old.nativeBuildInputs ++ packages;
+      inherit shellHook;
+    });
+
 in
-import flake-compat {
-  src = ./.;
-  inherit system;
+rec {
+  inherit nixpkgs;
+
+  nixpkgs-fmt = nixpkgs.naersk.buildPackage {
+    src = ./.;
+    root = ./.;
+    cratePaths = [ "." ];
+  };
+
+  devShell = mkShell {
+    packages = [
+      nixpkgs.cargo-fuzz
+      nixpkgs.gitAndTools.git-extras
+      nixpkgs.gitAndTools.pre-commit
+      nixpkgs.mdsh
+      nixpkgs.openssl
+      nixpkgs.pkgconfig
+      nixpkgs.wasm-pack
+      rustToolchain
+    ]
+    ++ nixpkgs.lib.optionals nixpkgs.stdenv.isDarwin [
+      nixpkgs.darwin.apple_sdk.frameworks.Security
+    ]
+    ;
+
+    shellHook = ''
+      export PATH=$PWD/target/debug:$PATH
+    '';
+  };
 }
diff --git a/flake.lock b/flake.lock
index ca8d249..e6b9757 100644
--- a/flake.lock
+++ b/flake.lock
@@ -1,46 +1,56 @@
 {
   "nodes": {
-    "flake-utils": {
+    "fenix": {
+      "inputs": {
+        "naersk": [
+          "naersk"
+        ],
+        "nixpkgs": [
+          "nixpkgs"
+        ],
+        "rust-analyzer-src": "rust-analyzer-src"
+      },
       "locked": {
-        "lastModified": 1605370193,
-        "narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=",
-        "owner": "numtide",
-        "repo": "flake-utils",
-        "rev": "5021eac20303a61fafe17224c087f5519baed54d",
+        "lastModified": 1621046791,
+        "narHash": "sha256-kSyaZCo2aECwS3c7eXhknXvR+XQigjxBlaRYhfVH2uc=",
+        "owner": "nix-community",
+        "repo": "fenix",
+        "rev": "fffd864ad08ed95fcb66554513fa07a5f3d626b5",
         "type": "github"
       },
       "original": {
-        "owner": "numtide",
-        "repo": "flake-utils",
+        "owner": "nix-community",
+        "repo": "fenix",
         "type": "github"
       }
     },
-    "mozilla": {
-      "flake": false,
+    "flake-utils": {
       "locked": {
-        "lastModified": 1603906276,
-        "narHash": "sha256-RsNPnEKd7BcogwkqhaV5kI/HuNC4flH/OQCC/4W5y/8=",
-        "owner": "mozilla",
-        "repo": "nixpkgs-mozilla",
-        "rev": "8c007b60731c07dd7a052cce508de3bb1ae849b4",
+        "lastModified": 1620759905,
+        "narHash": "sha256-WiyWawrgmyN0EdmiHyG2V+fqReiVi8bM9cRdMaKQOFg=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "b543720b25df6ffdfcf9227afafc5b8c1fabfae8",
         "type": "github"
       },
       "original": {
-        "owner": "mozilla",
-        "repo": "nixpkgs-mozilla",
+        "owner": "numtide",
+        "repo": "flake-utils",
         "type": "github"
       }
     },
     "naersk": {
       "inputs": {
-        "nixpkgs": "nixpkgs"
+        "nixpkgs": [
+          "nixpkgs"
+        ]
       },
       "locked": {
-        "lastModified": 1606738605,
-        "narHash": "sha256-QPg4eCZts6cn9GkeIKhrtIt6b100BzIY1sfcqniZQZk=",
+        "lastModified": 1620316130,
+        "narHash": "sha256-sU0VS5oJS1FsHsZsLELAXc7G2eIelVuucRw+q5B1x9k=",
         "owner": "nmattia",
         "repo": "naersk",
-        "rev": "8d562105f960c487cfc013c0e666c1951b03d392",
+        "rev": "a3f40fe42cc6d267ff7518fa3199e99ff1444ac4",
         "type": "github"
       },
       "original": {
@@ -51,25 +61,11 @@
     },
     "nixpkgs": {
       "locked": {
-        "lastModified": 1606772528,
-        "narHash": "sha256-q54ELh1LAAebwldh8vFWTOMQCMo6PPl2C4dL5FmsVY8=",
+        "lastModified": 1621083049,
+        "narHash": "sha256-b7Uva507+uEIDWbjtwRKuJ2YenuWTdYtHemjMUu2eRU=",
         "owner": "NixOS",
         "repo": "nixpkgs",
-        "rev": "7714edc2e5001b4d0128de93df723cc1d27b2842",
-        "type": "github"
-      },
-      "original": {
-        "id": "nixpkgs",
-        "type": "indirect"
-      }
-    },
-    "nixpkgs_2": {
-      "locked": {
-        "lastModified": 1606772528,
-        "narHash": "sha256-q54ELh1LAAebwldh8vFWTOMQCMo6PPl2C4dL5FmsVY8=",
-        "owner": "NixOS",
-        "repo": "nixpkgs",
-        "rev": "7714edc2e5001b4d0128de93df723cc1d27b2842",
+        "rev": "10a4520ec4730ee98227edff2d5f1fb6030dadf1",
         "type": "github"
       },
       "original": {
@@ -79,10 +75,27 @@
     },
     "root": {
       "inputs": {
+        "fenix": "fenix",
         "flake-utils": "flake-utils",
-        "mozilla": "mozilla",
         "naersk": "naersk",
-        "nixpkgs": "nixpkgs_2"
+        "nixpkgs": "nixpkgs"
+      }
+    },
+    "rust-analyzer-src": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1621033839,
+        "narHash": "sha256-QLKsmo7toh3VNW4H6Sng4m8tG2xXBQhS6fW2ZPtpOgc=",
+        "owner": "rust-analyzer",
+        "repo": "rust-analyzer",
+        "rev": "87ef340c19ae5ac73fc9b1cd37909d9d8ad53d09",
+        "type": "github"
+      },
+      "original": {
+        "owner": "rust-analyzer",
+        "ref": "nightly",
+        "repo": "rust-analyzer",
+        "type": "github"
       }
     }
   },
diff --git a/flake.lock.nix b/flake.lock.nix
new file mode 100644
index 0000000..1e4e41c
--- /dev/null
+++ b/flake.lock.nix
@@ -0,0 +1,105 @@
+# Adapted from https://github.com/edolstra/flake-compat/blob/master/default.nix
+#
+# This version only gives back the inputs. In that mode, flake becomes little
+# more than a niv replacement.
+{ src ? ./. }:
+let
+  lockFilePath = src + "/flake.lock";
+
+  lockFile = builtins.fromJSON (builtins.readFile lockFilePath);
+
+  # Emulate builtins.fetchTree
+  #
+  # TODO: only implement polyfill if the builtin doesn't exist?
+  fetchTree =
+    info:
+    if info.type == "github" then
+      {
+        outPath = fetchTarball "https://api.${info.host or "github.com"}/repos/${info.owner}/${info.repo}/tarball/${info.rev}";
+        rev = info.rev;
+        shortRev = builtins.substring 0 7 info.rev;
+        lastModified = info.lastModified;
+        narHash = info.narHash;
+      }
+    else if info.type == "git" then
+      {
+        outPath =
+          builtins.fetchGit
+            ({ url = info.url; }
+            // (if info ? rev then { inherit (info) rev; } else { })
+            // (if info ? ref then { inherit (info) ref; } else { })
+            );
+        lastModified = info.lastModified;
+        narHash = info.narHash;
+      } // (if info ? rev then {
+        rev = info.rev;
+        shortRev = builtins.substring 0 7 info.rev;
+      } else { })
+    else if info.type == "path" then
+      {
+        outPath = builtins.path { path = info.path; };
+        narHash = info.narHash;
+      }
+    else if info.type == "tarball" then
+      {
+        outPath = fetchTarball info.url;
+        narHash = info.narHash;
+      }
+    else if info.type == "gitlab" then
+      {
+        inherit (info) rev narHash lastModified;
+        outPath = fetchTarball "https://${info.host or "gitlab.com"}/api/v4/projects/${info.owner}%2F${info.repo}/repository/archive.tar.gz?sha=${info.rev}";
+        shortRev = builtins.substring 0 7 info.rev;
+      }
+    else
+    # FIXME: add Mercurial, tarball inputs.
+      throw "flake input has unsupported input type '${info.type}'";
+
+  allNodes =
+    builtins.mapAttrs
+      (key: node:
+        let
+          sourceInfo =
+            if key == lockFile.root
+            then { }
+            else fetchTree (node.info or { } // removeAttrs node.locked [ "dir" ]);
+
+          inputs = builtins.mapAttrs
+            (inputName: inputSpec: allNodes.${resolveInput inputSpec})
+            (node.inputs or { });
+
+          # Resolve a input spec into a node name. An input spec is
+          # either a node name, or a 'follows' path from the root
+          # node.
+          resolveInput = inputSpec:
+            if builtins.isList inputSpec
+            then getInputByPath lockFile.root inputSpec
+            else inputSpec;
+
+          # Follow an input path (e.g. ["dwarffs" "nixpkgs"]) from the
+          # root node, returning the final node.
+          getInputByPath = nodeName: path:
+            if path == [ ]
+            then nodeName
+            else
+              getInputByPath
+                # Since this could be a 'follows' input, call resolveInput.
+                (resolveInput lockFile.nodes.${nodeName}.inputs.${builtins.head path})
+                (builtins.tail path);
+
+          result = sourceInfo // { inherit inputs; inherit sourceInfo; };
+        in
+        if node.flake or true then
+          result
+        else
+          sourceInfo
+      )
+      lockFile.nodes;
+
+  result =
+    if lockFile.version >= 5 && lockFile.version <= 7
+    then allNodes.${lockFile.root}.inputs
+    else throw "lock file '${lockFilePath}' has unsupported version ${toString lockFile.version}";
+
+in
+result
diff --git a/flake.nix b/flake.nix
index 7b90c1f..3390ae2 100644
--- a/flake.nix
+++ b/flake.nix
@@ -2,75 +2,19 @@
   description = "nixpkgs-fmt";
 
   inputs.flake-utils.url = "github:numtide/flake-utils";
-  inputs.mozilla = { url = "github:mozilla/nixpkgs-mozilla"; flake = false; };
   inputs.naersk.url = "github:nmattia/naersk";
-
-  outputs = { self, mozilla, nixpkgs, naersk, flake-utils }:
-    flake-utils.lib.simpleFlake {
-      inherit self nixpkgs;
-
-      name = "nixpkgs-fmt";
-
-      systems = flake-utils.lib.defaultSystems;
-
-      preOverlays = [
-        (import "${mozilla}/lib-overlay.nix")
-        (import "${mozilla}/rust-overlay.nix")
-        naersk.overlay
-      ];
-
-      overlay = final: prev: {
-        nixpkgs-fmt = rec {
-          nixpkgs-fmt = final.naersk.buildPackage {
-            src = self;
-            root = self;
-            cratePaths = [ "." ];
-          };
-          defaultPackage = nixpkgs-fmt;
-        };
-      };
-
-      shell = { pkgs }:
-        let
-          inherit (pkgs) lib stdenv darwin;
-
-          rustChan = pkgs.rustChannelOf {
-            date = "2020-12-29";
-            channel = "nightly";
-            sha256 = "sha256-HEBBUpbIgjbluKyT1oKU/KvQFOBFPML9vuAHuXuhoYA=";
-          };
-
-          rust = rustChan.rust.override {
-            extensions = [
-              "clippy-preview"
-              "rls-preview"
-              "rustfmt-preview"
-              "rust-analysis"
-              "rust-std"
-              "rust-src"
-            ];
-            targets = [ "wasm32-unknown-unknown" ];
-          };
-        in
-        pkgs.mkShell {
-          buildInputs = [
-            pkgs.cargo-fuzz
-            pkgs.gitAndTools.git-extras
-            pkgs.gitAndTools.pre-commit
-            pkgs.mdsh
-            pkgs.openssl
-            pkgs.pkgconfig
-            pkgs.wasm-pack
-            rust
-          ]
-          ++ lib.optionals stdenv.isDarwin [
-            darwin.apple_sdk.frameworks.Security
-          ]
-          ;
-
-          shellHook = ''
-            export PATH=$PWD/target/debug:$PATH
-          '';
-        };
-    };
+  inputs.naersk.inputs.nixpkgs.follows = "nixpkgs";
+  inputs.fenix.url = "github:nix-community/fenix";
+  inputs.fenix.inputs.naersk.follows = "naersk";
+  inputs.fenix.inputs.nixpkgs.follows = "nixpkgs";
+
+  outputs = { self, nixpkgs, naersk, fenix, flake-utils }@inputs:
+    flake-utils.lib.eachDefaultSystem (system:
+      let pkgs = import ./. { inherit system inputs; }; in
+      {
+        defaultPackage = pkgs.nixpkgs-fmt;
+        legacyPackages = pkgs;
+        devShell = pkgs.devShell;
+      }
+    );
 }
diff --git a/shell.nix b/shell.nix
index 1302860..01d7b61 100644
--- a/shell.nix
+++ b/shell.nix
@@ -1,2 +1,2 @@
 { system ? builtins.currentSystem }:
-(import ./. { inherit system; }).shellNix
+(import ./. { inherit system; }).devShell
diff --git a/src/engine/fixes.rs b/src/engine/fixes.rs
index b699530..047e4a8 100644
--- a/src/engine/fixes.rs
+++ b/src/engine/fixes.rs
@@ -5,7 +5,6 @@ use rnix::{
     SyntaxKind::{NODE_STRING, TOKEN_COMMENT, TOKEN_STRING_CONTENT, TOKEN_WHITESPACE},
     SyntaxNode, SyntaxToken, TextRange, TextSize,
 };
-use smol_str::SmolStr;
 
 use super::indentation::single_line_comment_indent;
 use crate::{
@@ -122,21 +121,23 @@ fn fix_comment_indentation(
             first = false;
             continue;
         }
-        let last_line_only_end_block = line.ends_with("*/") || line.trim_start() == "*/";
-        let start_with_asterisk = line.trim_start().starts_with("*");
-        let current_indent = IndentLevel::get_whitespace_block(line);
+        let last_line_only_end_block = line.ends_with("*/") && line.trim_start() == "*/";
         if let Some(ws_end) = line.find(|it| it != ' ') {
-            let delete =
-                TextRange::at(offset, TextSize::try_from(ws_end).expect("woah big number"));
-            if last_line_only_end_block || start_with_asterisk {
+            if !last_line_only_end_block {
                 model.raw_edit(AtomEdit {
-                    delete,
-                    insert: comment_indent.add_alignment(current_indent).into(),
+                    delete: TextRange::at(
+                        offset,
+                        TextSize::try_from(ws_end).expect("woah big number"),
+                    ),
+                    insert: content_indent.into(),
                 })
             } else {
                 model.raw_edit(AtomEdit {
-                    delete,
-                    insert: content_indent.adjust_alignment(current_indent).into(),
+                    delete: TextRange::at(
+                        offset,
+                        TextSize::try_from(ws_end).expect("woah big number"),
+                    ),
+                    insert: comment_indent.into(),
                 })
             }
         }
diff --git a/src/engine/indentation.rs b/src/engine/indentation.rs
index 2eda9da..40e1a05 100644
--- a/src/engine/indentation.rs
+++ b/src/engine/indentation.rs
@@ -4,7 +4,6 @@ use std::{
 };
 
 use rnix::{SyntaxElement, SyntaxKind::*, SyntaxNode, SyntaxToken, TextSize};
-use serde_json::from_str;
 use smol_str::SmolStr;
 
 use crate::{
@@ -89,29 +88,6 @@ impl IndentLevel {
         IndentLevel { level: len / INDENT_SIZE, alignment: len % INDENT_SIZE }
     }
 
-    /// adjust `IndentLevel` based on whitespace provided
-    pub(super) fn adjust_alignment(self, new_indent: IndentLevel) -> IndentLevel {
-        if new_indent.len() > TextSize::from(5) {
-            return new_indent;
-        }
-        IndentLevel { level: self.level, alignment: new_indent.alignment }
-    }
-
-    /// adding alignment for multiline comment
-    pub(super) fn add_alignment(self, new_indent: IndentLevel) -> IndentLevel {
-        if self.level < new_indent.level {
-            return new_indent;
-        }
-        IndentLevel { level: self.level, alignment: new_indent.alignment }
-    }
-
-    pub(super) fn get_whitespace_block(s: &str) -> IndentLevel {
-        match s.find(|c: char| !c.is_whitespace()) {
-            None => IndentLevel::default(),
-            Some(idx) => IndentLevel::from_str(&s[..idx]),
-        }
-    }
-
     pub(super) fn from_whitespace_block(s: &str) -> IndentLevel {
         match s.rfind('\n') {
             None => IndentLevel::default(),


Test patch:
diff --git a/test_data/reindents_block_comments.bad.nix b/test_data/reindents_block_comments.bad.nix
index eeb6e48..63259cd 100644
--- a/test_data/reindents_block_comments.bad.nix
+++ b/test_data/reindents_block_comments.bad.nix
@@ -1,30 +1,17 @@
 {
 /* 
-  decorated
-  block
-  comment
+decoreted
+block
+comment
 */
 foo = 92;
-  /* the closing block comment
-     should not in the newline */
+    /* the closing block comment
+       should not in the newline */
   toPretty = {
-      /* the closing block comment
-       * should be aligned with the opening block comment
+    /* the closing block comment
+       should be aligned with the opening block comment
        */
       allowPrettyValues ? false
     }@args:
     let a = 0; in a;
-  /* Construct a binary search path (such as $PATH) containing the
-     binaries for a set of packages.
-     Example:
-       makeBinPath ["/root" "/usr" "/usr/local"]
-       => "/root/bin:/usr/bin:/usr/local/bin"
-  */
-makeBinPath = makeSearchPathOutput "bin" "bin";
-/* concatMapAttrsToList :: (string -> any -> [any]) -> set -> [any]
- *
- * Like mapAttrsToList, but allows multiple values to be returned
- * from the mapping function as a list.
- */
-concatMapAttrsToList = mapper: attrs: concatLists (mapAttrsToList mapper attrs);
-}
\ No newline at end of file
+}
diff --git a/test_data/reindents_block_comments.good.nix b/test_data/reindents_block_comments.good.nix
index e3aee94..325299f 100644
--- a/test_data/reindents_block_comments.good.nix
+++ b/test_data/reindents_block_comments.good.nix
@@ -1,31 +1,18 @@
 {
   /* 
-    decorated
+    decoreted
     block
     comment
   */
   foo = 92;
   /* the closing block comment
-     should not in the newline */
+    should not in the newline */
   toPretty =
     {
       /* the closing block comment
-       * should be aligned with the opening block comment
-       */
+        should be aligned with the opening block comment
+      */
       allowPrettyValues ? false
     }@args:
     let a = 0; in a;
-  /* Construct a binary search path (such as $PATH) containing the
-     binaries for a set of packages.
-     Example:
-       makeBinPath ["/root" "/usr" "/usr/local"]
-       => "/root/bin:/usr/bin:/usr/local/bin"
-  */
-  makeBinPath = makeSearchPathOutput "bin" "bin";
-  /* concatMapAttrsToList :: (string -> any -> [any]) -> set -> [any]
-   *
-   * Like mapAttrsToList, but allows multiple values to be returned
-   * from the mapping function as a list.
-   */
-  concatMapAttrsToList = mapper: attrs: concatLists (mapAttrsToList mapper attrs);
 }