mirror of
https://github.com/davegallant/nix-config
synced 2025-08-07 00:58:16 +00:00
Add nix-ld and fix for vscode remote wsl extension
This commit is contained in:
@@ -10,10 +10,13 @@ with lib; let
|
||||
in {
|
||||
imports = [
|
||||
"${modulesPath}/profiles/minimal.nix"
|
||||
./nix-ld-config.nix
|
||||
|
||||
nixos-wsl.nixosModules.wsl
|
||||
];
|
||||
|
||||
nix-ld-config.enable = true;
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
system.stateVersion = "unstable";
|
||||
|
31
machines/aether/nix-ld-config.nix
Normal file
31
machines/aether/nix-ld-config.nix
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
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 = "dave";
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
environment.variables = ldEnv;
|
||||
home-manager.users.${cfg.user}.home.file.".vscode-server/server-env-setup".text = joinedLdExports;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user