[–] 4 points 10 months ago* (last edited 10 months ago)

That could've used an example of debugging recursion to show how useful the repl is. I knew about the repl and have used it to find duplicate packages for example, but what it doesn't help with is finding out how stuff was added to environment.systemPackages and, most importantly, why.

The most glaring omission in nix is the lack of a debugger with conditional breakpoints. Nix is interpreted, is it not? Shouldn't it be possible to have breakpoints?

  • source
  • [–] 1 point 10 months ago

    the first issue is familiar to me as my first laptop had this issue, while running Windows XP. the fans were going out and simply couldn’t move enough heat. the solution then that mostly worked was one of those laptop stands with fans built in. it worked most of the time, but a real solution might mean cleaning out the chassis and maybe replacing the fans.

    for the second, i didn’t really have trouble setting up the Nvidia drivers just following the docs. sorry if that isn’t helpful; i’m stuck with Nvidia for my ML/CUDA stuff.

  • source
  • [–] 2 points 10 months ago (1 child)

    It's complex, because it does a lot of things, and it evolved over the past few years. The basics are very, very simple:

    #+begin_src nix :tangle out/flake.nix :noweb no-export :noweb-prefix no :mkdirp t
    {
      inputs = {
        <<flake-inputs>>
      };
    
      outputs = { self, nixpkgs, ... }@inputs: {
        <<flake-outputs>>
      };
    }
    #+end_src
    

    In some other file, you can then do:

    #+begin_src nix :noweb-ref flake-inputs
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
    #+end_src
    

    And voila, you now have:

    {
      inputs = {
        nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
      };
    
      // ...rest of the flake
    }
    

    How you organize your org documents, is entirely up to you. The trick is that this lets you split it up as you see fit, and you are no longer restricted by what the language or any framework built on top of it can provide.

  • source
  • parent
  • context
  • [–] [S] 1 point 10 months ago (2 children)

    o thanks, i'll take a closer look but for what i've seen so far it kinda looks complex I also flake-part mentioned in some of the commits,i remember seeing it a few times and apparently it can modularize flakes or sum like that, can it modularize inputs too outta curiosity

  • source
  • parent
  • context
  • [–] 3 points 10 months ago (5 children)

    The way I solved this problem is that I write my flake.nix in a literate-programming style using Org Roam. I have a code block that tangles out into out/flake.nix, which has a <<flake-inputs>> placeholder. I can have any number of code blocks, in any number of Org files that all reference flake-inputs. Thus, my inputs are near other code (& documentation) that uses them, split across dozens of files.

    The downside is that you no longer write Nix directly, but have to tangle it out.

  • source
  • [–] [S] 2 points 10 months 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

  • source
  • parent
  • context
  • [–] 1 point 10 months ago* (1 child)

    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.

  • source
  • parent
  • context
  • [–] 2 points 10 months ago (1 child)

    One note about // is that it doesn't deep combine attribute sets, so if you set the .url in one and .inputs.nixpkgs.follows in another then it will only use the second one. I don't think that matters here but it's tripped me up before. I think lib.mkMerge is the deep recursive alternative.

  • source
  • parent
  • context
  • [–] 2 points 10 months ago* (last edited 10 months ago) (5 children)

    I think you can use import to load the expression from each file, and the // operator to combine imported attribute sets. Like this:

    Edit: This doesn't work - see replies

    # flake.nix
    {
      inputs =
        import ./inputs/nixpkgs.nix //
        import ./inputs/nix-index.nix;
    
      # ...
    }
    
    # inputs/nixpkgs.nix
    {
      nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
      nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
    }
    
    # inputs/nix-index.nix
    {
      nix-index-database = {
        url = "github:Mic92/nix-index-database";
        inputs.nixpkgs.follows = "nixpkgs";
      };
    }
    
  • source
  • [–] 4 points 10 months ago

    Hi! Welcome to the Nix community. You've made an unfortunate choice for your first package, because VPNs usually need to be integrated with system networking to function properly, and Nix without a daemon or NixOS is not able to do that. A distro has multiple pieces, including package management (putting executables and libraries onto your disk) and system configuration (interacting with the low-level hardware). Nix is a package manager; NixOS is Nix and also system configuration and some other stuff like booting.

    For the specific case of Mullavad, I found this community documentation:

    Warning: Mullvad VPN currently only works if systemd-resolved is enabled.

    All you need to know here is that systemd is part of the system configuration; systemd-resolved is part of how some Linux systems look up names. Nix's version of Mullavad VPN is only compatible with a specific NixOS configuration.

    Honestly, it's great to hear that the GUI and nix-env are working for you; those are things that often break on unusual targets. It sounds like the only thing that doesn't work is something which cannot work as installed.

  • source
  • [–] 1 point 11 months ago* (last edited 11 months ago)

    No, you are getting the correct Lutris derivation, but it seems like you can't override buildFHSEnv in this way (unlike a regular derivation) which is unfortunate. Looking at it again the package takes an extraLibraries parameter (but it's a function taking a pkgs argument and producing a list, not a bare list). In principle this should work:

    home.packages = with pkgs; [
      (lutris.override {
        extraLibraries = pkgs: [ # shadows the other pkgs!
          (pkgs.runCommand "steamrun-lib" { } ''
            mkdir "$out"
            ln -s "${pkgs.steam-run.fhsenv}"/usr/lib64 "$out"/lib
          '')
        ];
      })
    ];
    

    But it actually fails because both steam-run and lutris provide /usr/lib64/ld-linux.so.2 leading to a name collision. So unfortunately it seems the idea of just adding the steam-run env to Lutris doesn't quite work...

    You could instead try something like this:

    home.packages = with pkgs; [
      (lutris.override {
        extraLibraries = pkgs: with pkgs; [
          glibc
          libxcrypt
          libGL
          # ... other libs in steam-run.fhs but not in the lutris FHS env
        ];
      })
    ];
    

    Which library the problem game actually needs is anyone's guess. That information might show up somewhere in the logs, or maybe ldd could tell you... but the signal to noise ratio probably won't be very good.

  • source
  • parent
  • context
  • [–] [S] 1 point 11 months ago

    Ok well i was abt to get the logs and just realized that the one game i choosed to try is literally the only one who doesn't wanna work in lutris so far. I've tried a few more native linux games with lutris and they all work, ig lutris just hates this first game in particular, which oddly enoug works with steam-run.

    I suppose if i add the libraries from steam-run to lutris' fhs environment it'll work maybe Alsothe lutris logs does't say anythingi particular, just that the game closed too fast

  • source
  • parent
  • context
  • [–] [S] 2 points 11 months ago (1 child)

    returns this error

    error: attribute 'multiPkgs' missing
            at /nix/store/j9lcrp816krraglnjk6r8iacl6jvww87-source/nixos/modules/home/packages.nix:24:19:
                23|     (lutris.overrideAttrs (_: prevAttrs: {
                24|       multiPkgs = prevAttrs.multiPkgs ++ [
                  |                   ^
                25|         (pkgs.runCommand "steamrun-lib" { } ''
    

    if i were to guess maybe cuz multiPkgs is defined in fhsenv.nix in not in default.nix, could be wring tho im pretty new to nix packaging

  • source
  • parent
  • context
  • [–] [S] 1 point 11 months ago (2 children)

    Nope im not running them inside lutris, just thought if i had nix-ld enabled it'd work but apparently not

    I did check, "Disable Lutris runtime" is checked off and "Prefer system libraries" is checked on, still doesn't work and dies with an exit code 134

  • source
  • parent
  • context
  • view more: ‹ prev next ›