Flox upgrade issue

Hi (and happy holidays!),

I am running flox 0.0.7-r106 and I tried to run flox upgrade:

floxmeta repository (/var/folders/kb/tjt27xcn6_dg095y88337mjm0000gn/T/tmp.IZDetxOz76/102) using deprecated (<=0.0.7) format.

Convert to latest (>=0.0.8) format?

           Yes        No

then

error: Found argument '{}' which wasn't expected, or isn't valid in this context

Usage: nix-editor [OPTIONS] <FILE> <ATTRIBUTE>

What can I do to fix this?

Happy holidays!

There’s probably a bug in the conversion logic - could you flox export > export.tar and attach the result?

If you want to perform the conversion manually, you could inspect your old environment with EDITOR=cat flox edit, and then you could flox destroy, flox edit, and manually add all your packages (or flox install if you prefer). The new format should have entries of the form packages.nixpkgs-flox.hello = {};

How can I send you the tar file? It seems that I can not attach a file to a message here?

Just to be clear, the old format is:

[packages]
  [packages."bat"]
  channel = "nixpkgs-flox"
  stability = "stable"

and the new format should simply be:

  [packages."bat"]
  packages.nixpkgs-flox.hello = {};

?

For me there’s an upload button (icon has a little mountain)

flox edit should drop you into a template, but the new format will be

{...}: {
  packages.nixpkgs-flox.hello = {};
}

if you prefer you can nest multiple packages like:

{...}: {
  packages.nixpkgs-flox = {
    hello = {};
    jq = {};
  };
}
1 Like

Stability and version can be added with:

{...}: {
  packages.nixpkgs-flox.hello = {
    stability = "unstable";
    version = "2.12";
  };
}

Happy holidays! In the reply-to box, the 7th icon should allow you to upload a file? If not, send it directly to me (I believe you already have my email address) and I’ll get it to Matthew. :slight_smile:

It only seems to work for an image, not even a tar disguised as a jpg.

Thanks Robin, I sent you an email.

1 Like

Do I understand that the whole file is a nix expression and not a toml file now?

Yes it is - documentation is pending. We may support TOML again at some point depending on how it’s received, but for now it’s just Nix

We have a quoting issue we hit for ff="fzf --preview='bat {} --color=always'". Will ping once we’ve rolled out a fix!

Good to know. I was thinking that a simple fix would be to use the non pre-release of flox and remove that line with EDITOR=vim flox edit but this doesn’t seem to edit the file. Could you please tell me if there’s another way to edit it?

That approach worked for me - are you hitting some other error?

> flox upgrade
floxmeta repository (/var/folders/2w/r9qm37r12qs4xn3sjn4cv2ym0000gn/T/tmp.kAPVA2p8JR/2) using deprecated (<=0.0.7) format.
error: Found argument '{}' which wasn't expected, or isn't valid in this context

Usage: nix-editor [OPTIONS] <FILE> <ATTRIBUTE>

For more information try '--help'
> EDITOR=vim /usr/local/bin/flox edit
Updating /Users/matthew/.config/flox/nix.conf
warning: ignoring untrusted substituter 'https://cache.floxdev.com'
warning: ignoring untrusted substituter 'https://cache.floxdev.com'
warning: ignoring untrusted substituter 'https://cache.floxdev.com'
warning: ignoring untrusted substituter 'https://cache.floxdev.com'
warning: ignoring untrusted substituter 'https://cache.floxdev.com'
warning: ignoring untrusted substituter 'https://cache.floxdev.com'
warning: ignoring untrusted substituter 'https://cache.floxdev.com'
warning: ignoring untrusted substituter 'https://cache.floxdev.com'
warning: ignoring untrusted substituter 'https://cache.floxdev.com'
warning: ignoring untrusted substituter 'https://cache.floxdev.com'
warning: ignoring untrusted substituter 'https://cache.floxdev.com'
warning: ignoring untrusted substituter 'https://cache.floxdev.com'
created generation 5
> flox upgrade                       
Updating /Users/matthew/.config/flox/nix.conf
floxmeta repository (/var/folders/2w/r9qm37r12qs4xn3sjn4cv2ym0000gn/T/tmp.K5GcFqlVzM/5) using deprecated (<=0.0.7) format.
warning: ignoring untrusted substituter 'https://cache.floxdev.com'
warning: ignoring untrusted substituter 'https://cache.floxdev.com'
warning: ssh://git@github.com/flox/nixpkgs-flox
warning: ssh://git@github.com/flox/nixpkgs-flox
warning: ssh://git@github.com/flox/nixpkgs-flox
warning: ssh://git@github.com/flox/nixpkgs-flox
warning: ssh://git@github.com/flox/nixpkgs-flox
warning: ssh://git@github.com/flox/nixpkgs-flox
warning: ssh://git@github.com/flox/nixpkgs-flox
warning: ssh://git@github.com/flox/nixpkgs-flox
warning: ssh://git@github.com/flox/nixpkgs-flox
warning: ssh://git@github.com/flox/nixpkgs-flox
warning: ssh://git@github.com/flox/nixpkgs-flox
warning: ssh://git@github.com/flox/nixpkgs-flox
warning: ssh://git@github.com/flox/nixpkgs-flox
warning: ssh://git@github.com/flox/nixpkgs-flox
warning: ssh://git@github.com/flox/nixpkgs-flox
warning: ssh://git@github.com/flox/nixpkgs-flox
warning: ssh://git@github.com/flox/nixpkgs-flox
warning: ssh://git@github.com/flox/nixpkgs-flox
warning: ssh://git@github.com/flox/nixpkgs-flox
warning: ignoring untrusted substituter 'https://cache.floxdev.com'
created generation 6
Conversion complete. Please re-run command.

I guess it all depends on the flox version.

At the moment I have

○ flox --version                                                                                                                                                                                                                                                                                                                                                    default
Version: 0.0.7-r92

and

○ /usr/local/bin/flox --version                                                                                                                                                                                                                                                                                                                                     default
Version: 0.0.7-r76

The first one tells me that No environment changes detected .. exiting after I edit and the second one failed with a few

       response body:

       {
         "message": "Not Found",
         "documentation_url": "https://docs.github.com/rest/commits/commits#get-a-commit"
# This is a prototype profile declarative manifest in TOML format,
       }; using cached version
warning: ignoring untrusted substituter 'https://cache.floxdev.com'
warning: error: unable to download 'https://api.github.com/repos/flox/nixpkgs-flox/commits/master': HTTP error 404

and now returns the same thing as the first one.

Maybe I should reinstall flox from the mac installer and then edit?

For me

> /usr/local/bin/flox --version
Version: 0.0.7-r84

so maybe installing would work.

Another workaround to try (not sure if it will work) would be adding or removing a package at the same time as the alias change to see if that avoids the No environment changes detected bug

Good idea. I tried to change a package during the editing and got:

remote: error: refusing to update checked out branch: refs/heads/x86_64-darwin.default
remote: error: By default, updating the current branch in a non-bare repository
remote: is denied, because it will make the index and work tree inconsistent
remote: with what you pushed, and will require 'git reset --hard' to match
remote: the work tree to HEAD.
remote:
remote: You can set the 'receive.denyCurrentBranch' configuration variable
remote: to 'ignore' or 'warn' in the remote repository to allow pushing into
remote: its current branch; however, this is not recommended unless you
remote: arranged to update its work tree to match what you pushed in some
remote: other way.
remote:
remote: To squelch this message and still keep the default behaviour, set
remote: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To /Users/etorreborre/.cache/flox/meta/etorreborre
 ! [remote rejected] x86_64-darwin.default -> x86_64-darwin.default (branch is currently checked out)
error: failed to push some refs to '/Users/etorreborre/.cache/flox/meta/etorreborre'

Then I tried to add a new generation manually (I’m probably not supposed to do that :-)) and then try to edit with the most recent flox version. That led me to accept the 0.7.0 to 0.8.0 format migration but then I ended up having the same git issue above. Any idea on how to fix that one?

Yikes :open_mouth: What do you get with a flox git status?

I get

○ flox git status                                                                                                                                                                                                                                                                                                                                                   default
Updating /Users/etorreborre/.config/flox/nix.conf
Updating /Users/etorreborre/.config/flox/gitconfig
On branch x86_64-darwin.default
nothing to commit, working tree clean

I’m a little lost about the failure, but you could try flox git checkout floxmain and then try again

1 Like