Skip to content

Commit

Permalink
Merge branch 'staging' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Sydney Kerckhove committed Jun 26, 2021
2 parents 5d1757a + 3c9356f commit 4891d1c
Show file tree
Hide file tree
Showing 112 changed files with 1,206 additions and 632 deletions.
1 change: 1 addition & 0 deletions .github/workflows/nix-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- development
- master
workflow_dispatch:

jobs:
hooks:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/stack-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches:
- development
- master
workflow_dispatch:

jobs:
stack-build:
name: ${{ matrix.os }} / Stack ${{ matrix.stack }} / GHC ${{ matrix.ghc }}
Expand Down Expand Up @@ -46,7 +48,7 @@ jobs:

- name: Build autoexporter
run: |
stack install --system-ghc autoexporter --stack-yaml setup-stack.yaml
stack install --system-ghc autoexporter
- name: Build dependencies
run: |
Expand Down
3 changes: 0 additions & 3 deletions .hindent.yaml

This file was deleted.

56 changes: 1 addition & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,64 +3,10 @@
![Stack Build](https://github.com/NorfairKing/smos/workflows/Stack%20Build/badge.svg)
![Nix Build](https://github.com/NorfairKing/smos/workflows/Nix%20Build/badge.svg)

See [the documentation site](https://docs.smos.online) for more information.
See [the online version](https://smos.online) to try it out and see [the documentation site](https://docs.smos.online) for more information.

<img src="smos-docs-site/content/assets/logo.svg" width="200" alt="logo"/>

## Try it out!

There is a demo playground at `smos-docs-site/demo-workflow`.
You can run `nix-shell` there and try out different things.

## Hacking on Smos

### Package overview

```
smos-data : The Smos data format
smos-data-gen : Generators for the Smos data format
smos-cursor : Smos-specific cursors
smos-cursor-gen : Generators for Smos-specific cursors
smos-report : Smos Reports
smos-report-gen : Generators for Smos reports
smos-report-cursor : Cursors for Smos reports
smos-report-cursor-gen : Generators for cursors for smos reports
smos : The smos TUI
smos-single ; The smos-single tool; to make a single-task project
smos-query : The smos-query tool; to query your workflow
smos-archive : The smos-archive tool: to archive smos files
smos-convert-org : The smos-convert-org tool: to convert org-mode files to smos files
smos-calendar-import : The calendar import tool: to import calendars in an onging manner
smos-api : The API for the smos server
smos-api-gen : Generators for the API for the smos server
smos-client : The smos client library
smos-server : The smos server
smos-server-gen : Generators for the smos server
smos-sync-client : The sync client tool
smos-web-style : The stylesheets for the web server and docs site
smos-web-server : The smos web server
smos-docs-site : The generator for the documentation website.
```

### Development

Before starting development, make sure to run `nix-shell` at least once to install pre-commit hooks.

Before submitting a PR, make sure that these commands _all_ succeed:

```
nix-build ci.nix
stack clean
stack build --test --bench --no-run-benchmarks --pedantic
```

## Cachix cache

There is a [cachix](https://cachix.org) cache for this project.

To use it, use `cachix use smos` or add the appropriate details to your nixos configuration.


## Sponsor this project

Smos is free and open-source software.
Expand Down
71 changes: 48 additions & 23 deletions nix/nixos-module-test.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{ pkgs ? import ./pkgs.nix { static = false; }
{ sources ? import ./sources.nix
, pkgs ? import ./pkgs.nix { inherit sources; static = false; }
, smosPackages ? pkgs.smosPackages
, sources ? import ./sources.nix
}:
let
# See this for more info:
# https://github.com/NixOS/nixpkgs/blob/99d379c45c793c078af4bb5d6c85459f72b1f30b/nixos/lib/testing-python.nix
smos-production = import ./nixos-module.nix { inherit sources; inherit smosPackages; envname = "production"; };
smos-production = import ./nixos-module.nix {
inherit sources;
inherit pkgs;
inherit smosPackages;
envname = "production";
};
home-manager = import (
builtins.fetchTarball
{
Expand All @@ -31,7 +36,7 @@ let
programs.smos = {
sync = {
enable = true;
server-url = "server:${builtins.toString api-port}";
server-url = "apiserver:${builtins.toString api-port}";
username = "sync_enabled";
password = "testpassword";
};
Expand Down Expand Up @@ -66,7 +71,7 @@ let
backup.enable = true;
sync = {
enable = true;
server-url = "server:${builtins.toString api-port}";
server-url = "apiserver:${builtins.toString api-port}";
username = "everything_enabled";
password = "testpassword";
};
Expand Down Expand Up @@ -157,18 +162,12 @@ pkgs.nixosTest (
{ lib, pkgs, ... }: {
name = "smos-module-test";
nodes = {
server = {
apiserver = {
imports = [
smos-production
];
services.smos.production = {
enable = true;
docs-site = {
enable = true;
port = docs-port;
api-url = "server:${builtins.toString api-port}";
web-url = "server:${builtins.toString web-port}";
};
api-server = {
enable = true;
port = api-port;
Expand All @@ -182,12 +181,34 @@ pkgs.nixosTest (
enable = false;
};
};
};
};
webserver = {
imports = [
smos-production
];
services.smos.production = {
enable = true;
web-server = {
enable = true;
port = web-port;
docs-url = "server:${builtins.toString docs-port}";
api-url = "server:${builtins.toString api-port}";
web-url = "server:${builtins.toString web-port}";
docs-url = "docsserver:${builtins.toString docs-port}";
api-url = "apiserver:${builtins.toString api-port}";
web-url = "webserver:${builtins.toString web-port}";
};
};
};
docsserver = {
imports = [
smos-production
];
services.smos.production = {
enable = true;
docs-site = {
enable = true;
port = docs-port;
api-url = "apiserver:${builtins.toString api-port}";
web-url = "webserver:${builtins.toString web-port}";
};
};
};
Expand All @@ -205,17 +226,21 @@ pkgs.nixosTest (
testScript = ''
from shlex import quote
server.start()
apiserver.start()
webserver.start()
docsserver.start()
client.start()
server.wait_for_unit("multi-user.target")
apiserver.wait_for_unit("multi-user.target")
webserver.wait_for_unit("multi-user.target")
docsserver.wait_for_unit("multi-user.target")
client.wait_for_unit("multi-user.target")
server.wait_for_open_port(${builtins.toString docs-port})
client.succeed("curl server:${builtins.toString docs-port}")
server.wait_for_open_port(${builtins.toString api-port})
client.succeed("curl server:${builtins.toString api-port}")
server.wait_for_open_port(${builtins.toString web-port})
client.succeed("curl server:${builtins.toString web-port}")
apiserver.wait_for_open_port(${builtins.toString api-port})
client.succeed("curl apiserver:${builtins.toString api-port}")
webserver.wait_for_open_port(${builtins.toString web-port})
client.succeed("curl webserver:${builtins.toString web-port}")
docsserver.wait_for_open_port(${builtins.toString docs-port})
client.succeed("curl docsserver:${builtins.toString docs-port}")
# Wait for all test users
${lib.concatStringsSep "\n" (builtins.map (username: "client.wait_for_unit(\"home-manager-${username}.service\")") (builtins.attrNames testUsers))}
Expand Down
18 changes: 12 additions & 6 deletions nix/nixos-module.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ envname
, sources ? import ./sources.nix
, smosPackages ? (import ./pkgs.nix { inherit sources; }).smosPackages
, pkgs ? import ./pkgs.nix { inherit sources; }
, smosPackages ? pkgs.smosPackages
}:

{ lib, pkgs, config, ... }:
Expand All @@ -21,6 +22,7 @@ in
docs-site =
mkOption {
default = null;
description = "Smos' documentation site service";
type =
types.nullOr (types.submodule {
options =
Expand Down Expand Up @@ -83,6 +85,7 @@ in
api-server =
mkOption {
default = null;
description = "Smos' API server service";
type =
types.nullOr (types.submodule {
options =
Expand Down Expand Up @@ -142,6 +145,8 @@ in
};
local-backup =
mkOption {
default = null;
description = "The local backup service for the API server database";
type = types.nullOr (
types.submodule {
options = {
Expand All @@ -155,7 +160,6 @@ in
};
}
);
default = null;
};
auto-backup = mkLooperOption "auto-backup";
backup-garbage-collector = mkLooperOption "backup-garbage-collector";
Expand All @@ -167,6 +171,8 @@ in
};
monetisation =
mkOption {
default = null;
description = "Monetisation settings for the API server";
type = types.nullOr (
types.submodule {
options = {
Expand Down Expand Up @@ -194,14 +200,14 @@ in
};
}
);
default = null;
};
};
});
};
web-server =
mkOption {
default = null;
description = "Smos' web server service";
type =
types.nullOr (types.submodule {
options =
Expand Down Expand Up @@ -281,12 +287,12 @@ in
attrOrNull = name: value: optionalAttrs (!builtins.isNull value) { "${name}" = value; };
# The docs server
docs-site-config = with cfg.docs-site; mergeListRecursively [
cfg.docs-site.config
(attrOrNull "port" port)
(attrOrNull "api-url" api-url)
(attrOrNull "web-url" (if builtins.isNull web-url then head hosts else web-url))
(attrOrNull "google-analytics-tracking" google-analytics-tracking)
(attrOrNull "google-search-console-verification" google-search-console-verification)
cfg.docs-site.config
];
docs-site-service =
optionalAttrs (cfg.docs-site.enable or false) {
Expand Down Expand Up @@ -332,7 +338,6 @@ in
api-server-working-dir = working-dir + "api-server/";
api-server-database-file = api-server-working-dir + "smos-server-database.sqlite3";
api-server-config = with cfg.api-server; mergeListRecursively [
cfg.api-server.config
(attrOrNull "log-level" log-level)
(attrOrNull "port" port)
(attrOrNull "database-file" api-server-database-file)
Expand All @@ -344,6 +349,7 @@ in
(attrOrNull "backup-garbage-collector" backup-garbage-collector)
(attrOrNull "file-migrator" file-migrator)
(attrOrNull "monetisation" monetisation)
cfg.api-server.config
];
# The api server
api-server-service =
Expand Down Expand Up @@ -440,7 +446,6 @@ in
web-server-working-dir = working-dir + "web-server/";
web-server-data-dir = web-server-working-dir + "web-server/";
web-server-config = with cfg.web-server; mergeListRecursively [
cfg.web-server.config
(attrOrNull "docs-url" docs-url)
(attrOrNull "api-url" api-url)
(attrOrNull "web-url" web-url)
Expand All @@ -449,6 +454,7 @@ in
(attrOrNull "google-analytics-tracking" google-analytics-tracking)
(attrOrNull "google-search-console-verification" google-search-console-verification)
(attrOrNull "data-dir" web-server-data-dir)
cfg.web-server.config
];
web-server-service =
optionalAttrs (cfg.web-server.enable or false) {
Expand Down
Loading

0 comments on commit 4891d1c

Please sign in to comment.