diff --git a/flake.nix b/flake.nix index 3e45c2f..486cd1d 100644 --- a/flake.nix +++ b/flake.nix @@ -28,6 +28,10 @@ The starlight on the Western Seas. inputs.nixpkgs.follows = "nixpkgs"; inputs.home-manager.follows = "home-manager"; }; + sddmSugarCandy4Nix = { + url = "github:MOIS3Y/sddmSugarCandy4Nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { self, diff --git a/modules/home-manager/packages.nix b/modules/home-manager/packages.nix index 147f743..0cb352f 100644 --- a/modules/home-manager/packages.nix +++ b/modules/home-manager/packages.nix @@ -82,6 +82,7 @@ in { chafa colordiff hyperfine + kdePackages.filelight # Disk usage analyzer # # flatseal # build-essential diff --git a/modules/nixos/desktop/default.nix b/modules/nixos/desktop/default.nix index c09d362..45817a5 100644 --- a/modules/nixos/desktop/default.nix +++ b/modules/nixos/desktop/default.nix @@ -1,4 +1,5 @@ { + inputs, lib, config, pkgs, @@ -6,6 +7,11 @@ ... }: let cfg = config.teq.nixos.desktop; + hostname = config.networking.hostName; + # walls_repo = builtins.fetchGit { + # url = "https://github.com/dharmx/walls"; + # rev = "6bf4d733ebf2b484a37c17d742eb47e5139e6a14"; + # }; in { options.teq.nixos.desktop = { enable = lib.mkEnableOption "Teq's NixOS Desktop configuration defaults."; @@ -13,10 +19,20 @@ in { imports = [ ./steam.nix ./pipewire.nix + { + nixpkgs = { + overlays = [ + (final: prev: { + sddm-sugar-candy = inputs.sddmSugarCandy4Nix.packages.${pkgs.stdenv.hostPlatform.system}.sddm-sugar-candy; + }) + ]; + }; + } ]; config = lib.mkIf cfg.enable { teq.nixos.desktop.audio.enable = lib.mkDefault true; # Enable audio defaults. teq.nixos.desktop.steam.enable = lib.mkDefault true; # Enable Steam defaults. + environment.systemPackages = [pkgs.bibata-cursors]; # Allows cursors to be used in the system, like the login screen services = { xserver = { enable = true; # You can disable the X11 windowing system if you're only using the Wayland session. @@ -28,7 +44,74 @@ in { # libinput.enable = true; # Enable touchpad support (enabled default in most desktopManager). }; # Enable the KDE Plasma Desktop Environment. - displayManager.sddm.enable = true; + displayManager.sddm = { + enable = true; + wayland.enable = true; + wayland.compositor = "kwin"; + theme = ''${ # <-- string interpolation and nix expression inside {} + pkgs.sddm-sugar-candy.override { + settings = { + # Background = "${walls_repo}/cold/a_mountain_with_clouds_in_the_sky.jpg"; + DimBackgroundImage = "0.0"; + ScaleImageCropped = true; + ScreenWidth = "1440"; + ScreenHeight = "900"; + FullBlur = false; + PartialBlur = true; + BlurRadius = "100"; + HaveFormBackground = false; + FormPosition = "left"; + BackgroundImageHAlignment = "center"; + BackgroundImageVAlignment = "center"; + MainColor = "white"; + AccentColor = "#fb884f"; + BackgroundColor = "#444"; + OverrideLoginButtonTextColor = ""; + InterfaceShadowSize = "6"; + InterfaceShadowOpacity = "0.6"; + RoundCorners = "20"; + ScreenPadding = "0"; + Font = "Source Sans Pro"; + FontSize = ""; + ForceRightToLeft = false; + ForceLastUser = true; + ForcePasswordFocus = true; + ForceHideCompletePassword = true; + ForceHideVirtualKeyboardButton = false; + ForceHideSystemButtons = false; + AllowEmptyPassword = false; + AllowBadUsernames = false; + Locale = ""; + HourFormat = "HH:mm"; + DateFormat = "dddd, d of MMMM"; + HeaderText = "${hostname}"; + TranslatePlaceholderUsername = ""; + TranslatePlaceholderPassword = ""; + TranslateShowPassword = ""; + TranslateLogin = ""; + TranslateLoginFailedWarning = ""; + TranslateCapslockWarning = ""; + TranslateSession = ""; + TranslateSuspend = ""; + TranslateHibernate = ""; + TranslateReboot = ""; + TranslateShutdown = ""; + TranslateVirtualKeyboardButton = ""; + }; + } + }''; + package = lib.mkForce pkgs.libsForQt5.sddm; + extraPackages = with pkgs; + lib.mkForce [ + libsForQt5.qt5.qtgraphicaleffects + ]; + settings = { + Theme = { + CursorTheme = "Bibata-Modern-Classic"; + # CursorSize = 29; + }; + }; + }; desktopManager.plasma6.enable = true; }; # nixpkgs.overlays = [nixpkgs-wayland.overlay]; # Automated, pre-built, (potentially) pre-release packages for Wayland (sway/wlroots) tools for NixOS. diff --git a/modules/nixos/programs.nix b/modules/nixos/programs.nix index 3f981c9..009069b 100644 --- a/modules/nixos/programs.nix +++ b/modules/nixos/programs.nix @@ -31,7 +31,6 @@ in { wezterm-flake.packages.${pkgs.system}.default # Wezterm flake nix-output-monitor # nix output monitor papirus-icon-theme # Allows icons to be used in the system, like the login screen - bibata-cursors # Allows cursors to be used in the system, like the login screen ]); programs = { diff --git a/pkgs/by-name/ka/kando/package.nix b/pkgs/by-name/ka/kando/package.nix new file mode 100644 index 0000000..4a37450 --- /dev/null +++ b/pkgs/by-name/ka/kando/package.nix @@ -0,0 +1,150 @@ +{ + lib, + stdenv, + buildNpmPackage, + fetchFromGitHub, + overrideSDK, + electron, + nodejs, + cmake, + zip, + makeWrapper, + wayland-scanner, + copyDesktopItems, + makeDesktopItem, + libxkbcommon, + libX11, + libXtst, + libXi, + wayland, + darwin, +}: let + buildNpmPackage' = buildNpmPackage.override { + stdenv = + if stdenv.isDarwin + then overrideSDK stdenv "11.0" + else stdenv; + }; +in + buildNpmPackage' rec { + pname = "kando"; + version = "1.4.0"; + + src = fetchFromGitHub { + owner = "kando-menu"; + repo = "kando"; + rev = "refs/tags/v${version}"; + hash = "sha256-JcPTplqrMgDsT0HDTh7liChUWvLqe9gwS51ANM3Wsds="; + }; + + npmDepsHash = "sha256-13NuhGq5Pv5GSLeXASWxbXZYaUb9KzMgR7y5I7mv+MA="; + + npmFlags = ["--ignore-scripts"]; + + makeCacheWritable = true; + + nativeBuildInputs = + [ + cmake + zip + makeWrapper + ] + ++ lib.optionals stdenv.isLinux [ + wayland-scanner + copyDesktopItems + ]; + + buildInputs = + lib.optionals stdenv.isLinux [ + libxkbcommon + libX11 + libXtst + libXi + wayland + ] + ++ lib.optionals stdenv.isDarwin [darwin.apple_sdk_11_0.frameworks.AppKit]; + + dontUseCmakeConfigure = true; + + env = { + ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; + # use our own node headers since we skip downloading them + NIX_CFLAGS_COMPILE = "-I${nodejs}/include/node"; + # disable code signing on Darwin + CSC_IDENTITY_AUTO_DISCOVERY = lib.optionalString stdenv.isDarwin "false"; + }; + + postConfigure = '' + # electron files need to be writable on Darwin + cp -r ${electron.dist} electron-dist + chmod -R u+w electron-dist + + pushd electron-dist + zip -0Xqr ../electron.zip . + popd + + rm -r electron-dist + + # force @electron/packager to use our electron instead of downloading it, even if it is a different version + substituteInPlace node_modules/@electron/packager/dist/packager.js \ + --replace-fail 'await this.getElectronZipPath(downloadOpts)' '"electron.zip"' + + # don't fetch node headers + substituteInPlace node_modules/cmake-js/lib/dist.js \ + --replace-fail '!this.downloaded' 'false' + ''; + + # we used --ignore-scripts to have time to patch the dependencies + # now we'll have to call npm rebuild manually + preBuild = '' + npm rebuild --verbose + ''; + + npmBuildScript = "package"; + + installPhase = '' + runHook preInstall + + ${lib.optionalString stdenv.isLinux '' + mkdir -p $out/share/lib/kando + cp -r out/*/{locales,resources{,.pak}} $out/share/lib/kando + + install -Dm644 assets/icons/icon.svg $out/share/icons/hicolor/scalable/apps/kando.svg + + makeWrapper ${lib.getExe electron} $out/bin/kando \ + --add-flags $out/share/lib/kando/resources/app \ + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \ + --inherit-argv0 + ''} + + ${lib.optionalString stdenv.isDarwin '' + mkdir -p $out/Applications + cp -r out/*/Kando.app $out/Applications + makeWrapper $out/Applications/Kando.app/Contents/MacOS/Kando $out/bin/kando + ''} + + runHook postInstall + ''; + + desktopItems = [ + (makeDesktopItem { + name = "kando"; + exec = "kando %U"; + icon = "kando"; + desktopName = "Kando"; + genericName = "Pie Menu"; + comment = "The Cross-Platform Pie Menu"; + categories = ["Utility"]; + }) + ]; + + meta = { + changelog = "https://github.com/kando-menu/kando/releases/tag/v${version}"; + description = "Cross-Platform Pie Menu"; + homepage = "https://github.com/kando-menu/kando"; + license = lib.licenses.mit; + mainProgram = "kando"; + maintainers = with lib.maintainers; [tomasajt]; + platforms = electron.meta.platforms; + }; + } diff --git a/pkgs/default.nix b/pkgs/default.nix index 8b4d0a2..c520745 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -3,4 +3,5 @@ pkgs: { # example = pkgs.callPackage ./example { }; scripts = pkgs.callPackage ./scripts {}; + kando = pkgs.callPackage ./by-name/ka/kando/package.nix {}; } diff --git a/pkgs/scripts/default.nix b/pkgs/scripts/default.nix index 1895a8b..194bb5a 100644 --- a/pkgs/scripts/default.nix +++ b/pkgs/scripts/default.nix @@ -11,7 +11,7 @@ with pkgs; version = "1"; src = ./src; # Folder src inside current folder that contains the script dontBuild = true; # No build required - nativeBuildInputs = [makeWrapper]; + nativeBuildInputs = [makeWrapper coreutils]; # buildInputs = [ ]; installPhase = '' # Create output directory in /nix/store