From 7df3e0321d9f2f3f6473080cbdd06e885b1a51f9 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 17 Sep 2024 13:31:13 +0200 Subject: [PATCH] feat: add devenv --- .envrc | 4 ++- .gitignore | 10 ++++++++ .vscode/launch.json | 2 +- devenv.nix | 31 ++++++++++++++++++++++++ devenv.yaml | 15 ++++++++++++ flake.lock | 59 --------------------------------------------- flake.nix | 50 -------------------------------------- 7 files changed, 60 insertions(+), 111 deletions(-) create mode 100644 devenv.nix create mode 100644 devenv.yaml delete mode 100644 flake.lock delete mode 100644 flake.nix diff --git a/.envrc b/.envrc index 3550a30..5bf8fc1 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,3 @@ -use flake +source_url "https://raw.githubusercontent.com/cachix/devenv/95f329d49a8a5289d31e0982652f7058a189bfca/direnvrc" "sha256-d+8cBpDfDBj41inrADaJt+bDWhOktwslgoP5YiGJ1v0=" + +use devenv \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9080c12..011e4b5 100644 --- a/.gitignore +++ b/.gitignore @@ -98,4 +98,14 @@ app.*.map.json # VS Code .vscode/settings.json +# Devenv +.devenv* +devenv.local.nix +.android/ +local.properties + +# direnv .direnv + +# pre-commit +.pre-commit-config.yaml diff --git a/.vscode/launch.json b/.vscode/launch.json index a5afaf6..196fdad 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -13,7 +13,7 @@ "request": "launch", "type": "dart", "flutterMode": "debug", - "args": ["--flavor", "main"] + "args": ["--flavor", "unsigend"] } ] } diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 0000000..d8a7d66 --- /dev/null +++ b/devenv.nix @@ -0,0 +1,31 @@ +{ pkgs, lib, config, inputs, ... }: + +{ + enterShell = '' + export CHROME_EXECUTABLE=`which chromium` + ''; + + scripts = { + create-emulator.exec = "avdmanager create avd --force --name android-32 --package 'system-images;android-32;google_apis_playstore;x86_64'"; + run-app.exec = "flutter run --flavor unsigned"; + build-apk-unsigned.exec = "flutter build apk --flavor unsigned"; + }; + + android = { + enable = true; + flutter.enable = true; + + platforms.version = [ "31" "33" "34" ]; + cmake.version = [ "3.18.1" "3.22.1" ]; + googleTVAddOns.enable = false; + ndk = { + enable = true; + version = [ "23.1.7779620" "26.1.10909125" ]; + }; + extras = [ ]; + emulator = { + enable = true; + version = "34.1.9"; + }; + }; +} diff --git a/devenv.yaml b/devenv.yaml new file mode 100644 index 0000000..1794a00 --- /dev/null +++ b/devenv.yaml @@ -0,0 +1,15 @@ +# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json +inputs: + nixpkgs: + url: github:NixOS/nixpkgs/nixpkgs-unstable + +# If you're using non-OSS software, you can set allowUnfree to true. +allowUnfree: true + +# If you're willing to use a package that's vulnerable +# permittedInsecurePackages: +# - "openssl-1.1.1w" + +# If you have more than one devenv you can merge them +#imports: +# - ./backend diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 95f5ad6..0000000 --- a/flake.lock +++ /dev/null @@ -1,59 +0,0 @@ -{ - "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": 1717459389, - "narHash": "sha256-I8/plBsua4/NZ5bKgj+z7/ThiWuud1YFwLsn1QQ5PgE=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "3b01abcc24846ae49957b30f4345bab4b3f1d14b", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "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 deleted file mode 100644 index 3951a16..0000000 --- a/flake.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ - description = "Vikunja Flutter app dev environment"; - - inputs.flake-utils.url = "github:numtide/flake-utils"; - - outputs = { self, nixpkgs, flake-utils }: - flake-utils.lib.eachDefaultSystem (system: - let pkgs = import nixpkgs { system = system; config.allowUnfree = true; }; - in { - defaultPackage = pkgs.mkShell { - buildInputs = with pkgs; [ - # Originally copied from https://github.com/zulip/zulip-flutter/blob/d882f50bf7d917ce7e040d7ee1f66f1d803ef988/shell.nix - clang - cmake - ninja - pkg-config - - gtk3 # Curiously `nix-env -i` can't handle this one adequately. - # But `nix-shell` on this shell.nix does fine. - pcre - epoxy - - flutter - - # This group all seem not strictly necessary -- commands like - # `flutter run -d linux` seem to *work* fine without them, but - # the build does print messages about missing packages, like: - # Package mount was not found in the pkg-config search path. - # Perhaps you should add the directory containing `mount.pc' - # to the PKG_CONFIG_PATH environment variable - # To add to this list on NixOS upgrades, the Nix package - # `nix-index` is handy: then `nix-locate mount.pc`. - libuuid # for mount.pc - xorg.libXdmcp.dev - libsepol.dev - libthai.dev - libdatrie.dev - libxkbcommon.dev - dbus.dev - at-spi2-core.dev - xorg.libXtst.out - pcre2.dev - - jdk11 - android-studio - android-tools - ]; - }; - }); -}