From f91196c8a4a3ba6953c85b94ea75dee5e331548f Mon Sep 17 00:00:00 2001 From: Reinout Meliesie Date: Tue, 4 Mar 2025 13:13:22 +0100 Subject: [PATCH] Restructure packages into subdirectories --- nixos-module.nix | 22 ++++-------------- packages/bookwyrm/nixos-module.nix | 20 ++++++++++++++++ bookwyrm.nix => packages/bookwyrm/package.nix | 0 .../python3.11-bw-file-resubmit/package.nix | 0 .../python3.11-django-imagekit/package.nix | 0 .../python3.11-django-pgtrigger/package.nix | 0 .../package.nix | 0 .../python3.11-s3-tar/package.nix | 0 readme.md | 23 ++++++++++++++++--- 9 files changed, 45 insertions(+), 20 deletions(-) create mode 100644 packages/bookwyrm/nixos-module.nix rename bookwyrm.nix => packages/bookwyrm/package.nix (100%) rename python3.11-bw-file-resubmit.nix => packages/python3.11-bw-file-resubmit/package.nix (100%) rename python3.11-django-imagekit.nix => packages/python3.11-django-imagekit/package.nix (100%) rename python3.11-django-pgtrigger.nix => packages/python3.11-django-pgtrigger/package.nix (100%) rename python3.11-django-sass-processor.nix => packages/python3.11-django-sass-processor/package.nix (100%) rename python3.11-s3-tar.nix => packages/python3.11-s3-tar/package.nix (100%) diff --git a/nixos-module.nix b/nixos-module.nix index 46e3880..461ee5f 100644 --- a/nixos-module.nix +++ b/nixos-module.nix @@ -1,9 +1,12 @@ -{ pkgs , ... } : +{ pkgs } : with pkgs ; -with pkgs . kernelmaft ; { + imports = [ + packages/bookwyrm/nixos-module.nix + ] ; + nixpkgs = { overlays = [ ( self : super : { @@ -50,19 +53,4 @@ with pkgs . kernelmaft ; } ) ] ; } ; - - systemd = { - units = { - "bookwyrm.service" = { - text = '' - [Unit] - After=network.target - - [Service] - ExecStart=${bookwyrm}/bin/bookwyrm - WorkingDirectory=/var/lib/bookwyrm - '' ; - } ; - } ; - } ; } diff --git a/packages/bookwyrm/nixos-module.nix b/packages/bookwyrm/nixos-module.nix new file mode 100644 index 0000000..bb92e4e --- /dev/null +++ b/packages/bookwyrm/nixos-module.nix @@ -0,0 +1,20 @@ +{ pkgs } : + +with pkgs . kernelmaft ; + +{ + systemd = { + units = { + "bookwyrm.service" = { + text = '' + [Unit] + After=network.target + + [Service] + ExecStart=${bookwyrm}/bin/bookwyrm + WorkingDirectory=/var/lib/bookwyrm + '' ; + } ; + } ; + } ; +} diff --git a/bookwyrm.nix b/packages/bookwyrm/package.nix similarity index 100% rename from bookwyrm.nix rename to packages/bookwyrm/package.nix diff --git a/python3.11-bw-file-resubmit.nix b/packages/python3.11-bw-file-resubmit/package.nix similarity index 100% rename from python3.11-bw-file-resubmit.nix rename to packages/python3.11-bw-file-resubmit/package.nix diff --git a/python3.11-django-imagekit.nix b/packages/python3.11-django-imagekit/package.nix similarity index 100% rename from python3.11-django-imagekit.nix rename to packages/python3.11-django-imagekit/package.nix diff --git a/python3.11-django-pgtrigger.nix b/packages/python3.11-django-pgtrigger/package.nix similarity index 100% rename from python3.11-django-pgtrigger.nix rename to packages/python3.11-django-pgtrigger/package.nix diff --git a/python3.11-django-sass-processor.nix b/packages/python3.11-django-sass-processor/package.nix similarity index 100% rename from python3.11-django-sass-processor.nix rename to packages/python3.11-django-sass-processor/package.nix diff --git a/python3.11-s3-tar.nix b/packages/python3.11-s3-tar/package.nix similarity index 100% rename from python3.11-s3-tar.nix rename to packages/python3.11-s3-tar/package.nix diff --git a/readme.md b/readme.md index d6bec7c..a43d834 100644 --- a/readme.md +++ b/readme.md @@ -3,11 +3,28 @@ ## Description An assortment of Nix packages not in the official collection. -They can either be imported individually or using the module if you're on NixOS. +They can either be used individually or, if you're on NixOS, imported wholesale using the top-level module. These are purposefully written without support for [overriding](https://nixos.org/guides/nix-pills/17-nixpkgs-overriding-packages) in order to minimise complexity. If you want to build upon them I encourage you to fork this repository. +## Structure + +### `nixos-module.nix` + +The top-level NixOS module containing all package expressions as an overlay, and all package modules. +Once imported the overlay contents can be found under `pkgs . kernelmaft`. + +### `packages//package.nix` + +A Nix package expression. + +### `packages//nixos-module.nix` + +NixOS module providing additional features for the package in question, such as for example systemd units. +Can be imported directly, but is also imported by the top-level module. +Not present for all packages. + ## Examples > **Note:** @@ -18,8 +35,8 @@ Using a specific package: ```nix pkgs . callPackage ( import ( pkgs . fetchurl { - url = "https://kernelmaft.com/forgejo/zedfrigg/nix-packages/raw/commit/c45884c66f31f8d8d80866bebc13e9e963e02a70/python3.11-django-imagekit.nix" ; - hash = "sha256-E4mo2JvK5SuxC6SQ7O5ZjhzehmxEThNJ7F6gBnil8ho=" ; + url = "https://kernelmaft.com/forgejo/zedfrigg/nix-packages/raw/commit/c45884c66f31f8d8d80866bebc13e9e963e02a70/packages/python3.11-django-imagekit/package.nix" ; + hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" ; } ) ) {} ```