Skip to content

Default to unstable, use overlay for stable packages #91

@MartiniMoe

Description

@MartiniMoe

I'm using this config, but I default to unstable packages. Now I am trying to install a specific package from nixpkgs-stable, because it is broken in unstable, but it does not work.

flake.nix:

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.11";
    ...

    nixosConfigurations = {
      "galactica" = nixpkgs.lib.nixosSystem {
        specialArgs = {inherit inputs outputs;};
        modules = [
          ./nixos/galactica
        ];
      };
    ....

    homeConfigurations = {
      "moe_galactica" = home-manager.lib.homeManagerConfiguration {
        pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
        extraSpecialArgs = {inherit inputs outputs;};
        modules = [
          ./home/moe_galactica
          ./home/moe_common/desktop
        ];
      };
    };

overlays/default.nix:

# This file defines overlays
{inputs, ...}: {
  # This one brings our custom packages from the 'pkgs' directory
  additions = final: _prev: import ../pkgs {pkgs = final;};

  # This one contains whatever you want to overlay
  # You can change versions, add patches, set compilation flags, anything really.
  # https://nixos.wiki/wiki/Overlays
  modifications = final: prev: {
    # example = prev.example.overrideAttrs (oldAttrs: rec {
    # ...
    # });
  };

  # When applied, the stable nixpkgs set (declared in the flake inputs) will
  # be accessible through 'pkgs.stable'
  stable-packages = final: _prev: {
    stable = import inputs.nixpkgs-stable {
      system = final.system;
      config.allowUnfree = true;
    };
  };
}

And then I want to install a stable package with home-manager:

{ inputs, outputs, lib, config, pkgs, ... }: {

  nixpkgs.overlays = [ outputs.overlays.stable-packages ];
  home.packages = with pkgs; [
    vlc            # So this would come from unstable
    stable.tic-80  # So this should come from stable, right?

However, when I want to apply something like this, I'm getting errors:

┏━ 1 Errors: 
┃ error:
┃        … while calling the 'derivationStrict' builtin
┃          at <nix/derivation-internal.nix>:37:12:
┃            36|
┃            37|   strict = derivationStrict drvAttrs;
┃              |            ^
┃            38|
┃ 
┃        … while evaluating derivation 'home-manager-generation'
┃          whose name attribute is located at /nix/store/5ds20jm3x2s4z7wn3581r6lc9ybmh45b-source/pkgs/stdenv/generic/make-derivation.nix:438:13
┃ 
┃        … while evaluating attribute 'buildCommand' of derivation 'home-manager-generation'
┃          at /nix/store/5ds20jm3x2s4z7wn3581r6lc9ybmh45b-source/pkgs/build-support/trivial-builders/default.nix:80:17:
┃            79|         enableParallelBuilding = true;
┃            80|         inherit buildCommand name;
┃              |                 ^
┃            81|         passAsFile = [ "buildCommand" ] ++ (derivationArgs.passAsFile or [ ]);
┃ 
┃        … while evaluating the option `home.activation.installPackages.data':
┃ 
┃        … while evaluating definitions from `/nix/store/n1wdrgyzriz611m0h0x7rqsp1lx4kpx5-source/modules/home-environment.nix':
┃ 
┃        (stack trace truncated; use '--show-trace' to show the full, detailed trace)
┃ 
┃        error: expected a Boolean but found a set: { _type = "pkgs"; AAAAAASomeThingsFailToEvaluate = «thunk»; AMB-plugins = «thunk»; ArchiSteamFarm = «thunk»; AusweisApp2 = «thunk»; BeatSaberModManager = «th…
┃        at /nix/store/5ds20jm3x2s4z7wn3581r6lc9ybmh45b-source/pkgs/applications/science/electronics/kicad/default.nix:315:9:
┃           314|       (
┃           315|         if (stable) then
┃              |         ^
┃           316|           "Open Source Electronics Design Automation suite"
┣━━━                                                             
┗━ ∑ ⚠ Exited with 1 errors reported by nix at 20:39:35 after 22s

I don't have AMB-plugins, ArchiSteamFarm, AusweisApp2 or BeatSaberModManager in my Config 😅 I have kicad in my config, but it is successfully coming from unstable, when I do not try to apply the overlay.

I'm really lost at this, any help would be greatly appreciated :) For reference, here is my full config: https://git.sr.ht/~martinimoe/nixos-config/tree

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions