-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnix-ld-config.nix
39 lines (39 loc) · 1.1 KB
/
nix-ld-config.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.nix-ld-config;
ldEnv = {
NIX_LD_LIBRARY_PATH = with pkgs; makeLibraryPath [
stdenv.cc.cc
];
NIX_LD = removeSuffix "\n" (builtins.readFile "${pkgs.stdenv.cc}/nix-support/dynamic-linker");
};
ldExports = mapAttrsToList (name: value: "export ${name}=${value}") ldEnv;
joinedLdExports = concatStringsSep "\n" ldExports;
in
{
options.nix-ld-config = {
enable = mkEnableOption "nix-ld config module";
user = mkOption {
type = types.str;
description = "The name of user you want to configure for using VSCode's Remote WSL extension.";
default = "nixos";
};
};
config = mkIf cfg.enable {
environment.variables = ldEnv;
home-manager.users.${cfg.user}.home.file.".vscode-server/server-env-setup".text = joinedLdExports;
};
}
{
imports = [
"${modulesPath}/profiles/minimal.nix" # This one is already there when you install NixOS
<nix-ld/modules/nix-ld.nix>
<home-manager/nixos>
./nix-ld-config.nix
];
environment.systemPackages = with pkgs; [
wget
];
nix-ld-config.enable = true;
}