From c422383506848469f7fbb907ead0761a494b471b Mon Sep 17 00:00:00 2001 From: Ruby Iris Juric Date: Wed, 30 Jul 2025 11:06:57 +1000 Subject: [PATCH 1/3] nix: extract overlay into own file --- contrib/package/nix/overlay.nix | 13 +++++++++++++ flake.nix | 14 +------------- 2 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 contrib/package/nix/overlay.nix diff --git a/contrib/package/nix/overlay.nix b/contrib/package/nix/overlay.nix new file mode 100644 index 00000000..0ea0f1bf --- /dev/null +++ b/contrib/package/nix/overlay.nix @@ -0,0 +1,13 @@ +final: prev: rec { + copyparty = final.python3.pkgs.callPackage ./copyparty { + ffmpeg = final.ffmpeg-full; + }; + + partyfuse = prev.callPackage ./partyfuse { + inherit copyparty; + }; + + u2c = prev.callPackage ./u2c { + inherit copyparty; + }; +} diff --git a/flake.nix b/flake.nix index 5f39d605..9f5359c1 100644 --- a/flake.nix +++ b/flake.nix @@ -12,19 +12,7 @@ }: { nixosModules.default = ./contrib/nixos/modules/copyparty.nix; - overlays.default = final: prev: rec { - copyparty = final.python3.pkgs.callPackage ./contrib/package/nix/copyparty { - ffmpeg = final.ffmpeg-full; - }; - - partyfuse = prev.callPackage ./contrib/package/nix/partyfuse { - inherit copyparty; - }; - - u2c = prev.callPackage ./contrib/package/nix/u2c { - inherit copyparty; - }; - }; + overlays.default = import ./contrib/package/nix/overlay.nix; } // flake-utils.lib.eachDefaultSystem ( system: From f32c447cf7a7ad073faa3aef1aefcea501bf1dc4 Mon Sep 17 00:00:00 2001 From: Ruby Iris Juric Date: Wed, 30 Jul 2025 11:35:53 +1000 Subject: [PATCH 2/3] nix: avoid evaluating nixpkgs in flake --- flake.nix | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/flake.nix b/flake.nix index 9f5359c1..e3261a39 100644 --- a/flake.nix +++ b/flake.nix @@ -17,13 +17,8 @@ // flake-utils.lib.eachDefaultSystem ( system: let - pkgs = import nixpkgs { - inherit system; - config = { - allowAliases = false; - }; - overlays = [ self.overlays.default ]; - }; + pkgs = nixpkgs.legacyPackages.${system}; + appliedOverlay = self.overlays.default pkgs pkgs; in { # check that copyparty builds with all optionals turned on @@ -40,7 +35,7 @@ }; packages = { - inherit (pkgs) + inherit (appliedOverlay) copyparty partyfuse u2c From 231b6625ee8bd5ec3ea35005b3060078e13fb6c1 Mon Sep 17 00:00:00 2001 From: Ruby Iris Juric Date: Wed, 30 Jul 2025 11:36:59 +1000 Subject: [PATCH 3/3] readme: document non-flake nixos usage --- README.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 05661ed4..e7707448 100644 --- a/README.md +++ b/README.md @@ -2264,7 +2264,7 @@ some recommended dependencies are enabled by default; [override the package](htt ## nixos module -for this setup, you will need a [flake-enabled](https://nixos.wiki/wiki/Flakes) installation of NixOS. +for [flake-enabled](https://nixos.wiki/wiki/Flakes) installations of NixOS: ```nix { @@ -2291,6 +2291,33 @@ for this setup, you will need a [flake-enabled](https://nixos.wiki/wiki/Flakes) } ``` +if you don't use a flake in your configuration, you can use other dependency management tools like [npins](https://github.com/andir/npins), [niv](https://github.com/nmattia/niv), or even plain [`fetchTarball`](https://nix.dev/manual/nix/stable/language/builtins#builtins-fetchTarball), like so: + +```nix +{ pkgs, ... }: + +let + # npins example, adjust for your setup. copyparty should be a path to the downloaded repo + # for niv, just replace the npins folder import with the sources.nix file + copyparty = (import ./npins).copyparty; + + # or with fetchTarball: + copyparty = fetchTarball "https://github.com/9001/copyparty/archive/hovudstraum.tar.gz"; +in + +{ + # load the copyparty NixOS module + imports = [ "${copyparty}/contrib/nixos/modules/copyparty.nix" ]; + + # add the copyparty overlay to expose the package to the module + nixpkgs.overlays = [ "${copyparty}/contrib/package/nix/overlay.nix" ]; + # (optional) install the package globally + environment.systemPackages = [ pkgs.copyparty ]; + # configure the copyparty module + services.copyparty.enable = true; +} +``` + copyparty on NixOS is configured via `services.copyparty` options, for example: ```nix services.copyparty = {