diff --git a/all-packages.nix b/all-packages.nix index 68be749ec..fd82a1cba 100644 --- a/all-packages.nix +++ b/all-packages.nix @@ -1,13 +1,12 @@ -{ newScope, ... }: -let +{newScope, ...}: let self = rec { - flarum = callPackage ./pkgs/flarum { }; - libgnunetchat = callPackage ./pkgs/libgnunetchat { }; - gnunet-messenger-cli = callPackage ./pkgs/gnunet-messenger-cli { }; - liberaforms = callPackage ./pkgs/liberaforms { }; - liberaforms-env = callPackage ./pkgs/liberaforms/env.nix { }; + flarum = callPackage ./pkgs/flarum {}; + libgnunetchat = callPackage ./pkgs/libgnunetchat {}; + gnunet-messenger-cli = callPackage ./pkgs/gnunet-messenger-cli {}; + liberaforms = callPackage ./pkgs/liberaforms {}; + liberaforms-env = callPackage ./pkgs/liberaforms/env.nix {}; }; callPackage = newScope self; in -self + self diff --git a/flake.nix b/flake.nix index 115e02233..700b174f6 100644 --- a/flake.nix +++ b/flake.nix @@ -10,57 +10,44 @@ inputs.treefmt-nix.url = "github:numtide/treefmt-nix"; inputs.treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; - outputs = { self, nixpkgs, php-nixpkgs, flake-utils, ... }: - flake-utils.lib.eachDefaultSystem - (system: - let - pkgs = php-nixpkgs.legacyPackages.${system}; - in - { - packages = import ./all-packages.nix { inherit (pkgs) newScope; }; - nixosModules = { - modules = import ./modules/all-modules.nix; - ngipkgs = { ... }: { - # inject an additional argument into the module system evaluation. - # this way our package set can be accessed separately and we don't have - # to muck around with overlays (which don't work with flakes as you'd expect) - _module.args.ngipkgs = self.packages.${system}; - }; - }; - # XXX: fugly hack to work around literal quoting of attribute paths passed to `nixos-container`. - # without it we'd have to pass `x86_64-linux.`, which will - # be taken as a single attribute name and not an attribute path (i.e. a dot-separated - # sequence attribute names) - }) // { - nixosConfigurations = - let - pkgs = nixpkgs.legacyPackages.x86_64-linux; - all-configurations = import ./configs/all-configurations.nix { inherit pkgs; }; - inject-ngipkgs = k: v: pkgs.nixos ({ ... }: { imports = [ self.nixosModules.x86_64-linux.ngipkgs v ]; }); - in - builtins.mapAttrs inject-ngipkgs all-configurations; - - hydraJobs = { - packages.x86_64-linux = self.packages.x86_64-linux; + outputs = { + self, + nixpkgs, + php-nixpkgs, + flake-utils, + treefmt-nix, + ... + }: let + buildOutputs = system: let + pkgs = nixpkgs.legacyPackages.${system}; + php-pkgs = php-nixpkgs.legacyPackages.${system}; + treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix; + in { + packages = import ./all-packages.nix {inherit (php-pkgs) newScope;}; + nixosModules = { + modules = import ./modules/all-modules.nix; + ngipkgs = {...}: { + # Inject an additional argument into the module system evaluation. + # This way our package set can be accessed separately and we don't have + # to muck around with overlays (which don't work with flakes as you'd expect) + _module.args.ngipkgs = self.packages.${system}; + }; }; formatter = treefmtEval.config.build.wrapper; }; - checkOutputs = system: - let + checkOutputs = system: let pkgs = nixpkgs.legacyPackages.${system}; treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix; - in - { + in { # Configurations have to go in checkOutputs (ie, avoid `eachDefaultSystem`) to generate # a single attribute name for nixos-container deployments (``), because # nixos-container can't parse dot-separated sequence attribute paths (`x86_64-linux.`). - nixosConfigurations = - let - all-configurations = import ./configs/all-configurations.nix { inherit pkgs; }; - inject-ngipkgs = k: v: pkgs.nixos ({ ... }: { imports = [ self.nixosModules.${system}.ngipkgs v ]; }); - in + nixosConfigurations = let + all-configurations = import ./configs/all-configurations.nix {inherit pkgs;}; + inject-ngipkgs = k: v: pkgs.nixos ({...}: {imports = [self.nixosModules.${system}.ngipkgs v];}); + in builtins.mapAttrs inject-ngipkgs all-configurations; # To generate a Hydra jobset for CI builds of all packages @@ -78,5 +65,5 @@ }; }; in - (flake-utils.lib.eachDefaultSystem buildOutputs) // (checkOutputs "x86_64-linux"); - } + (flake-utils.lib.eachDefaultSystem buildOutputs) // (checkOutputs "x86_64-linux"); +} diff --git a/composer.lock b/pkgs/flarum/composer.lock similarity index 100% rename from composer.lock rename to pkgs/flarum/composer.lock diff --git a/default.nix b/pkgs/flarum/default.nix similarity index 92% rename from default.nix rename to pkgs/flarum/default.nix index c5cec61b9..a17835d93 100644 --- a/default.nix +++ b/pkgs/flarum/default.nix @@ -1,5 +1,9 @@ -{ fetchFromGitHub, fetchurl, lib, php }: - +{ + fetchFromGitHub, + fetchurl, + lib, + php, +}: php.buildComposerProject (finalAttrs: { pname = "flarum"; version = "1.8.0";