nix: separate into multiple overlays and expose them from top-level

This commit is contained in:
steveej 2019-12-04 21:08:37 +01:00
parent a96588d9fd
commit e07c5e0fb3
12 changed files with 187 additions and 115 deletions

5
nix/overlays/default.nix Normal file
View file

@ -0,0 +1,5 @@
{
overrides = import ./overrides.nix;
pkgs = import ./pkgs.nix;
posh = import ./posh.nix;
}

View file

@ -0,0 +1,36 @@
# This overlay is used for overriding upstream packages.
self: super:
let
nixpkgs-master = import <nixpkgs-master> { inherit (super) config; };
in {
inherit nixpkgs-master;
# alacritty = nixpkgs-master.alacritty;
alacritty = super.stdenv.mkDerivation {
name = "alacritty-custom";
buildInputs = [ super.makeWrapper ];
phases = "installPhase";
installPhase = ''
makeWrapper ${self.nixpkgs-master.alacritty}/bin/alacritty $out/bin/alacritty \
--set-default WINIT_HIDPI_FACTOR 1.0
'';
};
roxterm = super.stdenv.mkDerivation {
name = "roxterm-custom";
buildInputs = [ super.makeWrapper ];
phases = "installPhase";
installPhase = ''
makeWrapper ${super.roxterm}/bin/roxterm $out/bin/roxterm \
--add-flags "--separate"
'';
};
# TODO: facetimehd is currfently broken (https://github.com/NixOS/nixpkgs/pull/72804)
facetimehd-firmware = super.hello;
qtile = self.nixpkgs-master.qtile;
}

18
nix/overlays/pkgs.nix Normal file
View file

@ -0,0 +1,18 @@
# This overlay includes all packages defined by the top-level default.nix.
# The code is copied from the NUR repository [0].
#
# [0]: https://github.com/nix-community/nur-packages-template/blob/2610a5b60bd926cea3e6395511da8f0d14c613b9/overlay.nix
self: super:
let
isReserved = n: n == "lib" || n == "overlays" || n == "modules";
nameValuePair = n: v: { name = n; value = v; };
nurAttrs = import ../pkgs { pkgs = super; };
in
builtins.listToAttrs
(map (n: nameValuePair n nurAttrs.${n})
(builtins.filter (n: !isReserved n)
(builtins.attrNames nurAttrs)))

8
nix/overlays/posh.nix Normal file
View file

@ -0,0 +1,8 @@
self: super:
let
nixpkgs-master = import <nixpkgs-master> {};
in {
inherit (nixpkgs-master) podman conmon slirp4netns;
posh = self.callPackage ../pkgs/posh.nix {};
}