initial commit
This commit is contained in:
172
flake.nix
Normal file
172
flake.nix
Normal file
@@ -0,0 +1,172 @@
|
||||
{
|
||||
description = "Web Engineering";
|
||||
|
||||
inputs = {
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/9da7f1cf7f8a6e2a7cb3001b048546c92a8258b4";
|
||||
nixpkgs-angular-cli.url = "github:NixOS/nixpkgs/a672be65651c80d3f592a89b3945466584a22069";
|
||||
};
|
||||
|
||||
outputs = inputs @ {
|
||||
flake-parts,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
flake-parts.lib.mkFlake {inherit inputs;} {
|
||||
imports = [];
|
||||
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"];
|
||||
perSystem = {
|
||||
config,
|
||||
self',
|
||||
inputs',
|
||||
pkgs,
|
||||
system,
|
||||
...
|
||||
}:
|
||||
with pkgs.lib; let
|
||||
latexPackages = with pkgs; [
|
||||
latexrun
|
||||
(texlive.withPackages
|
||||
(ps:
|
||||
with ps; [
|
||||
amsmath
|
||||
biber
|
||||
biblatex
|
||||
changepage
|
||||
csquotes
|
||||
enumitem
|
||||
fontaxes
|
||||
latexmk
|
||||
listings
|
||||
minted
|
||||
newtx
|
||||
newtxsf
|
||||
newtxtt
|
||||
scheme-medium
|
||||
textpos
|
||||
times
|
||||
titlesec
|
||||
transparent
|
||||
upquote
|
||||
]))
|
||||
];
|
||||
|
||||
wildfly = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "wildfly-39.0.0.Final";
|
||||
src = pkgs.fetchzip {
|
||||
url = "https://github.com/wildfly/wildfly/releases/download/39.0.0.Final/wildfly-39.0.0.Final.zip";
|
||||
hash = "sha256-nfdb4doRRn4AwMQZkNYwIDBKIq4iY6diFX/WlPFQqZI=";
|
||||
};
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r $src/* $out/
|
||||
'';
|
||||
};
|
||||
|
||||
wildfly-fhs = pkgs.buildFHSEnv {
|
||||
name = "wildfly-fhs";
|
||||
targetPkgs = pkgs:
|
||||
with pkgs; [
|
||||
openjdk21
|
||||
bash
|
||||
coreutils
|
||||
];
|
||||
runScript = "${wildfly}/bin/standalone.sh";
|
||||
profile =
|
||||
# bash
|
||||
''
|
||||
export WILDFLY_BASE_DIR="$HOME/.wildfly-fhs-base"
|
||||
mkdir -p "$WILDFLY_BASE_DIR"/{log,data,deployments,tmp,configuration}
|
||||
if [ ! -f "$WILDFLY_BASE_DIR/configuration/standalone.xml" ]; then
|
||||
cp -r ${wildfly}/standalone/configuration/* "$WILDFLY_BASE_DIR/configuration/"
|
||||
chmod -R u+w "$WILDFLY_BASE_DIR/configuration/"
|
||||
fi
|
||||
export JBOSS_HOME=${wildfly}
|
||||
export JBOSS_BASE_DIR="$WILDFLY_BASE_DIR"
|
||||
'';
|
||||
};
|
||||
in {
|
||||
# Per-system attributes can be defined here. The self' and inputs'
|
||||
# module parameters provide easy access to attributes of the same
|
||||
# system.
|
||||
packages = with pkgs; let
|
||||
fmtNum = strings.fixedWidthNumber 2;
|
||||
fmtReleaseName = sem: author: chap: "${fmtNum sem} - ${fmtNum chap} - ${author.lastName}, ${author.firstName}.pdf";
|
||||
fmtRelease = fmtReleaseName 3 {
|
||||
firstName = "Linus";
|
||||
lastName = "Nagel";
|
||||
};
|
||||
mkUebungPdf = n: args:
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
name = fmtRelease n;
|
||||
version = "1.0.0";
|
||||
src = ./.;
|
||||
buildInputs = latexPackages;
|
||||
buildPhase =
|
||||
# sh
|
||||
''
|
||||
cd docs/uebungen
|
||||
|
||||
latexmk \
|
||||
-pdf \
|
||||
-l -dir-report -file-line-error -verbose \
|
||||
-interaction=nonstopmode \
|
||||
"uebung-${toString n}.tex"
|
||||
'';
|
||||
installPhase =
|
||||
# sh
|
||||
''
|
||||
mkdir -p $out/share $out/log $out/artifacts
|
||||
cp out/uebung-${toString n}.pdf "$out/share/${name}"
|
||||
cp out/*.log $out/log/
|
||||
cp -r out/* $out/artifacts
|
||||
'';
|
||||
}
|
||||
// args;
|
||||
in {
|
||||
"uebung-5" = mkUebungPdf 5 {};
|
||||
"uebung-6" = mkUebungPdf 6 {};
|
||||
"uebung-7" = mkUebungPdf 7 {};
|
||||
};
|
||||
|
||||
devShells.default = with pkgs;
|
||||
mkShell {
|
||||
buildInputs = [wildfly-fhs pkgs.openjdk21];
|
||||
nativeBuildInputs = [];
|
||||
packages =
|
||||
[
|
||||
mermaid-cli
|
||||
openjdk
|
||||
jetty
|
||||
maven
|
||||
]
|
||||
++ latexPackages;
|
||||
|
||||
shellHook =
|
||||
# bash
|
||||
''
|
||||
export WILDFLY_BASE_DIR="$HOME/.wildfly-fhs-base"
|
||||
|
||||
build() {
|
||||
# builds target/demo.war
|
||||
mvn clean package
|
||||
}
|
||||
|
||||
# e.g. 'deploy target/demo.war'
|
||||
deploy() {
|
||||
cp -v "$1" "$WILDFLY_BASE_DIR/deployments/"
|
||||
}
|
||||
|
||||
start() {
|
||||
wildfly-fhs
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
flake = {
|
||||
# The usual flake attributes can be defined here, including system-
|
||||
# agnostic ones like nixosModule and system-enumerating ones, although
|
||||
# those are more easily expressed in perSystem.
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user