update to 1809
This commit is contained in:
@@ -14,10 +14,10 @@
|
|||||||
./programs/installed.nix
|
./programs/installed.nix
|
||||||
./services/enabled.nix
|
./services/enabled.nix
|
||||||
./users.nix
|
./users.nix
|
||||||
./desktop.nix
|
./desktop.nix
|
||||||
./setup.nix
|
./setup.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
nix.gc.automatic = true;
|
nix.gc.automatic = true;
|
||||||
nix.gc.dates = "03:15";
|
nix.gc.dates = "03:15";
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
# servers. You should change this only after NixOS release notes say you
|
# servers. You should change this only after NixOS release notes say you
|
||||||
# should.
|
# should.
|
||||||
system = {
|
system = {
|
||||||
stateVersion = "17.09"; # Did you read the comment?
|
stateVersion = "18.03"; # Did you read the comment?
|
||||||
autoUpgrade.enable = true;
|
autoUpgrade.enable = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
services.xserver.enable = true;
|
services.xserver.enable = false;
|
||||||
services.xserver.displayManager.lightdm = {
|
services.xserver.displayManager.lightdm = {
|
||||||
enable = true;
|
enable = false;
|
||||||
autoLogin = {
|
autoLogin = {
|
||||||
enable = true;
|
enable = true;
|
||||||
user = "devel";
|
user = "devel";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
services.xserver.desktopManager = {
|
services.xserver.desktopManager = {
|
||||||
xfce.enable = true;
|
xfce.enable = false;
|
||||||
default = "xfce";
|
default = "none";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
17
module/news2kindle2/calibre-disable_plugins.patch
Normal file
17
module/news2kindle2/calibre-disable_plugins.patch
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
Description: Disable plugin dialog. It uses a totally non-authenticated and non-trusted way of installing arbitrary code.
|
||||||
|
Author: Martin Pitt <mpitt@debian.org>
|
||||||
|
Bug-Debian: http://bugs.debian.org/640026
|
||||||
|
|
||||||
|
Index: calibre-0.8.29+dfsg/src/calibre/gui2/actions/preferences.py
|
||||||
|
===================================================================
|
||||||
|
--- calibre-0.8.29+dfsg.orig/src/calibre/gui2/actions/preferences.py 2011-12-16 05:49:14.000000000 +0100
|
||||||
|
+++ calibre-0.8.29+dfsg/src/calibre/gui2/actions/preferences.py 2011-12-20 19:29:04.798468930 +0100
|
||||||
|
@@ -28,8 +28,6 @@
|
||||||
|
pm.addAction(QIcon(I('config.png')), _('Preferences'), self.do_config)
|
||||||
|
cm('welcome wizard', _('Run welcome wizard'),
|
||||||
|
icon='wizard.png', triggered=self.gui.run_wizard)
|
||||||
|
- cm('plugin updater', _('Get plugins to enhance calibre'),
|
||||||
|
- icon='plugins/plugin_updater.png', triggered=self.get_plugins)
|
||||||
|
if not DEBUG:
|
||||||
|
pm.addSeparator()
|
||||||
|
cm('restart', _('Restart in debug mode'), icon='debug.png',
|
||||||
17
module/news2kindle2/cronjob-options.nix
Normal file
17
module/news2kindle2/cronjob-options.nix
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{ config, lib }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
cronExpression = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "0 5 * * *";
|
||||||
|
description = '' cron expression, when fetch should started. '';
|
||||||
|
example = "0 5 * * *";
|
||||||
|
};
|
||||||
|
|
||||||
|
recipes = mkOption {
|
||||||
|
type = types.listOf (types.submodule (import ./recipe-options.nix { inherit config lib; }));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
170
module/news2kindle2/news2kindle.nix
Normal file
170
module/news2kindle2/news2kindle.nix
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
{ config, lib, pkgs, fetchurl, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
cfg = config.services.news2kindle;
|
||||||
|
|
||||||
|
portString = toString cfg.smtp.port;
|
||||||
|
|
||||||
|
convertScript = pkgs.writeText "convertScript.sh" ''#!/bin/bash
|
||||||
|
NAME=$1
|
||||||
|
RECIPEPATH=$2
|
||||||
|
MOBIPATH=$3
|
||||||
|
FROMADDR=$4
|
||||||
|
TOADDR=$5
|
||||||
|
if [ ! -f mobi/$NAME.mobi ]; then
|
||||||
|
ebook-convert $RECIPEPATH/$NAME.recipe $MOBIPATH/$NAME.mobi --output-profile kindle -v
|
||||||
|
fi
|
||||||
|
|
||||||
|
mailsend -smtp ${cfg.smtp.address} -port ${portString} -from $FROMADDR -to $TOADDR -sub "New news from $NAME" -attach $MOBIPATH/$NAME.mobi
|
||||||
|
sleep 60
|
||||||
|
'';
|
||||||
|
|
||||||
|
reps = mapAttrsToList (name: value:
|
||||||
|
let
|
||||||
|
mailAddress = if value.mailAddress != null
|
||||||
|
then value.mailAddress
|
||||||
|
else name;
|
||||||
|
cronJobs = mapAttrsToList ( jobExpr: jobValue:
|
||||||
|
let
|
||||||
|
cronExpression = if jobValue.cronExpression != "0 5 * * *"
|
||||||
|
then jobValue.cronExpression
|
||||||
|
else jobExpr;
|
||||||
|
in
|
||||||
|
jobValue // {cronExpression = cronExpression;}) value.cronJobs;
|
||||||
|
in
|
||||||
|
value // { mailAddress = name; cronJobs = cronJobs; }
|
||||||
|
) cfg.recipients;
|
||||||
|
|
||||||
|
jobs = concatMap(recipient: concatMap(cronjob:
|
||||||
|
let
|
||||||
|
scriptName = builtins.replaceStrings ["*"] ["star"] (builtins.replaceStrings [" "] ["_"] (builtins.replaceStrings ["@"] [""] "${recipient.mailAddress}-${cronjob.cronExpression}.sh"));
|
||||||
|
scriptlines = concatMapStrings(recipe:
|
||||||
|
if isNull recipe.content then
|
||||||
|
"bash ${convertScript} ${recipe.name} ${calibreWithRecipes}/var/news2kindle/recipes ${cfg.mobiPath} ${recipient.fromMail} ${recipient.mailAddress}\n"
|
||||||
|
else
|
||||||
|
''
|
||||||
|
mkdir -p /tmp/news2kindle/recipes
|
||||||
|
echo "${recipe.content}" > /tmp/news2kindle/recipes/${recipe.name}.recipe
|
||||||
|
bash ${convertScript} ${recipe.name} /tmp/news2kindle/recipes/ ${cfg.mobiPath} ${recipient.fromMail} ${recipient.mailAddress}
|
||||||
|
'' ) cronjob.recipes;
|
||||||
|
script = pkgs.writeText "${scriptName}" ''#!/bin/bash
|
||||||
|
rm -f ${cfg.mobiPath}/*.mobi
|
||||||
|
mkdir -p ${cfg.mobiPath}
|
||||||
|
${scriptlines}
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
["${cronjob.cronExpression} root bash ${script}"]) recipient.cronJobs) reps;
|
||||||
|
|
||||||
|
|
||||||
|
odfpyNoTest = pkgs.python2Packages.odfpy.overrideAttrs (oldAttrs: rec {
|
||||||
|
doInstallCheck = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
calibreWithRecipes = pkgs.calibre.overrideAttrs (oldAttrs: rec {
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/var/news2kindle/recipes
|
||||||
|
cp -ravf recipes $out/var/news2kindle
|
||||||
|
''+ oldAttrs.installPhase ;
|
||||||
|
|
||||||
|
buildInputs = (remove pkgs.python2Packages.odfpy oldAttrs.buildInputs) ++ [odfpyNoTest];
|
||||||
|
|
||||||
|
# patches = oldAttrs.patches ++ [./calibre-disable_plugins.patch];
|
||||||
|
patches = [./calibre-disable_plugins.patch];
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
###### interface
|
||||||
|
|
||||||
|
options = {
|
||||||
|
|
||||||
|
services.news2kindle = {
|
||||||
|
|
||||||
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to enable news2kindle service.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
recipePath = mkOption {
|
||||||
|
example = "/var/news2kindle/recipes";
|
||||||
|
default = "/var/news2kindle/recipes";
|
||||||
|
type = types.str;
|
||||||
|
description = ''
|
||||||
|
Path where the recipes should be saved
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
mobiPath = mkOption {
|
||||||
|
example = "/tmp/news2kindle/mobi";
|
||||||
|
default = "/tmp/news2kindle/mobi";
|
||||||
|
type = types.str;
|
||||||
|
description = ''
|
||||||
|
Path where the mobi files should be saved
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
fromMail = mkOption {
|
||||||
|
example = "news@stubbe.rocks";
|
||||||
|
default = "news@stubbe.rocks";
|
||||||
|
type = types.str;
|
||||||
|
description = ''
|
||||||
|
Adrees of the sender, please allow this mail in your kindle doc service
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
recipients = mkOption {
|
||||||
|
type = types.attrsOf (types.submodule (import ./recipient-options.nix { inherit config lib; }));
|
||||||
|
};
|
||||||
|
|
||||||
|
smtp = {
|
||||||
|
|
||||||
|
address = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "localhost";
|
||||||
|
description = "Address of the SMTP server for news2kindle.";
|
||||||
|
};
|
||||||
|
|
||||||
|
port = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 25;
|
||||||
|
description = "Port of the SMTP server for news2kindle.";
|
||||||
|
};
|
||||||
|
|
||||||
|
username = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
description = "Username of the SMTP server for news2kindle.";
|
||||||
|
};
|
||||||
|
|
||||||
|
password = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
description = "Password of the SMTP server for news2kindle.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
###### implementation
|
||||||
|
|
||||||
|
config = mkIf cfg.enable{
|
||||||
|
environment.systemPackages = [pkgs.python27Packages.pyqt5 pkgs.python36Packages.pyqt5 pkgs.mailsend calibreWithRecipes];
|
||||||
|
services.cron.enable = true;
|
||||||
|
services.cron.systemCronJobs = jobs;
|
||||||
|
};
|
||||||
|
}
|
||||||
17
module/news2kindle2/recipe-options.nix
Normal file
17
module/news2kindle2/recipe-options.nix
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{ config, lib }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
name = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = null;
|
||||||
|
description = '' name of recipe '';
|
||||||
|
};
|
||||||
|
content = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
description = '' content of the recipe file, when its null the use the builtins recipes '';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
30
module/news2kindle2/recipient-options.nix
Normal file
30
module/news2kindle2/recipient-options.nix
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{ config, lib }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.news2kindle;
|
||||||
|
in
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
mailAddress = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = null;
|
||||||
|
description = '' mail address of the recipient '';
|
||||||
|
example = "foo@bar.bla";
|
||||||
|
};
|
||||||
|
|
||||||
|
fromMail = mkOption {
|
||||||
|
example = "foo@bar.bla";
|
||||||
|
default = cfg.fromMail;
|
||||||
|
type = types.str;
|
||||||
|
description = ''
|
||||||
|
Adrees of the sender, please allow this mail in your kindle doc service
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
cronJobs = mkOption {
|
||||||
|
type = types.attrsOf (types.submodule (import ./cronjob-options.nix { inherit config lib; }));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
firefox gitAndTools.gitFull git-cola git-crecord gitAndTools.git-extras git-lfs
|
gcc gcc_multi automake kmod linuxHeaders bash gnumake
|
||||||
gitAndTools.gitflow zsh-git-prompt cmakeWithGui qtcreator codeblocksFull eclipses.eclipse-cpp eclipses.eclipse-sdk clang gcc
|
|
||||||
gcc_multi automake atom kmod linuxHeaders tilix tmux screen bash gnumake ninja uncrustify hunspell hunspellDicts.en-us
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,8 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
ohMyZsh = {
|
|
||||||
enable = true;
|
|
||||||
plugins = ["git" "git-extras" "git-flow"];
|
|
||||||
};
|
|
||||||
enable = true;
|
enable = true;
|
||||||
enableAutosuggestions = true;
|
autosuggestions.enable = true;
|
||||||
enableCompletion = true;
|
enableCompletion = true;
|
||||||
syntaxHighlighting.enable = true;
|
syntaxHighlighting.enable = true;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user