summaryrefslogtreecommitdiff
path: root/env
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2024-01-21 18:53:13 -0500
committerAndrew Opalach <andrew@akon.city> 2024-01-21 18:53:13 -0500
commitdd2036e23a1f800f13b821eaa862403de1aa17f0 (patch)
tree85f241c30364319e8cf41114c8ff361046a51567 /env
parent88ea5bdca85fc0954d1dd64309a308199c1af4a8 (diff)
downloadcamu-dd2036e23a1f800f13b821eaa862403de1aa17f0.tar.gz
camu-dd2036e23a1f800f13b821eaa862403de1aa17f0.tar.bz2
camu-dd2036e23a1f800f13b821eaa862403de1aa17f0.zip
Add files for wsl environment, small fixes
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'env')
-rwxr-xr-xenv/clang_cl_env.bat3
-rwxr-xr-xenv/msvc_env.bat3
-rwxr-xr-xenv/msys2_env.sh5
-rwxr-xr-xenv/set_al_env.sh4
-rwxr-xr-xenv/wsl/bootstrap-configuration.nix13
-rwxr-xr-xenv/wsl/flake.lock136
-rwxr-xr-xenv/wsl/flake.nix25
-rw-r--r--env/wsl/kitty_new_window.bat2
-rwxr-xr-xenv/wsl/repair.sh4
-rw-r--r--env/wsl/run_hidden.vbs24
-rw-r--r--env/wsl/settings.nix8
-rw-r--r--env/wsl/ssdog.nix20
-rwxr-xr-xenv/wsl/wsl-dev-host.nix183
13 files changed, 430 insertions, 0 deletions
diff --git a/env/clang_cl_env.bat b/env/clang_cl_env.bat
new file mode 100755
index 0000000..0950a4e
--- /dev/null
+++ b/env/clang_cl_env.bat
@@ -0,0 +1,3 @@
+set PATH=%PATH%;C:\msys64\usr\bin;Z:\camu\bin
+set CC=clang-cl
+set CXX=clang-cl
diff --git a/env/msvc_env.bat b/env/msvc_env.bat
new file mode 100755
index 0000000..ea41011
--- /dev/null
+++ b/env/msvc_env.bat
@@ -0,0 +1,3 @@
+set PATH=%PATH%;C:\msys64\usr\bin;Z:\camu\bin
+set CC=cl
+set CXX=cl
diff --git a/env/msys2_env.sh b/env/msys2_env.sh
new file mode 100755
index 0000000..ea88557
--- /dev/null
+++ b/env/msys2_env.sh
@@ -0,0 +1,5 @@
+export PATH="/c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/":"/c/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build":"/z/camu/bin":$PATH
+#export CC=cl
+#export CXX=cl
+export CC=clang
+export CXX=clang++
diff --git a/env/set_al_env.sh b/env/set_al_env.sh
new file mode 100755
index 0000000..2a17d11
--- /dev/null
+++ b/env/set_al_env.sh
@@ -0,0 +1,4 @@
+echo "Setting env using build-dir $1..."
+export LD_LIBRARY_PATH=$HOME/c/camu/$1/subprojects/libakiyo/subprojects/libalabaster
+export LIBRARY_PATH=$HOME/c/camu/$1/subprojects/libakiyo/subprojects/libalabaster
+export C_INCLUDE_PATH=$HOME/c/camu/subprojects/libakiyo/subprojects/libalabaster/include
diff --git a/env/wsl/bootstrap-configuration.nix b/env/wsl/bootstrap-configuration.nix
new file mode 100755
index 0000000..6439ba5
--- /dev/null
+++ b/env/wsl/bootstrap-configuration.nix
@@ -0,0 +1,13 @@
+{ config, lib, pkgs, ... }:
+{
+ imports = [ <nixos-wsl/modules> ];
+
+ wsl.enable = true;
+ wsl.defaultUser = "nixos";
+
+ nix.settings.experimental-features = [ "nix-command" "flakes" ];
+
+ environment.systemPackages = with pkgs; [ git ];
+
+ system.stateVersion = "23.05";
+}
diff --git a/env/wsl/flake.lock b/env/wsl/flake.lock
new file mode 100755
index 0000000..749d367
--- /dev/null
+++ b/env/wsl/flake.lock
@@ -0,0 +1,136 @@
+{
+ "nodes": {
+ "flake-compat": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1696426674,
+ "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
+ "type": "github"
+ },
+ "original": {
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "type": "github"
+ }
+ },
+ "flake-utils": {
+ "inputs": {
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1701680307,
+ "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "home-manager": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1705875991,
+ "narHash": "sha256-ssoo8WYXy4H0qQ81GhzOaMnvDmeXV02D4DdGOYRKCnU=",
+ "owner": "nix-community",
+ "repo": "home-manager",
+ "rev": "0021558dba313b6f494cd16362dcd4071f407535",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "ref": "master",
+ "repo": "home-manager",
+ "type": "github"
+ }
+ },
+ "nixos-wsl": {
+ "inputs": {
+ "flake-compat": "flake-compat",
+ "flake-utils": "flake-utils",
+ "nixpkgs": "nixpkgs"
+ },
+ "locked": {
+ "lastModified": 1705359964,
+ "narHash": "sha256-ys1MDjIH6z5UP7gAciRfUAlf2FJV0t3yFib965N/S+I=",
+ "owner": "nix-community",
+ "repo": "NixOS-WSL",
+ "rev": "bb3eeeb96ce059ae29309138874ccf58e796f4b1",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "ref": "main",
+ "repo": "NixOS-WSL",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1705183652,
+ "narHash": "sha256-rnfkyUH0x72oHfiSDhuCHDHg3gFgF+lF8zkkg5Zihsw=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "428544ae95eec077c7f823b422afae5f174dee4b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-23.11",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs_2": {
+ "locked": {
+ "lastModified": 1705677747,
+ "narHash": "sha256-eyM3okYtMgYDgmYukoUzrmuoY4xl4FUujnsv/P6I/zI=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "bbe7d8f876fbbe7c959c90ba2ae2852220573261",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "home-manager": "home-manager",
+ "nixos-wsl": "nixos-wsl",
+ "nixpkgs": "nixpkgs_2"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/env/wsl/flake.nix b/env/wsl/flake.nix
new file mode 100755
index 0000000..ca45951
--- /dev/null
+++ b/env/wsl/flake.nix
@@ -0,0 +1,25 @@
+{
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ home-manager = {
+ url = "github:nix-community/home-manager/master";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
+ };
+
+ outputs = { self, nixpkgs, home-manager, nixos-wsl }: {
+ nixosConfigurations.wsl-dev = nixpkgs.lib.nixosSystem {
+ system = "x86_64-linux";
+ modules = [
+ ({ pkgs, ... }: { nixpkgs.overlays = [ ]; })
+ home-manager.nixosModules.home-manager {
+ home-manager.useGlobalPkgs = true;
+ home-manager.useUserPackages = true;
+ }
+ nixos-wsl.nixosModules.wsl
+ ./wsl-dev-host.nix
+ ];
+ };
+ };
+}
diff --git a/env/wsl/kitty_new_window.bat b/env/wsl/kitty_new_window.bat
new file mode 100644
index 0000000..698137c
--- /dev/null
+++ b/env/wsl/kitty_new_window.bat
@@ -0,0 +1,2 @@
+@echo off
+wscript .\run_hidden.vbs wsl -- sh -c "cd ../..; nix develop .#wsl"
diff --git a/env/wsl/repair.sh b/env/wsl/repair.sh
new file mode 100755
index 0000000..610d7ff
--- /dev/null
+++ b/env/wsl/repair.sh
@@ -0,0 +1,4 @@
+#! /usr/bin/env sh
+sudo rm -rf /root/.cache/nix
+rm -rf $HOME/.cache/nix
+sudo nix-store --verify --check-contents --repair
diff --git a/env/wsl/run_hidden.vbs b/env/wsl/run_hidden.vbs
new file mode 100644
index 0000000..b891159
--- /dev/null
+++ b/env/wsl/run_hidden.vbs
@@ -0,0 +1,24 @@
+' https://stackoverflow.com/a/41229169
+' Simple command-line help.
+select case WScript.Arguments(0)
+case "-?", "/?", "-h", "--help"
+ WScript.echo "Usage: runHidden executable [...]" & vbNewLine & vbNewLine & "Runs the specified command hidden (without a visible window)."
+ WScript.Quit(0)
+end select
+
+' Separate the arguments into the executable name
+' and a single string containing all arguments.
+exe = WScript.Arguments(0)
+sep = ""
+for i = 1 to WScript.Arguments.Count -1
+ ' Enclose arguments in "..." to preserve their original partitioning, if necessary.
+ if Instr(WScript.Arguments(i), " ") > 0 then
+ args = args & sep & """" & WScript.Arguments(i) & """"
+ else
+ args = args & sep & WScript.Arguments(i)
+ end if
+ sep = " "
+next
+
+' Execute the command with its window *hidden* (0)
+WScript.CreateObject("Shell.Application").ShellExecute exe, args, "", "open", 0
diff --git a/env/wsl/settings.nix b/env/wsl/settings.nix
new file mode 100644
index 0000000..362ed1c
--- /dev/null
+++ b/env/wsl/settings.nix
@@ -0,0 +1,8 @@
+{
+ font = {
+ name = "Consolas";
+ size = "12";
+ baseline = "-1";
+ };
+ scheme = import ./ssdog.nix;
+}
diff --git a/env/wsl/ssdog.nix b/env/wsl/ssdog.nix
new file mode 100644
index 0000000..03e549c
--- /dev/null
+++ b/env/wsl/ssdog.nix
@@ -0,0 +1,20 @@
+{
+ background = "0c0f11"; #0c0f11
+ foreground = "fefcf4"; #fefcf4
+ color0 = "0c0f11"; #0c0f11
+ color1 = "20668e"; #20668e
+ color2 = "6ca3c7"; #6ca3c7
+ color3 = "848daa"; #848daa
+ color4 = "f2a6a6"; #f2a6a6
+ color5 = "f9dcaf"; #f9dcaf
+ color6 = "e0b799"; #e0b799
+ color7 = "f2eadd"; #f2eadd
+ color8 = "e0b799"; #e0b799
+ color9 = "20668e"; #20668e
+ color10 = "6ca3c7"; #6ca3c7
+ color11 = "848daa"; #848daa
+ color12 = "f2a6a6"; #f2a6a6
+ color13 = "f9dcaf"; #f9dcaf
+ color14 = "e0b799"; #e0b799
+ color15 = "f2eadd"; #f2eadd
+}
diff --git a/env/wsl/wsl-dev-host.nix b/env/wsl/wsl-dev-host.nix
new file mode 100755
index 0000000..6b6baea
--- /dev/null
+++ b/env/wsl/wsl-dev-host.nix
@@ -0,0 +1,183 @@
+{ config, lib, pkgs, ... }:
+let
+ inherit (import ./settings.nix) scheme font;
+in {
+ imports = [ ];
+
+ system.stateVersion = "23.05";
+
+ nix = {
+ settings = {
+ experimental-features = [ "nix-command" "flakes" ];
+ trusted-users = [ "john" ];
+ };
+ };
+
+ wsl = {
+ enable = true;
+ defaultUser = "john";
+ useWindowsDriver = true;
+ };
+
+ users.users.john.extraGroups = [ "audio" "video" ];
+
+ nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
+ nixpkgs.config.allowUnfree = true;
+ hardware.enableRedistributableFirmware = true;
+
+ boot.supportedFilesystems = [ "ntfs" "nfs" ];
+ boot.kernelParams = [ "mitigations=off" ];
+
+ networking.hostName = "wsl-dev";
+ networking.firewall.enable = false;
+
+ sound.enable = true;
+ hardware.pulseaudio.enable = true;
+
+ xdg.portal = {
+ enable = true;
+ extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
+ config.common.default = "*";
+ };
+
+ environment.systemPackages = with pkgs; [
+ git
+ htop
+ neovim
+ kitty
+ pavucontrol
+ glxinfo
+ neofetch
+ cmatrix
+ ];
+
+ fonts = {
+ fontDir.enable = true;
+ packages = with pkgs; [
+ corefonts
+ vistafonts
+ noto-fonts
+ noto-fonts-extra
+ noto-fonts-cjk-sans
+ noto-fonts-cjk-serif
+ noto-fonts-emoji-blob-bin
+ ubuntu_font_family
+ ];
+ fontconfig = {
+ enable = true;
+ includeUserConf = false;
+ antialias = true;
+ hinting.enable = true;
+ allowBitmaps = true;
+ subpixel = {
+ rgba = "rgb";
+ lcdfilter = "default";
+ };
+ defaultFonts = {
+ serif = [ "Ubuntu Light" ];
+ sansSerif = [ "Ubuntu Light" ];
+ monospace = [ font.name ];
+ emoji = [ "Blobmoji" ];
+ };
+ };
+ };
+
+ environment.sessionVariables = {
+ TERMINAL = "kitty";
+ };
+
+ programs.zsh.enable = true;
+ environment.shells = [ pkgs.zsh ];
+ environment.pathsToLink = [ "/share/zsh" ];
+ users.defaultUserShell = pkgs.zsh;
+
+ home-manager.users.john = let
+ homeDir = "${config.users.users.john.home}";
+ in {
+ programs.zsh = {
+ enable = true;
+ shellAliases = {
+ sudo = "nocorrect sudo ";
+ cmv-next = "cmv-add NEXT";
+ cmv-prev = "cmv-add PREV";
+ cmv-shuffle = "cmv-add SHUFFLE";
+ cmc = "./src/fruits/cmc/cmc";
+ };
+ defaultKeymap = "emacs";
+ history = {
+ save = 10000;
+ size = 10000;
+ path = "${homeDir}/.histfile";
+ share = false;
+ };
+ enableCompletion = true;
+ initExtra = ''
+ autoload -U colors && colors
+ setopt prompt_subst
+ if [[ -v NIX_SHELL ]]; then
+ PS1="%B($NIX_SHELL) %{$fg[blue]%}%n%{$fg[red]%}@%{$fg[light\ red]%}%M%{$fg[magenta]%}:%~%{$reset_color%}%b "
+ else
+ PS1="%B%{$fg[blue]%}%n%{$fg[red]%}@%{$fg[light\ red]%}%M%{$fg[magenta]%}:%~%{$reset_color%}%b "
+ fi
+ '';
+ };
+ programs.kitty = {
+ enable = true;
+ font = {
+ name = font.name;
+ size = lib.toInt font.size;
+ };
+ shellIntegration = {
+ mode = "enabled";
+ enableZshIntegration = true;
+ };
+ extraConfig = ''
+ enable_audio_bell no
+ disable_ligatures always
+ confirm_os_window_close 0
+ update_check_interval 0
+ allow_remote_control yes
+ linux_display_server x11
+ initial_window_width 640
+ initial_window_height 480
+ remember_window_size yes
+ placement_strategy top-left
+ modify_font baseline ${font.baseline}
+ cursor #${scheme.foreground}
+ foreground #${scheme.foreground}
+ background #${scheme.background}
+ color0 #${scheme.color0}
+ color1 #${scheme.color1}
+ color2 #${scheme.color2}
+ color3 #${scheme.color3}
+ color4 #${scheme.color4}
+ color5 #${scheme.color5}
+ color6 #${scheme.color6}
+ color7 #${scheme.color7}
+ color8 #${scheme.color8}
+ color9 #${scheme.color9}
+ color10 #${scheme.color10}
+ color11 #${scheme.color11}
+ color12 #${scheme.color12}
+ color13 #${scheme.color13}
+ color14 #${scheme.color14}
+ color15 #${scheme.color15}
+ selection_foreground #${scheme.background}
+ selection_background #${scheme.color6}
+ mark1_foreground #${scheme.background}
+ mark1_background #${scheme.color5}
+ mark2_foreground #${scheme.background}
+ mark2_background #${scheme.color6}
+ mark3_foreground #${scheme.background}
+ mark3_background #${scheme.color4}
+ background_opacity 0.965
+ '';
+ };
+ programs.neovim = {
+ enable = true;
+ viAlias = true;
+ vimAlias = true;
+ };
+ home.stateVersion = "${config.system.stateVersion}";
+ };
+}