Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos module #31

Merged
merged 2 commits into from
Dec 18, 2022
Merged

nixos module #31

merged 2 commits into from
Dec 18, 2022

Conversation

Mic92
Copy link
Owner

@Mic92 Mic92 commented Nov 4, 2022

No description provided.

@VanCoding
Copy link

VanCoding commented Nov 4, 2022

@Mic92 whoa, that was quick!

I came up with the following today:

# nix-ld.nix
{config, lib, pkgs, ...}:{
  programs.nix-ld.enable = true;
  environment.variables = {
      NIX_LD_LIBRARY_PATH = lib.makeLibraryPath (config.systemd.packages ++ config.environment.systemPackages);
      NIX_LD = "${pkgs.glibc}/lib/ld-linux-x86-64.so.2";
  };
}

I don't know excatly how the module system works, but my assumption was that for systemd.packages and environment.systemPackages to contain all configured packages, it would have to run at the very last, even after the main configuration.nix file. So in the system configuration flake, I'd import the above module after configuration.nix file like so:

{
  description = "My NixOS configuration";
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  };
  outputs = {self,nixpkgs, }:{
    nixosConfigurations.my-machine = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
         ./configuration.nix
         ./nix-ld.nix
      ];
      specialArgs = { inherit nixpkgs; };
    };
  };
}

But I couldn't login to gnome after this 😓 and I discarded it. But it'd still be cool, if nix-ld would somehow detect all the libraries that are installed on the system anyway and make them available. Having a list of "common" libs is probably the better idea, but it also means that there will be stuff installed that's probably not needed.

@Mic92
Copy link
Owner Author

Mic92 commented Nov 4, 2022

I think I would probably in the beginning just leave it to the user what libraries to install since everyone needs something else. Discovering all libraries sounds tricky - it would likely cause conflicts and its unclear which library should be preferred in this case.

Copy link

@Quoteme Quoteme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In line 8 you added a closing brace which never got opened, it seems

@Mic92 Mic92 changed the title wip nixos module nixos module Dec 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants