Add orgzly shell

This commit is contained in:
Charlotte Van Petegem 2023-05-15 18:43:33 +02:00
parent d7fa6cf7fa
commit a2dc92cade
No known key found for this signature in database
GPG key ID: 019E764B7184435A
8 changed files with 51 additions and 7 deletions

View file

@ -146,7 +146,7 @@
systemAttrs = flake-utils.lib.eachDefaultSystem (system: systemAttrs = flake-utils.lib.eachDefaultSystem (system:
let let
pkgs = import (nixpkgsForSystem system) { inherit overlays system; }; pkgs = import (nixpkgsForSystem system) { inherit overlays system; };
nameToValue = name: import (./shells + "/${name}.nix") { inherit pkgs inputs; }; nameToValue = name: import (./shells + "/${name}.nix") { inherit pkgs inputs system; };
in in
{ {
devShells = builtins.listToAttrs (builtins.map (name: { inherit name; value = nameToValue name; }) shellNames); devShells = builtins.listToAttrs (builtins.map (name: { inherit name; value = nameToValue name; }) shellNames);

View file

@ -1,4 +1,4 @@
{ pkgs, inputs }: { pkgs, inputs, ... }:
let let
support-services = { support-services = {
memcached.command = "memcached"; memcached.command = "memcached";

View file

@ -1,4 +1,4 @@
{ pkgs, inputs }: pkgs.devshell.mkShell { { pkgs, inputs, ... }: pkgs.devshell.mkShell {
name = "Gamification 2"; name = "Gamification 2";
imports = [ "${inputs.devshell}/extra/language/ruby.nix" ]; imports = [ "${inputs.devshell}/extra/language/ruby.nix" ];
env = [ env = [

View file

@ -1,4 +1,4 @@
{ pkgs, inputs }: pkgs.devshell.mkShell { { pkgs, inputs, ... }: pkgs.devshell.mkShell {
name = "Gandalf"; name = "Gandalf";
imports = [ "${inputs.devshell}/extra/language/ruby.nix" ]; imports = [ "${inputs.devshell}/extra/language/ruby.nix" ];
commands = [ commands = [

View file

@ -1,4 +1,4 @@
{ pkgs, inputs }: pkgs.devshell.mkShell { { pkgs, ... }: pkgs.devshell.mkShell {
name = "NixOS config"; name = "NixOS config";
commands = [ commands = [
{ {

44
shells/orgzly.nix Normal file
View file

@ -0,0 +1,44 @@
{ inputs, system, ... }: let
pkgs = import inputs.nixpkgs { inherit system; config = { android_sdk.accept_license = true; allowUnfree = true; }; overlays = [ inputs.devshell.overlays.default ]; };
buildToolsVersion = "30.0.3";
composed = pkgs.androidenv.composeAndroidPackages {
buildToolsVersions = [ buildToolsVersion ];
platformVersions = [ "32" ];
};
fhsEnv = pkgs.buildFHSUserEnv {
name = "android-sdk-env";
targetPkgs = pkgs: (with pkgs; [ glibc ]);
profile = ''
export ANDROID_SDK_ROOT="${composed.androidsdk}/libexec/android-sdk/"
'';
};
in
pkgs.devshell.mkShell {
name = "Orgzly";
packages = [ pkgs.jdk17 pkgs.kotlin-language-server pkgs.nixpkgs-fmt ];
env = [
{ name = "ANDROID_SDK_ROOT"; eval = "${composed.androidsdk}/libexec/android-sdk/"; }
{ name = "BUILD_TOOLS_PATH"; eval = "$ANDROID_SDK_ROOT/build-tools/${buildToolsVersion}"; }
{ name = "APK_DIR"; eval = "$PRJ_ROOT/app/build/outputs/apk/release"; }
];
commands = [
{
name = "gradle";
category = "tools";
help = "Working gradle invocation";
command = "${fhsEnv}/bin/android-sdk-env \"$PRJ_ROOT/gradlew\" $@";
}
{
name = "install-debug-signed-release";
category = "tools";
help = "Install a debug signed release APK";
command = ''
rm -f "$APK_DIR/"*
gradle assembleRelease
"$BUILD_TOOLS_PATH/zipalign" -v -p 4 "$APK_DIR/app-release-unsigned.apk" "$APK_DIR/app-release-unsigned-aligned.apk"
echo android | "$BUILD_TOOLS_PATH/apksigner" sign --ks "$HOME/.android/debug.keystore" --out "$APK_DIR/app-release.apk" "$APK_DIR/app-release-unsigned-aligned.apk"
adb install -r "$APK_DIR/app-release.apk"
'';
}
];
}

View file

@ -1,4 +1,4 @@
{ pkgs, inputs }: pkgs.devshell.mkShell { { pkgs, inputs, ... }: pkgs.devshell.mkShell {
name = "Tab"; name = "Tab";
imports = [ "${inputs.devshell}/extra/language/ruby.nix" ]; imports = [ "${inputs.devshell}/extra/language/ruby.nix" ];
commands = [ commands = [

View file

@ -1,4 +1,4 @@
{ pkgs, inputs }: pkgs.devshell.mkShell { { pkgs, inputs, ... }: pkgs.devshell.mkShell {
name = "Tap"; name = "Tap";
imports = [ "${inputs.devshell}/extra/language/ruby.nix" ]; imports = [ "${inputs.devshell}/extra/language/ruby.nix" ];
commands = [ commands = [