{ description = "Monster is a javascript and component library for building fantastic web applications."; inputs = { nixpkgs = {url = "github:nixos/nixpkgs/nixos-23.11";}; flake-utils = {url = "github:numtide/flake-utils";}; version = {url = "git+https://gitlab.schukai.com/oss/utilities/version.git/";}; devFlakes = {url = "git+https://gitlab.schukai.com/schukai/entwicklung/nix-flakes.git";}; }; outputs = { self, nixpkgs, flake-utils, devFlakes, version, } @ inputs: flake-utils.lib.eachDefaultSystem (system: let inherit (nixpkgs.lib) optional; pkgs' = import nixpkgs { inherit system; }; versionPath = version.packages.${system}.version; versionBin = versionPath + "/bin/version"; script-task = pkgs'.callPackage ./nix/scripts/go-task.nix {inherit commonScript versionBin;}; script-run-ci-tests = pkgs'.callPackage ./nix/scripts/run-ci-tests.nix {inherit commonScript;}; script-clean-up = pkgs'.callPackage ./nix/scripts/clean-up.nix {inherit commonScript;}; script-deploy = pkgs'.callPackage ./nix/scripts/deploy.nix {inherit commonScript versionBin updateChangelogScript;}; script-update-changelog = pkgs'.callPackage ./nix/scripts/update-changelog.nix {inherit commonScript versionBin;}; updateChangelogScript = script-update-changelog + "/bin/update-changelog"; rootPath = ./.; commonPck = devFlakes.packages.${system}.common; commonScript = commonPck + "/bin/common"; commonPackages = import ./nix/config/common-packages.nix {inherit pkgs';}; extendedPackages = [ script-task ]; scriptPackages = [ versionPath ]; gitlabPackages = commonPackages ++ scriptPackages ++ [ script-deploy script-clean-up script-run-ci-tests ]; shellPackages = let lib = pkgs'.lib; in commonPackages ++ extendedPackages ++ scriptPackages; in { packages = rec { monster = pkgs'.callPackage ./nix/packages/monster.nix {inherit commonScript;}; default = monster; }; devShells = { default = let ciJobToken = builtins.getEnv "CI_JOB_TOKEN"; in pkgs'.mkShell { nativeBuildInputs = shellPackages; shellHook = '' source ${commonScript} if [ -n "${ciJobToken}" ]; 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 "Default Monster 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 "node_modules" ]; then echo_ok "Node modules are already installed" else echo_fail "Node modules are not installed, run task init-project" fi echo_section "Happy hacking!" ''; }; gitlab = let ciJobToken = builtins.getEnv "CI_JOB_TOKEN"; in pkgs'.mkShell { nativeBuildInputs = gitlabPackages; # apps.run-server = pkgs'.writeShellScriptBin "run-server" '' # ${commonScript} # ${script-run-server} # ''; shellHook = '' source ${commonScript} if [ -z "${ciJobToken}" ]; then echo_fail "You are not in a CI environment, this shell is intended for CI, but for local development" exit 1 fi echo_header "Gitlab Monster Shell" ''; }; }; }); }