diff options
Diffstat (limited to 'nix')
| -rw-r--r-- | nix/package.nix | 102 | ||||
| -rw-r--r-- | nix/theme.nix | 19 |
2 files changed, 121 insertions, 0 deletions
diff --git a/nix/package.nix b/nix/package.nix new file mode 100644 index 0000000..d077740 --- /dev/null +++ b/nix/package.nix @@ -0,0 +1,102 @@ +{ + buildPackages, + lib, + openssl, + stdenv, + tcl, + zlib, + sources ? import ../npins, +}: + +let + version = lib.removeSuffix "\n" (builtins.readFile ../VERSION); +in +stdenv.mkDerivation { + pname = "copland-fossil"; + version = "${version}-copland"; + + src = lib.cleanSourceWith { + name = "copland-fossil-source"; + src = ../.; + filter = path: type: + let + name = baseNameOf (toString path); + in + lib.cleanSourceFilter path type + && !(builtins.elem name [ + ".agents" + ".build" + ".codex" + ".copland-preview" + ".fslckout" + ".references" + ".repository" + "jimsh0" + "nix" + "node_modules" + "npins" + "playwright-report" + "result" + "test-output" + ]); + }; + + nativeBuildInputs = [ tcl ]; + buildInputs = [ openssl zlib ]; + + configurePhase = '' + runHook preConfigure + mkdir build + cd build + CC_FOR_BUILD=${buildPackages.stdenv.cc}/bin/cc \ + ../configure --disable-fusefs --json \ + ${lib.optionalString stdenv.hostPlatform.isStatic "--static"} \ + --prefix="$out" + runHook postConfigure + ''; + + buildPhase = '' + runHook preBuild + make -j''${NIX_BUILD_CORES:-1} fossil + runHook postBuild + ''; + + doCheck = true; + checkPhase = '' + runHook preCheck + make test TESTFLAGS='org.test wiki.test' + runHook postCheck + ''; + + installPhase = '' + runHook preInstall + install -Dm755 fossil "$out/bin/fossil" + install -Dm644 ../fossil.1 "$out/share/man/man1/fossil.1" + + testRoot="$(mktemp -d)" + export HOME="$testRoot/home" + export USER=builder + export LOGNAME=builder + mkdir -p "$HOME" + "$out/bin/fossil" help test-org-render >/dev/null + "$out/bin/fossil" test-org-render \ + ../tools/copland/tests/fixtures/org/all.org | grep -q 'class="org-document"' + "$out/bin/fossil" test-builtin-get skins/copland/css.txt \ + | grep -q -- '--page-bg:' + + "$out/bin/fossil" init "$testRoot/fresh.fossil" >/dev/null + printf 'GET /style.css HTTP/1.0\r\nHost: localhost\r\n\r\n' \ + | "$out/bin/fossil" test-http "$testRoot/fresh.fossil" \ + | grep -q -- '--page-bg:' + rm -r "$testRoot" + runHook postInstall + ''; + + meta = { + description = "Copland's Fossil fork with native Org and the built-in Copland skin"; + homepage = "https://fossil-scm.org/"; + license = lib.licenses.bsd2; + mainProgram = "fossil"; + platforms = lib.platforms.unix; + }; +} diff --git a/nix/theme.nix b/nix/theme.nix new file mode 100644 index 0000000..e92e087 --- /dev/null +++ b/nix/theme.nix @@ -0,0 +1,19 @@ +{ lib, runCommand }: + +let + package = builtins.fromJSON (builtins.readFile ../tools/copland/package.json); +in +runCommand "copland-fossil-theme-${package.version}" + { + meta = { + description = "Copland skin for Fossil SCM"; + platforms = lib.platforms.all; + }; + } + '' + destination="$out/share/fossil/skins/copland" + mkdir -p "$destination" + cp ${../skins/copland}/*.txt "$destination/" + cp ${../skins/copland}/README.md "$destination/" + cp ${../tools/copland/dist/copland-skin.config} "$destination/copland-skin.config" + '' |
