nix-community / nix-on-droid

Nix-enabled environment for your Android device. [maintainers=@t184256,@Gerschtli]
https://nix-on-droid.unboiled.info
MIT License
1.15k stars 65 forks source link

Clean install claiming stateVersion "23.05" does not exist #292

Closed jpentland closed 9 months ago

jpentland commented 9 months ago

I just installed nix-on-droid on my Pixel6, and used the "23.05" tarball.

When trying to run ```nix-on-droid switch -F ." i get the following error:

error: A definition for option `home-manager.config.home.stateVersion' is not of type `one of "18.09", "19.03", "19.09", "20.03", "20.09", "21.03", "21.05", "21.11", "22.05", "22.11"'. Definition values:
       - In `/nix/store/jls7150y1izgq97ks99fvk6zd0ia6rry-source/nix-on-droid.nix': "23.05"
(use '--show-trace' to show detailed location information)

My config is mostly default, with home-manager added:

flake.nix

  {
  description = "Basic example of Nix-on-Droid system config.";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";

    nix-on-droid = {
      url = "github:t184256/nix-on-droid/release-23.05";
      inputs.nixpkgs.follows = "nixpkgs";
    };
        home-manager.url = "github:nix-community/home-manager/release-23.05";
       home-manager.inputs.nixpkgs.follows = "nixpkgs";
  };
  outputs = { self, nixpkgs, nix-on-droid, home-manager }: {

    nixOnDroidConfigurations.default = nix-on-droid.lib.nixOnDroidConfiguration {
      modules = [ ./nix-on-droid.nix ];
    };

  };
}

nix-on-droid.nix

{ config, lib, pkgs, ... }:
{
  # Simply install just the packages
  environment.packages = with pkgs; [
git
openssh
    # User-facing stuff that you really really want to have
    vim # or some other editor, e.g. nano or neovim

    # Some common stuff that people expect to have
    #diffutils
    #findutils
    #utillinux
    #tzdata
    #hostname
    #man
    #gnugrep
    #gnupg
    #gnused
    #gnutar
    #bzip2
    #gzip
    #xz
    #zip
    #unzip
  ];

  # Backup etc files instead of failing to activate generation if a file already exists in /etc
  environment.etcBackupExtension = ".bak";

  # Read the changelog before changing this value
  system.stateVersion = "23.05";

  # Set up nix for flakes
  nix.extraOptions = ''
    experimental-features = nix-command flakes
  '';

  # Set your time zone
  #time.timeZone = "Europe/Berlin";
  home-manager.backupFileExtension = "hm-bak";
  home-manager.useGlobalPkgs = true;
  home-manager.config =
    { pkgs, ... }:
    {
      # Read home-manager changelog before changing this value
      home.stateVersion = "23.05";

      # insert home-manager config
    };
}
Gerschtli commented 9 months ago

nix-on-droid has home-manager as input. If you want to use a different version than the version set in nix-on-droid, use inputs.home-manager.follows.. or provide the home-manager flake to the nixOnDroidConfiguration function call.

It is a similar behaviour like with nixpkgs.

jpentland commented 9 months ago

If I comment out the lines:

#home-manager.url = "github:nix-community/home-manager/release-23.05";
#home-manager.inputs.nixpkgs.follows = "nixpkgs";

I am still getting the same issue.

t184256 commented 9 months ago

my config is mostly default

Please check out the default flake home-manager config the flake offers, specifically inputs.nix-on-droid.inputs.home-manager.follows: https://github.com/nix-community/nix-on-droid/blob/039379abeee67144d4094d80bbdaf183fb2eabe5/templates/home-manager/flake.nix#L15

jpentland commented 9 months ago

Copying this section in the inputs seems to have worked:

    home-manager = {
      url = "github:nix-community/home-manager/release-23.05";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    nix-on-droid = {
      url = "github:nix-community/nix-on-droid/release-23.05";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.home-manager.follows = "home-manager";
    };