error: attribute 'formats' missing, at /nix/store/aikfplfczzsw1p7dv6h33f2s4w28139n-home-manager/home-manager/modules/programs/pet.nix:9:12
(use '--show-trace' to show detailed location information)
Seems this got introduced with the pet module. It is also failing for me
Here too.
Happens to me too, because I was cheating:
I'm on nixos 20.09 but using master version of home-manager channel, which I'm not supposed to do but it worked, until this pkgs.formats.toml.
Edit: Oh maybe that's not the reason.
If you get this error then you most likely using Home Manager master with Nixpkgs/NixOS 20.03. The pkgs.formats.toml function should be available in Nixpkgs 20.09 and master.
@anilanar You should not get this error with Nixpkgs 20.09, perhaps you are actually building your HM configuration with Nixpkgs 20.03?
My bad!
Fixed by using Home Manager with 20.03.
Thank you.
@rycee Nah, I mistyped the version. I'm on NixOS 20.03, thanks for clarification.
I have the same problem on MacOS with nixpkgs-unstable (with home-manager loaded as a nix-darwin module)
confirmed, using home-manager 20.03 worked for me
nix-channel --remove home-manager
nix-channel --add https://github.com/nix-community/home-manager/archive/release-20.03.tar.gz home-manager
nix-channel --update
home-manager switch
Ran into this issue while using flakes. I switched to the master branch because of the deprecation warning for bqv-flakes not realizing it wasn't compatible with 20.03.
I鈥檝e just run in this issue while trying to build a configuration using a NixOS 20.09 mirror with home-manager 20.09:
[jpc@helios]:/config/home-manager % sudo nix-channel --list
mirror file:///data/Mirroirs/nixpkgs/channel
nixos https://nixos.org/channels/nixos-20.03
nixpkgs-jpc https://github.com/ejpcmac/nixpkgs-jpc/archive/master.tar.gz
nixpkgs-mozilla https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz
[jpc@helios]:/config/home-manager % nix eval mirror.lib.version
"20.09.1500.edb26126d98"
[jpc@helios]:/config/home-manager % git rev-parse HEAD
abaebf3b346c4bef500c5bd2fdebbed109261a0c
[jpc@helios]:/config/home-manager % cd ../Nix/saturne
[jpc@helios]:/config/Nix/saturne % nix build -f '<mirror/nixos>' system --arg configuration ./configuration.nix
error: attribute 'formats' missing, at /config/home-manager/modules/programs/pet.nix:9:12
(use '--show-trace' to show detailed location information)
The machine on which I鈥檓 running this is still on NixOS 20.03, but as I use another channel to build the configuration, it should work, isn鈥檛 it?
@ejpcmac, most likely your <nixpkgs> is still pointing to Nixpkgs 20.03.
I'll close this issue since it is not an actual issue.
@rycee I'm not on NixOS (using home-manager on Ubuntu) and also not very experienced on Nix environments, but when I run the command below I see that my nixpkgs is not 20.03:
> nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
"20.09pre226586.571212eb839"
And when I switch to 20.09 for home manager via commands below, it fails:
> nix-channel --add https://github.com/nix-community/home-manager/archive/release-20.09.tar.gz home-manager
> nix-shell '<home-manager>' -A install
these derivations will be built:
/nix/store/mdw4s2nzcghzr17j8j0fqignwk97aa8f-home-manager.drv
building '/nix/store/mdw4s2nzcghzr17j8j0fqignwk97aa8f-home-manager.drv'...
install: creating directory '/nix/store/vg7nzh5540v25yvwnxi22cirsj89gg45-home-manager'
install: creating directory '/nix/store/vg7nzh5540v25yvwnxi22cirsj89gg45-home-manager/bin'
'/nix/store/cz8nfln7qw4y3v60pnbi37n5hrq44dxl-home-manager' -> '/nix/store/vg7nzh5540v25yvwnxi22cirsj89gg45-home-manager/bin/home-manager'
Creating initial Home Manager generation...
error: attribute 'formats' missing, at /nix/store/21zjzlk4f295f5lhdg46ikakk07mwj1q-home-manager-20.09/home-manager/modules/programs/pet.nix:9:12
(use '--show-trace' to show detailed location information)
There are 6 unread and relevant news items.
Read them by running the command 'home-manager news'.
Uh oh, the installation failed! Please create an issue at
https://github.com/nix-community/home-manager/issues
if the error seems to be the fault of Home Manager.
Is there somewhere else that I should look into for nixpkgs?
@korayal https://github.com/NixOS/nixpkgs/commit/571212eb839d482992adb05479b86eeb6a9c7b2f is from May 22 and the formats code was added on July 29. You will have to update your Nixpkgs channel to a non-pre version of 20.09.
looks like for some reason I had my ~/.nix-defexpr/channels_root chowned by root, and even though I had nixpkgs-unstable in my nix-channel --list, that specific channel_root was pointing to the pre version of 20.09, and was overriding the unstable version.
I am trying to upgrade to 20.09 so have my channel lists set as:
位 nix-channel --list
home-manager https://github.com/nix-community/home-manager/archive/release-20.09.tar.gz
nixpkgs-20.09-darwin https://nixos.org/channels/nixpkgs-20.09-darwin
and when I run home-manager switch I get the same error as being discussed here:
error: attribute 'formats' missing, at /Users/salar/.nix-defexpr/channels/home-manager/modules/programs/pet.nix:9:12
(use '--show-trace' to show detailed location information)
looking at what @korayal pointed out this what I get when i ls ~/.nix-defexpr/channels_root:
lrwxr-xr-x 60 root 31 Dec 1969 manifest.nix -> /nix/store/fm7z21j1vcgqsw5xksss8xw437jrzlfl-env-manifest.nix
lrwxr-xr-x 86 root 31 Dec 1969 nixpkgs -> /nix/store/3gd43sghpavkyvclwm9mz5bp7qz48f52-nixpkgs-20.09pre229671.9d0c3ffe678/nixpkgs
if I do ls /Users/salar/.nix-defexpr/channels:
lrwxr-xr-x 75 root 31 Dec 1969 home-manager -> /nix/store/isfyjpskyz19sb5a4apy4wmvqg92pjkl-home-manager-20.09/home-manager
lrwxr-xr-x 60 root 31 Dec 1969 manifest.nix -> /nix/store/wzixy09p0h6hymi7a7q6nrpbrbl2y9rq-env-manifest.nix
lrwxr-xr-x 112 root 31 Dec 1969 nixpkgs-20.09-darwin -> /nix/store/gb0va8lp1h9qasn6yxd6vbplh3dynsld-nixpkgs-20.09-darwin-20.09pre244447.7bcc7b6cd82/nixpkgs-20.09-darwin
any thoughts on how I fix my issue Also whats with the 1969 date :-) assume thats the modified year
Fixed my issues by doing the following steps:
rm -fr ~/.nix-defexpr/channels_root/nixpkgsnix-channel --remove nixpkgs-20.09-darwinnix-channel --add https://nixos.org/channels/nixpkgs-20.09-darwin nixpkgsnix-channel --updatehome-manager switch
Most helpful comment
confirmed, using home-manager
20.03worked for me