mirror of
https://github.com/davegallant/nix-config
synced 2025-08-06 03:13:38 +00:00
Add nix-ld and fix for vscode remote wsl extension
This commit is contained in:
3
Makefile
3
Makefile
@@ -8,7 +8,8 @@ HOSTNAME ?= $(shell hostname)
|
||||
UNAME_S := $(shell uname -s)
|
||||
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
SWITCH_CMD := nixos-rebuild --use-remote-sudo -I nixos-config="machines/$(HOSTNAME)/configuration.nix" switch --flake '.\#'
|
||||
SWITCH_CMD := nixos-rebuild --use-remote-sudo -I nixos-config="machines/$(HOSTNAME)/configuration.nix" switch --flake '.\#' \
|
||||
--impure # Impure because of: https://discourse.nixos.org/t/vscode-remote-wsl-extension-works-on-nixos-without-patching-thanks-to-nix-ld/14615
|
||||
endif
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
SWITCH_CMD := exec darwin-rebuild switch --flake .
|
||||
|
52
flake.lock
generated
52
flake.lock
generated
@@ -116,6 +116,25 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-ld": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"utils": "utils_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1652641841,
|
||||
"narHash": "sha256-TTBz20XR2vmvOSDu8hXcbHbOEI0t/IWq8vZuRKyep1E=",
|
||||
"owner": "Mic92",
|
||||
"repo": "nix-ld",
|
||||
"rev": "c25cc4b5ec65f03c2bb96f927ae724a59c51d7ee",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Mic92",
|
||||
"repo": "nix-ld",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos-hardware": {
|
||||
"locked": {
|
||||
"lastModified": 1658401027,
|
||||
@@ -149,6 +168,21 @@
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1652536154,
|
||||
"narHash": "sha256-d+y62beDhz2/l65SBAkxwtvTBzw3hgU1kECogyncKYM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ddfb78791c95019d3d102d9dcb2631112ca7661f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1658380158,
|
||||
"narHash": "sha256-DBunkegKWlxPZiOcw3/SNIFg93amkdGIy2g0y/jDpHg=",
|
||||
@@ -169,8 +203,9 @@
|
||||
"darwin": "darwin",
|
||||
"home-manager": "home-manager",
|
||||
"neovim-nightly-overlay": "neovim-nightly-overlay",
|
||||
"nix-ld": "nix-ld",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
"nixpkgs": "nixpkgs_3"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
@@ -187,6 +222,21 @@
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1652372896,
|
||||
"narHash": "sha256-lURGussfF3mGrFPQT3zgW7+RC0pBhbHzco0C7I+ilow=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "0d347c56f6f41de822a4f4c7ff5072f3382db121",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
@@ -13,6 +13,8 @@
|
||||
|
||||
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
|
||||
|
||||
nix-ld.url = "github:Mic92/nix-ld";
|
||||
|
||||
darwin = {
|
||||
url = "github:lnl7/nix-darwin";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
@@ -25,6 +27,7 @@
|
||||
home-manager,
|
||||
nixpkgs,
|
||||
nixos-hardware,
|
||||
nix-ld,
|
||||
...
|
||||
} @ inputs: {
|
||||
nixosConfigurations = let
|
||||
@@ -95,6 +98,7 @@
|
||||
modules =
|
||||
[
|
||||
./machines/aether/configuration.nix
|
||||
nix-ld.nixosModules.nix-ld
|
||||
]
|
||||
++ defaultModules;
|
||||
};
|
||||
|
@@ -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;
|
||||
};
|
||||
}
|
@@ -21,6 +21,7 @@ in {
|
||||
unzip
|
||||
viddy
|
||||
xclip
|
||||
wget
|
||||
xdg_utils
|
||||
yq-go
|
||||
zip
|
||||
|
Reference in New Issue
Block a user