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

services.flatpak.uninstallUnmanaged has invalid default value #61

Closed
eclairevoyant opened this issue Apr 1, 2024 · 1 comment
Closed
Assignees
Labels
bug Something isn't working UBN Unblock now

Comments

@eclairevoyant
Copy link

Tested with nixos-rebuild build --flake . with the following:

flake.nix
# flake.nix
{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
    flatpak.url = "github:gmodena/nix-flatpak";
  };

  outputs =
    {
      self,
      nixpkgs,
      flatpak,
    }:
    {
      nixosConfigurations.test = nixpkgs.lib.nixosSystem {
        modules = [
          (
            { modulesPath, pkgs, ... }:
            {
              imports = [
                "${modulesPath}/profiles/minimal.nix"
                flatpak.nixosModules.nix-flatpak
              ];

              boot.loader.grub.enable = false;
              fileSystems."/".device = "nodev";
              nixpkgs.hostPlatform = "x86_64-linux";
              system.stateVersion = "24.05";

              services.flatpak.enable = true;
              xdg.portal = {
                enable = true;
                extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
                config.common.default = [ "gtk" ];
              };
            }
          )
        ];
      };
    };
}

Which produces the following error:

error:
       … while calling the 'head' builtin
         at /nix/store/cb1gs888vfqxawvc65q1dk6jzbayh3wz-source/lib/attrsets.nix:1541:11:
         1540|         || pred here (elemAt values 1) (head values) then
         1541|           head values
             |           ^
         1542|         else

       … while evaluating the attribute 'value'
         at /nix/store/cb1gs888vfqxawvc65q1dk6jzbayh3wz-source/lib/modules.nix:809:9:
          808|     in warnDeprecation opt //
          809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          810|         inherit (res.defsFinal') highestPrio;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: expected a Boolean but found null: null
       at /nix/store/9h5mvnz9wn5q3bf55q6r4iyvmdsvdw4g-source/modules/options.nix:177:66:
          176|     type = with types; bool;
          177|     default = config.services.flatpak.uninstallUnmanagedPackages || false;
             |                                                                  ^
          178|     description = lib.mdDoc ''

This is because the default value of the option services.flatpak.uninstallUnmanagedPackages is null, but null || false is not a valid expression in nix.

Even if null || false was valid, the option services.flatpak.uninstallUnmanaged is type bool (not nullOr bool) so this option couldn't take null anyway.

@gmodena gmodena self-assigned this Apr 1, 2024
@gmodena
Copy link
Owner

gmodena commented Apr 1, 2024

Hey @eclairevoyant ,

I did an oepsie with integration tests and this bug slipped in. Hotfix incoming.

A workarond for this would be to explicitly set services.flatpak.uninstallUnmanagedPackages = false in your config.

@gmodena gmodena added bug Something isn't working UBN Unblock now labels Apr 1, 2024
gmodena added a commit that referenced this issue Apr 1, 2024
Coherce `null` value to `false` when initialising
the value of uninstallUnmanaged from the
uninstallUnmanagedPackages option default
value.

Fixes issue #61.
gmodena added a commit that referenced this issue Apr 1, 2024
Coherce `null` value to `false` when initialising
the value of uninstallUnmanaged from the
uninstallUnmanagedPackages option default
value.

Fixes issue #61.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working UBN Unblock now
Projects
None yet
Development

No branches or pull requests

2 participants