From 5505524dd4dfbde9fd3f491447b3844d2fd331f6 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sun, 22 Jun 2025 23:52:17 +0100 Subject: [PATCH] Migrate to flake.parts --- flake.lock | 21 ++++++++++++++++++++ flake.nix | 58 +++++++++++++++++++++++++++++++----------------------- 2 files changed, 54 insertions(+), 25 deletions(-) diff --git a/flake.lock b/flake.lock index cac9087..d2c004a 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,25 @@ { "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1749398372, + "narHash": "sha256-tYBdgS56eXYaWVW3fsnPQ/nFlgWi/Z2Ymhyu21zVM98=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9305fe4e5c2a6fcf5ba6a3ff155720fbe4076569", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1750365781, @@ -18,6 +38,7 @@ }, "root": { "inputs": { + "flake-parts": "flake-parts", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index b21a0d6..147de7e 100644 --- a/flake.nix +++ b/flake.nix @@ -1,33 +1,41 @@ { - inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + inputs = { + flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; + flake-parts.url = "github:hercules-ci/flake-parts"; + + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + }; outputs = - { nixpkgs, ... }: - let - system = "x86_64-linux"; - pkgs = import nixpkgs { inherit system; }; + inputs@{ flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "x86_64-linux" ]; - inherit (pkgs) callPackage; + perSystem = + { config, pkgs, ... }: + let + inherit (pkgs) callPackage; - commonPhpPackages = with pkgs; [ - phpactor - ]; - in - { - devShells.${system} = { - default = pkgs.mkShell { - packages = with pkgs; [ nixd ]; + commonPhpPackages = with pkgs; [ + phpactor + ]; + in + { + devShells = { + default = pkgs.mkShell { + packages = with pkgs; [ nixd ]; + }; + + nodejs = callPackage ./modules/nodejs.nix { }; + + php82 = callPackage ./modules/php82.nix { inherit commonPhpPackages; }; + + php83 = callPackage ./modules/php83.nix { inherit commonPhpPackages; }; + + tailwindcss = callPackage ./modules/tailwindcss.nix { }; + }; + + formatter = pkgs.nixfmt-rfc-style; }; - - nodejs = callPackage ./modules/nodejs.nix { }; - - php82 = callPackage ./modules/php82.nix { inherit commonPhpPackages; }; - - php83 = callPackage ./modules/php83.nix { inherit commonPhpPackages; }; - - tailwindcss = callPackage ./modules/tailwindcss.nix { }; - }; - - formatter.${system} = pkgs.nixfmt-rfc-style; }; }