From 70d4601c9b88b0ea1d4c154b76dfceefc42d3312 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Fri, 1 Nov 2024 14:21:02 -0700 Subject: [PATCH] add more samples and update README --- README.md | 22 +++++++++++++++++ hugo/flake.lock | 60 ---------------------------------------------- node/flake.nix | 23 ++++++++++++++++++ wrangler/flake.nix | 24 +++++++++++++++++++ 4 files changed, 69 insertions(+), 60 deletions(-) delete mode 100644 hugo/flake.lock create mode 100644 node/flake.nix create mode 100644 wrangler/flake.nix diff --git a/README.md b/README.md index c16af2a..2cd0a0c 100644 --- a/README.md +++ b/README.md @@ -1 +1,23 @@ Various examples for different nix flakes, useful for `nix develop` + +Usage +----- + +Several options for using these flakes: + +1. Copy the flake.nix file locally, use nix develop +2. Use in place with nix develop. For example, for hugo: + +```sh +$ nix develop https://git.lerch.org/lobo/nix-flake-examples/archive/master.tar.gz?dir=/hugo +``` + +3. Use with [devenv](https://devenv.sh/). Again, hugo example. Add this to `.envrc`: + +```sh +if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM=" +fi + +use flake 'https://git.lerch.org/lobo/nix-flake-examples/archive/master.tar.gz?dir=/hugo' +``` diff --git a/hugo/flake.lock b/hugo/flake.lock deleted file mode 100644 index b526f6f..0000000 --- a/hugo/flake.lock +++ /dev/null @@ -1,60 +0,0 @@ -{ - "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1726560853, - "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1730272153, - "narHash": "sha256-B5WRZYsRlJgwVHIV6DvidFN7VX7Fg9uuwkRW9Ha8z+w=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "2d2a9ddbe3f2c00747398f3dc9b05f7f2ebb0f53", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixpkgs-unstable", - "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/node/flake.nix b/node/flake.nix new file mode 100644 index 0000000..b9326aa --- /dev/null +++ b/node/flake.nix @@ -0,0 +1,23 @@ +{ + description = "Good basic flake template"; + inputs = { + nixpkgs.url = "nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + systempkgs = nixpkgs.legacyPackages.${system}; + in + { + devShells.default = systempkgs.mkShell { + buildInputs = with systempkgs; [ + # specific nodejs versions available, e.g. nodejs_18 + nodejs_20 + nodePackages.typescript-language-server + ]; + }; + } + ); +} diff --git a/wrangler/flake.nix b/wrangler/flake.nix new file mode 100644 index 0000000..57b5d8a --- /dev/null +++ b/wrangler/flake.nix @@ -0,0 +1,24 @@ +{ + description = "Good basic flake template"; + inputs = { + nixpkgs.url = "nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + systempkgs = nixpkgs.legacyPackages.${system}; + in + { + devShells.default = systempkgs.mkShell { + buildInputs = with systempkgs; [ + # specific nodejs versions available, e.g. nodejs_18 + nodejs_20 + nodePackages.typescript-language-server + wrangler + ]; + }; + } + ); +}