Description
I am on Windows 10 and I want to write some Agda code.
The HoTT Game recommends that I install NixOS on WSL2 and run Agda there.
So I installed NioOS using wsl --import NixOS .\NixOS\ nixos-wsl.tar.gz --version 2
as described in NixOS-WSL.
Now, the current version of NixOS-WSL does not support VS Code out of the box (issue here), so I used this flake to fix that, as recommended in the issue.
That means that my current configuration is as follows:
NixOS in WSL2 on Windows 10 with /etc/nixos/
containing:
flake.nix
:
{
description = "A configuration flake for WSL2 NixOS with VS Code";
inputs = {
nixos-wsl-vscode.url = "github:Atry/nixos-wsl-vscode";
};
outputs = { self, nixpkgs, nixos-wsl-vscode }: {
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
nixos-wsl-vscode.nixosModules.vscodeServerWsl
({ config, pkgs, ... }: {
# rest of your configuration
})
./configuration.nix
];
};
};
}
configuration.nix
:
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
# NixOS-WSL specific options are documented on the NixOS-WSL repository:
# https://github.com/nix-community/NixOS-WSL
{ config, lib, pkgs, ... }:
{
imports = [
];
wsl.enable = true;
wsl.defaultUser = "nixos";
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
}
Additionally, I have a project folder ~/agda-test
containing:
flake.nix
:
{
description = "An Agda shell";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.${system}.default =
pkgs.mkShell
{
buildInputs = [
(pkgs.agda.withPackages (ps: [
ps.standard-library
ps.cubical
]))
];
};
};
}
AgdaTest.agda
with some Agda code.
Now, in this folder (~/agda-test
) I run:
nix develop
code .
This opens the folder in VS Code in Windows, as intended.
I open AgdaTest.agda
in this VS Code instance, go C-c C-l
and it fails.
I initially got this error:
[Error - 8:09:49 AM] Server initialization failed.
Message: write EPIPE
Code: -32099
[Error - 8:09:49 AM] Agda Language Server client: couldn't create connection to server.
Message: write EPIPE
Code: -32099
/home/nixos/.vscode-server/data/User/globalStorage/banacorn.agda-mode/v0.2.6.4.0.3-linux/als: /home/nixos/.vscode-server/data/User/globalStorage/banacorn.agda-mode/v0.2.6.4.0.3-linux/als: cannot execute binary file
I tried doing chmod a+x als
, but this had no effect - the error persisted as it was despite the added permission, and I subsequently reversed that change.
Now, writing this issue, I restarted everything and seemingly spontaneously got a different error after C-c C-l
:
[Error - 8:52:12 AM] Agda Language Server client: couldn't create connection to server.
Launching server using command /home/nixos/.vscode-server/data/User/globalStorage/banacorn.agda-mode/v0.2.6.4.0.3-linux/als failed. Error: spawn /home/nixos/.vscode-server/data/User/globalStorage/banacorn.agda-mode/v0.2.6.4.0.3-linux/als EACCES