!tDnwWRNkmmYtMXfaZl:nixos.org

Nix Language

1670 Members
Nix programming language303 Servers

Load older messages


SenderMessageTime
1 May 2025
@drupol:matrix.orgPolI'm looking for some help. I'm trying to do this: https://gist.github.com/drupol/15146d0b2d4eff11473a5db0caf2315518:01:16
@drupol:matrix.orgPol

I have found this:

  mergedUsers = lib.foldl lib.recursiveUpdate {} (map (m: m.users.users or {}) (builtins.attrValues modules));

But the list are not merged together. Do you suggest something better?

18:17:43
@rosariopulella:matrix.orgrosariopulella changed their display name from Rosario Pulella to Rosuavio.20:09:29
@piegames:flausch.socialpiegames You could maybe try to hack something around evalModules 20:17:52
@mattsturg:matrix.orgMatt Sturgeon

In that example, you want to merge multiple modules into home-manager.users, which sounds like you're already using the module system.

If you, you can simply define home-manager.users multiple times, and the module system will do the merging for you.

The only work you need to do is to extract the data at the attrpath *.users.users.

Something like:

let
  userModules = {
    module1 = {
      users.users = {
        pol = {
          attr1 = "attr1";
          list = [ "a" "b" ];
        };
        baz = {
          attr2 = "attr2";
          list = [ "c" "d" ];
        };
      };
    };
    module2 = {
      users.users = {
        pol = {
          attr2 = "attr2";
          list = [ "c" "d" ];
        };
      };
    };
    module3 = {
      users.users = {
        baz = {
          attr1 = "attr1";
          list = [ "a" "b" ];
        };
      };
    };
  };

  homeManagerUserDefs =
    lib.mapAttrsToList
      (_: value: value.users.users)
      userModules;
in
{
  home-manager.users = lib.mkMerge homeManagerUserDefs;
}
21:13:31
2 May 2025
@realhotgirlshit:envs.netrocky (she/they) 🏳️‍⚧️ Hello everybody!

I want to create a Nix development environment flake for Rust. For tools that are accessed by my editor (Emacs), such as rust-analyzer and clippy, should I keep those outside of the flake somehow?
02:51:03
@uep:matrix.orguep"it depends" :-)02:55:32
@uep:matrix.orguepYou might want some project specfic sets of tools, like the LSP, that's only used with that project.. maybe a relevant pinned version matching the compiler version, etc. Or maybe you only want the Rust LSP when working on a Rust project, and you have another for Python or whatever else in other projects. In that case, having your entire project setup in the project flake is helpful. You would enter the project directory / devshell, and then start the editor in that environment. One good thing about that is then you can have that same editor environment on any host, nixos or not.02:57:49
@uep:matrix.orguepOr you might think of the editor more as part of your user and desktop environment, that you want working the same for any directory. This is especially true if you tend to have a long-running emacs session, and use emacsclient to edit specific files. In that case, you want it outside the project and managed by your system or home-manager config02:59:17
@uep:matrix.orguepHere's a recent post on the topic with some suggestions: https://discourse.nixos.org/t/how-to-run-a-command-in-a-running-nix-shell-from-outside/63595/7?u=uep03:03:08
@drupol:matrix.orgPolThank you, going to try !06:29:13
@drupol:matrix.orgPolI tried, without luck so far, here's the issue I have: https://matrix.to/#/!gcrYWdPsIUOFpXFDHB:matrix.org/$fQDQSwXfnSWd6bL9fpOnpz5ir57hBqBlqr35Rf7I_0c?via=matrix.org&via=goblin.sh&via=nixos.dev13:21:13
4 May 2025
@dolcetriade:matrix.orgDolceTriade I'm trying to create a wrapped version of lld so that the Nix magic works for dynamically linked libraries. I'm trying to modify this snippet: https://github.com/NixOS/nixpkgs/issues/24744#issuecomment-2094118403 to work for me, but it's unclear how to get the "path" (ie, the path to nixpkgs. I've tried something like ${<nixpkgs/foo>}, but that does not seem to match the nixpkgs in my flake. How do I get this path? 05:07:33
@dolcetriade:matrix.orgDolceTriade * I'm trying to create a wrapped version of lld so that the Nix magic works for dynamically linked libraries. I'm trying to modify this snippet: https://github.com/NixOS/nixpkgs/issues/24744#issuecomment-2094118403 to work for me, but it's unclear how to get the "path" (ie, the path to nixpkgs. I've tried something like ${<nixpkgs/foo>}, but that does not seem to match the nixpkgs in my flake (maybe it's the nixpkgs in my channels or something?). How do I get this path? 05:07:58
@dolcetriade:matrix.orgDolceTriade Or better yet, given pkgs that I got from doing something like pkgs = import <nixpkgs> {}, how do I get the store path of that <nixpkgs> 05:14:38
@piegames:flausch.socialpiegamespkgs.path05:15:38
@piegames:flausch.socialpiegamesOr better, builtins.storePath pkgs.path05:15:55
@dolcetriade:matrix.orgDolceTriadeOh wow, that works!!05:22:24
@dolcetriade:matrix.orgDolceTriadeThanks so much!05:22:26
@djacu:matrix.orgdjacu
In reply to @piegames:flausch.social
Or better, builtins.storePath pkgs.path
Why is this one better?
15:49:52
@piegames:flausch.socialpiegamesIn the case where pkgs.path points into the store, it won't copy it into the store twice16:46:15
5 May 2025
@edsoncsouza:matrix.orgEdson C. Souza left the room.09:40:04
@googleson78:tryp.iogoogleson78 left the room.15:00:17
@federicodschonborn:matrix.orgThis LEGO® Worm™ is licensed under the terms of the he/him or they/them pronouns, at your choice changed their display name from This legally distinct plastic brick is licensed under the terms of the he/him or they/them pronouns, at your choice to This LEGO© Worm™ is licensed under the terms of the he/him or they/them pronouns, at your choice.20:48:11
6 May 2025
@federicodschonborn:matrix.orgThis LEGO® Worm™ is licensed under the terms of the he/him or they/them pronouns, at your choice changed their display name from This LEGO© Worm™ is licensed under the terms of the he/him or they/them pronouns, at your choice to This LEGO® Worm™ is licensed under the terms of the he/him or they/them pronouns, at your choice.09:12:26
7 May 2025
@wimpress:matrix.orgWimpy changed their profile picture.15:11:41
8 May 2025
@isabel:isabelroses.comisabel changed their profile picture.08:58:21
@98765abc:mozilla.org98765abc changed their profile picture.11:35:19
@goerp:matrix.orggoerp left the room.16:53:38
@wimpress:matrix.orgWimpy left the room.19:20:39

Show newer messages


Back to Room ListRoom Version: 6