templates: add mojo template
This commit is contained in:
parent
bad40bdbf6
commit
33c5b13e99
@ -178,5 +178,9 @@
|
||||
path = ./templates/perl;
|
||||
description = "Perl template.";
|
||||
};
|
||||
templates."mojo" = {
|
||||
path = ./templates/mojo;
|
||||
description = "Perl MojoLicious template.";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
1
templates/mojo/.envrc
Normal file
1
templates/mojo/.envrc
Normal file
@ -0,0 +1 @@
|
||||
use flake
|
15
templates/mojo/LICENSE
Normal file
15
templates/mojo/LICENSE
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Aaron Bieber <aaron@bolddaemon.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
53
templates/mojo/flake.nix
Normal file
53
templates/mojo/flake.nix
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
description = "thing: stuff and things";
|
||||
|
||||
inputs.nixpkgs.url = "nixpkgs/nixos-22.05";
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
supportedSystems =
|
||||
[ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
|
||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
|
||||
in {
|
||||
packages = forAllSystems (system:
|
||||
let pkgs = nixpkgsFor.${system};
|
||||
in {
|
||||
thing = pkgs.stdenv.mkDerivation {
|
||||
pname = "thing";
|
||||
version = "v0.0.0";
|
||||
src = ./.;
|
||||
buildInputs = with pkgs.perlPackages; [ PerlTidy perl ];
|
||||
nativeBuildInputs = with pkgs.perlPackages; [
|
||||
perl
|
||||
Mojolicious
|
||||
MojoSQLite
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
install -t $out/bin thing.pl
|
||||
'';
|
||||
};
|
||||
});
|
||||
|
||||
defaultPackage = forAllSystems (system: self.packages.${system}.thing);
|
||||
devShells = forAllSystems (system:
|
||||
let pkgs = nixpkgsFor.${system};
|
||||
in {
|
||||
default = pkgs.mkShell {
|
||||
shellHook = ''
|
||||
PS1='\u@\h:\@; '
|
||||
echo "Perl `${pkgs.perl}/bin/perl --version`"
|
||||
'';
|
||||
buildInputs = with pkgs.perlPackages; [ PerlTidy ];
|
||||
nativeBuildInputs = with pkgs.perlPackages; [
|
||||
perl
|
||||
Mojolicious
|
||||
MojoSQLite
|
||||
];
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
14
templates/mojo/thing.pl
Normal file
14
templates/mojo/thing.pl
Normal file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use 5.10.0;
|
||||
|
||||
use Mojolicious::Lite -signatures;
|
||||
|
||||
get '/' => sub ($c) {
|
||||
$c->render(text => 'Hello Thing!');
|
||||
};
|
||||
|
||||
app->start;
|
Loading…
Reference in New Issue
Block a user