1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-19 04:02:10 +00:00

Merge pull request #187270 from yayayayaka/snipe-it-add-missing-directory

This commit is contained in:
Sandro 2022-10-26 22:11:24 +02:00 committed by GitHub
commit 45ff74823b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 15 deletions

View file

@ -454,25 +454,43 @@ in {
# migrate db
${pkgs.php}/bin/php artisan migrate --force
# A placeholder file for invalid barcodes
invalid_barcode_location="${cfg.dataDir}/public/uploads/barcodes/invalid_barcode.gif"
[ ! -e "$invalid_barcode_location" ] \
&& cp ${snipe-it}/share/snipe-it/invalid_barcode.gif "$invalid_barcode_location"
'';
};
systemd.tmpfiles.rules = [
"d ${cfg.dataDir} 0710 ${user} ${group} - -"
"d ${cfg.dataDir}/bootstrap 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/bootstrap/cache 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/public 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/public/uploads 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/storage 0700 ${user} ${group} - -"
"d ${cfg.dataDir}/storage/app 0700 ${user} ${group} - -"
"d ${cfg.dataDir}/storage/fonts 0700 ${user} ${group} - -"
"d ${cfg.dataDir}/storage/framework 0700 ${user} ${group} - -"
"d ${cfg.dataDir}/storage/framework/cache 0700 ${user} ${group} - -"
"d ${cfg.dataDir}/storage/framework/sessions 0700 ${user} ${group} - -"
"d ${cfg.dataDir}/storage/framework/views 0700 ${user} ${group} - -"
"d ${cfg.dataDir}/storage/logs 0700 ${user} ${group} - -"
"d ${cfg.dataDir}/storage/uploads 0700 ${user} ${group} - -"
"d ${cfg.dataDir}/storage/private_uploads 0700 ${user} ${group} - -"
"d ${cfg.dataDir} 0710 ${user} ${group} - -"
"d ${cfg.dataDir}/bootstrap 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/bootstrap/cache 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/public 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/public/uploads 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/public/uploads/accessories 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/public/uploads/assets 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/public/uploads/avatars 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/public/uploads/barcodes 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/public/uploads/categories 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/public/uploads/companies 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/public/uploads/components 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/public/uploads/consumables 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/public/uploads/departments 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/public/uploads/locations 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/public/uploads/manufacturers 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/public/uploads/models 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/public/uploads/suppliers 0750 ${user} ${group} - -"
"d ${cfg.dataDir}/storage 0700 ${user} ${group} - -"
"d ${cfg.dataDir}/storage/app 0700 ${user} ${group} - -"
"d ${cfg.dataDir}/storage/fonts 0700 ${user} ${group} - -"
"d ${cfg.dataDir}/storage/framework 0700 ${user} ${group} - -"
"d ${cfg.dataDir}/storage/framework/cache 0700 ${user} ${group} - -"
"d ${cfg.dataDir}/storage/framework/sessions 0700 ${user} ${group} - -"
"d ${cfg.dataDir}/storage/framework/views 0700 ${user} ${group} - -"
"d ${cfg.dataDir}/storage/logs 0700 ${user} ${group} - -"
"d ${cfg.dataDir}/storage/uploads 0700 ${user} ${group} - -"
"d ${cfg.dataDir}/storage/private_uploads 0700 ${user} ${group} - -"
];
users = {

View file

@ -7,12 +7,20 @@ let
noDev = true; # Disable development dependencies
}).overrideAttrs (attrs : {
installPhase = attrs.installPhase + ''
# Before symlinking the following directories, copy the invalid_barcode.gif
# to a different location. The `snipe-it-setup` oneshot service will then
# copy the file back during bootstrap.
mkdir -p $out/share/snipe-it
cp $out/public/uploads/barcodes/invalid_barcode.gif $out/share/snipe-it/
rm -R $out/storage $out/public/uploads $out/bootstrap/cache
ln -s ${dataDir}/.env $out/.env
ln -s ${dataDir}/storage $out/
ln -s ${dataDir}/public/uploads $out/public/uploads
ln -s ${dataDir}/bootstrap/cache $out/bootstrap/cache
chmod +x $out/artisan
substituteInPlace config/database.php --replace "env('DB_DUMP_PATH', '/usr/local/bin')" "env('DB_DUMP_PATH', '${mariadb}/bin')"
'';
});