From d18e2cfc58735981cd3d2bc45a022c9bc7abd60f Mon Sep 17 00:00:00 2001 From: "Emma (Rory&)" Date: Sun, 15 Oct 2023 01:15:22 +0000 Subject: Add new stuff from WSL --- flake.lock | 78 +++++++++++++------ flake.nix | 20 ++++- host/Rory-wsl/configuration.nix | 11 ++- modules/packages/mtxclient-git.nix | 61 +++++++++++++++ modules/packages/nheko-git.nix | 95 +++++++++++++++++++++++ modules/software-templates/profilers.nix | 10 +++ modules/users/Rory.nix | 124 +++++++++++++++++++++++++++++-- 7 files changed, 366 insertions(+), 33 deletions(-) create mode 100644 modules/packages/mtxclient-git.nix create mode 100644 modules/packages/nheko-git.nix create mode 100644 modules/software-templates/profilers.nix diff --git a/flake.lock b/flake.lock index ac4b593..3419425 100644 --- a/flake.lock +++ b/flake.lock @@ -110,11 +110,11 @@ "flake-compat_2": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -164,11 +164,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1696145345, - "narHash": "sha256-3dM7I/d4751SLPJah0to1WBlWiyzIiuCEUwJqwBdmr4=", + "lastModified": 1696940889, + "narHash": "sha256-p2Wic74A1tZpFcld1wSEbFQQbrZ/tPDuLieCnspamQo=", "owner": "nix-community", "repo": "home-manager", - "rev": "6f9b5b83ad1f470b3d11b8a9fe1d5ef68c7d0e30", + "rev": "6bba64781e4b7c1f91a733583defbd3e46b49408", "type": "github" }, "original": { @@ -178,6 +178,40 @@ "type": "github" } }, + "mtxclientSrc": { + "flake": false, + "locked": { + "lastModified": 1697051830, + "narHash": "sha256-8KmvXUHoeeBcZ10SqFllMWEpzKafilgFc5MY3fAFAQI=", + "owner": "Nheko-reborn", + "repo": "mtxclient", + "rev": "f878e29420c037f45b575fbd29a11cabce3c010a", + "type": "github" + }, + "original": { + "owner": "Nheko-reborn", + "ref": "master", + "repo": "mtxclient", + "type": "github" + } + }, + "nhekoSrc": { + "flake": false, + "locked": { + "lastModified": 1697057071, + "narHash": "sha256-TnBhRcc2r3ONCroxU97Yd5V75sDRzoceizg/pPC2DgI=", + "owner": "Nheko-reborn", + "repo": "nheko", + "rev": "07fd58e59fd594734f43706b510bb77b0ed25fc9", + "type": "github" + }, + "original": { + "owner": "Nheko-reborn", + "ref": "master", + "repo": "nheko", + "type": "github" + } + }, "nixos-wsl": { "inputs": { "flake-compat": "flake-compat_2", @@ -185,11 +219,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1696239710, - "narHash": "sha256-Ps7zIKYGT7TEi9JrG1fV9cdUY5X6hmaidUcTaEDxPO4=", + "lastModified": 1696883888, + "narHash": "sha256-EdQMeJxDoi26YDtkNf20mNBeCj7Y5eKg+rrxkiB86z0=", "owner": "nix-community", "repo": "NixOS-WSL", - "rev": "337edef90c8abe35b42e95aecf510a063dad02dd", + "rev": "5da7c4fd0ab9693d83cae50de7d9430696f92568", "type": "github" }, "original": { @@ -216,11 +250,11 @@ }, "nixpkgs-RoryNix": { "locked": { - "lastModified": 1696039360, - "narHash": "sha256-g7nIUV4uq1TOVeVIDEZLb005suTWCUjSY0zYOlSBsyE=", + "lastModified": 1696983906, + "narHash": "sha256-L7GyeErguS7Pg4h8nK0wGlcUTbfUMDu+HMf1UcyP72k=", "owner": "NixOs", "repo": "nixpkgs", - "rev": "32dcb45f66c0487e92db8303a798ebc548cadedc", + "rev": "bd1cde45c77891214131cbbea5b1203e485a9d51", "type": "github" }, "original": { @@ -248,11 +282,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1695360818, - "narHash": "sha256-JlkN3R/SSoMTa+CasbxS1gq+GpGxXQlNZRUh9+LIy/0=", + "lastModified": 1696604326, + "narHash": "sha256-YXUNI0kLEcI5g8lqGMb0nh67fY9f2YoJsILafh6zlMo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e35dcc04a3853da485a396bdd332217d0ac9054f", + "rev": "87828a0e03d1418e848d3dd3f3014a632e4a4f64", "type": "github" }, "original": { @@ -264,11 +298,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1696039360, - "narHash": "sha256-g7nIUV4uq1TOVeVIDEZLb005suTWCUjSY0zYOlSBsyE=", + "lastModified": 1696697597, + "narHash": "sha256-q26Qv4DQ+h6IeozF2o1secyQG0jt2VUT3V0K58jr3pg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "32dcb45f66c0487e92db8303a798ebc548cadedc", + "rev": "5a237aecb57296f67276ac9ab296a41c23981f56", "type": "github" }, "original": { @@ -280,11 +314,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1696019113, - "narHash": "sha256-X3+DKYWJm93DRSdC5M6K5hLqzSya9BjibtBsuARoPco=", + "lastModified": 1696879762, + "narHash": "sha256-Ud6bH4DMcYHUDKavNMxAhcIpDGgHMyL/yaDEAVSImQY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f5892ddac112a1e9b3612c39af1b72987ee5783a", + "rev": "f99e5f03cc0aa231ab5950a15ed02afec45ed51a", "type": "github" }, "original": { @@ -299,6 +333,8 @@ "botcore-v4": "botcore-v4", "conduit": "conduit", "home-manager": "home-manager", + "mtxclientSrc": "mtxclientSrc", + "nhekoSrc": "nhekoSrc", "nixos-wsl": "nixos-wsl", "nixpkgs": "nixpkgs_4", "nixpkgs-RoryNix": "nixpkgs-RoryNix", diff --git a/flake.nix b/flake.nix index 07e9dce..a30d9a8 100755 --- a/flake.nix +++ b/flake.nix @@ -28,9 +28,20 @@ inputs.nixpkgs.follows = "nixpkgs"; }; nixos-wsl.url = "github:nix-community/NixOS-WSL"; + #inputs.nur.url = github:nix-community/NUR; + + # Sources... + nhekoSrc = { + url = "github:Nheko-reborn/nheko/master"; + flake = false; + }; + mtxclientSrc = { + url = "github:Nheko-reborn/mtxclient/master"; + flake = false; + }; }; - outputs = { self, nixpkgs, nixpkgs-RoryNix, nixpkgs-rory, home-manager, botcore-v4, conduit, nixos-wsl }: { + outputs = { self, nixpkgs, nixpkgs-RoryNix, nixpkgs-rory, home-manager, botcore-v4, conduit, nixos-wsl, ... }@inputs: { nixosConfigurations = { #NIXPKGS FORK Rory-nginx = nixpkgs-rory.lib.nixosSystem { @@ -90,8 +101,13 @@ nixos-wsl.nixosModules.default ./host/Rory-wsl/configuration.nix # ./hardware-configuration.nix - home-manager.nixosModules.home-manager + home-manager.nixosModules.home-manager + #nur.nixosModules.nur ]; + specialArgs = { + inherit (inputs) mtxclientSrc; + inherit (inputs) nhekoSrc; + }; }; }; }; diff --git a/host/Rory-wsl/configuration.nix b/host/Rory-wsl/configuration.nix index 8aa8f3e..f18b918 100644 --- a/host/Rory-wsl/configuration.nix +++ b/host/Rory-wsl/configuration.nix @@ -1,15 +1,20 @@ -{ lib, pkgs, config, modulesPath, ... }: +{ lib, pkgs, config, modulesPath, nhekoSrc, mtxclientSrc, ... }: { imports = [ ../../modules/base-client.nix + ../../modules/software-templates/profilers.nix ]; wsl = { enable = true; automountPath = "/mnt"; - defaultUser = "nixos"; + #defaultUser = "nixos"; + defaultUser = "Rory"; startMenuLaunchers = true; + # Fix binfmt registration + interop.register = true; + # Enable native Docker support # docker-native.enable = true; @@ -18,6 +23,7 @@ }; networking.hostName = "Rory-wsl"; + users.users.Rory.uid = 1000; environment.systemPackages = with pkgs; [ wget @@ -40,6 +46,7 @@ vimPlugins.vim-nix neovim tree + (callPackage ../../modules/packages/nheko-git.nix { inherit nhekoSrc; inherit mtxclientSrc; }) ]; system.stateVersion = "23.05"; diff --git a/modules/packages/mtxclient-git.nix b/modules/packages/mtxclient-git.nix new file mode 100644 index 0000000..d2a9d6a --- /dev/null +++ b/modules/packages/mtxclient-git.nix @@ -0,0 +1,61 @@ +# This file was copied from NUR: https://github.com/nix-community/nur-combined/blob/master/repos/deeunderscore/pkgs/mtxclient/default.nix +# This file is a modified version of nixpkgs/pkgs/development/libraries/mtxclient/default.nix (copied at 5c4b9be) + +{ lib, stdenv +, fetchFromGitHub +, cmake +, pkg-config +, openssl +, olm +, spdlog +, nlohmann_json +, libevent +, curl +, coeurl +, re2 +, mtxclientSrc +}: +stdenv.mkDerivation { + pname = "mtxclient"; + version = "git+master"; + src = mtxclientSrc; + + cmakeFlags = [ + # Network requiring tests can't be disabled individually: + # https://github.com/Nheko-Reborn/mtxclient/issues/22 + "-DBUILD_LIB_TESTS=OFF" + "-DBUILD_LIB_EXAMPLES=OFF" + ]; + + postPatch = '' + # See https://github.com/gabime/spdlog/issues/1897 + sed -i '1a add_compile_definitions(SPDLOG_FMT_EXTERNAL)' CMakeLists.txt + ''; + + + nativeBuildInputs = [ + cmake + pkg-config + ]; + buildInputs = [ + spdlog + nlohmann_json + openssl + olm + libevent + curl + coeurl + re2 + ]; + + meta = with lib; { + description = "Client API library for Matrix, built on top of Boost.Asio"; + homepage = "https://github.com/Nheko-Reborn/mtxclient"; + license = licenses.mit; + maintainers = with maintainers; [ fpletz pstn ]; + platforms = platforms.all; + # Should be fixable if a higher clang version is used, see: + # https://github.com/NixOS/nixpkgs/pull/85922#issuecomment-619287177 + broken = stdenv.targetPlatform.isDarwin; + }; +} diff --git a/modules/packages/nheko-git.nix b/modules/packages/nheko-git.nix new file mode 100644 index 0000000..dac42c9 --- /dev/null +++ b/modules/packages/nheko-git.nix @@ -0,0 +1,95 @@ +# This file was copied from NUR: https://github.com/nix-community/nur-combined/blob/master/repos/deeunderscore/pkgs/nheko/default.nix#L93 +# This file is a modified version of nixpkgs/pkgs/applications/networking/instant-messengers/nheko/default.nix (copied at 2e896fce) + +{ lib +, stdenv +, fetchFromGitHub +, cmake +#, wrapQtAppsHook +, asciidoctor +, qt6 +, qt6Packages +#, qtmultimedia +#, qtimageformats +#, qtkeychain +, cmark +, coeurl +, curl +, libevent +, lmdb +, lmdbxx +#, mtxclient +, nlohmann_json +, olm +, pkg-config +, re2 +, spdlog +, httplib +, voipSupport ? true +, gst_all_1 +, libnice +, pkgs +, nhekoSrc +, mtxclientSrc +}: + +stdenv.mkDerivation { + pname = "nheko"; + version = "git+master"; + src = nhekoSrc; + + nativeBuildInputs = [ + lmdbxx + cmake + pkg-config + asciidoctor + qt6.wrapQtAppsHook + ]; + + buildInputs = [ + qt6.qtbase + qt6.qttools + qt6.qtsvg + qt6.qtmultimedia + qt6.qtimageformats + qt6Packages.qtkeychain + cmark + coeurl + curl + libevent + lmdb + (pkgs.callPackage ./mtxclient-git.nix { inherit mtxclientSrc; }) + nlohmann_json + olm + re2 + spdlog + httplib + ] ++ lib.optionals voipSupport (with gst_all_1; [ + gstreamer + gst-plugins-base + (gst-plugins-good.override { qt5Support = true; }) + gst-plugins-bad + libnice + ]); + + LC_ALL = lib.optionalString (!stdenv.isDarwin) "C.UTF-8"; + + cmakeFlags = [ + "-DCOMPILE_QML=ON" # see https://github.com/Nheko-Reborn/nheko/issues/389 + "-DCMAKE_BUILD_TYPE=Release" + "-DBUILD_SHARED_LIBS=OFF" + ]; + + + preFixup = lib.optionalString voipSupport '' + # add gstreamer plugins path to the wrapper + qtWrapperArgs+=(--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0") + ''; + + meta = with lib; { + description = "Desktop client for the Matrix protocol"; + homepage = "https://github.com/Nheko-Reborn/nheko"; + platforms = platforms.all; + license = licenses.gpl3Plus; + }; +} diff --git a/modules/software-templates/profilers.nix b/modules/software-templates/profilers.nix new file mode 100644 index 0000000..ce55c4e --- /dev/null +++ b/modules/software-templates/profilers.nix @@ -0,0 +1,10 @@ +{ config, lib, pkgs, home-manager, ... }: + +{ + environment.systemPackages = with pkgs; [ + kcachegrind + linuxKernel.packages.linux_5_15.perf + hotspot + valgrind + ]; +} \ No newline at end of file diff --git a/modules/users/Rory.nix b/modules/users/Rory.nix index daafb15..25ab725 100755 --- a/modules/users/Rory.nix +++ b/modules/users/Rory.nix @@ -1,4 +1,4 @@ -{ config, pkgs, home-manager, ... }: +{ config, lib, pkgs, home-manager, ... }: { @@ -19,17 +19,125 @@ }; home-manager.users.Rory = { - programs.git = { - enable = true; - userName = "TheArcaneBrony"; - userEmail = "myrainbowdash949@gmail.com"; - extraConfig = { - safe = { - directory = "/"; + #services.gnome-keyring.enable = true; + + programs = { + git = { + enable = true; + userName = "TheArcaneBrony"; + userEmail = "myrainbowdash949@gmail.com"; + extraConfig = { + safe = { + directory = "/"; + }; }; }; + zsh = { + enable = true; + enableAutosuggestions = true; + enableVteIntegration = true; + autocd = true; + + initExtra = '' + alias ls='lsd -lA --color=always --icon=always' + ''; + oh-my-zsh = { + enable = true; + plugins = [ + "git" + "sudo" + "zsh-syntax-highlighting" + "zsh-autosuggetsions" + ]; + }; + #plugins = [ + # "git" + # "zsh-syntax-highlighting" + # "zsh-autosuggestions" + #]; + + plugins = [ + { + name = "powerlevel10k"; + src = pkgs.zsh-powerlevel10k; + file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; + } + #{ + # name = "powerlevel10k-config"; + # src = lib.cleanSource ./p10k-config; + # file = "p10k.zsh"; + #} + ]; + + + + localVariables = { + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS = [ + "os_icon" + "dir" + "vcs" + "prompt_char" + ]; + POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS = [ + "status" + "command_execution_time" + "background_jobs" + "direnv" + "virtualenv" + "pyenv" + "nodeenv" + "context" + "nix_shell" + "vi_mode" + "load" + "disk_usage" + "ram" + ]; + POWERLEVEL9K_MODE = "nerdfont-complete"; + POWERLEVEL9K_ICON_PADDING = "none"; + POWERLEVEL9K_PROMPT_ADD_NEWLINE = "false"; + POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR = "\uE0B1"; + POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR = "\uE0B3"; + POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR = "\uE0B0"; + POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR = "\uE0B2"; + POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL = "\uE0B0"; + POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL = "\uE0B2"; + POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE = true; + }; + }; + neovim = { + defaultEditor = true; + viAlias = true; + vimAlias = true; + vimdiffAlias = true; + coc = { + enable = true; + + }; + }; + }; + + # keepassxc, maybe? + systemd.user.services.keepassxc = { + Unit = { + Description = "KeePassXC password manager"; + #After = [ "graphical-session-pre.target" ]; + PartOf = [ "default.target" ]; + }; + + Install = { WantedBy = [ "default.target" ]; }; + + Service = { ExecStart = "${pkgs.keepassxc}/bin/keepassxc ~/.secrets.kdbx"; }; }; + programs.neovim.plugins = with pkgs.vimPlugins; [ + pkgs.vimPlugins.nvim-tree-lua + { + plugin = pkgs.vimPlugins.vim-startify; + config = "let g:startify_change_to_vcs_root = 0"; + } + ]; + home.stateVersion = "22.11"; }; } -- cgit 1.4.1