forked from pub-solar/os
packages: apply overlays to output packages
Apply overlays to output packages so we can easily use a modified package.
This commit is contained in:
parent
4248b2d1a5
commit
f8f67d2dcb
32
flake.nix
32
flake.nix
|
@ -26,26 +26,29 @@
|
|||
externOverlays = [ nur.overlay devshell.overlay ];
|
||||
externModules = [ home.nixosModules.home-manager ];
|
||||
|
||||
pkgs' = unstable:
|
||||
let
|
||||
override = import ./pkgs/override.nix;
|
||||
overlays = (attrValues self.overlays)
|
||||
++ externOverlays
|
||||
++ [ self.overlay (override unstable) ];
|
||||
in
|
||||
pkgImport nixos overlays;
|
||||
|
||||
unstable' = pkgImport master [ ];
|
||||
|
||||
osSystem = "x86_64-linux";
|
||||
|
||||
outputs =
|
||||
let
|
||||
system = osSystem;
|
||||
pkgset =
|
||||
let
|
||||
overlays =
|
||||
(attrValues self.overlays)
|
||||
++ externOverlays
|
||||
++ [ self.overlay ];
|
||||
in
|
||||
genPkgset {
|
||||
inherit master nixos overlays system;
|
||||
};
|
||||
unstablePkgs = unstable' system;
|
||||
osPkgs = pkgs' unstablePkgs system;
|
||||
in
|
||||
{
|
||||
nixosConfigurations =
|
||||
import ./hosts (recursiveUpdate inputs {
|
||||
inherit lib pkgset utils externModules system;
|
||||
inherit lib osPkgs unstablePkgs utils externModules system;
|
||||
});
|
||||
|
||||
overlay = import ./pkgs;
|
||||
|
@ -65,11 +68,8 @@
|
|||
(eachDefaultSystem
|
||||
(system:
|
||||
let
|
||||
pkgs = pkgImport {
|
||||
inherit system;
|
||||
pkgs = nixos;
|
||||
overlays = [ devshell.overlay ];
|
||||
};
|
||||
unstablePkgs = unstable' system;
|
||||
pkgs = pkgs' unstablePkgs system;
|
||||
|
||||
packages = flattenTreeSystem system
|
||||
(genPackages {
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
, lib
|
||||
, nixos
|
||||
, master
|
||||
, pkgset
|
||||
, osPkgs
|
||||
, self
|
||||
, system
|
||||
, unstablePkgs
|
||||
, utils
|
||||
, externModules
|
||||
, ...
|
||||
|
@ -12,7 +13,6 @@
|
|||
let
|
||||
inherit (utils) recImport;
|
||||
inherit (builtins) attrValues removeAttrs;
|
||||
inherit (pkgset) osPkgs unstablePkgs;
|
||||
|
||||
unstableModules = [ ];
|
||||
addToDisabledModules = [ ];
|
||||
|
@ -65,14 +65,6 @@ let
|
|||
system.configurationRevision = lib.mkIf (self ? rev) self.rev;
|
||||
};
|
||||
|
||||
overrides = {
|
||||
nixpkgs.overlays =
|
||||
let
|
||||
override = import ../pkgs/override.nix unstablePkgs;
|
||||
in
|
||||
[ override ];
|
||||
};
|
||||
|
||||
local = import "${toString ./.}/${hostName}.nix";
|
||||
|
||||
# Everything in `./modules/list.nix`.
|
||||
|
@ -84,7 +76,6 @@ let
|
|||
core
|
||||
global
|
||||
local
|
||||
overrides
|
||||
modOverrides
|
||||
] ++ externModules;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{ lib, ... }:
|
||||
let
|
||||
inherit (builtins) attrNames isAttrs readDir listToAttrs;
|
||||
inherit (builtins) attrNames attrValues isAttrs readDir listToAttrs mapAttrs;
|
||||
|
||||
inherit (lib) filterAttrs hasSuffix mapAttrs' nameValuePair removeSuffix
|
||||
inherit (lib) fold filterAttrs hasSuffix mapAttrs' nameValuePair removeSuffix
|
||||
recursiveUpdate genAttrs;
|
||||
|
||||
# mapFilterAttrs ::
|
||||
|
@ -14,8 +14,8 @@ let
|
|||
# Generate an attribute set by mapping a function over a list of values.
|
||||
genAttrs' = values: f: listToAttrs (map f values);
|
||||
|
||||
pkgImport = { pkgs, system, overlays }:
|
||||
import pkgs {
|
||||
pkgImport = nixpkgs: overlays: system:
|
||||
import nixpkgs {
|
||||
inherit system overlays;
|
||||
config = { allowUnfree = true; };
|
||||
};
|
||||
|
@ -33,20 +33,6 @@ in
|
|||
{
|
||||
inherit mapFilterAttrs genAttrs' pkgImport pathsToImportedAttrs;
|
||||
|
||||
genPkgset = { master, nixos, overlays, system }:
|
||||
{
|
||||
osPkgs = pkgImport {
|
||||
inherit system overlays;
|
||||
pkgs = nixos;
|
||||
};
|
||||
|
||||
unstablePkgs = pkgImport {
|
||||
inherit system;
|
||||
overlays = [];
|
||||
pkgs = master;
|
||||
};
|
||||
};
|
||||
|
||||
overlayPaths =
|
||||
let
|
||||
overlayDir = ../overlays;
|
||||
|
@ -86,12 +72,19 @@ in
|
|||
genPackages = { self, pkgs }:
|
||||
let
|
||||
inherit (self) overlay overlays;
|
||||
packages = overlay pkgs pkgs;
|
||||
overlayPkgs =
|
||||
genAttrs
|
||||
(attrNames overlays)
|
||||
(name: (overlays."${name}" pkgs pkgs)."${name}");
|
||||
packagesNames = attrNames (overlay null null)
|
||||
++ attrNames (fold
|
||||
(attr: sum: recursiveUpdate sum attr)
|
||||
{ }
|
||||
(attrValues
|
||||
(mapAttrs (_: v: v null null) overlays)
|
||||
)
|
||||
);
|
||||
in
|
||||
recursiveUpdate packages overlayPkgs;
|
||||
|
||||
fold
|
||||
(key: sum: recursiveUpdate sum {
|
||||
${key} = pkgs.${key};
|
||||
})
|
||||
{ }
|
||||
packagesNames;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue