Skip to content

Commit

Permalink
max depth
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Sydney Kerckhove committed Sep 14, 2021
1 parent f182ec4 commit 81b7060
Show file tree
Hide file tree
Showing 22 changed files with 524 additions and 719 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,4 +1,5 @@
.stack-work/
stack.yaml.lock
*~
result*
.pre-commit-config.yaml
7 changes: 7 additions & 0 deletions ci.nix
@@ -0,0 +1,7 @@
let
pkgs = import ./nix/pkgs.nix;
pre-commit = import ./nix/pre-commit.nix;
in
pkgs.seoCheckPackages // {
pre-commit-check = pre-commit.check;
}
15 changes: 1 addition & 14 deletions default.nix
@@ -1,17 +1,4 @@
let
pkgs = import ./nix/pkgs.nix;
nix-pre-commit-hooks =
import (
builtins.fetchTarball "https://github.com/hercules-ci/nix-pre-commit-hooks/archive/f709c4652d4696dbe7c6a8354ebd5938f2bf807b.tar.gz"
);
in
pkgs.seoCheckPackages // {
pre-commit-check = nix-pre-commit-hooks.run {
src = ./.;
hooks = {
nixpkgs-fmt.enable = true;
hlint.enable = true;
ormolu.enable = true;
};
};
}
pkgs.seoCheckPackages
13 changes: 0 additions & 13 deletions nix/gitignore-src.nix

This file was deleted.

92 changes: 46 additions & 46 deletions nix/module.nix
Expand Up @@ -4,7 +4,7 @@ with lib;

let
cfg = config.services.smos."${envname}";
concatAttrs = attrList: fold (x: y: x // y) {} attrList;
concatAttrs = attrList: fold (x: y: x // y) { } attrList;
in
{
options.services.smos."${envname}" =
Expand Down Expand Up @@ -112,37 +112,37 @@ in
let
workingDir = "/www/smos/${envname}/data/";
in
optionalAttrs enable {
"smos-sync-${envname}" = {
description = "Smos sync server ${envname} Service";
wantedBy = [ "multi-user.target" ];
environment =
{
"SMOS_SERVER_LOG_LEVEL" =
"${builtins.toString log-level}";
"SMOS_SERVER_PORT" =
"${builtins.toString port}";
};
script =
''
mkdir -p "${workingDir}"
cd "${workingDir}"
${smosPkgs.smos-server}/bin/smos-server \
serve
'';
serviceConfig =
{
Restart = "always";
RestartSec = 1;
Nice = 15;
};
unitConfig =
{
StartLimitIntervalSec = 0;
# ensure Restart=always is always honoured
};
};
optionalAttrs enable {
"smos-sync-${envname}" = {
description = "Smos sync server ${envname} Service";
wantedBy = [ "multi-user.target" ];
environment =
{
"SMOS_SERVER_LOG_LEVEL" =
"${builtins.toString log-level}";
"SMOS_SERVER_PORT" =
"${builtins.toString port}";
};
script =
''
mkdir -p "${workingDir}"
cd "${workingDir}"
${smosPkgs.smos-server}/bin/smos-server \
serve
'';
serviceConfig =
{
Restart = "always";
RestartSec = 1;
Nice = 15;
};
unitConfig =
{
StartLimitIntervalSec = 0;
# ensure Restart=always is always honoured
};
};
};
sync-server-host =
with cfg.sync-server;

Expand All @@ -162,20 +162,20 @@ in
};
};
in
mkIf cfg.enable {
systemd.services =
concatAttrs [
docs-site-service
sync-server-service
];
networking.firewall.allowedTCPPorts = builtins.concatLists [
(optional cfg.docs-site.enable cfg.docs-site.port)
(optional cfg.sync-server.enable cfg.sync-server.port)
mkIf cfg.enable {
systemd.services =
concatAttrs [
docs-site-service
sync-server-service
];
networking.firewall.allowedTCPPorts = builtins.concatLists [
(optional cfg.docs-site.enable cfg.docs-site.port)
(optional cfg.sync-server.enable cfg.sync-server.port)
];
services.nginx.virtualHosts =
concatAttrs [
docs-site-host
sync-server-host
];
services.nginx.virtualHosts =
concatAttrs [
docs-site-host
sync-server-host
];
};
};
}
4 changes: 0 additions & 4 deletions nix/nixpkgs-version.nix

This file was deleted.

8 changes: 0 additions & 8 deletions nix/nixpkgs.nix

This file was deleted.

34 changes: 19 additions & 15 deletions nix/overlay.nix
Expand Up @@ -6,38 +6,42 @@ with final.haskell.lib;
let
seoCheckPkg =
name:
doBenchmark (
addBuildDepend (
doBenchmark (
addBuildDepend
(
failOnAllWarnings (
disableLibraryProfiling (
final.haskellPackages.callCabal2nix name (final.gitignoreSource (../. + "/${name}")) {}
final.haskellPackages.callCabal2nix name (final.gitignoreSource (../. + "/${name}")) { }
)
)
) (final.haskellPackages.autoexporter)
);
)
(final.haskellPackages.autoexporter)
);
seoCheckPkgWithComp =
exeName: name:
generateOptparseApplicativeCompletion exeName (seoCheckPkg name);
generateOptparseApplicativeCompletion exeName (seoCheckPkg name);
seoCheckPkgWithOwnComp = name: seoCheckPkgWithComp name name;
in
{
"seocheck" = seoCheckPkgWithOwnComp "seocheck";
};
{
"seocheck" = seoCheckPkgWithOwnComp "seocheck";
};
haskellPackages =
previous.haskellPackages.override (
old:
{
overrides =
final.lib.composeExtensions (
{
overrides =
final.lib.composeExtensions
(
old.overrides or (
_:
_:
{}
{ }
)
) (
)
(
self: super:
final.seoCheckPackages
);
}
}
);
}
21 changes: 11 additions & 10 deletions nix/pkgs.nix
@@ -1,19 +1,20 @@
let
pkgsv = import (import ./nixpkgs.nix);
pkgs = pkgsv {};
yamlparse-applicative-overlay =
import (
pkgs.fetchFromGitHub (import ./yamlparse-applicative-version.nix) + "/nix/overlay.nix"
);
linkCheckPkgs =
pkgsv {
sources = import ./sources.nix;
pkgsf = import sources.nixpkgs;
pre-commit-hooks = import sources.pre-commit-hooks;
yamlparse-applicative-overlay = import (sources.yamlparse-applicative + "/nix/overlay.nix");
safe-coloured-text-overlay = import (sources.safe-coloured-text + "/nix/overlay.nix");
seoCheckPkgs =
pkgsf {
overlays =
[
yamlparse-applicative-overlay
(import ./gitignore-src.nix)
safe-coloured-text-overlay
(final: previous: { niv = (import sources.niv { pkgs = final; }).niv; })
(final: previous: { inherit (import sources.gitignore { inherit (final) lib; }) gitignoreSource; })
(import ./overlay.nix)
];
config.allowUnfree = true;
};
in
linkCheckPkgs
seoCheckPkgs
22 changes: 22 additions & 0 deletions nix/pre-commit.nix
@@ -0,0 +1,22 @@
let
sources = import ./sources.nix;
nix-pre-commit-hooks = import sources.pre-commit-hooks;

in
{
tools = with nix-pre-commit-hooks; [
hlint
hpack
nixpkgs-fmt
ormolu
];
check = nix-pre-commit-hooks.run {
src = ../.;
hooks = {
hlint.enable = true;
hpack.enable = true;
nixpkgs-fmt.enable = true;
ormolu.enable = true;
};
};
}

0 comments on commit 81b7060

Please sign in to comment.