mirror of
https://github.com/davegallant/nix-config
synced 2025-08-06 11:23:40 +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)
|
UNAME_S := $(shell uname -s)
|
||||||
|
|
||||||
ifeq ($(UNAME_S),Linux)
|
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
|
endif
|
||||||
ifeq ($(UNAME_S),Darwin)
|
ifeq ($(UNAME_S),Darwin)
|
||||||
SWITCH_CMD := exec darwin-rebuild switch --flake .
|
SWITCH_CMD := exec darwin-rebuild switch --flake .
|
||||||
|
52
flake.lock
generated
52
flake.lock
generated
@@ -116,6 +116,25 @@
|
|||||||
"type": "github"
|
"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": {
|
"nixos-hardware": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1658401027,
|
"lastModified": 1658401027,
|
||||||
@@ -149,6 +168,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"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": {
|
"locked": {
|
||||||
"lastModified": 1658380158,
|
"lastModified": 1658380158,
|
||||||
"narHash": "sha256-DBunkegKWlxPZiOcw3/SNIFg93amkdGIy2g0y/jDpHg=",
|
"narHash": "sha256-DBunkegKWlxPZiOcw3/SNIFg93amkdGIy2g0y/jDpHg=",
|
||||||
@@ -169,8 +203,9 @@
|
|||||||
"darwin": "darwin",
|
"darwin": "darwin",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"neovim-nightly-overlay": "neovim-nightly-overlay",
|
"neovim-nightly-overlay": "neovim-nightly-overlay",
|
||||||
|
"nix-ld": "nix-ld",
|
||||||
"nixos-hardware": "nixos-hardware",
|
"nixos-hardware": "nixos-hardware",
|
||||||
"nixpkgs": "nixpkgs_2"
|
"nixpkgs": "nixpkgs_3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"utils": {
|
"utils": {
|
||||||
@@ -187,6 +222,21 @@
|
|||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"type": "github"
|
"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",
|
"root": "root",
|
||||||
|
@@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
|
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
|
||||||
|
|
||||||
|
nix-ld.url = "github:Mic92/nix-ld";
|
||||||
|
|
||||||
darwin = {
|
darwin = {
|
||||||
url = "github:lnl7/nix-darwin";
|
url = "github:lnl7/nix-darwin";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
@@ -25,6 +27,7 @@
|
|||||||
home-manager,
|
home-manager,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
nixos-hardware,
|
nixos-hardware,
|
||||||
|
nix-ld,
|
||||||
...
|
...
|
||||||
} @ inputs: {
|
} @ inputs: {
|
||||||
nixosConfigurations = let
|
nixosConfigurations = let
|
||||||
@@ -95,6 +98,7 @@
|
|||||||
modules =
|
modules =
|
||||||
[
|
[
|
||||||
./machines/aether/configuration.nix
|
./machines/aether/configuration.nix
|
||||||
|
nix-ld.nixosModules.nix-ld
|
||||||
]
|
]
|
||||||
++ defaultModules;
|
++ defaultModules;
|
||||||
};
|
};
|
||||||
|
@@ -10,10 +10,13 @@ with lib; let
|
|||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
"${modulesPath}/profiles/minimal.nix"
|
"${modulesPath}/profiles/minimal.nix"
|
||||||
|
./nix-ld-config.nix
|
||||||
|
|
||||||
nixos-wsl.nixosModules.wsl
|
nixos-wsl.nixosModules.wsl
|
||||||
];
|
];
|
||||||
|
|
||||||
|
nix-ld-config.enable = true;
|
||||||
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
system.stateVersion = "unstable";
|
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
|
unzip
|
||||||
viddy
|
viddy
|
||||||
xclip
|
xclip
|
||||||
|
wget
|
||||||
xdg_utils
|
xdg_utils
|
||||||
yq-go
|
yq-go
|
||||||
zip
|
zip
|
||||||
|
Reference in New Issue
Block a user