Skip to content

Commit

Permalink
Merge pull request #261432 from yayayayaka/snipe-it-convert-to-buildC…
Browse files Browse the repository at this point in the history
…omposerProject

snipe-it: convert to buildComposerProject
  • Loading branch information
drupol authored Oct 26, 2023
2 parents 99be59b + d91c530 commit aaccf42
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 2,109 deletions.
16 changes: 10 additions & 6 deletions nixos/modules/services/web-apps/snipe-it.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@ let
inherit (snipe-it.passthru) phpPackage;

# shell script for local administration
artisan = pkgs.writeScriptBin "snipe-it" ''
artisan = (pkgs.writeScriptBin "snipe-it" ''
#! ${pkgs.runtimeShell}
cd ${snipe-it}
cd "${snipe-it}/share/php/snipe-it"
sudo=exec
if [[ "$USER" != ${user} ]]; then
sudo='exec /run/wrappers/bin/sudo -u ${user}'
fi
$sudo ${phpPackage}/bin/php artisan $*
'';
'').overrideAttrs (old: {
meta = old.meta // {
mainProgram = "snipe-it";
};
});
in {
options.services.snipe-it = {

Expand Down Expand Up @@ -357,7 +361,7 @@ in {
services.nginx = {
enable = mkDefault true;
virtualHosts."${cfg.hostName}" = mkMerge [ cfg.nginx {
root = mkForce "${snipe-it}/public";
root = mkForce "${snipe-it}/share/php/snipe-it/public";
extraConfig = optionalString (cfg.nginx.addSSL || cfg.nginx.forceSSL || cfg.nginx.onlySSL || cfg.nginx.enableACME) "fastcgi_param HTTPS on;";
locations = {
"/" = {
Expand Down Expand Up @@ -394,7 +398,7 @@ in {
RuntimeDirectory = "snipe-it/cache";
RuntimeDirectoryMode = "0700";
};
path = [ pkgs.replace-secret ];
path = [ pkgs.replace-secret artisan ];
script =
let
isSecret = v: isAttrs v && v ? _secret && (isString v._secret || builtins.isPath v._secret);
Expand Down Expand Up @@ -451,7 +455,7 @@ in {
rm "${cfg.dataDir}"/bootstrap/cache/*.php || true
# migrate db
${phpPackage}/bin/php artisan migrate --force
${lib.getExe artisan} migrate --force
# A placeholder file for invalid barcodes
invalid_barcode_location="${cfg.dataDir}/public/uploads/barcodes/invalid_barcode.gif"
Expand Down
244 changes: 0 additions & 244 deletions pkgs/servers/web-apps/snipe-it/composer-env.nix

This file was deleted.

15 changes: 0 additions & 15 deletions pkgs/servers/web-apps/snipe-it/composition.nix

This file was deleted.

Loading

0 comments on commit aaccf42

Please sign in to comment.