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