From b8e7a96248058b1613e5954a6817d82a335922ee Mon Sep 17 00:00:00 2001 From: Reinout Meliesie Date: Tue, 4 Mar 2025 12:15:12 +0100 Subject: [PATCH 1/2] Rename NixOS overlay to module --- nixos-overlay.nix => nixos-module.nix | 0 readme.md | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) rename nixos-overlay.nix => nixos-module.nix (100%) diff --git a/nixos-overlay.nix b/nixos-module.nix similarity index 100% rename from nixos-overlay.nix rename to nixos-module.nix diff --git a/readme.md b/readme.md index d4567d4..d6bec7c 100644 --- a/readme.md +++ b/readme.md @@ -3,7 +3,7 @@ ## Description An assortment of Nix packages not in the official collection. -They can either be imported individually or using the overlay if you're on NixOS. +They can either be imported individually or using the module if you're on NixOS. 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. @@ -23,13 +23,13 @@ pkgs . callPackage ( import ( pkgs . fetchurl { } ) ) {} ``` -Using the NixOS overlay: +Using the NixOS module: ```nix imports = [ ( fetchTarball { url = "https://kernelmaft.com/forgejo/zedfrigg/nix-packages/archive/432123bb0984dd766c16ac06b7e3ef4cfee36145.tar.gz" ; sha256 = "sha256:1wx7ljabgndandcd11jmr590jfpkhs55mqrgksf24ji90m37wpq0" ; - } + "/nixos-overlay.nix" ) + } + "/nixos-module.nix" ) ] ; ``` From 03963af59e25b8e661e3d5844ff6d52e87e15082 Mon Sep 17 00:00:00 2001 From: Reinout Meliesie Date: Tue, 4 Mar 2025 12:19:47 +0100 Subject: [PATCH 2/2] Move Bookwyrm systemd unit from package to NixOS module --- bookwyrm.nix | 11 ----------- nixos-module.nix | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/bookwyrm.nix b/bookwyrm.nix index 66e03ec..dfec431 100644 --- a/bookwyrm.nix +++ b/bookwyrm.nix @@ -116,17 +116,6 @@ mkDerivation { chmod +x $out/bin/bookwyrm - # Systemd units - - cat <<- EOF > $out/lib/systemd/system/bookwyrm.service - [Unit] - After=network.target - - [Service] - ExecStart=$out/bin/bookwyrm - WorkingDirectory=/var/lib/bookwyrm - EOF - runHook postInstall '' ; } diff --git a/nixos-module.nix b/nixos-module.nix index 5a527a3..b90ef12 100644 --- a/nixos-module.nix +++ b/nixos-module.nix @@ -51,4 +51,19 @@ ) ] ; } ; + + systemd = { + units = { + bookwyrm = { + text = '' + [Unit] + After=network.target + + [Service] + ExecStart=$out/bin/bookwyrm + WorkingDirectory=/var/lib/bookwyrm + '' ; + } ; + } ; + } ; }