From 2d51ac7f75c4ce3d4365f6c393085e1f450b5292 Mon Sep 17 00:00:00 2001 From: Cian Hughes Date: Wed, 16 Jul 2025 11:31:23 +0100 Subject: [PATCH] Switched profile appearance management from activation script to systemd service This is to fix an issue i found with activation scripts not really playing nicely with UWSM --- nixos/worklaptop.nix | 13 ------------- nixos/worklaptop/services.nix | 35 ++++++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/nixos/worklaptop.nix b/nixos/worklaptop.nix index afbb49d..778e7e4 100644 --- a/nixos/worklaptop.nix +++ b/nixos/worklaptop.nix @@ -127,19 +127,6 @@ extraGroups = ["networkmanager" "wheel" "libvirtd"]; shell = unstablePkgs.nushell; }; - # # The hack below sets the user profile image declaratively - system.activationScripts.script.text = '' - mkdir -p /var/lib/AccountsService/{icons,users} - cp /home/cianh/Pictures/face.png /var/lib/AccountsService/icons/cianh - echo "[User] - Session= - Icon=/var/lib/AccountsService/icons/cianh - SystemAccount=false" > /var/lib/AccountsService/users/cianh - chown root:root /var/lib/AccountsService/users/cianh - chmod 0600 /var/lib/AccountsService/users/cianh - chown root:root /var/lib/AccountsService/icons/cianh - chmod 0444 /var/lib/AccountsService/icons/cianh - ''; xdg.portal = { enable = true; diff --git a/nixos/worklaptop/services.nix b/nixos/worklaptop/services.nix index 3d94ee7..d9d0108 100644 --- a/nixos/worklaptop/services.nix +++ b/nixos/worklaptop/services.nix @@ -39,13 +39,34 @@ }; # Add custom services - systemd.services.pueued = { - enable = true; - description = "Pueue Daemon - CLI process scheduler and manager"; - wantedBy = ["default.target"]; - serviceConfig = { - Restart = "no"; - ExecStart = "${pkgs.pueue.outPath}/bin/pueued -vv"; + systemd.services = { + setup-user-icon = { + description = "Set user profile icon"; + wantedBy = ["multi-user.target"]; + after = ["home.mount"]; + serviceConfig = { + Type = "oneshot"; + ExecStart = '' + ${pkgs.bash}/bin/bash -c " \ + mkdir -p /var/lib/AccountsService/{icons,users} && \ + cp /home/cianh/Pictures/face.png /var/lib/AccountsService/icons/cianh && \ + echo '[User]\nSession=\nIcon=/var/lib/AccountsService/icons/cianh\nSystemAccount=false' > /var/lib/AccountsService/users/cianh && \ + chown root:root /var/lib/AccountsService/users/cianh && \ + chmod 0600 /var/lib/AccountsService/users/cianh && \ + chown root:root /var/lib/AccountsService/icons/cianh && \ + chmod 0444 /var/lib/AccountsService/icons/cianh \ + " + ''; + }; + }; + pueued = { + enable = true; + description = "Pueue Daemon - CLI process scheduler and manager"; + wantedBy = ["default.target"]; + serviceConfig = { + Restart = "no"; + ExecStart = "${pkgs.pueue.outPath}/bin/pueued -vv"; + }; }; };