diff --git a/flake-modules/dev-shell.nix b/flake-modules/dev-shell.nix new file mode 100644 index 000000000..4ef789955 --- /dev/null +++ b/flake-modules/dev-shell.nix @@ -0,0 +1,25 @@ +{ inputs, ... }: + +{ + imports = [ inputs.devshell.flakeModule ]; + + perSystem.devshells.default = + { pkgs, ... }: + { + packages = with pkgs; [ + nodePackages.browser-sync + + (php83.buildEnv { + extraConfig = '' + error_reporting = E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED + ''; + }) + + php83Packages.composer + tailwindcss + + (import ../drafts.nix { inherit pkgs; }) + (import ../new-draft.nix { inherit pkgs; }) + ]; + }; +} diff --git a/flake-modules/systems.nix b/flake-modules/systems.nix new file mode 100644 index 000000000..ce708c68b --- /dev/null +++ b/flake-modules/systems.nix @@ -0,0 +1,3 @@ +{ + systems = [ "x86_64-linux" ]; +} diff --git a/flake.lock b/flake.lock index d29d65a69..b94f97353 100644 --- a/flake.lock +++ b/flake.lock @@ -1,23 +1,94 @@ { "nodes": { - "nixpkgs": { + "devshell": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, "locked": { - "lastModified": 1742422364, - "narHash": "sha256-mNqIplmEohk5jRkqYqG19GA8MbQ/D4gQSK0Mu4LvfRQ=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "a84ebe20c6bc2ecbcfb000a50776219f48d134cc", + "lastModified": 1741473158, + "narHash": "sha256-kWNaq6wQUbUMlPgw8Y+9/9wP0F8SHkjy24/mN3UAppg=", + "owner": "numtide", + "repo": "devshell", + "rev": "7c9e793ebe66bcba8292989a68c0419b737a22a0", "type": "github" }, "original": { - "owner": "nixos", + "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": 1755615617, + "narHash": "sha256-HMwfAJBdrr8wXAkbGhtcby1zGFvs+StOp19xNsbqdOg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "20075955deac2583bb12f07151c2df830ef346b4", + "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" } } diff --git a/flake.nix b/flake.nix index ff9e17aa6..bd0de9bc3 100644 --- a/flake.nix +++ b/flake.nix @@ -1,31 +1,20 @@ { - inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + 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 = - { nixpkgs, ... }: - let - system = "x86_64-linux"; - pkgs = import nixpkgs { inherit system; }; - in - { - devShells.${system}.default = pkgs.mkShell { - buildInputs = with pkgs; [ - nodePackages.browser-sync - - (php83.buildEnv { - extraConfig = '' - error_reporting = E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED - ''; - }) - - php83Packages.composer - tailwindcss - - (import ./drafts.nix { inherit pkgs; }) - (import ./new-draft.nix { inherit pkgs; }) - ]; - }; - - formatter.${system} = pkgs.nixfmt-rfc-style; + inputs: + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + imports = [ + (inputs.import-tree ./flake-modules) + ]; }; }