# Use latest version of scotty when using Nix

**URL:** <https://discourse.haskell.org/t/use-latest-version-of-scotty-when-using-nix/9069>\
**Category:** Learn\
**Created:** [March 16, 2024, 8:27am UTC](https://discourse.haskell.org/t/use-latest-version-of-scotty-when-using-nix/9069 "2024-03-16T08:27:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pmidden](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/pmidden/32/2426_2.png) [@pmidden](https://discourse.haskell.org/u/pmidden)\
**Post date:** [March 16, 2024, 8:27am UTC](https://discourse.haskell.org/t/use-latest-version-of-scotty-when-using-nix/9069/1 "2024-03-16T08:27:48Z")

</div>

I’m using Nix and Haskell using the Serokell flake template (meaning I just use `haskellPackages.callCabal2nix packageName` to package my application). I have `build-depends: scotty` in my `.cabal` file. That pulls in an old version of scotty (0.12). I’m seeing a newer version available in nixpkgs as `haskellPackages.scotty_0_21`. How do I tell Nix to use that version instead?

---

<div class="post-metadata">

**Author:** ![kamek-pf](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/kamek-pf/32/3272_2.png) [@kamek-pf](https://discourse.haskell.org/u/kamek-pf)\
**Post date:** [March 16, 2024, 3:41pm UTC](https://discourse.haskell.org/t/use-latest-version-of-scotty-when-using-nix/9069/2 "2024-03-16T15:41:10Z")

</div>

Since it’s pulling from nixpkgs, you probably need to run `nix flake update` to pin a newer version.

---

<div class="post-metadata">

**Author:** ![silky](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/silky/32/3555_2.png) [@silky](https://discourse.haskell.org/u/silky)\
**Post date:** [March 16, 2024, 6:47pm UTC](https://discourse.haskell.org/t/use-latest-version-of-scotty-when-using-nix/9069/3 "2024-03-16T18:47:37Z")

</div>

Seems like that template uses it’s own flake registry which points to serokell’s own fork of nixpkgs …

For that reason it’s probably a poor starting point 😅

Maybe trying starting from something like this instead - [https://github.com/isovector/cornelis/blob/master/flake.nix](https://github.com/isovector/cornelis/blob/master/flake.nix) - it’s a bit more idiomatic.

---

<div class="post-metadata">

**Author:** ![tbidne](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/tbidne/32/2949_2.png) [@tbidne](https://discourse.haskell.org/u/tbidne)\
**Post date:** [March 17, 2024, 4:17am UTC](https://discourse.haskell.org/t/use-latest-version-of-scotty-when-using-nix/9069/4 "2024-03-17T04:17:57Z")

</div>

I’m not sure what serokell’s flake looks like, but assuming you’re using something like `haskellPackages`, you can add an override like:

```haskell
compiler = pkgs.haskell.packages."${ghc-version}".override {
  overrides = final: prev: {
    # if it's in nixpkgs but not the default
    scotty = prev.scotty_0_21;

    # not in nixpkgs, but in cabal per nixpkgs' cabal's index-state
    # scotty = final.callHackage "scotty" "0.21" { };

    # last resort, not in nixpkgs nor in index-state
    # scotty = (final.callHackageDirect
    # {
    # pkg = "scotty";
    # ver = "0.21";
    # sha256 = "sha256-<hash>";
    # }
    # { });
  }
}

```

---

<div class="post-metadata">

**Author:** ![pmidden](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/pmidden/32/2426_2.png) [@pmidden](https://discourse.haskell.org/u/pmidden)\
**Post date:** [March 17, 2024, 8:09am UTC](https://discourse.haskell.org/t/use-latest-version-of-scotty-when-using-nix/9069/5 "2024-03-17T08:09:01Z")

</div>

That fixed it. Thanks!

---

<div class="post-metadata">

**Author:** ![ocramz](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/ocramz/32/3713_2.png) [@ocramz](https://discourse.haskell.org/u/ocramz)\
**Post date:** [March 17, 2024, 1:17pm UTC](https://discourse.haskell.org/t/use-latest-version-of-scotty-when-using-nix/9069/6 "2024-03-17T13:17:57Z")

</div>

btw the latest-latest version is 0.22 😉
