Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install GUI app from unstable #1328

Open
dwt opened this issue Feb 8, 2025 · 6 comments
Open

Cannot install GUI app from unstable #1328

dwt opened this issue Feb 8, 2025 · 6 comments

Comments

@dwt
Copy link

dwt commented Feb 8, 2025

Hi there,

I've set up my flake based setup to install from nixpkgs-24.11 by default, but would like to install some applications from unstable. However this doesn't seem to work. Even though the desired application shows as part of the derivations in systemPackages, it does not seem to be installed.

How to reproduce

I did enable nixpkgs-unstable via an input

inputs = {
  nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-24.11-darwin";
  nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
}

Then added pegs-unstable to the special args like this:

      darwinConfigurations.Sokrates = nix-darwin.lib.darwinSystem rec {
        system = "aarch64-darwin";
        specialArgs =
          let
            pkgs-unstable = import nixpkgs-unstable {
              config.allowUnfree = true;
              inherit system;
            };
          in
          {
            inherit inputs pkgs-unstable;
          };
        modules = [

Then tried to install unreal tournament 1999 like this:

{
  pkgs-unstable,
  ...
}:
{
  environment.systemPackages = with pkgs-unstable; [
    ut1999
  ];
}

My full configuration is available here

When I inspect this configuration, it looks like the package is setup correctly

❯ nix eval --json .#darwinConfigurations.Sokrates.config.environment.systemPackages | jq .[0]
"/nix/store/xrqpzc22y8ipdkgh2alw0wf5psmpskyx-ut1999"
# however
nix path-info --recursive /nix/var/nix/profiles/system|rg ut199

does not show anything. :-(

Workarounds

This works fine with a custom registry:

❯ nix registry list | head -n 2
user   flake:nixpkgs-unstable github:NixOS/nixpkgs/nixpkgs-unstable
system flake:nixpkgs path:/nix/store/gr8cixx9d330s6qyxa6kv7nyd4ig6kpc-source
❯ NIXPKGS_ALLOW_UNFREE=1 nix shell --impure nixpkgs-unstable#ut1999 --command open -a (NIXPKGS_ALLOW_UNFREE=1 nix eval --impure --raw nixpkgs-unstable#ut1999)/UnrealTournament.app

So nix is able to install ut1999. Not sure where the bug is now, but nix-darwin is my first best candidate.

I would love to get some advice on how to help debug this.

@dwt
Copy link
Author

dwt commented Feb 8, 2025

I've just verified, that I can install non gut applications this way, so the general nix setup seems to be sound. I.e. this works:

environment.systemPackages = with pkgs-unstable; [
    # doesn't work yet, not sure why
    # https://github.com/LnL7/nix-darwin/issues/1328
    # Workaround:
    #  NIXPKGS_ALLOW_UNFREE=1 nix shell --impure nixpkgs-unstable#ut1999 --command open -a (NIXPKGS_ALLOW_UNFREE=1 nix eval --impure --raw nixpkgs-unstable#ut1999)/UnrealTournament.app
    ut1999
    fzy
  ];

After the switch fzy is available.

@dwt
Copy link
Author

dwt commented Feb 8, 2025

I suspect that the way the nixpkgs package is built may be at fault, perhaps it does not expose enough metadata for nix-darwin to do its magic? Here is the package in question

@dwt
Copy link
Author

dwt commented Feb 10, 2025

I'll try this once it's merged into unstable.

@dwt
Copy link
Author

dwt commented Feb 11, 2025

Indeed, with this change the ut1999 package gets installed. So the actual bug seems to be that if the package doesn't provide either a bin or Applications folder in its output, it doesn't get installed.

That seems like something I would like to have some trace output for? (Not sure if that is the correct way to do it) But Silently ignoring the package seems like a bad idea.

@Samasaur1
Copy link
Contributor

I'm not sure how we could add trace output, especially since packages can have arbitrary folders in their output. The behavior you noticed is controlled by the following bits of nix-darwin:

system.build.applications = pkgs.buildEnv {
name = "system-applications";
paths = config.environment.systemPackages;
pathsToLink = "/Applications";
};

system.path = pkgs.buildEnv {
name = "system-path";
paths = cfg.systemPackages;
postBuild = cfg.extraSetup;
ignoreCollisions = true;
inherit (cfg) pathsToLink extraOutputsToInstall;
};

(pathsToLink can be modified by the user, but had defaults defined here:

environment.pathsToLink = [
"/bin"
"/share/locale"
"/share/terminfo"
];

)

and they are linked into place here:

ln -s ${cfg.path} $out/sw
mkdir -p $out/Library
ln -s ${cfg.build.applications}/Applications $out/Applications

@dwt
Copy link
Author

dwt commented Feb 15, 2025

@Samasaur1 If I get you correctly, you say that only packages with $out/{Applications,bin,share/locale,share/terminfo} get linked into the system?

I still don't understand why the package was not even marked as installed afterwards?

Perhaps adding an assertion about all packages which provide neither of these paths that nix-darwin is ignoring them because it does not know what to do with them might be a way forward?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants