Added assets
This commit is contained in:
32
modules/assets.nix
Normal file
32
modules/assets.nix
Normal file
@@ -0,0 +1,32 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
# The assets folder from the project root
|
||||
assetsPath = ../assets;
|
||||
in
|
||||
{
|
||||
systemd.user.services.sync-assets = {
|
||||
description = "Sync assets to home directory";
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
partOf = [ "graphical-session.target" ];
|
||||
script = ''
|
||||
# Remove existing Assets folder to ensure clean sync
|
||||
rm -rf %h/Assets
|
||||
|
||||
# Create the directory
|
||||
mkdir -p %h/Assets
|
||||
|
||||
# Copy contents from the nix store to the home directory
|
||||
# -L dereferences symlinks (if any)
|
||||
# --no-preserve=mode,ownership to ensure the user owns the files and can write to them
|
||||
${pkgs.coreutils}/bin/cp -rL --no-preserve=mode,ownership ${assetsPath}/* %h/Assets/
|
||||
|
||||
# Ensure permissions are correct (u+rw)
|
||||
chmod -R u+rw %h/Assets
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user