Nix Flake: Path does not exist, even though everything is tracked in git

So I have encountered something strange with NixOS. I have my config in a flake, in git, and I have git added and git commit and git pushed everything, and yet, when I run

nixos-rebuild switch --use-remote-sudo --flake path:///home/wilnil/Code/dotfiles/nixos#thinkwillardthink

or

nixos-rebuild switch --use-remote-sudo --flake ~/Code/dotfiles/nixos

I get this error, which according to the internet…

…is because I am not tracking everything in git, but I am. This happened the other week, at first, with another file I added to the flake, then mysteriously stopped. Now, I am trying to change that file name (willard-sway.nix → desktop-sway.nix) and add a new file (vpn-wireguard.nix), and the error is back.

error:
       … while calling the 'seq' builtin
         at /nix/store/ka13k2zhk09q32ip9aidyd20v48g90jk-source/lib/modules.nix:359:18:
          358|         options = checked options;
          359|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          360|         _module = checked (config._module);

       … while evaluating a branch condition
         at /nix/store/ka13k2zhk09q32ip9aidyd20v48g90jk-source/lib/modules.nix:295:9:
          294|       checkUnmatched =
          295|         if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [ ] then
             |         ^
          296|           let

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: path '/nix/store/rw1rbl3izwi81qf8ps5c0g7a51lkz4f1-source/destop-sway.nix' does not exist

Here’s my config, if anyone could take a look and let me know what I am doing wrong, that would be much appreciated!

flake.nix

{
  description = "Willard's sick laptop config";

  inputs = {
    # NixOS official package source, using the nixos-25.05 branch here
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";

    disko.url = "github:nix-community/disko/latest";
    disko.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = { self, disko, nixpkgs, ... }@inputs: {
    # Please replace my-nixos with your hostname
    nixosConfigurations.thinkwillardthink = nixpkgs.lib.nixosSystem {
      modules = [
        disko.nixosModules.disko
        ./configuration.nix
        ./hardware-configuration.nix
        ./luks-btrfs-subvolumes.nix
        ./desktop-sway.nix
        ./vpn-wireguard.nix
      ];
    };
  };
}

vpn-wireguard.nix

{ config, pkgs, lib, ... }:
{
  # environment.systemPackages = with pkgs; [];
  networking.wg-quick.interfaces.nycmesh0.configFile = "/etc/nixos/files/wireguard/nycmesh0.conf";
  networking.wg-quick.interfaces.wgal0.configFile = "/etc/nixos/files/wireguard/wgal0.conf";
}

Links if they are helpful:

Error says “destop-sway”, your snippet says “desktop-sway”, guessing you’ve a spelling error somewhere.

https://github.com/WillNilges/dotfiles/pull/8/files#diff-b963c2ae3f7246bf0d8c80ddf4ece5b778908fc48d7fa9b104fcc2b727cf0138R14

1 Like

It’s always the simplest things. Thanks so much, that was it :smile: :+1:

There was a typo in nixos/configuration.nix. Added everything to git, and it works now!