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

Unable to use with home manager #15

Open
doofy opened this issue Dec 8, 2021 · 9 comments
Open

Unable to use with home manager #15

doofy opened this issue Dec 8, 2021 · 9 comments

Comments

@doofy
Copy link

doofy commented Dec 8, 2021

I am trying to follow example https://github.com/tadfisher/android-nixpkgs#home-manager and include this into my home.nix but I get the following error:

error: cannot coerce a set to a string
       at /home/doofy/.config/nixpkgs/home.nix:10:15:

            9|     in
           10|       import (android-nixpkgs + "/hm-module.nix");
             |               ^
           11|
(use '--show-trace' to show detailed location information)

Anyone willing to help me?

@tadfisher
Copy link
Owner

Can you try it with this change?

{ config, pkgs, ... }:

let
  android-sdk =
    let
      android-nixpkgs = fetchTarball "https://github.com/tadfisher/android-nixpkgs/archive/main.tar.gz";
    in
      import (android-nixpkgs + "/hm-module.nix");

in
{
  imports = [ android-sdk ];

 #  ...
}

@doofy
Copy link
Author

doofy commented Dec 9, 2021

I guess this got me one step further but:

I have:

{ config, pkgs, ... }:

let
  android-sdk =
    let
      android-nixpkgs = fetchTarball "https://github.com/tadfisher/android-nixpkgs/archive/main.tar.gz";
    in
      import (android-nixpkgs + "/hm-module.nix");

in
{
  imports = [ android-sdk ];

  android-sdk.enable = true;

  # Optional; default path is "~/.local/share/android".
  android-sdk.path = "${config.home.homeDirectory}/.android/sdk";

  android-sdk.packages = sdk: with sdk; [
    build-tools-30-0-2
    cmdline-tools-latest
    emulator
    platforms-android-30
    sources-android-30
  ];

  programs.home-manager.enable = true;
...

but I get error when building:

~ home-manager switch         
error: attribute 'androidSdk' missing

       at /nix/store/dvslxnzg6j93qad6y2s8b5m5k1zjaanz-source/hm-module.nix:48:32:

           47|   config = mkIf (cfg.enable) {
           48|     android-sdk.finalPackage = pkgs.androidSdk cfg.packages;
             |                                ^
           49|
(use '--show-trace' to show detailed location information)

@tadfisher
Copy link
Owner

Ah, you need the overlay installed, which isn't exposed outside of the flake. I'll try and make this possible, or avoid requiring an overlay.

@ari-becker
Copy link

Ah, you need the overlay installed, which isn't exposed outside of the flake. I'll try and make this possible, or avoid requiring an overlay.

Hey, I just ran into the same error. I'm not using the nixpkgs Anrdoid setup since it doesn't include cmdline-tools for some reason, which Flutter requires. Is there some kind of workaround?

@sminf
Copy link

sminf commented Mar 17, 2022

Ah, you need the overlay installed, which isn't exposed outside of the flake. I'll try and make this possible, or avoid requiring an overlay.

Hey, I just ran into the same error. I'm not using the nixpkgs Anrdoid setup since it doesn't include cmdline-tools for some reason, which Flutter requires. Is there some kind of workaround?

machine.nix

{ config, lib, pkgs, inputs, ... }:
{
  # android-nixpkgs overlay
  nixpkgs.overlays = [
    inputs.android-nixpkgs.overlay
  ];
}

@ebsi-cgoboncan
Copy link

ebsi-cgoboncan commented Mar 31, 2022

I was able to access the overlay and add it to my nixpkg config with the following:

outputs = { self, darwin, nixpkgs, ... }@inputs:
    let
      inherit (darwin.lib) darwinSystem;
      inherit (nixpkgs.lib) attrValues makeOverridable optionalAttrs singleton;
      nixpkgsConfig = {
        config = {
          allowUnfree = true;
        };
        overlays = attrValues self.overlays
          ++ singleton inputs.android-nixpkgs.overlay
      }

Once I added the overlay, I was able to configure android-sdk via home-manager and flakes.

@hacker1024
Copy link

hacker1024 commented Jul 7, 2022

How can this be done when using home-manager as a NixOS module? I have no inputs attribute to use. (Sorry if I'm missing something obvious, I'm quite new to this)

Edit: Turns out the overlay isn't needed if you use (callPackage <android-nixpkgs> {}).sdk directly.

@Eldorico
Copy link

Edit: Turns out the overlay isn't needed if you use (callPackage <android-nixpkgs> {}).sdk directly.

Would you have some example please? I'm new to nix and these notions start to be blurry to me

@offeex
Copy link

offeex commented Apr 28, 2024

nixpkgsConfig

yeah, very unclear to me too

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

8 participants