diff --git a/flake.lock b/flake.lock index bbc1fbb..931287b 100644 --- a/flake.lock +++ b/flake.lock @@ -87,42 +87,6 @@ "type": "github" } }, - "flake-parts_2": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib_3" - }, - "locked": { - "lastModified": 1706830856, - "narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_3": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib_4" - }, - "locked": { - "lastModified": 1706830856, - "narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, "flake-utils": { "inputs": { "systems": "systems" @@ -260,6 +224,28 @@ "type": "github" } }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "plasma-manager", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1667907331, + "narHash": "sha256-bHkAwkYlBjkupPUFcQjimNS8gxWSWjOTevEuwdnp5m0=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "6639e3a837fc5deb6f99554072789724997bc8e5", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-22.05", + "repo": "home-manager", + "type": "github" + } + }, "kitty-themes-src": { "flake": false, "locked": { @@ -276,6 +262,21 @@ "type": "github" } }, + "nix-flatpak": { + "locked": { + "lastModified": 1708268179, + "narHash": "sha256-NNVuhf84AeDTxadfSGnFqPHR0ED+QyM2gmu+Wyz6PrY=", + "owner": "gmodena", + "repo": "nix-flatpak", + "rev": "a243cb0522f6240c194b873dde68e25370b06034", + "type": "github" + }, + "original": { + "owner": "gmodena", + "repo": "nix-flatpak", + "type": "github" + } + }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -423,42 +424,6 @@ "type": "github" } }, - "nixpkgs-lib_3": { - "locked": { - "dir": "lib", - "lastModified": 1706550542, - "narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "97b17f32362e475016f942bbdfda4a4a72a8a652", - "type": "github" - }, - "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-lib_4": { - "locked": { - "dir": "lib", - "lastModified": 1706550542, - "narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "97b17f32362e475016f942bbdfda4a4a72a8a652", - "type": "github" - }, - "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs-stable": { "locked": { "lastModified": 1678872516, @@ -523,6 +488,22 @@ "type": "github" } }, + "nixpkgs_4": { + "locked": { + "lastModified": 1685573264, + "narHash": "sha256-Zffu01pONhs/pqH07cjlF10NnMDLok8ix5Uk4rhOnZQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "380be19fbd2d9079f677978361792cb25e8a3635", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.05", + "repo": "nixpkgs", + "type": "github" + } + }, "nur": { "locked": { "lastModified": 1708294799, @@ -538,6 +519,25 @@ "type": "github" } }, + "plasma-manager": { + "inputs": { + "home-manager": "home-manager_2", + "nixpkgs": "nixpkgs_4" + }, + "locked": { + "lastModified": 1707590627, + "narHash": "sha256-LJ/lFEupLSi7xtUps234hhMk7ZdVLRoYeU7KiCFaoGw=", + "owner": "pjones", + "repo": "plasma-manager", + "rev": "4e56cfeb95081a43cb49487d0996dc936d6201e5", + "type": "github" + }, + "original": { + "owner": "pjones", + "repo": "plasma-manager", + "type": "github" + } + }, "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat_3", @@ -563,83 +563,12 @@ "type": "github" } }, - "pywlroots": { - "inputs": { - "flake-parts": "flake-parts_3", - "nixpkgs": [ - "qtile", - "nixpkgs" - ], - "pywlroots-src": "pywlroots-src" - }, - "locked": { - "lastModified": 1, - "narHash": "sha256-MRa0TFXRei+B+/TlmI0IPpH1hdtnLfSpVdKP0gKeTVQ=", - "path": "pywlroots", - "type": "path" - }, - "original": { - "path": "pywlroots", - "type": "path" - } - }, - "pywlroots-src": { - "flake": false, - "locked": { - "lastModified": 1706416608, - "narHash": "sha256-aC3/RDDPgknWrp2rwE9jpyN7D+zORERnwNynw6HMODc=", - "owner": "flacjacket", - "repo": "pywlroots", - "rev": "b38b6ceab0a4cf7cc8d755217b365702f59692cb", - "type": "github" - }, - "original": { - "owner": "flacjacket", - "repo": "pywlroots", - "type": "github" - } - }, - "qtile": { - "inputs": { - "flake-parts": "flake-parts_2", - "nixpkgs": [ - "nixpkgs" - ], - "pywlroots": "pywlroots", - "qtile-src": "qtile-src" - }, - "locked": { - "lastModified": 1, - "narHash": "sha256-7WNxEpUZUnC7ouHP86QtymKhE0yzbdwPIR2SQzRVzbs=", - "path": "flakes/qtile", - "type": "path" - }, - "original": { - "path": "flakes/qtile", - "type": "path" - } - }, - "qtile-src": { - "flake": false, - "locked": { - "lastModified": 1708218053, - "narHash": "sha256-hlVLj/ZGBAfIPWBHTZ6JI6igmqPifV0gtifO/2g/uMY=", - "owner": "qtile", - "repo": "qtile", - "rev": "3a61a2789b06b53bd66171499791541bb838fe23", - "type": "github" - }, - "original": { - "owner": "qtile", - "repo": "qtile", - "type": "github" - } - }, "root": { "inputs": { "flake-utils": "flake-utils", "helix": "helix", "home-manager": "home-manager", + "nix-flatpak": "nix-flatpak", "nix-index-database": "nix-index-database", "nix-ld-rs": "nix-ld-rs", "nix-rice": "nix-rice", @@ -648,7 +577,7 @@ "nixpkgs": "nixpkgs_3", "nixpkgs-stable": "nixpkgs-stable_2", "nur": "nur", - "qtile": "qtile", + "plasma-manager": "plasma-manager", "rust-overlay": "rust-overlay_2" } }, diff --git a/flake.nix b/flake.nix index 2a18484..3b2a002 100644 --- a/flake.nix +++ b/flake.nix @@ -17,9 +17,6 @@ flake-utils.url = "github:numtide/flake-utils"; - # TODO get rid of fu for fp - # flake-parts.url = "github:hercules-ci/flake-parts"; - helix = { url = "github:helix-editor/helix"; inputs.nixpkgs.follows = "nixpkgs"; @@ -42,18 +39,11 @@ nix-ld-rs = { url = "github:nix-community/nix-ld-rs"; inputs.nixpkgs.follows = "nixpkgs"; - # inputs.rust-overlay.follows = "rust-overlay"; }; - qtile = { - url = "path:flakes/qtile"; - inputs.nixpkgs.follows = "nixpkgs"; - }; + plasma-manager.url = "github:pjones/plasma-manager"; - # swayosd = { - # url = "path:flakes/swayosd"; - # inputs.nixpkgs.follows = "nixpkgs"; - # }; + nix-flatpak.url = "github:gmodena/nix-flatpak"; }; outputs = { @@ -63,8 +53,8 @@ home-manager, nur, helix, - qtile, - # swayosd, + plasma-manager, + nix-flatpak, nixd, nix-ld-rs, nix-index-database, diff --git a/home/home.nix b/home/home.nix index bb5f197..b202a97 100644 --- a/home/home.nix +++ b/home/home.nix @@ -13,15 +13,13 @@ in { imports = [ ./programs/helix.nix - ./programs/wlogout.nix - ./programs/fuzzel.nix - ./programs/qtile.nix - # ./programs/swayosd.nix - ./programs/swaync.nix ./programs/firefox.nix ./programs/kitty.nix ./programs/zsh.nix ./util/ez.nix + ./util/firefox-webapp.nix + inputs.plasma-manager.homeManagerModules.plasma-manager # TODO: set up manually, use rc2nix to convert + inputs.nix-flatpak.homeManagerModules.nix-flatpak ]; home.packages = with pkgs; @@ -29,8 +27,6 @@ in { thunderbird strawberry inkscape - (xfce.thunar.override {thunarPlugins = [xfce.thunar-archive-plugin xfce.thunar-volman xfce.thunar-media-tags-plugin];}) - peazip imv @@ -48,7 +44,6 @@ in { slurp libnotify - gtklock playerctl kooha @@ -56,7 +51,6 @@ in { onlyoffice-bin croc - logseq xorg.xrdb culr @@ -87,55 +81,29 @@ in { enable = true; }; - services.avizo = { - enable = true; - settings = with pkgs.rice.palette; { - default = { - height = 120; - width = 300; - time = 1.0; - border-radius = 16; - fade-in = 0.5; - fade-out = 1.0; - padding = pkgs.rice.borders.gaps_in; - block-count = 16; - block-spacing = 4; - block-height = 4; - background = lib.strings.concatStrings ["rgba(" "${toString bright.black.r}" " ," "${toString bright.black.g}" " ," "${toString bright.black.b}" " , 1.0)"]; - border-color = lib.strings.concatStrings ["rgba(" "${toString bright.yellow.r}" " ," "${toString bright.yellow.g}" " ," "${toString bright.yellow.b}" " , 1.0)"]; - bar-fg-color = lib.strings.concatStrings ["rgba(" "${toString bright.yellow.r}" " ," "${toString bright.yellow.g}" " ," "${toString bright.yellow.b}" " , 1.0)"]; - bar-bg-color = lib.strings.concatStrings ["rgba(" "${toString util.bg.r}" " ," "${toString util.bg.g}" " ," "${toString util.bg.b}" " , 1.0)"]; - }; + services.udiskie.enable = true; # TODO is this fixed now? + + services.flatpak.packages = [ + "com.logseq.Logseq" + # "com.github.IsmaelMartinez.teams_for_linux" + ]; + services.flatpak.overrides = { + global = { + Context.sockets = ["wayland" "!x11" "!fallback-x11"]; + Environment."ELECTRON_OZONE_PLATFORM_HINT" = "auto"; }; }; - services.swayidle = { - enable = true; - timeouts = [ - { - timeout = 300; - command = "${lib.getExe pkgs.gtklock} &"; - } - { - timeout = 900; - command = "${lib.getExe' pkgs.systemd "systemctl"} suspend"; - } - ]; - # events = [ - # { - # event = "before-sleep"; - # command = "${lib.getExe pkgs.gtklock}"; - # } - # { - # event = "lock"; - # command = "${lib.getExe pkgs.gtklock}"; - # } - # ]; - systemdTarget = "qtile-session.target"; + programs.firefox.webapps = { + teams = { + url = "https://teams.microsoft.com"; + id = 1; + extraSettings = config.programs.firefox.profiles.default.settings; + name = "Microsoft Teams"; + icon = ./ms_teams.png; + }; }; - services.udiskie.enable = false; # TODO change once upstream python package is fixed in nixpkgs - programs.vscode = { enable = true; extensions = with pkgs.vscode-extensions; [ @@ -162,10 +130,10 @@ in { }; systemd.user.startServices = "sd-switch"; - ezServices = with pkgs; { - swaybg = "${lib.getExe swaybg} -i ${rice.bg.image} -m fill"; - # swayosd = "${lib.getExe' swayosd "swayosd"} --max-volume 100"; - }; + # ezServices = with pkgs; { + # swaybg = "${lib.getExe swaybg} -i ${rice.bg.image} -m fill"; + # # swayosd = "${lib.getExe' swayosd "swayosd"} --max-volume 100"; + # }; xdg.enable = true; xresources.properties = with palette-hex; { @@ -208,18 +176,18 @@ in { comment = "A privacy-first, open-source platform for knowledge management and collaboration."; }; - gtk = with pkgs.rice; { - enable = true; - theme = with gtk-theme; { - inherit package name; - }; - iconTheme = with icons; { - inherit package name; - }; - font = with fonts.sans; { - inherit name size package; - }; - }; + # gtk = with pkgs.rice; { + # enable = true; + # theme = with gtk-theme; { + # inherit package name; + # }; + # iconTheme = with icons; { + # inherit package name; + # }; + # font = with fonts.sans; { + # inherit name size package; + # }; + # }; programs.direnv = { enable = true; diff --git a/home/ms_teams.png b/home/ms_teams.png new file mode 100644 index 0000000..0009690 Binary files /dev/null and b/home/ms_teams.png differ diff --git a/home/programs/firefox.nix b/home/programs/firefox.nix index 944f396..b2c8644 100644 --- a/home/programs/firefox.nix +++ b/home/programs/firefox.nix @@ -11,6 +11,8 @@ name = "Default"; settings = { "browser.startup.homepage" = "about:blank"; + "widget.use-xdg-desktop-portal.file-picker" = 1; + "widget.use-xdg-desktop-portal.mime-handler" = 1; }; extensions = with pkgs.nur.repos.rycee.firefox-addons; [ vimium-c diff --git a/home/util/firefox-webapp.nix b/home/util/firefox-webapp.nix new file mode 100644 index 0000000..d992c7e --- /dev/null +++ b/home/util/firefox-webapp.nix @@ -0,0 +1,203 @@ +{ + config, + lib, + ... +}: let + inherit (builtins) getAttr stringLength substring; + inherit (lib) mkOption; + inherit (lib.attrsets) mapAttrs mapAttrs' nameValuePair; + inherit (lib.strings) concatStringsSep toUpper; + + make-app-profiles = cfg: + mapAttrs' (name: cfg: + nameValuePair "home-manager-webapp-${name}" { + inherit (cfg) id; + + userChrome = '' + @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); + + browser { + margin-right: 0px; margin-bottom: 0px; + } + + #TabsToolbar { + visibility: collapse !important; + } + + #nav-bar { + margin-top: 0; + margin-bottom: -42px; + z-index: -100; + } + + #main-window[windowtype="navigator:browser"] { + background-color: transparent !important; + } + + .tab-background[selected="true"] { + background: ${cfg.backgroundColor} !important; + } + ''; + + settings = + cfg.extraSettings + // { + "browser.sessionstore.resume_session_once" = false; + "browser.sessionstore.resume_from_crash" = false; + "browser.cache.disk.enable" = false; + "browser.cache.disk.capacity" = 0; + "browser.cache.disk.filesystem_reported" = 1; + "browser.cache.disk.smart_size.enabled" = false; + "browser.cache.disk.smart_size.first_run" = false; + "browser.cache.disk.smart_size.use_old_max" = false; + "browser.ctrlTab.previews" = true; + "browser.tabs.warnOnClose" = false; + "plugin.state.flash" = 2; + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + "browser.tabs.drawInTitlebar" = false; + "browser.tabs.inTitlebar" = 0; + "browser.contentblocking.category" = "strict"; + "network.cookie.lifetimePolicy" = 0; + "layout.css.prefers-color-scheme.content-override" = getAttr cfg.theme { + dark = 0; + light = 1; + system = 2; + }; + }; + }) + cfg; +in { + options.programs.firefox.webapps = mkOption { + default = {}; + + type = with lib.types; + attrsOf (submodule { + options = { + #################### + # Firefox settings # + #################### + url = mkOption { + type = str; + description = "The URL of the webapp to launch."; + }; + + id = mkOption { + type = int; + description = "The Firefox profile ID to set."; + }; + + extraArgs = mkOption { + type = listOf str; + default = []; + description = "Extra args to launch Firefox with."; + }; + + extraSettings = mkOption { + type = attrsOf (either bool (either int str)); + default = {}; + description = "Additional Firefox profile settings."; + }; + + backgroundColor = mkOption { + type = str; + default = "rgba(0, 0, 0, 0)"; + description = "The background color to use for loading pages."; + }; + + theme = mkOption { + type = enum ["dark" "light" "system"]; + default = "system"; + description = "The application CSS theme to use, if supported."; + }; + + ######################### + # Desktop file settings # + ######################### + + # Copied from xdg.desktopEntries, with slight modification for default settings + name = mkOption { + type = nullOr str; + default = null; + description = "Specific name of the application. Defaults to the capitalized attribute name."; + }; + + mimeType = mkOption { + description = "The MIME type(s) supported by this application."; + type = nullOr (listOf str); + default = ["text/html" "text/xml" "application/xhtml_xml"]; + }; + + # Copied verbatim from xdg.desktopEntries. + genericName = mkOption { + type = nullOr str; + default = null; + description = "Generic name of the application."; + }; + + comment = mkOption { + type = nullOr str; + default = null; + description = "Tooltip for the entry."; + }; + + categories = mkOption { + type = nullOr (listOf str); + default = null; + description = "Categories in which the entry should be shown in a menu."; + }; + + icon = mkOption { + type = nullOr (either str path); + default = null; + description = "Icon to display in file manager, menus, etc."; + }; + + prefersNonDefaultGPU = mkOption { + type = nullOr bool; + default = null; + description = '' + If true, the application prefers to be run on a more + powerful discrete GPU if available. + ''; + }; + }; + }); + + description = "Websites to create special site-specific Firefox instances for."; + }; + + config = { + programs.firefox.profiles = make-app-profiles config.programs.firefox.webapps; + + xdg.desktopEntries = + mapAttrs (name: cfg: { + inherit (cfg) genericName comment categories icon mimeType prefersNonDefaultGPU; + + name = + if cfg.name == null + then (toUpper (substring 0 1 name)) + (substring 1 (stringLength name) name) + else cfg.name; + + startupNotify = true; + terminal = false; + type = "Application"; + + exec = concatStringsSep " " ([ + "${config.programs.firefox.package}/bin/firefox" + "--class" + "WebApp-${name}" + "-P" + "${config.programs.firefox.profiles."home-manager-webapp-${name}".path}" + "--no-remote" + ] + ++ cfg.extraArgs + ++ ["${cfg.url}"]); + + settings = { + X-MultipleArgs = "false"; # Consider enabling, don't know what this does + StartupWMClass = "WebApp-${name}"; + }; + }) + config.programs.firefox.webapps; + }; +} diff --git a/system/configuration.nix b/system/configuration.nix index 7874ea0..c6dfd70 100644 --- a/system/configuration.nix +++ b/system/configuration.nix @@ -72,7 +72,6 @@ hardware.opengl.driSupport32Bit = true; #input stuff - services.xserver.enable = false; services.xserver.xkb.options = "caps:escape"; services.xserver.xkb.layout = "us"; @@ -80,47 +79,32 @@ services.udisks2.enable = true; - services.xserver.windowManager.qtile = { - enable = true; - backend = "wayland"; - package = inputs.qtile.packages.x86_64-linux.qtile; - configFile = null; # using hm instead - extraPackages = python3Packages: - with python3Packages; [ - pkgs.stable.python3Packages.qtile-extras - # coconut - ]; - }; + services.xserver.enable = true; # SDDM requires this + services.xserver.desktopManager.plasma5.enable = true; + services.xserver.displayManager.sddm.enable = true; + services.xserver.displayManager.defaultSession = "plasmawayland"; + environment.plasma5.excludePackages = with pkgs.libsForQt5; [ + konsole + ]; - services.greetd = { - enable = true; - settings = { - default_session = { - command = "${lib.getExe pkgs.greetd.tuigreet} -r -g \"what's good\" --time --cmd \"qtile start -b wayland\""; - user = "greeter"; - }; - }; - }; + services.flatpak.enable = true; security.polkit.enable = true; - programs.dconf.enable = true; - xdg.autostart.enable = true; - xdg.portal = { - enable = true; - wlr.enable = true; - gtkUsePortal = true; - extraPortals = with pkgs; [ - xdg-desktop-portal-gtk - ]; - config = { - common = { - default = ["wlr" "gtk"]; - "org.freedesktop.impl.portal.FileChooser" = "gtk"; - }; - }; - }; + xdg.portal.enable = true; + # xdg.portal = { + # enable = true; + # extraPortals = with pkgs; [ + # xdg-desktop-portal-gtk + # ]; + # config = { + # common = { + # default = ["wlr" "gtk"]; + # "org.freedesktop.impl.portal.FileChooser" = "gtk"; + # }; + # }; + # }; services.resolved = { enable = true; @@ -139,8 +123,11 @@ }; qt.enable = true; - qt.platformTheme = "gtk2"; - qt.style = "gtk2"; + qt.platformTheme = "kde"; + qt.style = "kvantum"; + programs.dconf.enable = true; + + services.colord.enable = true; programs.zsh.enable = true; users.defaultUserShell = pkgs.zsh; @@ -162,10 +149,6 @@ eza swaybg - pulseaudio - pamixer - brightnessctl - git nix-index @@ -174,6 +157,9 @@ cachix alejandra + + plasma5Packages.qtstyleplugin-kvantum + ayu-theme-gtk ]; documentation.dev.enable = true; @@ -198,28 +184,6 @@ }; networking.nftables.enable = true; - # programs.sway = { - # # to use home-manager - # package = null; - # enable = true; - # wrapperFeatures = { - # base = true; - # gtk = true; - # }; - # # extraPackages = with pkgs; [swaylock swayidle foot dmenu vulkan-validation-layers]; - # }; - - # systemd.services.fixNetworkingForTailscale = { - # wantedBy = ["multi-user.target"]; - # after = ["network.target" "mullvad-daemon.service"]; - # description = "fix the damn routing table"; - # serviceConfig = { - # Type = "oneshot"; - # User = "root"; - # ExecStart = ''${pkgs.bash}/bin/bash -c "if [[ \"$( ${pkgs.iproute2}/bin/ip rule | grep -e \"62:.*52\" | wc -l)\" -eq 0 ]]; then ${pkgs.iproute2}/bin/ip rule add pref 62 table 52; fi"''; - # }; - # }; - # give cpuset to user systemd.services."user@".serviceConfig.Delegate = "memory pids cpu cpuset";