Skip to content

Commit

Permalink
repo: Introduce pkgs/by-name
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzleutgeb committed Sep 28, 2023
1 parent da86490 commit 5c884ac
Show file tree
Hide file tree
Showing 25 changed files with 110 additions and 81 deletions.
62 changes: 0 additions & 62 deletions all-packages.nix

This file was deleted.

42 changes: 24 additions & 18 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions pkgs/by-name/default.nix
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
ncurses,
}:
stdenv.mkDerivation rec {
name = "gnunet-messenger-cli";
pname = "gnunet-messenger-cli";
version = "0.1.1";

src = fetchgit {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions pkgs/by-name/pretalx-frontend/package.nix
Original file line number Diff line number Diff line change
@@ -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
'';
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions pkgs/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
lib,
callPackage,
}: let
self = rec {
# LiberaForms is intentionally disabled.
# Refer to <https://github.com/ngi-nix/ngipkgs/issues/40>.
#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

0 comments on commit 5c884ac

Please sign in to comment.