Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
18 changes: 17 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,22 @@
date = self.lastModifiedDate or "19700101";
version = "${baseVersion}-unstable-${builtins.substring 0 4 date}-${builtins.substring 4 2 date}-${builtins.substring 6 2 date}";
pnpmDepsHash = "sha256-QgIDb06iQvDNz/Znk9yH3W5tPwfu7X5w18Q60m+u4SM=";

# nixpkgs keeps meta.doc, because its redirects.json lists the doc's anchors. Out of tree,
# the doc would be built into the system manual, whose redirect check rejects the unknown
# anchors and fails the whole system build.
module = import ./nix/module.nix;
moduleWithoutDoc = lib.setFunctionArgs (
args:
let
m = module args;
in
m
// {
_file = ./nix/module.nix;
meta = builtins.removeAttrs m.meta [ "doc" ];
}
) (lib.functionArgs module);
in
{
packages = forAllSystems (
Expand All @@ -59,7 +75,7 @@
split-pro =
{ lib, pkgs, ... }:
{
imports = [ ./nix/module.nix ];
imports = [ moduleWithoutDoc ];
services.split-pro.package =
lib.mkDefault
self.packages.${pkgs.stdenv.hostPlatform.system}.split-pro;
Expand Down
10 changes: 3 additions & 7 deletions nix/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,16 @@ let
in
{
meta = {
# nixpkgs: `maintainers = [ lib.maintainers.krokosik ];` once the maintainer entry exists.
# The maintainer entry is added in NixOS/nixpkgs#595003. In nixpkgs this is simply
# `maintainers = [ lib.maintainers.krokosik ];`.
maintainers = lib.optional (lib.maintainers ? krokosik) lib.maintainers.krokosik;
doc = ./split-pro.md;
};

options.services.split-pro = recursiveUpdate tableOptions {
enable = lib.mkEnableOption "SplitPro, an open source alternative to Splitwise";

package = mkOption {
type = types.package;
default = pkgs.split-pro;
defaultText = literalExpression "pkgs.split-pro";
description = "The SplitPro package to use.";
};
package = lib.mkPackageOption pkgs "split-pro" { };

openFirewall = mkOption {
type = types.bool;
Expand Down
15 changes: 9 additions & 6 deletions nix/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
openssl,
nixosTests ? { },
callPackage,
nix-update-script,
}:
let
nodejs = nodejs_22;
Expand All @@ -19,23 +20,22 @@ in
stdenv.mkDerivation (finalAttrs: {
pname = "split-pro";
# Keep this in sync with package.json; the flake's `version` check fails if they differ.
# In nixpkgs, nix-update bumps it.
# TODO(nixpkgs): fill in the real src and pnpm hashes for the first release that includes nix/.
# The flake replaces src, version and pnpmDeps with this checkout.
# The hashes below are for the release tagged `v${version}`. The flake replaces src, version
# and pnpmDeps with this checkout. In nixpkgs, nix-update bumps all three.
version = "2.2.0";

src = fetchFromGitHub {
owner = "oss-apps";
repo = "split-pro";
tag = "v${finalAttrs.version}";
hash = lib.fakeHash;
hash = "sha256-ELsoEDzjUiov8+tMMLc9xF42xrAGkdCYbstcY2ZSMZ4=";
};

pnpmDeps = fetchPnpmDeps {
inherit (finalAttrs) pname version src;
inherit pnpm;
fetcherVersion = 5;
hash = lib.fakeHash;
hash = "sha256-QgIDb06iQvDNz/Znk9yH3W5tPwfu7X5w18Q60m+u4SM=";
};

nativeBuildInputs = [
Expand Down Expand Up @@ -114,13 +114,16 @@ stdenv.mkDerivation (finalAttrs: {
envCoverage = callPackage ./env-coverage.nix { split-pro = finalAttrs.finalPackage; };
}
// lib.optionalAttrs (nixosTests ? split-pro) { nixos = nixosTests.split-pro; };
updateScript = nix-update-script { };
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
};

meta = {
# nixpkgs: `maintainers = [ lib.maintainers.krokosik ];` once the maintainer entry exists.
# The maintainer entry is added in NixOS/nixpkgs#595003. In nixpkgs this is simply
# `maintainers = [ lib.maintainers.krokosik ];`, and the nixos test above is unconditional.
maintainers = lib.optional (lib.maintainers ? krokosik) lib.maintainers.krokosik;
description = "Open source alternative to Splitwise";
homepage = "https://github.com/oss-apps/split-pro";
changelog = "https://github.com/oss-apps/split-pro/releases/tag/v${finalAttrs.version}";
license = lib.licenses.mit;
mainProgram = "split-pro";
platforms = lib.platforms.linux;
Expand Down
6 changes: 4 additions & 2 deletions nix/test.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Imported by `runNixOSTest`. Expects `defaults` to import the module.
{ pkgs, ... }:
# Imported by `runNixOSTest`. Expects `defaults` to import the module. In nixpkgs the module
# is in the module list already, so the copy there drops that expectation.
{ lib, pkgs, ... }:
let
dbPassword = "hunter2-with/special@chars";
in
{
name = "split-pro";
meta.maintainers = lib.optional (lib.maintainers ? krokosik) lib.maintainers.krokosik;

nodes = {
# Zero-config: local database, generated NEXTAUTH_SECRET, managed nginx in front.
Expand Down