{ description = "Monster is a javascript and component library for building fantastic web applications."; inputs = { nixpkgs = {url = "github:nixos/nixpkgs/nixos-24.05";}; flake-utils = {url = "github:numtide/flake-utils";}; commonFlake = { url = "git+https://gitlab.schukai.com/schukai/entwicklung/nix-flakes.git?dir=common"; flake = true; }; versionFlake = { url = "git+https://gitlab.schukai.com/oss/utilities/version.git"; flake = true; }; }; outputs = { self, nixpkgs, flake-utils, versionFlake, commonFlake, } @ inputs: flake-utils.lib.eachDefaultSystem (system: let inherit (nixpkgs.lib) optional; commonPck = commonFlake.packages.${system}.common; versionPck = versionFlake.packages.${system}.version; pkgs' = import nixpkgs { inherit system; overlays = [ (final: prev: { common = commonPck; }) (final: prev: { version = versionPck; }) ]; }; in { packages = rec { monster = pkgs'.callPackage ./nix/packages/monster.nix {inherit self pkgs';}; default = monster; }; devShells = { default = let commonPck = commonFlake.packages.${system}.common; commonScript = commonPck + "/bin/common"; versionPck = versionFlake.packages.${system}.version; versionBin = versionPck + "/bin/version"; scriptGoTask = import ./nix/scripts/go-task.nix {inherit self system pkgs';}; commonPackages = import ./nix/config/common-packages.nix {inherit pkgs';}; extendedPackages = [ scriptGoTask ]; scriptPackages = [ versionPck ]; shellPackages = let lib = pkgs'.lib; in commonPackages ++ extendedPackages ++ scriptPackages; in pkgs'.mkShell { nativeBuildInputs = shellPackages; shellHook = '' source ${commonScript} if [ -n "$CI_JOB_TOKEN" ]; then echo_fail "You are in a CI environment, this shell is not intended for CI, but for local development" exit 1 fi echo_header "Monster development shell" readonly worktree=$(get_working_dir) echo_hint "Working directory: ''${worktree}" currentVersion=$(${versionBin} print -g) if [ -z "''${currentVersion}" ]; then echo_fail "No version found, check your git tags" else echo_hint "Current version: ''${currentVersion}" fi currentGitBranch=$(git rev-parse --abbrev-ref HEAD) echo_hint "Current branch: ''${currentGitBranch}" echo_hint "You can run the task command to see the available tasks" if [[ -d "''${worktree}/node_modules" ]]; then echo_ok "Node modules are already installed" else echo_fail "Node modules are not installed" selection=$(${pkgs'.gum}/bin/gum confirm "Do you want to install node modules?" && echo "yes" || echo "no") if [ "$selection" != "yes" ]; then echo_fail "You chose not to install node modules" echo_hint "You have to install node modules to run the project" exit 1 fi task init-project fi echo_section "Happy hacking!" ''; }; gitlab = let commonPck = commonFlake.packages.${system}.common; commonScript = commonPck + "/bin/common"; scriptCleanUp = pkgs'.callPackage ./nix/scripts/clean-up.nix {inherit pkgs';}; scriptRunCITests = pkgs'.callPackage ./nix/scripts/run-ci-tests.nix {inherit pkgs';}; scriptRunCIWebTests = pkgs'.callPackage ./nix/scripts/run-ci-web-tests.nix {inherit pkgs';}; scriptRelease = pkgs'.callPackage ./nix/scripts/release.nix {inherit pkgs';}; scriptDeploy = pkgs'.callPackage ./nix/scripts/deploy.nix {inherit pkgs' system self;}; commonPackages = import ./nix/config/common-packages.nix {inherit pkgs';}; extendedPackages = [ scriptCleanUp scriptRunCITests scriptRunCIWebTests scriptRelease scriptDeploy ]; scriptPackages = [ versionPck ]; shellPackages = let lib = pkgs'.lib; in commonPackages ++ extendedPackages ++ scriptPackages; in pkgs'.mkShell { nativeBuildInputs = shellPackages; shellHook = '' source ${commonScript} if [ -z "$CI_JOB_TOKEN" ]; then echo_fail "You are not in a CI environment, this shell is intended for CI, but for local development" exit 1 fi cd ''${CI_PROJECT_DIR} || exit 1 ''; }; }; }); }