1# GNOME Initial Setup.
2
3{
4 config,
5 pkgs,
6 lib,
7 ...
8}:
9
10let
11
12 # GNOME initial setup's run is conditioned on whether
13 # the gnome-initial-setup-done file exists in XDG_CONFIG_HOME
14 # Because of this, every existing user will have initial setup
15 # running because they never ran it before.
16 #
17 # To prevent this we create the file if the users stateVersion
18 # is older than 20.03 (the release we added this module).
19
20 script = pkgs.writeScript "create-gis-stamp-files" ''
21 #!${pkgs.runtimeShell}
22 setup_done=$HOME/.config/gnome-initial-setup-done
23
24 echo "Creating g-i-s stamp file $setup_done ..."
25 cat - > $setup_done <<- EOF
26 yes
27 EOF
28 '';
29
30 createGisStampFilesAutostart = pkgs.writeTextFile rec {
31 name = "create-g-i-s-stamp-files";
32 destination = "/etc/xdg/autostart/${name}.desktop";
33 text = ''
34 [Desktop Entry]
35 Type=Application
36 Name=Create GNOME Initial Setup stamp files
37 Exec=${script}
38 StartupNotify=false
39 NoDisplay=true
40 OnlyShowIn=GNOME;
41 AutostartCondition=unless-exists gnome-initial-setup-done
42 X-GNOME-Autostart-Phase=EarlyInitialization
43 '';
44 };
45
46in
47
48{
49
50 meta = {
51 maintainers = lib.teams.gnome.members;
52 };
53
54 ###### interface
55
56 options = {
57
58 services.gnome.gnome-initial-setup = {
59
60 enable = lib.mkEnableOption "GNOME Initial Setup, a Simple, easy, and safe way to prepare a new system";
61
62 };
63
64 };
65
66 ###### implementation
67
68 config = lib.mkIf config.services.gnome.gnome-initial-setup.enable {
69
70 environment.systemPackages = [
71 pkgs.gnome-initial-setup
72 ]
73 ++ lib.optional (lib.versionOlder config.system.stateVersion "20.03") createGisStampFilesAutostart;
74
75 systemd.packages = [
76 pkgs.gnome-initial-setup
77 ];
78
79 systemd.user.targets."gnome-session".wants = [
80 "gnome-initial-setup-copy-worker.service"
81 "gnome-initial-setup-first-login.service"
82 "gnome-welcome-tour.service"
83 ];
84
85 systemd.user.targets."gnome-session@gnome-initial-setup".wants = [
86 "gnome-initial-setup.service"
87 ];
88
89 programs.dconf.profiles.gnome-initial-setup.databases = [
90 "${pkgs.gnome-initial-setup}/share/gnome-initial-setup/initial-setup-dconf-defaults"
91 ];
92 };
93
94}