I need help pulling alacritty from unstable on 23.11

Hi i just found out that my alacritty version is to low for it to use my toml config file therefore i want to only get alacritty from unstable. I dont want nix to bump everything up to unstable. i have followed everything listed in this reddit post. [https://www.reddit.com/r/NixOS/comments/17nphls/trying_to_install_a_single_package_from_unstable/] either i get bumped up completely or nixos-rebuild switch thorws an error like unexpected let. My config file is here [https://github.com/EdgeLordKirito/Nixos/blob/c645176c3584501d8fad9a04b848869032803dc3/configuration.nix] i would really appreciate help with formatting this file so that i can pull in unstable.alacritty. Thank you in advance for trying to help. If possible i would like to not use flakes but if it is impossible i will follow and use them.

I don’t use NixOS so can’t recommend a concrete solution, but in a generic nix setup, you can use multiple version of nixpkgs attrset and their programs. Of course this will have the added storage cost, but you can have pkgs and pkgs-unstable (and any other version of nixpkgs).
I normally use niv to manage multiple versions so how to set this up will be up to you (unless there’s a specific way for it in nixos). as far as I’m aware you can also simply have a new pkg set like this without any additonal tools (probably need to add the sha as well):

nixpkgs-unstable = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/c75037bbf9093a2acb617804ee46320d6d1fea5a.tar.gz") {};

then use it similar to pkgs. Just be aware that it’ll pull anything that has changed and needed by the packages you use

1 Like

while i do understand parts of what you said. I am to new to nix to understand it fully. What exactly do you mean with but you can have pkgs and pkgs-unstable. I understand that i can have environment.systemPackages = with pkgs; [ list of the packages i want from stable] and
environment.systemPackages = with pkgs- unstable; [ alacritty]

Look into nix flakes. I am yet to understand them completely, but they are the exact answer to your problem, meaning they are made to control different applications versions, also help in reproducibility

1 Like

Ok thank you i tried to dodge flakes for as long as possible as i do not really like using experimental features but if it is the tool for the job guess i have to abide. Do you have an guide that you can recommend?

I had this exact same problem. Luckily I was already using flakes so it was pretty easy to replace the package version.
Commit where i fixed my alacritty config
Where unstable is overlayed into the nixpkgs
My flake setup is pretty convoluted. A simpler answer was already given here.
I would not recommend switching to flakes only for this reason, the same can be achieved without flakes.

2 Likes

You don’t need to switch to flakes to use single packages from unstable.

First, add the unstable channel

nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs-unstable

Second, in your configuration.nix apply this structure

{ config, pkgs, ... }:  
  
let  
 unstable-pkgs = import <nixpkgs-unstable> {config.allowUnfree = true;};  
in  
{
  # ...
  # ... your existing configuration
  # ...
  
  environment.systemPackages = with pkgs; [
    thunderbird # package from stable you already have
    vlc  # package from stable you already have
    # ...
  ] ++ (with unstable-pkgs; [
    alacritty # <---- put your unstable package here
    another-unstable-package2
  ]);

  # ...
  # ... your existing configuration
  # ...
}

Third, rebuild with updates

nixos-rebuild --upgrade-all switch

This worked for me when I needed obsidian from unstable when 23.05 was current. The alowUnfree is optional of course.

3 Likes

does this have to be at the very top of the file. or can anything be in the in{} block like this
boot.loader.grub.enable = true;
boot.loader.grub.device = “/dev/sda”;
boot.loader.grub.useOSProber = true;

The let/in expression does not have to be on the top. Something like this should IMHO work, too. But I haven’t tested this.

{ config, pkgs, ... }:  
  
{
  # ...
  # ...
  # boot.option1.*
  # boot.option2.*
  # ...
  
  environment.systemPackages =   
    let  
      unstable-pkgs = import <nixpkgs-unstable> {config.allowUnfree = true;};  
    in
      with pkgs; [
          thunderbird # package from stable you already have
          vlc  # package from stable you already have
          # ...
        ] ++ (with unstable-pkgs; [
          alacritty # <---- put your unstable package here
          another-unstable-package2
        ]);

  # ...
  # ...
}

The boot.* options dont belong in the let but simply stay where they were before.See code example.

1 Like

thank you i will try this as soon as possible thank you very much

1 Like

Exactly as tiez described here

Can use the tarball method instead of using channels to contain all the information within the file, but using channels will also achieve the same result (unless you change the channel reference or want to use this file on a different machine)

You are basically adding a new nixpkgs root and can pick any piece of software from it, note that this is not limited to nixpkgs, can also define custom derivations and include them as systemPackages

1 Like

i got this when running my rebuild the config file is [https://github.com/EdgeLordKirito/Nixos/blob/b04e2c3869cb2cce92f943d89c663b972e717967/configuration.nix]

Try

nixos-rebuild --upgrade-all switch

or simply nix-channel --update and then nixos-rebuild switch.

1 Like

Will try this tomorrow.

Thank you very much everything worked great. Would it still be recommended to learn about flakes. As i am a bit hesitant about the entire experimental feature thing.