I’m using overlays in NixOS, and it’s working great except for one thing: when a package is defined in my overlay that already exists (in an older version) in the NixOS repo, the version in the repo is picked up instead of the version in my overlay.
How can I get NixOS to use the package in my overlay instead of the one in the repo? I suspect that I need to modify overlays.nix, but I’m not sure how to do it.
My overlays directory looks like this.
$ tree
.
├── default.nix
├── hello-amy
│ ├── default.nix
│ ├── simple_builder.sh
│ └── simple.c
├── jot
│ └── default.nix
├── liquid-fixpoint
│ └── default.nix
├── liquidhaskell
│ └── default.nix
└── overlays.nix
$ cat overlays.nix
self: super:
with super.lib;
let
# Using the nixos plumbing that's used to evaluate the config...
eval = import <nixpkgs/nixos/lib/eval-config.nix>;
# Evaluate the config,
paths = (eval {modules = [(import <nixos-config>)];})
# then get the `nixpkgs.overlays` option.
.config.nixpkgs.overlays
;
in
foldl' (flip extends) (_: super) paths self
I tried swapping the order of paths
in overlays.nix
, like so:, but it had no effect. I’m not sure overlays.nix
is even being used; if I delete it there’s no change in the behaviour of nixos-rebuild switch
paths =
# First get the `nixpkgs.overlays` option,
.config.nixpkgs.overlays
# then evaluate the config.
(eval {modules = [(import <nixos-config>)];})
FYI, here’s my top-level default.nix.
$ cat default.nix
self: super: {
hello-amy = super.callPackage ./hello-amy {};
jot = super.haskellPackages.callPackage ./jot {};
liquid-fixpoint = super.haskellPackages.callPackage ./liquid-fixpoint {};
liquidhaskell = super.haskellPackages.callPackage ./liquidhaskell {};
}