Skip to content

Commit

Permalink
treewide: reduce number of evaluations by re-using pkgs
Browse files Browse the repository at this point in the history
This means:
- For home-manager standalone, we will re-use the
  `self.outputs.legacyPackages`
- For NixOS, we will still eval its own pkgs, but we will pass
  `useGlobalPkgs` option to Home-Manager
  • Loading branch information
thiagokokada committed Jan 1, 2024
1 parent 663b4f9 commit f58210e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 1 addition & 3 deletions home-manager/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, lib, flake, osConfig, ... }:
{ pkgs, lib, osConfig, ... }:

{
imports = [
Expand All @@ -15,8 +15,6 @@
# Inherit config from NixOS or homeConfigurations
inherit (osConfig) device mainUser;

nixpkgs.overlays = [ (import ../overlays { inherit flake; }) ];

# Assume that this is a non-NixOS system
targets.genericLinux.enable = lib.mkIf pkgs.stdenv.isLinux (lib.mkDefault true);
}
6 changes: 3 additions & 3 deletions lib/flake-helpers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ in
mkGHActionsYAMLs = names: eachDefaultSystem (system:
let
inherit (nixpkgs) lib;
pkgs = nixpkgs.legacyPackages.${system};
pkgs = self.outputs.legacyPackages.${system};
mkGHActionsYAML = name:
let
file = import (../actions/${name}.nix);
Expand Down Expand Up @@ -38,7 +38,7 @@ in
, deps ? pkgs: [ ]
}: eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
pkgs = self.outputs.legacyPackages.${system};
in
{
apps.${name} = mkApp {
Expand Down Expand Up @@ -102,7 +102,7 @@ in
}:
{
homeConfigurations.${hostname} = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system};
pkgs = self.outputs.legacyPackages.${system};
modules = [
({ ... }: {
home = { inherit username homeDirectory; };
Expand Down
1 change: 1 addition & 0 deletions nixos/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ in

home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
users.${config.mainUser.username} = {
inherit (config.nixos.home) imports;
};
Expand Down

0 comments on commit f58210e

Please sign in to comment.