diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..8392d15 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9b3dadf..d754307 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ app/src/main/res/drawable/ app/release app/src/main/ic_launcher-playstore.png app/src/main/res/ +.direnv/ diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..6a0bba4 --- /dev/null +++ b/flake.lock @@ -0,0 +1,96 @@ +{ + "nodes": { + "branch-nix": { + "inputs": { + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable", + "utils": "utils" + }, + "locked": { + "lastModified": 1734137041, + "narHash": "sha256-jjGJtyjrVuLjdGblvHqIRbEv8QCDEzwkZad6ZBG1z5s=", + "ref": "refs/heads/master", + "rev": "410cf7254c55b4d78945e2075ed819daf153239f", + "revCount": 86, + "type": "git", + "url": "ssh://git@github.com/BranchMetrics/nix" + }, + "original": { + "type": "git", + "url": "ssh://git@github.com/BranchMetrics/nix" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1734017764, + "narHash": "sha256-msOfmyJSjAHgIygI/JD0Ae3JsDv4rT54Nlfr5t6MQMQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "64e9404f308e0f0a0d8cdd7c358f74e34802494b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1733940404, + "narHash": "sha256-Pj39hSoUA86ZePPF/UXiYHHM7hMIkios8TYG29kQT4g=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5d67ea6b4b63378b9c13be21e2ec9d1afc921713", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "branch-nix": "branch-nix" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..0aa86ef --- /dev/null +++ b/flake.nix @@ -0,0 +1,36 @@ +{ + description = "BranchLinkSimulatorAndroid flake"; + inputs = { + branch-nix.url = "git+ssh://git@github.com/BranchMetrics/nix"; + }; + + outputs = { self, branch-nix }: + let + nixpkgs = branch-nix.nixpkgs; + extra-pkgs = branch-nix.packages; + utils = branch-nix.utils; + system-utils = branch-nix.system-utils; + in + utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system} // { + extra-pkgs = extra-pkgs.${system}; + }; + jdk = pkgs.openjdk21; + in + { + devShell = pkgs.mkShell { + nativeBuildInputs = [ + jdk + ]; + JAVA_HOME = "${jdk}"; + shellHook = '' + if [ -f $HOME/.config/bin/setup-intellij-jdk ] && [ -f ./.idea/misc.xml ]; then + $HOME/.config/bin/setup-intellij-jdk || echo "setup-intellij-jdk failed" + fi + ''; + }; + formatter = pkgs.nixpkgs-fmt; + } + ); +} \ No newline at end of file