diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..faa8210 --- /dev/null +++ b/.envrc @@ -0,0 +1,3 @@ +source_url "https://raw.githubusercontent.com/cachix/devenv/d1f7b48e35e6dee421cfd0f51481d17f77586997/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0=" + +use devenv diff --git a/.gitignore b/.gitignore index 0d93981..5b52762 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,7 @@ __pycache__ *.bin *.rom build + +# Devenv +.devenv* +devenv.local.nix diff --git a/README.md b/README.md index 0c902ce..dc84211 100644 --- a/README.md +++ b/README.md @@ -79,21 +79,29 @@ For more details please refer to the [methodology documentation](docs/methodolog ## Requirements -- [cbfstool](https://github.com/coreboot/coreboot/tree/master/util/cbfstool) - installed on host system -- [UEFIExtract NE](https://github.com/LongSoft/UEFITool) installed in host - system -- `lzma` compression tool installed on host system -- `make` - -Python requirements: +* Install [Nix pakcage manager](https://nixos.org/download.html) ```bash -virtualenv -p $(which python3) venv -source venv/bin/activate -pip install -r requirements.txt +sh <(curl -L https://nixos.org/nix/install) --no-daemon ``` +* Install [devenv](https://devenv.sh/getting-started/) + +```bash +nix-env -iA cachix -f https://cachix.org/api/v1/install +cachix use devenv +nix-env -if https://github.com/cachix/devenv/tarball/latest +``` + +* Enter devenv shell + +```bash +devenv shell +``` + +* Now you have all dependencies in place, and can proceed with using the + scripts + ## Documentation The documentation sources can be found in [docs directory](docs). diff --git a/devenv.lock b/devenv.lock new file mode 100644 index 0000000..5a6df73 --- /dev/null +++ b/devenv.lock @@ -0,0 +1,138 @@ +{ + "nodes": { + "devenv": { + "locked": { + "dir": "src/modules", + "lastModified": 1685521914, + "narHash": "sha256-0fdFP5IASLwJ0PSXrErW8PZon9TVYmi8VRF8OtjGkV4=", + "owner": "cachix", + "repo": "devenv", + "rev": "e206d8f2e3e8d6aa943656052f15bdfea8146b8d", + "type": "github" + }, + "original": { + "dir": "src/modules", + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1685399834, + "narHash": "sha256-Lt7//5snriXSdJo5hlVcDkpERL1piiih0UXIz1RUcC4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "58c85835512b0db938600b6fe13cc3e3dc4b364e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1678872516, + "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1685361114, + "narHash": "sha256-4RjrlSb+OO+e1nzTExKW58o3WRwVGpXwj97iCta8aj4=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "ca2fdbf3edda2a38140184da6381d49f8206eaf4", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 0000000..f18e646 --- /dev/null +++ b/devenv.nix @@ -0,0 +1,25 @@ +{ pkgs, ... }: + +with pkgs; +{ + packages = [ + coreboot-utils + uefitool + lzma + stdenv.cc.cc.lib + glib + ]; + + languages.python.enable = true; + languages.python.venv.enable = true; + + enterShell = '' + echo "Welcome!" + pip install -r ./requirements.txt + ''; + + # pre-commit.hooks = { + # # lint shell scripts + # shellcheck.enable = true; + # }; +} diff --git a/devenv.yaml b/devenv.yaml new file mode 100644 index 0000000..c7cb5ce --- /dev/null +++ b/devenv.yaml @@ -0,0 +1,3 @@ +inputs: + nixpkgs: + url: github:NixOS/nixpkgs/nixpkgs-unstable