go-musicfox: 4.5.7 -> 4.6.0 (#364326)
[NixPkgs.git] / nixos / modules / services / desktops / gnome / gnome-initial-setup.nix
blobf130b820b71670011e8f021635b75418ff2be1d2
1 # GNOME Initial Setup.
4   config,
5   pkgs,
6   lib,
7   ...
8 }:
10 let
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).
20   script = pkgs.writeScript "create-gis-stamp-files" ''
21     #!${pkgs.runtimeShell}
22     setup_done=$HOME/.config/gnome-initial-setup-done
24     echo "Creating g-i-s stamp file $setup_done ..."
25     cat - > $setup_done <<- EOF
26     yes
27     EOF
28   '';
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   };
50   meta = {
51     maintainers = lib.teams.gnome.members;
52   };
54   ###### interface
56   options = {
58     services.gnome.gnome-initial-setup = {
60       enable = lib.mkEnableOption "GNOME Initial Setup, a Simple, easy, and safe way to prepare a new system";
62     };
64   };
66   ###### implementation
68   config = lib.mkIf config.services.gnome.gnome-initial-setup.enable {
70     environment.systemPackages =
71       [
72         pkgs.gnome-initial-setup
73       ]
74       ++ lib.optional (lib.versionOlder config.system.stateVersion "20.03") createGisStampFilesAutostart;
76     systemd.packages = [
77       pkgs.gnome-initial-setup
78     ];
80     systemd.user.targets."gnome-session".wants = [
81       "gnome-initial-setup-copy-worker.service"
82       "gnome-initial-setup-first-login.service"
83       "gnome-welcome-tour.service"
84     ];
86     systemd.user.targets."gnome-session@gnome-initial-setup".wants = [
87       "gnome-initial-setup.service"
88     ];
90     programs.dconf.profiles.gnome-initial-setup.databases = [
91       "${pkgs.gnome-initial-setup}/share/gnome-initial-setup/initial-setup-dconf-defaults"
92     ];
93   };