From aee38783e77d8ef327b3a2597593014a08dbd6d6 Mon Sep 17 00:00:00 2001 From: Lorenz Leutgeb Date: Fri, 15 Sep 2023 14:34:40 +0200 Subject: [PATCH] repo: Introduce `pkgs/by-name` --- all-packages.nix | 60 ------------------- flake.nix | 42 +++++++------ pkgs/by-name/default.nix | 32 ++++++++++ .../by-name/euclid3/package.nix | 0 pkgs/{ => by-name}/flarum/composer.lock | 0 .../flarum/package.nix} | 0 .../gnunet-messenger-cli/package.nix} | 2 +- pkgs/{ => by-name}/kikit/README.md | 0 .../default.nix => by-name/kikit/package.nix} | 0 pkgs/{ => by-name}/kikit/shapely/default.nix | 0 .../kikit/shapely/library-paths.patch | 0 .../kikit/solidpython/default.nix | 0 .../default.nix => by-name/lcrq/package.nix} | 0 .../lcsync/package.nix} | 0 .../libgnunetchat/package.nix} | 0 .../librecast/package.nix} | 0 .../by-name/pcbnew-transition/package.nix | 0 pkgs/by-name/pretalx-frontend/package.nix | 20 +++++++ .../by-name/pybars3/package.nix | 0 .../by-name/pymeta3/package.nix | 0 .../rosenpass-tools/package.nix} | 0 .../rosenpass/package.nix} | 0 pkgs/default.nix | 33 ++++++++++ 23 files changed, 110 insertions(+), 79 deletions(-) delete mode 100644 all-packages.nix create mode 100644 pkgs/by-name/default.nix rename nixpkgs-candidates/euclid3/default.nix => pkgs/by-name/euclid3/package.nix (100%) rename pkgs/{ => by-name}/flarum/composer.lock (100%) rename pkgs/{flarum/default.nix => by-name/flarum/package.nix} (100%) rename pkgs/{gnunet-messenger-cli/default.nix => by-name/gnunet-messenger-cli/package.nix} (95%) rename pkgs/{ => by-name}/kikit/README.md (100%) rename pkgs/{kikit/default.nix => by-name/kikit/package.nix} (100%) rename pkgs/{ => by-name}/kikit/shapely/default.nix (100%) rename pkgs/{ => by-name}/kikit/shapely/library-paths.patch (100%) rename pkgs/{ => by-name}/kikit/solidpython/default.nix (100%) rename pkgs/{lcrq/default.nix => by-name/lcrq/package.nix} (100%) rename pkgs/{lcsync/default.nix => by-name/lcsync/package.nix} (100%) rename pkgs/{libgnunetchat/default.nix => by-name/libgnunetchat/package.nix} (100%) rename pkgs/{librecast/default.nix => by-name/librecast/package.nix} (100%) rename nixpkgs-candidates/pcbnew-transition/default.nix => pkgs/by-name/pcbnew-transition/package.nix (100%) create mode 100644 pkgs/by-name/pretalx-frontend/package.nix rename nixpkgs-candidates/pybars3/default.nix => pkgs/by-name/pybars3/package.nix (100%) rename nixpkgs-candidates/pymeta3/default.nix => pkgs/by-name/pymeta3/package.nix (100%) rename pkgs/{rosenpass-tools/default.nix => by-name/rosenpass-tools/package.nix} (100%) rename pkgs/{rosenpass/default.nix => by-name/rosenpass/package.nix} (100%) create mode 100644 pkgs/default.nix diff --git a/all-packages.nix b/all-packages.nix deleted file mode 100644 index b1a4e8745..000000000 --- a/all-packages.nix +++ /dev/null @@ -1,60 +0,0 @@ -{ - lib, - newScope, - nixosTests, -}: let - self = let - pretalxPlugins = lib.recurseIntoAttrs (callPackage ./pkgs/pretalx/plugins.nix {}); - in rec { - flarum = callPackage ./pkgs/flarum {}; - gnunet-messenger-cli = callPackage ./pkgs/gnunet-messenger-cli {}; - kikit = callPackage ./pkgs/kikit {}; - lcrq = callPackage ./pkgs/lcrq {}; - lcsync = callPackage ./pkgs/lcsync {inherit lcrq librecast;}; - - # LiberaForms is intentionally disabled. - # Refer to . - #liberaforms = callPackage ./pkgs/liberaforms {}; - #liberaforms-env = callPackage ./pkgs/liberaforms/env.nix {}; - - libgnunetchat = callPackage ./pkgs/libgnunetchat {}; - librecast = callPackage ./pkgs/librecast {inherit lcrq;}; - pretalx = callPackage ./pkgs/pretalx {}; - pretalx-frontend = callPackage ./pkgs/pretalx/frontend.nix {}; - pretalx-full = callPackage ./pkgs/pretalx { - withPlugins = [ - pretalx-downstream - pretalx-media-ccc-de - pretalx-pages - pretalx-venueless - pretalx-public-voting - ]; - }; - - inherit - (pretalxPlugins) - pretalx-downstream - pretalx-media-ccc-de - pretalx-pages - pretalx-venueless - pretalx-public-voting - ; - - rosenpass = callPackage ./pkgs/rosenpass {}; - rosenpass-tools = callPackage ./pkgs/rosenpass-tools {}; - }; - - nixpkgs-candidates = { - # Attempting to upstream to nixpkgs here: https://github.com/NixOS/nixpkgs/pull/249464 - pcbnew-transition = callPackage ./nixpkgs-candidates/pcbnew-transition {}; - # Attempting to upstream to nixpkgs here: https://github.com/NixOS/nixpkgs/pull/249464 - pybars3 = callPackage ./nixpkgs-candidates/pybars3 {}; - # Attempting to upstream to nixpkgs here: https://github.com/NixOS/nixpkgs/pull/249464 - pymeta3 = callPackage ./nixpkgs-candidates/pymeta3 {}; - # Attempting to upstream to nixpkgs here: https://github.com/NixOS/nixpkgs/pull/249464 - euclid3 = callPackage ./nixpkgs-candidates/euclid3 {}; - }; - - callPackage = newScope (self // nixpkgs-candidates // {inherit callPackage nixosTests;}); -in - self diff --git a/flake.nix b/flake.nix index c350a6537..7bd11de3a 100644 --- a/flake.nix +++ b/flake.nix @@ -28,25 +28,31 @@ nixosSystem ; - importPackages = pkgs: - import ./all-packages.nix { - inherit (pkgs) newScope lib; - - # nixosTests is overriden with tests defined in this - # flake. - nixosTests = - pkgs.nixosTests - // ( - let - dir = ./tests; - in - mapAttrs (name: _: - pkgs.nixosTest (import (dir + "/${name}") { - modules = extendedModules; - configurations = importNixosConfigurations; - })) (readDir dir) - ); + importPackages = pkgs: let + # nixosTests is overriden with tests defined in this + # flake. + nixosTests = + pkgs.nixosTests + // ( + let + dir = ./tests; + in + mapAttrs (name: _: + pkgs.nixosTest (import (dir + "/${name}") { + modules = extendedModules; + configurations = importNixosConfigurations; + })) (readDir dir) + ); + callPackage = pkgs.newScope ( + result // {inherit callPackage nixosTests;} + ); + args = { + inherit (pkgs) lib; + inherit callPackage; }; + result = (import ./pkgs/by-name args) // (import ./pkgs args); + in + result; importNixpkgs = system: overlays: import nixpkgs { diff --git a/pkgs/by-name/default.nix b/pkgs/by-name/default.nix new file mode 100644 index 000000000..1d15cd0d7 --- /dev/null +++ b/pkgs/by-name/default.nix @@ -0,0 +1,32 @@ +{ + lib, + callPackage, +}: let + baseDirectory = ./.; + + inherit + (builtins) + readDir + ; + + inherit + (lib.attrsets) + mapAttrs + concatMapAttrs + ; + + names = name: type: + if type != "directory" + then assert name == "README.md" || name == "default.nix"; {} + else {${name} = baseDirectory + "/${name}/package.nix";}; + + packageFiles = concatMapAttrs names (readDir baseDirectory); + + self = + mapAttrs ( + _: file: + callPackage file {} + ) + packageFiles; +in + self diff --git a/nixpkgs-candidates/euclid3/default.nix b/pkgs/by-name/euclid3/package.nix similarity index 100% rename from nixpkgs-candidates/euclid3/default.nix rename to pkgs/by-name/euclid3/package.nix diff --git a/pkgs/flarum/composer.lock b/pkgs/by-name/flarum/composer.lock similarity index 100% rename from pkgs/flarum/composer.lock rename to pkgs/by-name/flarum/composer.lock diff --git a/pkgs/flarum/default.nix b/pkgs/by-name/flarum/package.nix similarity index 100% rename from pkgs/flarum/default.nix rename to pkgs/by-name/flarum/package.nix diff --git a/pkgs/gnunet-messenger-cli/default.nix b/pkgs/by-name/gnunet-messenger-cli/package.nix similarity index 95% rename from pkgs/gnunet-messenger-cli/default.nix rename to pkgs/by-name/gnunet-messenger-cli/package.nix index 1f57d5e33..b7843b00d 100644 --- a/pkgs/gnunet-messenger-cli/default.nix +++ b/pkgs/by-name/gnunet-messenger-cli/package.nix @@ -13,7 +13,7 @@ ncurses, }: stdenv.mkDerivation rec { - name = "gnunet-messenger-cli"; + pname = "gnunet-messenger-cli"; version = "0.1.1"; src = fetchgit { diff --git a/pkgs/kikit/README.md b/pkgs/by-name/kikit/README.md similarity index 100% rename from pkgs/kikit/README.md rename to pkgs/by-name/kikit/README.md diff --git a/pkgs/kikit/default.nix b/pkgs/by-name/kikit/package.nix similarity index 100% rename from pkgs/kikit/default.nix rename to pkgs/by-name/kikit/package.nix diff --git a/pkgs/kikit/shapely/default.nix b/pkgs/by-name/kikit/shapely/default.nix similarity index 100% rename from pkgs/kikit/shapely/default.nix rename to pkgs/by-name/kikit/shapely/default.nix diff --git a/pkgs/kikit/shapely/library-paths.patch b/pkgs/by-name/kikit/shapely/library-paths.patch similarity index 100% rename from pkgs/kikit/shapely/library-paths.patch rename to pkgs/by-name/kikit/shapely/library-paths.patch diff --git a/pkgs/kikit/solidpython/default.nix b/pkgs/by-name/kikit/solidpython/default.nix similarity index 100% rename from pkgs/kikit/solidpython/default.nix rename to pkgs/by-name/kikit/solidpython/default.nix diff --git a/pkgs/lcrq/default.nix b/pkgs/by-name/lcrq/package.nix similarity index 100% rename from pkgs/lcrq/default.nix rename to pkgs/by-name/lcrq/package.nix diff --git a/pkgs/lcsync/default.nix b/pkgs/by-name/lcsync/package.nix similarity index 100% rename from pkgs/lcsync/default.nix rename to pkgs/by-name/lcsync/package.nix diff --git a/pkgs/libgnunetchat/default.nix b/pkgs/by-name/libgnunetchat/package.nix similarity index 100% rename from pkgs/libgnunetchat/default.nix rename to pkgs/by-name/libgnunetchat/package.nix diff --git a/pkgs/librecast/default.nix b/pkgs/by-name/librecast/package.nix similarity index 100% rename from pkgs/librecast/default.nix rename to pkgs/by-name/librecast/package.nix diff --git a/nixpkgs-candidates/pcbnew-transition/default.nix b/pkgs/by-name/pcbnew-transition/package.nix similarity index 100% rename from nixpkgs-candidates/pcbnew-transition/default.nix rename to pkgs/by-name/pcbnew-transition/package.nix diff --git a/pkgs/by-name/pretalx-frontend/package.nix b/pkgs/by-name/pretalx-frontend/package.nix new file mode 100644 index 000000000..65cc7cca1 --- /dev/null +++ b/pkgs/by-name/pretalx-frontend/package.nix @@ -0,0 +1,20 @@ +{ + buildNpmPackage, + pretalx, +}: +buildNpmPackage { + inherit (pretalx) version src meta; + pname = "pretalx-frontend"; + + sourceRoot = "source/src/pretalx/frontend/schedule-editor"; + + npmDepsHash = "sha256-4cnBHZ8WpHgp/bbsYYbdtrhuD6ffUAZq9ZjoLpWGfRg="; + + buildPhase = '' + runHook preBuild + + npm run build + + runHook postBuild + ''; +} diff --git a/nixpkgs-candidates/pybars3/default.nix b/pkgs/by-name/pybars3/package.nix similarity index 100% rename from nixpkgs-candidates/pybars3/default.nix rename to pkgs/by-name/pybars3/package.nix diff --git a/nixpkgs-candidates/pymeta3/default.nix b/pkgs/by-name/pymeta3/package.nix similarity index 100% rename from nixpkgs-candidates/pymeta3/default.nix rename to pkgs/by-name/pymeta3/package.nix diff --git a/pkgs/rosenpass-tools/default.nix b/pkgs/by-name/rosenpass-tools/package.nix similarity index 100% rename from pkgs/rosenpass-tools/default.nix rename to pkgs/by-name/rosenpass-tools/package.nix diff --git a/pkgs/rosenpass/default.nix b/pkgs/by-name/rosenpass/package.nix similarity index 100% rename from pkgs/rosenpass/default.nix rename to pkgs/by-name/rosenpass/package.nix diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 000000000..a2e081554 --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,33 @@ +{ + lib, + callPackage, +}: let + self = rec { + # LiberaForms is intentionally disabled. + # Refer to . + #liberaforms = callPackage ./pkgs/liberaforms {}; + #liberaforms-env = callPackage ./pkgs/liberaforms/env.nix {}; + + pretalx = callPackage ./pretalx {}; + pretalx-frontend = callPackage ./pretalx/frontend.nix {}; + pretalx-full = callPackage ./pretalx { + withPlugins = [ + pretalx-downstream + pretalx-media-ccc-de + pretalx-pages + pretalx-venueless + pretalx-public-voting + ]; + }; + + inherit + (lib.recurseIntoAttrs (callPackage ./pretalx/plugins.nix {})) + pretalx-downstream + pretalx-media-ccc-de + pretalx-pages + pretalx-venueless + pretalx-public-voting + ; + }; +in + self