From f478299f840918011f658a385fed06357d4322c1 Mon Sep 17 00:00:00 2001 From: elythh Date: Fri, 30 Aug 2024 01:16:48 +0200 Subject: [PATCH] wip --- .../x86_64-linux/gwen@grovetender/default.nix | 1 + .../terminals/editors/nvim/default.nix | 10 +- modules/home/suites/desktop/default.nix | 1 - modules/home/suites/music/default.nix | 1 - modules/home/theme/stylix/default.nix | 10 +- modules/home/user/default.nix | 24 ---- packages/teams-for-linux/default.nix | 113 ++++++++++++++++++ 7 files changed, 126 insertions(+), 34 deletions(-) create mode 100644 packages/teams-for-linux/default.nix diff --git a/homes/x86_64-linux/gwen@grovetender/default.nix b/homes/x86_64-linux/gwen@grovetender/default.nix index d0261eb9..0656d4c3 100644 --- a/homes/x86_64-linux/gwen@grovetender/default.nix +++ b/homes/x86_64-linux/gwen@grovetender/default.nix @@ -98,6 +98,7 @@ in video = enabled; }; + theme.enable = true; theme.name = "paradise"; }; diff --git a/modules/home/programs/graphical/terminals/editors/nvim/default.nix b/modules/home/programs/graphical/terminals/editors/nvim/default.nix index 80c2b9d1..ac23707b 100644 --- a/modules/home/programs/graphical/terminals/editors/nvim/default.nix +++ b/modules/home/programs/graphical/terminals/editors/nvim/default.nix @@ -6,10 +6,10 @@ ... }: let - inherit (lib) mkIf; + inherit (lib) mkIf mkEnableOption; inherit (lib.${namespace}) mkBoolOpt; - cfg = config.${namespace}.programs.graphical.editors.neovim; + cfg = config.${namespace}.programs.terminal.editors.neovim; nixvim' = inputs.nixvim.packages."x86_64-linux".default; nixvim = nixvim'.extend { @@ -45,17 +45,17 @@ let in { options.${namespace}.programs.terminal.editors.neovim = { - enable = mkBoolOpt false "Enable neovim"; + enable = mkEnableOption "neovim"; default = mkBoolOpt true "Whether to set Neovim as the session EDITOR"; - }; + config = mkIf cfg.enable { home = { sessionVariables = { EDITOR = mkIf cfg.default "nvim"; - packages = [ nixvim ]; }; + packages = [ nixvim ]; }; }; } diff --git a/modules/home/suites/desktop/default.nix b/modules/home/suites/desktop/default.nix index 7b3baa39..abfc4586 100644 --- a/modules/home/suites/desktop/default.nix +++ b/modules/home/suites/desktop/default.nix @@ -33,7 +33,6 @@ in input-leap kdePackages.ark kdePackages.gwenview - pkgs.${namespace}.pocketcasts realvnc-vnc-viewer # FIXME: broken nixpkgs # rustdesk diff --git a/modules/home/suites/music/default.nix b/modules/home/suites/music/default.nix index 2c39008a..1221b58b 100644 --- a/modules/home/suites/music/default.nix +++ b/modules/home/suites/music/default.nix @@ -30,7 +30,6 @@ in spicetify-cli tageditor youtube-music - pkgs.${namespace}.yt-music ]; }; } diff --git a/modules/home/theme/stylix/default.nix b/modules/home/theme/stylix/default.nix index d1ae35f1..14419898 100644 --- a/modules/home/theme/stylix/default.nix +++ b/modules/home/theme/stylix/default.nix @@ -6,14 +6,18 @@ ... }: let - inherit (lib) mkIf mkOption types; - inherit (lib.${namespace}) mkBoolOpt; + inherit (lib) + mkIf + mkOption + mkEnableOption + types + ; cfg = config.${namespace}.theme; in { options.${namespace}.theme = { - enable = mkBoolOpt false "Weather to enable the theming"; + enable = mkEnableOption "Wether to enable stylix"; name = mkOption { type = types.str; default = "paradise"; diff --git a/modules/home/user/default.nix b/modules/home/user/default.nix index 4aeab462..4e6054f2 100644 --- a/modules/home/user/default.nix +++ b/modules/home/user/default.nix @@ -28,23 +28,6 @@ let "/Users/${cfg.name}" else "/home/${cfg.name}"; - - defaultIcon = pkgs.stdenvNoCC.mkDerivation { - name = "default-icon"; - src = ./. + "/${defaultIconFileName}"; - - dontUnpack = true; - - installPhase = # bash - '' - cp $src $out - ''; - - passthru = { - fileName = defaultIconFileName; - }; - }; - defaultIconFileName = "profile.png"; in { options.${namespace}.user = { @@ -52,7 +35,6 @@ in email = mkOpt types.str "gwen@omg.lol" "The email of the user."; fullName = mkOpt types.str "Gwenc'hlan Le Kerneau" "The full name of the user."; home = mkOpt (types.nullOr types.str) home-directory "The user's home directory."; - icon = mkOpt (types.nullOr types.package) defaultIcon "The profile picture to use for the user."; name = mkOpt (types.nullOr types.str) config.snowfallorg.user.name "The user account."; }; @@ -71,15 +53,12 @@ in home = { file = { - ".face".source = cfg.icon; - ".face.icon".source = cfg.icon; "Desktop/.keep".text = ""; "Documents/.keep".text = ""; "Downloads/.keep".text = ""; "Music/.keep".text = ""; "Pictures/.keep".text = ""; "Videos/.keep".text = ""; - "Pictures/${cfg.icon.fileName or (builtins.baseNameOf cfg.icon)}".source = cfg.icon; }; homeDirectory = mkDefault cfg.home; @@ -141,9 +120,6 @@ in programs.home-manager = enabled; - xdg.configFile = { - "sddm/faces/.${cfg.name}".source = cfg.icon; - }; } ]); } diff --git a/packages/teams-for-linux/default.nix b/packages/teams-for-linux/default.nix new file mode 100644 index 00000000..a7b895a7 --- /dev/null +++ b/packages/teams-for-linux/default.nix @@ -0,0 +1,113 @@ +{ + lib, + stdenv, + buildNpmPackage, + fetchFromGitHub, + alsa-utils, + copyDesktopItems, + electron_30, + makeDesktopItem, + makeWrapper, + which, +}: + +let + electronDist = "${electron_30}/${if stdenv.isDarwin then "Applications" else "libexec/electron"}"; +in +buildNpmPackage rec { + pname = "teams-for-linux"; + version = "1.9.5"; + + src = fetchFromGitHub { + owner = "IsmaelMartinez"; + repo = "teams-for-linux"; + rev = "refs/tags/v${version}"; + hash = "sha256-+rEGDg+/qvjCMhGHccb4p+CKOo/65RpkFT/WnCDlCgU="; + }; + + npmDepsHash = "sha256-vDRFFxkIQo5qU9gmkSwUhPz4FG2XbUNkTw6SCuvMqCc="; + + nativeBuildInputs = [ + makeWrapper + ] ++ lib.optionals stdenv.isLinux [ copyDesktopItems ]; + + env = { + # disable code signing on Darwin + CSC_IDENTITY_AUTO_DISCOVERY = "false"; + ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; + }; + + buildPhase = '' + runHook preBuild + + cp -r ${electronDist} electron-dist + chmod -R u+w electron-dist + + npm exec electron-builder -- \ + --dir \ + -c.npmRebuild=true \ + -c.asarUnpack="**/*.node" \ + -c.electronDist=electron-dist \ + -c.electronVersion=${electron_30.version} + + runHook postBuild + ''; + + installPhase = + '' + runHook preInstall + + '' + + lib.optionalString stdenv.isLinux '' + mkdir -p $out/share/{applications,teams-for-linux} + cp dist/*-unpacked/resources/app.asar $out/share/teams-for-linux/ + + pushd build/icons + for image in *png; do + mkdir -p $out/share/icons/hicolor/''${image%.png}/apps + cp -r $image $out/share/icons/hicolor/''${image%.png}/apps/teams-for-linux.png + done + popd + + # Linux needs 'aplay' for notification sounds + makeWrapper '${lib.getExe electron_30}' "$out/bin/teams-for-linux" \ + --prefix PATH : ${ + lib.makeBinPath [ + alsa-utils + which + ] + } \ + --add-flags "$out/share/teams-for-linux/app.asar" \ + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" + '' + + lib.optionalString stdenv.isDarwin '' + mkdir -p $out/Applications + cp -r dist/mac*/teams-for-linux.app $out/Applications + makeWrapper $out/Applications/teams-for-linux.app/Contents/MacOS/teams-for-linux $out/bin/teams-for-linux + '' + + '' + + runHook postInstall + ''; + + desktopItems = [ + (makeDesktopItem { + name = "teams-for-linux"; + exec = "teams-for-linux"; + icon = "teams-for-linux"; + desktopName = "Microsoft Teams for Linux"; + comment = meta.description; + categories = [ + "Network" + "InstantMessaging" + "Chat" + ]; + }) + ]; + + meta = { + description = "Unofficial Microsoft Teams client for Linux"; + mainProgram = "teams-for-linux"; + platforms = with lib.platforms; darwin ++ linux; + }; +}