Commit 0b145d93 authored by OPNA2608's avatar OPNA2608
Browse files

nixos/lomiri: Add internal basics option for shared shell/greeter things

parent 50e230c4
Loading
Loading
Loading
Loading
+211 −176
Original line number Diff line number Diff line
@@ -13,9 +13,63 @@ in
    enable = lib.mkEnableOption ''
      the Lomiri graphical shell (formerly known as Unity8)
    '';

    basics = lib.mkOption {
      internal = true;
      description = ''
        Enable basic things for getting Lomiri working.
      '';
      type = lib.types.bool;
      default = config.services.xserver.displayManager.lightdm.greeters.lomiri.enable || cfg.enable;
    };
  };

  config = lib.mkIf cfg.enable {
  config = lib.mkMerge [
    # Basics for getting Lomiri to work
    (lib.mkIf cfg.basics {
      environment = {
        # To override the default keyboard layout in Lomiri
        etc.${pkgs.lomiri.lomiri.passthru.etcLayoutsFile}.text = lib.strings.replaceStrings [ "," ] [
          "\n"
        ] config.services.xserver.xkb.layout;

        pathsToLink = [
          # Data
          "/share/locale" # TODO LUITK hardcoded default locale path, fix individual apps to not rely on it
          "/share/wallpapers"
        ];

        systemPackages = with pkgs.lomiri; [
          lomiri-wallpapers # default + additional wallpaper
          suru-icon-theme # basic indicator icons
        ];
      };

      fonts.packages = with pkgs; [
        ubuntu-classic # Ubuntu is default font
      ];

      # Xwayland is partly hardcoded in Mir so it can't really be fully turned off, and it must be on PATH for X11 apps *and Lomiri's web browser* to work.
      # Until Mir/Lomiri can be properly used without it, force it on so everything behaves as expected.
      programs.xwayland.enable = lib.mkForce true;

      services.ayatana-indicators = {
        enable = true;
        packages = (
          with pkgs;
          [
            ayatana-indicator-datetime # Clock
            ayatana-indicator-session # Controls for shutting down etc
          ]
        );
      };
    })

    # Full Lomiri DE
    (lib.mkIf cfg.enable {
      # We need the basic setup as well
      services.desktopManager.lomiri.basics = true;

      environment = {
        systemPackages =
          (with pkgs; [
@@ -44,19 +98,12 @@ in
            lomiri-terminal-app
            lomiri-thumbnailer
            lomiri-url-dispatcher
          lomiri-wallpapers
            mediascanner2 # TODO possibly needs to be kicked off by graphical-session.target
            morph-browser
            qtmir # not having its desktop file for Xwayland available causes any X11 application to crash the session
          suru-icon-theme
            telephony-service
            teleports
          ]);

      # To override the default keyboard layout in Lomiri
      etc.${pkgs.lomiri.lomiri.passthru.etcLayoutsFile}.text = lib.strings.replaceStrings [ "," ] [
        "\n"
      ] config.services.xserver.xkb.layout;
      };

      hardware = {
@@ -76,20 +123,11 @@ in
        lomiri-download-manager
      ];

    fonts.packages = with pkgs; [
      # Applications tend to default to Ubuntu font
      ubuntu-classic
    ];

      # Copy-pasted basic stuff
      hardware.graphics.enable = lib.mkDefault true;
      fonts.enableDefaultPackages = lib.mkDefault true;
      programs.dconf.enable = lib.mkDefault true;

    # Xwayland is partly hardcoded in Mir so it can't really be fully turned off, and it must be on PATH for X11 apps *and Lomiri's web browser* to work.
    # Until Mir/Lomiri can be properly used without it, force it on so everything behaves as expected.
    programs.xwayland.enable = lib.mkForce true;

      services.accounts-daemon.enable = true;

      services.ayatana-indicators = {
@@ -98,11 +136,9 @@ in
          (
            with pkgs;
            [
            ayatana-indicator-datetime
              ayatana-indicator-display
              ayatana-indicator-messages
              ayatana-indicator-power
            ayatana-indicator-session
            ]
            ++ lib.optionals config.hardware.bluetooth.enable [ ayatana-indicator-bluetooth ]
            ++ lib.optionals (config.hardware.pulseaudio.enable || config.services.pipewire.pulse.enable) [
@@ -154,9 +190,7 @@ in
        # At least the network indicator is still under the unity name, due to leftover Unity-isms
        "/share/unity"
        # Data
      "/share/locale" # TODO LUITK hardcoded default locale path, fix individual apps to not rely on it
        "/share/sounds"
      "/share/wallpapers"
      ];

      systemd.user.services = {
@@ -217,7 +251,8 @@ in
      };

      users.groups.usermetrics = { };
  };
    })
  ];

  meta.maintainers = lib.teams.lomiri.members;
}