From b0cd4852fd78b7f80aec170fca77269645ea7a7b Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 7 Aug 2025 09:18:42 +0100 Subject: [PATCH] Use import-tree to import modules from a directory --- nix/flakes/import-tree/.envrc | 1 + nix/flakes/import-tree/flake.lock | 98 ++++++++++++++++++++ nix/flakes/import-tree/flake.nix | 20 ++++ nix/flakes/import-tree/modules/dev-shell.nix | 16 ++++ nix/flakes/import-tree/modules/systems.nix | 3 + 5 files changed, 138 insertions(+) create mode 100644 nix/flakes/import-tree/.envrc create mode 100644 nix/flakes/import-tree/flake.lock create mode 100644 nix/flakes/import-tree/flake.nix create mode 100644 nix/flakes/import-tree/modules/dev-shell.nix create mode 100644 nix/flakes/import-tree/modules/systems.nix diff --git a/nix/flakes/import-tree/.envrc b/nix/flakes/import-tree/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/nix/flakes/import-tree/.envrc @@ -0,0 +1 @@ +use flake diff --git a/nix/flakes/import-tree/flake.lock b/nix/flakes/import-tree/flake.lock new file mode 100644 index 0000000..e0cb4a2 --- /dev/null +++ b/nix/flakes/import-tree/flake.lock @@ -0,0 +1,98 @@ +{ + "nodes": { + "devshell": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1741473158, + "narHash": "sha256-kWNaq6wQUbUMlPgw8Y+9/9wP0F8SHkjy24/mN3UAppg=", + "owner": "numtide", + "repo": "devshell", + "rev": "7c9e793ebe66bcba8292989a68c0419b737a22a0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1754487366, + "narHash": "sha256-pHYj8gUBapuUzKV/kN/tR3Zvqc7o6gdFB9XKXIp1SQ8=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "af66ad14b28a127c5c0f3bbb298218fc63528a18", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "import-tree": { + "locked": { + "lastModified": 1752730890, + "narHash": "sha256-GES8fapSLGz36MMPRVNkSUWXUTtqvGQNXHjRmRLfJUY=", + "owner": "vic", + "repo": "import-tree", + "rev": "6ebb8cb87987b20264c09296166543fd3761d274", + "type": "github" + }, + "original": { + "owner": "vic", + "repo": "import-tree", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1754214453, + "narHash": "sha256-Q/I2xJn/j1wpkGhWkQnm20nShYnG7TI99foDBpXm1SY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5b09dc45f24cf32316283e62aec81ffee3c3e376", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1753579242, + "narHash": "sha256-zvaMGVn14/Zz8hnp4VWT9xVnhc8vuL3TStRqwk22biA=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "0f36c44e01a6129be94e3ade315a5883f0228a6e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "root": { + "inputs": { + "devshell": "devshell", + "flake-parts": "flake-parts", + "import-tree": "import-tree", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/nix/flakes/import-tree/flake.nix b/nix/flakes/import-tree/flake.nix new file mode 100644 index 0000000..d1ae92b --- /dev/null +++ b/nix/flakes/import-tree/flake.nix @@ -0,0 +1,20 @@ +{ + inputs = { + devshell.inputs.nixpkgs.follows = "nixpkgs"; + devshell.url = "github:numtide/devshell"; + + flake-parts.url = "github:hercules-ci/flake-parts"; + + import-tree.url = "github:vic/import-tree"; + + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + }; + + outputs = + inputs: + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + imports = [ + (inputs.import-tree ./modules) + ]; + }; +} diff --git a/nix/flakes/import-tree/modules/dev-shell.nix b/nix/flakes/import-tree/modules/dev-shell.nix new file mode 100644 index 0000000..bc9c612 --- /dev/null +++ b/nix/flakes/import-tree/modules/dev-shell.nix @@ -0,0 +1,16 @@ +{ inputs, ... }: + +{ + imports = [ inputs.devshell.flakeModule ]; + + perSystem = + { pkgs, ... }: + { + devshells.default.packages = with pkgs; [ + go + php + phpPackages.composer + tailwindcss + ]; + }; +} diff --git a/nix/flakes/import-tree/modules/systems.nix b/nix/flakes/import-tree/modules/systems.nix new file mode 100644 index 0000000..ce708c6 --- /dev/null +++ b/nix/flakes/import-tree/modules/systems.nix @@ -0,0 +1,3 @@ +{ + systems = [ "x86_64-linux" ]; +}