Hello,
I recently rewrote all my nixos configuration to modularize it completely.
It worked pretty well and I’m quite happy with the final structure of my flake.
BUT (yes there is always a but), I just encounter some problems when rebuilding after modifying config files included in my flake.
Example: Here is a module of my flake that manage the i3 configuration:
{ config, lib, pkgs, ... }:
{
home.packages = with pkgs; [
feh
picom
imagemagick
graphicsmagick
flameshot
];
home.file.".config/background.png".source = ./background.png;
home.file.".config/i3/config".source = lib.mkDefault ./config;
home.file.".config/i3/locker.sh".source = ./locker.sh;
services.picom = {
enable = true;
menuOpacity = 1.0;
activeOpacity = 1.0;
inactiveOpacity = 0.75;
};
# More stuff, irrelevant for the problem ...
}
I just added flameshot to the home.packages variable, and I modified the ./config file to run flameshot at startup.
Then I rebuilt my system and rebooted. Flameshot is now correctly installed but the config file linked in my home/.config/i3 folder is still the previous one, without the line I added.
This makes me question about when a file is copied from a flake source to the nix store ?
I tried to change lib.mkDefault to lib.mkForce, just to test what would be the result and now the flake won’t run at all, complaining as follows:
error: The option `home-manager.users.jm445.home.file.".config/i3/config".source' has conflicting definition values:
- In `/nix/store/22a729pbwaxx0pmy3396m2057drba60s-source/flake.nix': /nix/store/982bi3rhnjmr091yzjh8154q5887qj52-source/home/nuc-fr/config
- In `/nix/store/982bi3rhnjmr091yzjh8154q5887qj52-source/home/common-i3/common-i3.nix': /nix/store/982bi3rhnjmr091yzjh8154q5887qj52-source/home/common-i3/config
This makes no sense to me, it seems complaining about file being different from itself ???
What is the notion I misunderstood with flakes ? I don’t understand why files are not updated when I change them.
Thank’s for help,
JM