diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..68f3b10 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +# Devenv +.devenv* +devenv.local.nix +devenv.local.yaml diff --git a/README.md b/README.md index 7df875b..9070e99 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,46 @@ # [rssbase](https://rssbase.io) +
+First, install tools + + +## Developer environment + +The developer environment is handled by: +- [devenv] is a tool for a fast, declarative, reproducible and composable developer environments using Nix +- [nix] is a package manager, but also a programming language, used by devenv + +### Step by step commands + +```bash +# Install nix +curl -fsSL https://install.determinate.systems/nix | sh -s -- install --determinate + +# Nix optimisation +gh auth status || gh auth login +mkdir -p ~/.config/nix && echo "access-tokens = github.com=$(gh auth token)" >> ~/.config/nix/nix.conf +sudo sh -c 'echo "trusted-users = root ${SUDO_USER:-$USER}" >> /etc/nix/nix.custom.conf' +sudo sh -c 'echo "extra-substituters = https://devenv.cachix.org" >> /etc/nix/nix.custom.conf' +sudo sh -c 'echo "extra-trusted-public-keys = devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" >> /etc/nix/nix.custom.conf' +sudo systemctl restart nix-daemon + +# Enable devenv auto activation +if [[ "$SHELL" == */bash ]]; then + grep -qF 'devenv hook bash' ~/.bashrc || echo 'eval "$(devenv hook bash)"' >> ~/.bashrc +elif [[ "$SHELL" == */zsh ]]; then + grep -qF 'devenv hook zsh' ~/.zshrc || echo 'eval "$(devenv hook zsh)"' >> ~/.zshrc +elif [[ "$SHELL" == */fish ]]; then + grep -qF 'devenv hook fish' ~/.config/fish/config.fish || echo 'devenv hook fish | source' >> ~/.config/fish/config.fish +else + open https://devenv.sh/auto-activation/ +fi + +# Get the codebase +git clone git@tangled.org:mykiwi.dev/rssbase && cd rssbase +devenv allow + +# Your developer environment is ready 👨‍🚀🚀 +``` + +[devenv]: https://devenv.sh +[nix]: https://search.nixos.org/packages diff --git a/devenv.lock b/devenv.lock new file mode 100644 index 0000000..07af2c8 --- /dev/null +++ b/devenv.lock @@ -0,0 +1,65 @@ +{ + "nodes": { + "devenv": { + "locked": { + "dir": "src/modules", + "lastModified": 1782492839, + "narHash": "sha256-j9wrcB4al5QhMelEghJ0Qs+RQPT+wyCcI4070NEgPLQ=", + "owner": "cachix", + "repo": "devenv", + "rev": "3d39d0817d62069f7b18821c34a617b5141cb278", + "type": "github" + }, + "original": { + "dir": "src/modules", + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "nixpkgs": { + "inputs": { + "nixpkgs-src": "nixpkgs-src" + }, + "locked": { + "lastModified": 1782132010, + "narHash": "sha256-ZnAVHdVrotp80iIMm5CSR1fdxPlw7Uwmwxb+O/wsgZ8=", + "owner": "cachix", + "repo": "devenv-nixpkgs", + "rev": "12866ae2dddbc0ab8b329915f8072bb9c75bde89", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "rolling", + "repo": "devenv-nixpkgs", + "type": "github" + } + }, + "nixpkgs-src": { + "flake": false, + "locked": { + "lastModified": 1781607440, + "narHash": "sha256-rxO+uc/KFbSJp+pgyXRuAX6QlG9hJdnt0BXpEQRXY+U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3e41b24abd260e8f71dbe2f5737d24122f972158", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} \ No newline at end of file diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 0000000..ec7e612 --- /dev/null +++ b/devenv.nix @@ -0,0 +1,19 @@ +{ + pkgs, + ... +}: + +{ + # https://devenv.sh/packages/ + packages = [ pkgs.git ]; + + # https://devenv.sh/basics/ + enterShell = '' + echo "rssbase devenv:" + echo "- `git --version`" + ''; + + languages.nix.enable = true; + + # See full reference at https://devenv.sh/reference/options/ +} diff --git a/devenv.yaml b/devenv.yaml new file mode 100644 index 0000000..3dcab58 --- /dev/null +++ b/devenv.yaml @@ -0,0 +1,18 @@ +# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json +inputs: + nixpkgs: + url: github:cachix/devenv-nixpkgs/rolling + +# If you're using non-OSS software, you can set allow_unfree to true. +# allow_unfree: true + +# If you're not willing to allow unsupported packages: +# allow_unsupported_system: false + +# If you're willing to use a package that's vulnerable +# permitted_insecure_packages: +# - "openssl-1.1.1w" + +# If you have more than one devenv you can merge them +#imports: +# - ./backend