Hi,
I am trying to transition my /etc/nixos/configuration.nix to a flake-based setup. I have been following these two guides:
https://nixos.wiki/wiki/Flakes
I am simply trying to take my existing configuration.nix that works and try it with a flake. Here is my flake in /etc/nixos/flake.nix
{
description = "flake for yourHostNameGoesHere";
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
outputs = { self, nixpkgs, ... }: {
nixosConfigurations."foobar" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
];
};
};
}
When I try to run the rebuild command, I get some strange errors I cannot decipher:
[root@nixos:/etc/nixos]# nixos-rebuild switch --flake '.#foobar'
error:
… while updating the lock file of flake 'path:/etc/nixos?lastModified=1704487271&narHash=sha256-IlRuxHOZE1vr%2BeYpWqlE32PpNoIMMeaBXHuxQDmXGeA%3D'
… while updating the flake input 'nixpkgs'
… while fetching the input 'github:NixOS/nixpkgs/nixos-unstable'
error: failed to extract archive (Write failed)
I had found another topic to try build but getting same error
[root@nixos:/etc/nixos]# nix build -vvv '.#nixosConfigurations.foobar.config.system.build.toplevel'
evaluating derivation 'path:/etc/nixos#nixosConfigurations.foobar.config.system.build.toplevel'...
copying '/etc/nixos'...
linking '/nix/store/9lc4bryry5hwh35rp7fcvwaqqpz1330j-source/configuration.nix' to '/nix/store/.links/1g3aza31ackyclcnvf88xcc5z8pq152pf8n0v7h1y196vcgpd3ws'
linking '/nix/store/9lc4bryry5hwh35rp7fcvwaqqpz1330j-source/hardware-configuration.nix' to '/nix/store/.links/1p53bhsq5jmqncbfbz21z84b0mpmvrmlpqay3mdkz70pj3x9wqz9'
linking '/nix/store/9lc4bryry5hwh35rp7fcvwaqqpz1330j-source/disko-config.nix' to '/nix/store/.links/1pf87csmizvdssh688g6d613qzjc4q15z7wz081hmxsivwgvc18q'
evaluating file '/nix/store/9lc4bryry5hwh35rp7fcvwaqqpz1330j-source/flake.nix'
error:
… while updating the lock file of flake 'path:/etc/nixos?lastModified=1704487271&narHash=sha256-IlRuxHOZE1vr%2BeYpWqlE32PpNoIMMeaBXHuxQDmXGeA%3D'
… while updating the flake input 'nixpkgs'
… while fetching the input 'github:NixOS/nixpkgs/nixos-unstable'
error: failed to extract archive (Write failed)
Some other topics mentioned disk space being a culprit but I have plenty and / and /tmp.
[root@nixos:/etc/nixos]# ls -l /etc/nixos
total 20
-rw-r--r-- 1 root root 6338 Dec 26 11:34 configuration.nix
-rw-r--r-- 1 root root 857 Dec 22 09:41 disko-config.nix
-rw-r--r-- 1 root root 324 Jan 5 15:41 flake.nix
-rw-r--r-- 1 root root 1138 Dec 22 16:32 hardware-configuration.nix
[root@nixos:/etc/nixos]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 1.6G 0 1.6G 0% /dev
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 7.8G 6.6M 7.8G 1% /run
tmpfs 16G 960K 16G 1% /run/wrappers
/dev/disk/by-partlabel/disk-vdb-root 916G 3.8G 866G 1% /
none 200M 0 200M 0% /tmp
/dev/nvme0n1p1 500M 27M 474M 6% /boot
tmpfs 3.2G 4.0K 3.2G 1% /run/user/1000
Thanks for any help