(6 gnome 桌面)nixos 从0实现全集 梦中情os

输入法

添加到 configuration.nix

1
2
3
4
5
6
7
  i18n.inputMethod = {
      enabled = "fcitx5";
      fcitx5.addons = with pkgs; [
          fcitx5-chinese-addons
          fcitx5-gtk
      ];
  };

启用桌面

添加到 configuration.nix

1
2
3
services.xserver.enable = true;
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;  

去掉一些不需要的包

这些包都会被排除

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
environment.gnome.excludePackages = (with pkgs; [
  gnome-photos
  gnome-tour
  yelp
]) ++ (with pkgs.gnome; [
  gnome-maps
  gnome-contacts 
  gnome-calendar
  cheese # webcam tool
  gnome-music
  gnome-terminal
  gedit # text editor
  epiphany # web browser
  geary # email reader
  evince # document viewer
  gnome-characters
  totem # video player
  tali # poker game
  iagno # go game
  hitori # sudoku game
  atomix # puzzle game
]);

一些可能的错

如果你使用了unstable 一些的包和配置名称可能会变化,比如 gnome-text-editor gedit=> pkgs.gedit

构建

plasma6 目前还在unstable阶段,并且确实很多插件都有问题,建议先用plasma5

1
sudo nixos-rebuild switch --option  substituters https://mirror.sjtu.edu.cn/nix-channels/store

但是 国内源很多有有问题,所以最好还是科学上网 如果构建中出问题需要更换源码,可以运行下面的命令清理后重新运行

1
sudo nix-collect-garbage -d

进阶

flake + home-manager 管理gnome

gnome-flake.nix

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{
  options,
  config,
  lib,
  pkgs,
  ...
}:
with lib;
with lib.plusultra; let
  

in {
  services.xserver.enable = true;
  services.xserver.displayManager.gdm = {
      enable = true;
      autoSuspend = false;
      wayland = true;
    };
  services.xserver.desktopManager.gnome = {
    enable = true;
    extraGSettingsOverridePackages = [pkgs.gnome.gnome-settings-daemon];
  };
  # gsettings set org.gnome.desktop.wm.preferences resize-with-right-button true



  services.udev.packages = with pkgs; [ gnome.gnome-settings-daemon ];

  # 可以和 kde-connect 协议连接的 gnome 软件
  programs.kdeconnect = {
       enable = true;
       package = pkgs.gnomeExtensions.gsconnect;
  };
 
  # 需要屏蔽的gnome 软件
    environment.gnome.excludePackages = (with pkgs; [
      gnome-photos
      gnome-tour
      yelp
      gnome-text-editor
      snapshot #摄像头Camera
      xterm
    ]) ++ (with pkgs.gnome; [
      simple-scan
      gnome-maps
      gnome-contacts
      gnome-calendar
      cheese # webcam tool
      gnome-music
      gnome-terminal
      #gedit # text editor
      pkgs.gedit
      epiphany # web browser
      geary # email reader
      evince # document viewer
      gnome-characters
      totem # video player
      tali # poker game
      iagno # go game
      hitori # sudoku game
      atomix # puzzle game
    ]);
}
 

gnome-home-manager.nix

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
{ config, pkgs, ... }:
let
  wallpaper = "${../../../pkgs/wallpaper-hm/pics/butterfly_surface_wooden_116623_3840x2160.jpg}";
  avatar = "${../../../staticFile/avatar.jpg}";
in
{
  imports = [
    # ../../../pkgs/wallpaper-hm
  ];
  home.file.".face".source = avatar; #头像
  home.packages = with pkgs;[
    gnome.gnome-tweaks
    gnome.gnome-themes-extra
    wl-clipboard
    gnome.adwaita-icon-theme
    pkgs.whitesur-gtk-theme
    gnome.dconf-editor

    gnomeExtensions.appindicator
    #gnomeExtensions.dash-to-dock
    gnomeExtensions.clipboard-history
    #gnomeExtensions.kimpanel #输入法样式,注释掉 使用 fcitx5.pkgs的配置
    gnomeExtensions.blur-my-shell
    #gnomeExtensions.paperwm #不太好用 alt+tab 还可以
    #gnomeExtensions.material-shell 不兼容最新版
    gnomeExtensions.bing-wallpaper-changer
  ];

  gtk = {
    enable = true;
    font = {
      package = pkgs.cantarell-fonts;
      name = "Cantarell 11";
    };

    #theme = {
    #   name = "vimix-dark-ruby";
    #   package = pkgs.vimix-gtk-themes.override {
    #     themeVariants = ["beryl"];#[doder|beryl|ruby|amethyst|jade|grey|all] 
    #     colorVariants = ["dark"];
    #     tweaks = ["flat" "grey"];
    #   };
    # };
    #Adwaita-dark
    #theme.name = "Adwaita-dark";

    theme = {
      name = "Adwaita-dark";
      package = pkgs.gnome3.gnome-themes-extra;
    };

    #cursorTheme = {
    #  name    = "Vanilla-DMZ";
    #  package = pkgs.vanilla-dmz;
    #};

    #iconTheme = {
    #  name    = "Vanilla-DMZ";
    #  package = pkgs.vanilla-dmz; # gnome3.adwaita-icon-theme;
    #};

    iconTheme = {
      package = pkgs.papirus-icon-theme;
      name = "Papirus-Dark";
    };

    gtk3.extraConfig = {
      #gtk-decoration-layout = "appmenu:";
      #gtk-decoration-layout = "appmenu:minimize,close";  #去掉最大化按钮 没啥卵用
    };
  };

  dconf = {
    enable = true;
    settings = {
      "org/gnome/shell" = {
        disable-user-extensions = false;
        enabled-extensions = [
          "appindicatorsupport@rgcjonas.gmail.com" #系统托盘
          #"dash-to-dock@micxgx.gmail.com"
          "clipboard-history@alexsaveau.dev" # 剪切板
          #"kimpanel@kde.org"
          "blur-my-shell@aunetx" #毛玻璃
          "BingWallpaper@ineffable-gmail.com"
          "apps-menu@gnome-shell-extensions.gcampax.github.com"
          #"auto-move-windows@gnome-shell-extensions.gcampax.github.corm"
          #"drive-menu@gnome-shell-extensions.gcampax.github.com"
          #"launch-new-instance@gnome-shell-extensions.gcampax.github.com"
          #"light-style@gnome-shell-extensions.gcampax.github.com"
          #"native-window-placement@gnome-shell-extensions.gcampax.github.com"
          #"places-menu@gnome-shell-extensions.gcampax.github.com"
          "screenshot-window-sizer@gnome-shell-extensions.gcampax.github.com"
          "user-theme@gnome-shell-extensions.gcampax.github.com"
          "window-list@gnome-shell-extensions.gcampax.github.com"
          "windowsNavigator@gnome-shell-extensions.gcampax.github.com"
          #"workspace-indicator@gnome-shell-extensions.gcampax.github.com"

          #"paperwm@paperwm.github.com"
          #"material-shell@papyelgringo"
        ];
        favorite-apps = [
          "firefox.desktop"
          "chromium-browser.desktop"
          "microsoft-edge.desktop"
          "brave-browser.desktop"
          "com.vivaldi.Vivaldi.desktop"
          "terminator.desktop"
          "org.gnome.Terminal.desktop"
          "org.gnome.Nautilus.desktop"
          "code.desktop"
          "sublime_text.desktop"
          "nixos-manual.desktop"
          "gparted.desktop"

          "idea-ultimate.desktop"
          "rust-rover.desktop"
          "goland.desktop"
          "pycharm-professional.desktop"
          "goland.desktop"
          "jetbrains-toolbox.desktop"

          "AnotherRedisDesktopManager.desktop"
          "Hiddify-next.desktop"

          "virtualbox.desktop"
        ];

      };
      "org/gnome/desktop/background" = {
        # 壁纸
        picture-uri = wallpaper;
        picture-uri-dark = wallpaper;
      };
      "org/gnome/mutter" = {
        # 新窗口在屏幕中心打开
        center-new-windows = true;
      };

      "org/gnome/desktop/interface" = {
        # gtk-theme="Adwaita-dark";
        clock-show-date = true;
        clock-show-weekday = true;
        color-scheme = "prefer-dark";
      };
      #电源和做锁屏 ===============
      "org/gnome/desktop/screensaver" = {
        lock-delay = 0;
        lock-enabled = true;
      };
      "org/gnome/desktop/session" = {
        idle-delay = 0;
      };
      #gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'
      #gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'nothing'
      "org.gnome.settings-daemon.plugins.power" = {
        sleep-inactive-ac-type = "nothing";
        sleep-inactive-battery-type = "nothing";
      };
      "org/gnome/settings-daemon/plugins/power" = {
        idle-dim = false;
        power-button-action = "suspend";
        sleep-inactive-ac-type = "nothing";
        sleep-inactive-battery-timeout = 1800;
        sleep-inactive-battery-type = "hibernate";
      };
      #电源和做锁屏 ===============

      "org/gnome/desktop/wm/preferences" = {
        resize-with-right-button = true; #win+右键 修改窗口大小  
        button-layout = "appmenu:minimize,close"; #去掉最大化按钮 没啥卵用
        focus-mode = "sloppy";
      };

      "org/gnome/desktop/wm/keybindings" = {
        close = [ "<Alt>F4" "<Super><Shift>q" ]; # 关闭窗口
        show-desktop = [ "<Super>d" ]; # win+d 显示桌面壁纸
      };
      "org/gnome/settings-daemon/plugins/media-keys" = {
        custom-keybindings = [
          "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/"
          "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/"
          "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/"
          "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3/"
          "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom4/"
        ];
        home = [ "<Super>e" ]; # 打开文件home 使用默认文件管理器
      };
      "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
        binding = "<Super>Return";
        command = "terminator";
        name = "Open terminator";
      };
      "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = {
        binding = "<Super>p";
        command = "flameshot gui";
        name = "Open flameshot gui";
      };
      "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2" = {
        binding = "<Shift><Ctrl>Escape";
        command = "gnome-system-monitor";
        name = "gnome-system-monitor";
      };
      # 毛玻璃效果 ============================================================ start
      "org/gnome/shell/extensions/blur-my-shell" = { hacks-level = 3; };
      "org/gnome/shell/extensions/blur-my-shell/applications" = {
        whitelist = [ "terminator" "kitty" "emacs" ];
        blur-on-overview = true;
        sigma = 44;
        opacity = 241;
      };
      "org/gnome/shell/extensions/blur-my-shell/appfolder" = {
        blur = true;
        dialog-opacity = 1;
      };
      # 毛玻璃效果 ============================================================ end
      "org/gnome/desktop/notifications/application/com-tencent-wechat" = {
        force-expanded = true;
        show-banners = true;
      };
    };
  };

}
Licensed under CC BY-NC-SA 4.0
comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计