Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repo: Introduce pkgs/by-name #60

Merged
merged 1 commit into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
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.
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.
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
Loading