From 5679918ba7188b0f1b48381e4faf2781a3808a06 Mon Sep 17 00:00:00 2001 From: turtton Date: Mon, 17 Jun 2024 20:55:31 +0900 Subject: [PATCH 1/2] chore: Add nixflake To improve develop experience in my nixos pc --- .dockerignore | 3 ++- .envrc | 4 ++++ .gitignore | 1 + flake.lock | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 25 +++++++++++++++++++++ 5 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.dockerignore b/.dockerignore index 8a924827..776b6240 100644 --- a/.dockerignore +++ b/.dockerignore @@ -8,4 +8,5 @@ npm-debug.log /kotlin/.gradle /kotlin/.idea /kotlin/build -/kotlin/jflex* \ No newline at end of file +/kotlin/jflex* +.direnv diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..9ee556b1 --- /dev/null +++ b/.envrc @@ -0,0 +1,4 @@ +if ! has nix_direnv_version || ! nix_direnv_version 3.0.5; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.5/direnvrc" "sha256-RuwIS+QKFj/T9M2TFXScjBsLR6V3A17YVoEW/Q6AZ1w=" +fi +use flake diff --git a/.gitignore b/.gitignore index b7521ac0..32490b2a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ /.yarn /kotlin/jflex*.jar /tsconfig.tsbuildinfo +/.direnv # dependencies /node_modules diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..93ed53cd --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1718396522, + "narHash": "sha256-C0re6ZtCqC1ndL7ib7vOqmgwvZDhOhJ1W0wQgX1tTIo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3e6b9369165397184774a4b7c5e8e5e46531b53f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..68053fee --- /dev/null +++ b/flake.nix @@ -0,0 +1,25 @@ +{ + description = "A basic flake with a shell"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + + outputs = { nixpkgs, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + corepack = with pkgs; stdenv.mkDerivation { + name = "corepack"; + buildInputs = [ pkgs.nodejs-slim ]; + phases = [ "installPhase" ]; + installPhase = '' + mkdir -p $out/bin + corepack enable --install-directory=$out/bin + ''; + }; + in + { + devShells.default = with pkgs; mkShell { + packages = [ bashInteractive corepack ]; + }; + }); +} From 7785063b6a2c1ab521ce19d4eb89d37efe56094d Mon Sep 17 00:00:00 2001 From: turtton Date: Mon, 17 Jun 2024 21:08:43 +0900 Subject: [PATCH 2/2] chore: Fix pnpm install process --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6a68577e..bc1c5016 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ WORKDIR /app # Install dependencies based on the preferred package manager COPY package.json pnpm-lock.yaml* ./ -RUN yarn global add pnpm && pnpm i +RUN corepack enable && pnpm i FROM gradle:8.6.0-jdk11 AS kdeps WORKDIR /app @@ -35,7 +35,7 @@ COPY . . # Uncomment the following line in case you want to disable telemetry during the build. ENV NEXT_TELEMETRY_DISABLED 1 -RUN yarn global add pnpm && pnpm run buildnd +RUN corepack enable && pnpm run buildnd # If using npm comment out above and use below instead # RUN npm run build