I’m starting to have a lot of flake inputs in my flake.nix file, and it’s starting to get really cluttered. I’m wondering if there’s a way to separate my inputs into multiple files so it looks cleaner. I’ve tried to look it up but couldn’t really find anything abt it

Edit: Well as it turns out it’s not something possible yet, apparently the flake.nix file isn’t parsed like regular nix files and doesn’t support stuff like import

  • claymorwan@lemmy.blahaj.zoneOP
    link
    fedilink
    English
    arrow-up
    2
    ·
    8 days ago

    I followed how u did it but it doesn’t seem to work, i keep getting hit with this error:

    error: expected a set but got a thunk at /home/claymorwan/.dotfiles/NixOS/flake.nix:4:3
    
    • hallettj@leminal.space
      link
      fedilink
      English
      arrow-up
      1
      ·
      8 days ago

      Whoops! Guess I was wrong. After some experimenting it looks like the flake system parses, but does not evaluate flake.nix to read inputs. I also experimented with string concatenation, and that failed with the same error:

      nixpkgs.url = "github:nixos/nixpkgs" ++ "/nixos-25.05"; # error: expected a string or path, but got a thunk
      

      A “thunk” is an expression whose evaluation has been delayed. It’s a key piece of lazy evaluation. Remember that every expression in Nix is lazily evaluated.

      It looks only literal attribute set, string, and path expressions will work in inputs. I think that means it is not possible to split inputs over multiple files.

      • claymorwan@lemmy.blahaj.zoneOP
        link
        fedilink
        English
        arrow-up
        2
        ·
        8 days ago

        yea i think it may just not be possible yet, looking it up more i’ve seen people talking abt how a big con of flakes is that flake.nix is not parsed like regular nix files. I’m not sure why they made it work like that but it gets changed eventually cuz that’s really too bad we can’t do things as simple as imports