diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 238857fc2b1b2b04c9507ec336dd56776fe40421..f48b400d79582cfe2a0e008ee9f13b7f460f9e00 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,8 +5,8 @@ </component> <component name="ChangeListManager"> <list default="true" id="9979eb22-471e-4f2f-b624-fd3edb5e8c6e" name="Changes" comment=""> - <change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/flake.lock" beforeDir="false" afterPath="$PROJECT_DIR$/flake.lock" afterDir="false" /> <change beforePath="$PROJECT_DIR$/flake.nix" beforeDir="false" afterPath="$PROJECT_DIR$/flake.nix" afterDir="false" /> <change beforePath="$PROJECT_DIR$/nix/scripts/go-task.nix" beforeDir="false" afterPath="$PROJECT_DIR$/nix/scripts/go-task.nix" afterDir="false" /> </list> diff --git a/flake.lock b/flake.lock index 77c6c65c618805dbd20ded70edac89bfbf2bd37d..acc266b8251c4f4ceecb5affe62a3cede1fca2b9 100644 --- a/flake.lock +++ b/flake.lock @@ -18,71 +18,7 @@ "type": "github" } }, - "git-commit": { - "inputs": { - "nixpkgs": "nixpkgs" - }, - "locked": { - "lastModified": 1, - "narHash": "sha256-8hXrOA8SKy//ctoL1poIhJwuT7G4rvVu7FguROzEoDg=", - "path": "./git-commit", - "type": "path" - }, - "original": { - "path": "./git-commit", - "type": "path" - } - }, - "gitlab-commit": { - "inputs": { - "git-commit": "git-commit", - "nixpkgs": "nixpkgs_2" - }, - "locked": { - "lastModified": 1704993617, - "narHash": "sha256-++u7I3KCDgP+JhW70k5tiLfBESWVSKdVK7aei0G+mR8=", - "ref": "refs/heads/master", - "rev": "e63b1d6ae5526158fa2a1f4cd53b0ea4f4c93573", - "revCount": 18, - "type": "git", - "url": "https://gitlab.schukai.com/schukai/entwicklung/nix-flakes" - }, - "original": { - "type": "git", - "url": "https://gitlab.schukai.com/schukai/entwicklung/nix-flakes" - } - }, "nixpkgs": { - "locked": { - "lastModified": 1704874635, - "narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-23.11", - "type": "indirect" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1713344939, - "narHash": "sha256-jpHkAt0sG2/J7ueKnG7VvLLkBYUMQbXQ2L8OBpVG53s=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "e402c3eb6d88384ca6c52ef1c53e61bdc9b84ddd", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-23.11", - "type": "indirect" - } - }, - "nixpkgs_3": { "locked": { "lastModified": 1713344939, "narHash": "sha256-jpHkAt0sG2/J7ueKnG7VvLLkBYUMQbXQ2L8OBpVG53s=", @@ -101,8 +37,7 @@ "root": { "inputs": { "flake-utils": "flake-utils", - "gitlab-commit": "gitlab-commit", - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs" } }, "systems": { diff --git a/flake.nix b/flake.nix index d728ebf651dc90b33933c089b7a1d60117693abb..e708ea23b5ddbc7b7f28430dd3d199d38d30e2e6 100644 --- a/flake.nix +++ b/flake.nix @@ -2,89 +2,80 @@ description = "Development environment"; inputs = { - nixpkgs = {url = "github:nixos/nixpkgs/nixos-23.11";}; + nixpkgs = {url = "github:nixos/nixpkgs/nixos-23.11";}; flake-utils = {url = "github:numtide/flake-utils";}; - gitlab-commit = {url = "git+https://gitlab.schukai.com/schukai/entwicklung/nix-flakes";}; }; outputs = { self, nixpkgs, flake-utils, - gitlab-commit, }: - flake-utils.lib.eachDefaultSystem (system: let + flake-utils.lib.eachDefaultSystem (system: + + let inherit (nixpkgs.lib) optional; pkgs' = import nixpkgs {inherit system;}; script-task = pkgs'.callPackage ./nix/scripts/go-task.nix {}; script-run-tests = pkgs'.callPackage ./nix/scripts/run-tests.nix {}; - script-run-extended-tests = pkgs'.callPackage ./nix/scripts/run-extended-tests.nix {}; + script-run-extended-tests = pkgs'.callPackage ./nix/scripts/run-extended-tests.nix {}; script-run-ci-tests = pkgs'.callPackage ./nix/scripts/run-ci-tests.nix {}; script-check-code = pkgs'.callPackage ./nix/scripts/check-code.nix {}; script-build-cover-report = pkgs'.callPackage ./nix/scripts/build-cover-report.nix {}; - - import-gitlab-commit = gitlab-commit.packages.${system}.git-commit; - in { devShells = { default = let ciJobToken = builtins.getEnv "CI_JOB_TOKEN"; in pkgs'.mkShell { - nativeBuildInputs = with pkgs'; [ - script-run-tests - script-run-extended-tests - script-run-ci-tests - script-check-code - script-build-cover-report - script-task + nativeBuildInputs = with pkgs'; + [ + script-run-tests + script-run-extended-tests + script-run-ci-tests + script-check-code + script-build-cover-report + script-task - alejandra - blackbox - blackbox-terminal - coreutils-full - delve - dialog - drill - fd - feh - gcc12 - gdlv - git - glab - gnugrep - gnumake - gnused - go - go-licenses - golangci-lint - gosec - gum - jq - niv - libffi - logrotate - meld - memcached - netcat - ranger - unixtools.xxd - unzip - util-linux - vhs - wget - zlib - ] ++ ( - if ciJobToken == "" - then [ - import-gitlab-commit - ] - else []); - - + alejandra + blackbox + blackbox-terminal + coreutils-full + delve + dialog + drill + fd + feh + gcc12 + gdlv + git + glab + gnugrep + gnumake + gnused + go + go-licenses + golangci-lint + gosec + gum + jq + niv + libffi + logrotate + meld + memcached + netcat + ranger + unixtools.xxd + unzip + util-linux + vhs + wget + zlib + ]; shellHook = '' - echo "Welcome to your development environment." + echo "Welcome to your development environment." ''; }; }; diff --git a/nix/scripts/go-task.nix b/nix/scripts/go-task.nix index 1e2b0b11abbf46252c35cdb11c330c31ec480868..f4f2a553c9a963545f8656bd18e039594f06f2da 100644 --- a/nix/scripts/go-task.nix +++ b/nix/scripts/go-task.nix @@ -17,6 +17,8 @@ TEST_BY_TASK: true cmds: - run-tests + silent: true + run-extended-tests: desc: Execute all tests including cover, bench and race tests. aliases: @@ -25,6 +27,8 @@ TEST_BY_TASK: true cmds: - run-extended-tests + silent: true + build-cover-report: desc: Build coverage report. aliases: @@ -33,6 +37,8 @@ TEST_BY_TASK: true cmds: - build-cover-report + silent: true + check-code: desc: Check code style, linting, and formatting. aliases: @@ -41,6 +47,7 @@ USER_WORKING_DIR: "{{.USER_WORKING_DIR}}" cmds: - check-code + silent: true git-commit: desc: Commit changes. @@ -48,7 +55,9 @@ - gc - commit cmds: - - cd "{{.USER_WORKING_DIR}}" && cd $(git rev-parse --show-toplevel) && git-commit + - cd "{{.USER_WORKING_DIR}}" && cd $(git rev-parse --show-toplevel) && nix run git+https://gitlab.schukai.com/schukai/entwicklung/nix-flakes#git-commit --no-write-lock-file + silent: true + ''; in pkgs.writeShellScriptBin "task" ''