workhorse done and nixpkgs-fmt
This commit is contained in:
parent
87be340dfa
commit
fc33e57a54
124 changed files with 3142 additions and 2590 deletions
nixos/modules
programs
browser.nixcitate.nixcurl-scripts.nixeasytag.nixelm.nixespeak.nixffmpeg.nixgit.nixshell-tools.nixshell-zsh.nixslack.nixsteam.nixtaskwarrior.nixurxvt.nixvideo.nixvim.nixxterm.nix
services
castget.nixhome-assistant.nixlektor.nixlight-control.nixsamba-share.nixsshd.nixtaskwarrior-pushover.nixvideoencoder.nix
system
|
@ -45,92 +45,104 @@ let
|
|||
backupFile = "${homeBackup}.tar.lzma";
|
||||
rolloutFile = "${home}.tar.lzma";
|
||||
lockFile = "${home}-lock";
|
||||
in pkgs.writeShellScriptBin "${name}-clean" # sh
|
||||
''
|
||||
sudo killall -9 -u ${name}
|
||||
sudo rm -f ${lockFile}
|
||||
sudo rm -rf ${home}
|
||||
'';
|
||||
in
|
||||
pkgs.writeShellScriptBin "${name}-clean" # sh
|
||||
''
|
||||
sudo killall -9 -u ${name}
|
||||
sudo rm -f ${lockFile}
|
||||
sudo rm -rf ${home}
|
||||
'';
|
||||
|
||||
createBrowser = name: user: browser: home: homeBackup:
|
||||
let
|
||||
backupFile = "${homeBackup}.tar.lzma";
|
||||
rolloutFile = "${home}.tar.lzma";
|
||||
lockFile = "${home}-lock";
|
||||
in pkgs.writeShellScriptBin "${name}" # sh
|
||||
''
|
||||
# set -x
|
||||
if [[ ! -e ${lockFile} ]]
|
||||
then
|
||||
# rollout backup
|
||||
if [[ -e ${backupFile} ]]
|
||||
then
|
||||
if [[ ! -d ${home} ]]
|
||||
then
|
||||
# todo : use make user
|
||||
sudo mkdir -p ${home}
|
||||
sudo chown -R ${user}:users ${home}
|
||||
fi
|
||||
cp ${backupFile} ${rolloutFile}
|
||||
sudo -u ${user} ${tarBin} xf ${rolloutFile} --directory ${home}
|
||||
rm ${rolloutFile}
|
||||
touch ${lockFile}
|
||||
fi
|
||||
fi
|
||||
in
|
||||
pkgs.writeShellScriptBin "${name}" # sh
|
||||
''
|
||||
# set -x
|
||||
if [[ ! -e ${lockFile} ]]
|
||||
then
|
||||
# rollout backup
|
||||
if [[ -e ${backupFile} ]]
|
||||
then
|
||||
if [[ ! -d ${home} ]]
|
||||
then
|
||||
# todo : use make user
|
||||
sudo mkdir -p ${home}
|
||||
sudo chown -R ${user}:users ${home}
|
||||
fi
|
||||
cp ${backupFile} ${rolloutFile}
|
||||
sudo -u ${user} ${tarBin} xf ${rolloutFile} --directory ${home}
|
||||
rm ${rolloutFile}
|
||||
touch ${lockFile}
|
||||
fi
|
||||
fi
|
||||
|
||||
sudo -u ${user} ${browser}
|
||||
'';
|
||||
sudo -u ${user} ${browser}
|
||||
'';
|
||||
|
||||
browserExecutableList = let
|
||||
allBrowser = flip mapAttrsToList cfg.configList (name: config:
|
||||
let
|
||||
browser = if config.browserType == "chrome" then
|
||||
''${chromiumBin} "$@"''
|
||||
else if config.browserType == "google" then
|
||||
''${chromeBin} "$@"''
|
||||
else
|
||||
''${firefoxBin} "$@"'';
|
||||
in createBrowser name config.user browser config.home config.homeBackup);
|
||||
xclipBrowser = [
|
||||
(pkgs.writeShellScriptBin "copy-to-xclip" # sh
|
||||
''
|
||||
echo "$*" | ${pkgs.xclip}/bin/xclip
|
||||
'')
|
||||
];
|
||||
in allBrowser ++ xclipBrowser;
|
||||
browserExecutableList =
|
||||
let
|
||||
allBrowser = flip mapAttrsToList cfg.configList (name: config:
|
||||
let
|
||||
browser =
|
||||
if config.browserType == "chrome" then
|
||||
''${chromiumBin} "$@"''
|
||||
else if config.browserType == "google" then
|
||||
''${chromeBin} "$@"''
|
||||
else
|
||||
''${firefoxBin} "$@"'';
|
||||
in
|
||||
createBrowser name config.user browser config.home config.homeBackup);
|
||||
xclipBrowser = [
|
||||
(pkgs.writeShellScriptBin "copy-to-xclip" # sh
|
||||
''
|
||||
echo "$*" | ${pkgs.xclip}/bin/xclip
|
||||
'')
|
||||
];
|
||||
in
|
||||
allBrowser ++ xclipBrowser;
|
||||
|
||||
createBackupScript = name: home: backupHome:
|
||||
pkgs.writeShellScriptBin "${name}-backup" # sh
|
||||
''
|
||||
sudo -u ${name} \
|
||||
${tarBin} \
|
||||
--exclude=.cache \
|
||||
--exclude=Downloads \
|
||||
--create \
|
||||
--verbos \
|
||||
--lzma \
|
||||
--file ${home}.tar.lzma \
|
||||
--directory ${home} \
|
||||
.
|
||||
''
|
||||
sudo -u ${name} \
|
||||
${tarBin} \
|
||||
--exclude=.cache \
|
||||
--exclude=Downloads \
|
||||
--create \
|
||||
--verbos \
|
||||
--lzma \
|
||||
--file ${home}.tar.lzma \
|
||||
--directory ${home} \
|
||||
.
|
||||
|
||||
cp ${home}.tar.lzma ${backupHome}.tar.lzma
|
||||
'';
|
||||
cp ${home}.tar.lzma ${backupHome}.tar.lzma
|
||||
'';
|
||||
|
||||
allBackupScripts = let
|
||||
filteredConfigs =
|
||||
filterAttrs (name: browserConfig: browserConfig.homeBackup != null)
|
||||
cfg.configList;
|
||||
in mapAttrsToList (name: browserConfig:
|
||||
createBackupScript name browserConfig.home browserConfig.homeBackup)
|
||||
filteredConfigs;
|
||||
allBackupScripts =
|
||||
let
|
||||
filteredConfigs =
|
||||
filterAttrs (name: browserConfig: browserConfig.homeBackup != null)
|
||||
cfg.configList;
|
||||
in
|
||||
mapAttrsToList
|
||||
(name: browserConfig:
|
||||
createBackupScript name browserConfig.home browserConfig.homeBackup)
|
||||
filteredConfigs;
|
||||
|
||||
allCleanScripts = let
|
||||
filteredConfigs =
|
||||
filterAttrs (name: browserConfig: browserConfig.homeBackup != null)
|
||||
cfg.configList;
|
||||
in mapAttrsToList (name: browserConfig:
|
||||
cleanBrowser name name browserConfig.home browserConfig.homeBackup)
|
||||
filteredConfigs;
|
||||
allCleanScripts =
|
||||
let
|
||||
filteredConfigs =
|
||||
filterAttrs (name: browserConfig: browserConfig.homeBackup != null)
|
||||
cfg.configList;
|
||||
in
|
||||
mapAttrsToList
|
||||
(name: browserConfig:
|
||||
cleanBrowser name name browserConfig.home browserConfig.homeBackup)
|
||||
filteredConfigs;
|
||||
|
||||
allKillScripts = mapAttrsToList (name: _: killBrowser name) cfg.configList;
|
||||
|
||||
|
@ -153,7 +165,8 @@ let
|
|||
$BIN "$@"
|
||||
'';
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.programs.custom.browser = {
|
||||
enable = mkEnableOption "enable browsers";
|
||||
|
@ -214,18 +227,22 @@ in {
|
|||
config = mkIf cfg.enable {
|
||||
|
||||
# add sudo rights
|
||||
security.sudo.extraConfig = let
|
||||
extraRules = flip mapAttrsToList cfg.configList (name: values:
|
||||
concatStringsSep "" (map (sudoUser: ''
|
||||
# sudo configuration to control browser
|
||||
${sudoUser} ALL=(${values.user}) NOPASSWD: ALL
|
||||
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/mkdir -p ${values.home}
|
||||
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/chown -R ${values.user}\:users ${values.home}
|
||||
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/killall -9 -u ${name}
|
||||
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/rm -rf ${values.home}
|
||||
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/rm -f ${values.home}-lock
|
||||
'') values.sudoUsers));
|
||||
in lib.concatStringsSep "\n" extraRules;
|
||||
security.sudo.extraConfig =
|
||||
let
|
||||
extraRules = flip mapAttrsToList cfg.configList (name: values:
|
||||
concatStringsSep "" (map
|
||||
(sudoUser: ''
|
||||
# sudo configuration to control browser
|
||||
${sudoUser} ALL=(${values.user}) NOPASSWD: ALL
|
||||
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/mkdir -p ${values.home}
|
||||
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/chown -R ${values.user}\:users ${values.home}
|
||||
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/killall -9 -u ${name}
|
||||
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/rm -rf ${values.home}
|
||||
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/rm -f ${values.home}-lock
|
||||
'')
|
||||
values.sudoUsers));
|
||||
in
|
||||
lib.concatStringsSep "\n" extraRules;
|
||||
|
||||
# create users
|
||||
users.users = flip mapAttrs cfg.configList (name: config: {
|
||||
|
|
|
@ -19,7 +19,8 @@ let
|
|||
scriptAxel = citateScript (toString ../../assets/sprueche-axel) "axel";
|
||||
scriptSiw = citateScript (toString ../../assets/sprueche-siw) "siw";
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.programs.custom.citate = {
|
||||
enable = mkEnableOption "enable programs.custom.citate";
|
||||
|
|
|
@ -18,7 +18,8 @@ let
|
|||
|
||||
cfg = config.programs.custom.curlScripts;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.programs.custom.curlScripts.enable =
|
||||
mkEnableOption "enable curl scripts";
|
||||
|
|
|
@ -6,7 +6,8 @@ let
|
|||
|
||||
cfg = config.programs.custom.easytag;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.programs.custom.easytag.enable =
|
||||
mkEnableOption "install easytag with dependencies";
|
||||
|
|
|
@ -6,7 +6,8 @@ let
|
|||
|
||||
cfg = config.programs.custom.elm;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.programs.custom.elm.enable = mkEnableOption "enable elm stack";
|
||||
|
||||
|
|
|
@ -36,7 +36,8 @@ let
|
|||
|
||||
cfg = config.programs.custom.espeak;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.programs.custom.espeak.enable =
|
||||
mkEnableOption "enable espeak scripts";
|
||||
|
|
|
@ -5,8 +5,13 @@ let
|
|||
cfg = config.programs.custom.ffmpeg;
|
||||
|
||||
ffmpegTemplate = name:
|
||||
{ profile, preset, tune ? null, width ? 1280, height ? 720
|
||||
, resolution ? "720p" }:
|
||||
{ profile
|
||||
, preset
|
||||
, tune ? null
|
||||
, width ? 1280
|
||||
, height ? 720
|
||||
, resolution ? "720p"
|
||||
}:
|
||||
pkgs.writeShellScriptBin "ffmpeg-${name}" ''
|
||||
|
||||
if [ $# -eq 0 ]
|
||||
|
@ -99,48 +104,53 @@ let
|
|||
];
|
||||
tunes = [ "film" "animation" "grain" "stillimage" "fastdecode" ];
|
||||
|
||||
ffmpegs = let
|
||||
ffmpegs =
|
||||
let
|
||||
|
||||
configurations = lib.cartesianProductOfSets {
|
||||
profile = profiles;
|
||||
preset = presets;
|
||||
};
|
||||
|
||||
p720 = { profile, preset }:
|
||||
ffmpegTemplate "${profile}-${preset}-720p" { inherit profile preset; };
|
||||
|
||||
p1080 = { profile, preset }:
|
||||
ffmpegTemplate "${profile}-${preset}-1080p" {
|
||||
inherit profile preset;
|
||||
height = 1080;
|
||||
width = 1920;
|
||||
resolution = "1080p";
|
||||
};
|
||||
in (map p720 configurations) ++ (map p1080 configurations);
|
||||
|
||||
ffmpegsTune = let
|
||||
configurations = lib.cartesianProductOfSets {
|
||||
profile = profiles;
|
||||
preset = presets;
|
||||
tune = tunes;
|
||||
};
|
||||
|
||||
p720 = { profile, preset, tune }:
|
||||
ffmpegTemplate "${profile}-${preset}-${tune}-720p" {
|
||||
inherit profile preset tune;
|
||||
configurations = lib.cartesianProductOfSets {
|
||||
profile = profiles;
|
||||
preset = presets;
|
||||
};
|
||||
|
||||
p1080 = { profile, preset, tune }:
|
||||
ffmpegTemplate "${profile}-${preset}-${tune}-1080p" {
|
||||
inherit profile preset tune;
|
||||
height = 1080;
|
||||
width = 1920;
|
||||
resolution = "1080p";
|
||||
p720 = { profile, preset }:
|
||||
ffmpegTemplate "${profile}-${preset}-720p" { inherit profile preset; };
|
||||
|
||||
p1080 = { profile, preset }:
|
||||
ffmpegTemplate "${profile}-${preset}-1080p" {
|
||||
inherit profile preset;
|
||||
height = 1080;
|
||||
width = 1920;
|
||||
resolution = "1080p";
|
||||
};
|
||||
in
|
||||
(map p720 configurations) ++ (map p1080 configurations);
|
||||
|
||||
ffmpegsTune =
|
||||
let
|
||||
configurations = lib.cartesianProductOfSets {
|
||||
profile = profiles;
|
||||
preset = presets;
|
||||
tune = tunes;
|
||||
};
|
||||
|
||||
in (map p720 configurations) ++ (map p1080 configurations);
|
||||
p720 = { profile, preset, tune }:
|
||||
ffmpegTemplate "${profile}-${preset}-${tune}-720p" {
|
||||
inherit profile preset tune;
|
||||
};
|
||||
|
||||
in {
|
||||
p1080 = { profile, preset, tune }:
|
||||
ffmpegTemplate "${profile}-${preset}-${tune}-1080p" {
|
||||
inherit profile preset tune;
|
||||
height = 1080;
|
||||
width = 1920;
|
||||
resolution = "1080p";
|
||||
};
|
||||
|
||||
in
|
||||
(map p720 configurations) ++ (map p1080 configurations);
|
||||
|
||||
in
|
||||
{
|
||||
|
||||
options.programs.custom.ffmpeg = {
|
||||
enable = mkEnableOption "enable programs.custom.ffmpeg";
|
||||
|
|
|
@ -6,7 +6,8 @@ let
|
|||
|
||||
cfg = config.programs.custom.git;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.programs.custom.git.enable =
|
||||
mkEnableOption "install git and all its tools";
|
||||
|
|
|
@ -29,7 +29,8 @@ let
|
|||
|
||||
cfg = config.programs.custom.shellTools;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.programs.custom.shellTools.enable =
|
||||
mkEnableOption "enable shell tools";
|
||||
|
|
|
@ -6,7 +6,8 @@ let
|
|||
|
||||
cfg = config.programs.custom.zsh;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.programs.custom.zsh = {
|
||||
enable = mkEnableOption "enable zsh";
|
||||
|
|
|
@ -14,47 +14,51 @@ let
|
|||
# ---------------------------
|
||||
command = "${pkgs.slack}/bin/slack";
|
||||
|
||||
desktopFile = let
|
||||
name = program;
|
||||
comment = "Chat Programm";
|
||||
in pkgs.writeTextFile {
|
||||
name = "${name}.desktop";
|
||||
destination = "/share/applications/${name}.desktop";
|
||||
text = ''
|
||||
[Desktop Entry]
|
||||
Categories=Application;Utility;
|
||||
Comment=${comment}
|
||||
Encoding=UTF-8
|
||||
Exec=${bin}/bin/${name}
|
||||
Icon=gnome-lockscreen
|
||||
Name=${name}
|
||||
Terminal=false
|
||||
Type=Application
|
||||
'';
|
||||
};
|
||||
desktopFile =
|
||||
let
|
||||
name = program;
|
||||
comment = "Chat Programm";
|
||||
in
|
||||
pkgs.writeTextFile {
|
||||
name = "${name}.desktop";
|
||||
destination = "/share/applications/${name}.desktop";
|
||||
text = ''
|
||||
[Desktop Entry]
|
||||
Categories=Application;Utility;
|
||||
Comment=${comment}
|
||||
Encoding=UTF-8
|
||||
Exec=${bin}/bin/${name}
|
||||
Icon=gnome-lockscreen
|
||||
Name=${name}
|
||||
Terminal=false
|
||||
Type=Application
|
||||
'';
|
||||
};
|
||||
|
||||
# the script
|
||||
# ----------
|
||||
bin = let
|
||||
backupFile = "${cfg.homeBackup}.tar.lzma";
|
||||
rolloutFile = "${cfg.home}.tar.lzma";
|
||||
lockFile = "${cfg.home}-lock";
|
||||
in pkgs.writeShellScriptBin "${program}" ''
|
||||
# set -x
|
||||
if [[ ! -e ${lockFile} ]]
|
||||
then
|
||||
# rollout backup
|
||||
if [[ -e ${backupFile} ]]
|
||||
bin =
|
||||
let
|
||||
backupFile = "${cfg.homeBackup}.tar.lzma";
|
||||
rolloutFile = "${cfg.home}.tar.lzma";
|
||||
lockFile = "${cfg.home}-lock";
|
||||
in
|
||||
pkgs.writeShellScriptBin "${program}" ''
|
||||
# set -x
|
||||
if [[ ! -e ${lockFile} ]]
|
||||
then
|
||||
cp ${backupFile} ${rolloutFile}
|
||||
sudo -u ${program} ${tarBin} xf ${rolloutFile} --directory ${cfg.home}
|
||||
rm ${rolloutFile}
|
||||
touch ${lockFile}
|
||||
# rollout backup
|
||||
if [[ -e ${backupFile} ]]
|
||||
then
|
||||
cp ${backupFile} ${rolloutFile}
|
||||
sudo -u ${program} ${tarBin} xf ${rolloutFile} --directory ${cfg.home}
|
||||
rm ${rolloutFile}
|
||||
touch ${lockFile}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
sudo -u ${program} ${command}
|
||||
'';
|
||||
sudo -u ${program} ${command}
|
||||
'';
|
||||
|
||||
backupScript = pkgs.writeShellScriptBin "${program}-backup" ''
|
||||
sudo -u ${program} \
|
||||
|
@ -75,7 +79,8 @@ let
|
|||
|
||||
cfg = config.programs.custom.slack;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.programs.custom.slack = {
|
||||
enable = mkEnableOption "install slack";
|
||||
|
|
|
@ -14,7 +14,8 @@ let
|
|||
|
||||
cfg = config.programs.custom.steam;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.programs.custom.steam.enable = mkEnableOption "enable steam";
|
||||
|
||||
|
|
|
@ -34,7 +34,8 @@ let
|
|||
});
|
||||
#vit = pkgs.vit;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.programs.custom.taskwarrior.enable =
|
||||
mkEnableOption "Enable Taskwarrior services";
|
||||
|
|
|
@ -6,7 +6,8 @@ let
|
|||
|
||||
cfg = config.programs.custom.urxvt;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.programs.custom.urxvt = {
|
||||
|
||||
|
@ -63,24 +64,26 @@ in {
|
|||
URxvt.fading: 0
|
||||
'';
|
||||
|
||||
"X11/Xresource.d/urxvt-font".source = let
|
||||
fontFamily = "terminus";
|
||||
normalFont = fontSize:
|
||||
"-*-${fontFamily}-medium-*-*-*-${toString fontSize}-*-*-*-*-*-*-*";
|
||||
boldFont = fontSize:
|
||||
"-*-${fontFamily}-bold-*-*-*-${toString fontSize}-*-*-*-*-*-*-*";
|
||||
italicFont = normalFont;
|
||||
itallicBoldFont = boldFont;
|
||||
backupFont = fontSize:
|
||||
"xft:TerminessTTF Nerd Font:pixelsize=${toString fontSize}";
|
||||
"X11/Xresource.d/urxvt-font".source =
|
||||
let
|
||||
fontFamily = "terminus";
|
||||
normalFont = fontSize:
|
||||
"-*-${fontFamily}-medium-*-*-*-${toString fontSize}-*-*-*-*-*-*-*";
|
||||
boldFont = fontSize:
|
||||
"-*-${fontFamily}-bold-*-*-*-${toString fontSize}-*-*-*-*-*-*-*";
|
||||
italicFont = normalFont;
|
||||
itallicBoldFont = boldFont;
|
||||
backupFont = fontSize:
|
||||
"xft:TerminessTTF Nerd Font:pixelsize=${toString fontSize}";
|
||||
|
||||
fontCommand = key: fontSize: ''
|
||||
URxvt.keysym.M-${key}: command:\033]710;${normalFont fontSize},${
|
||||
backupFont fontSize
|
||||
}\007\033]711;${boldFont fontSize},${backupFont fontSize}\007
|
||||
'';
|
||||
fontCommand = key: fontSize: ''
|
||||
URxvt.keysym.M-${key}: command:\033]710;${normalFont fontSize},${
|
||||
backupFont fontSize
|
||||
}\007\033]711;${boldFont fontSize},${backupFont fontSize}\007
|
||||
'';
|
||||
|
||||
in pkgs.writeText "Xresource-urxvt-font" ''
|
||||
in
|
||||
pkgs.writeText "Xresource-urxvt-font" ''
|
||||
|
||||
URxvt.allow_bold: true
|
||||
URxvt.xftAntialias: true
|
||||
|
@ -110,28 +113,31 @@ in {
|
|||
${fontCommand "F4" (cfg.fontSize + 20)}
|
||||
'';
|
||||
|
||||
"X11/Xresource.d/urxvt-colors".source = let
|
||||
colorTheme = if (cfg.colorTheme == "dark") then ''
|
||||
#define S_base03 #002b36
|
||||
#define S_base02 #073642
|
||||
#define S_base01 #586e75
|
||||
#define S_base00 #657b83
|
||||
#define S_base0 #839496
|
||||
#define S_base1 #93a1a1
|
||||
#define S_base2 #eee8d5
|
||||
#define S_base3 #fdf6e3
|
||||
'' else ''
|
||||
#define S_base03 #fdf6e3
|
||||
#define S_base02 #eee8d5
|
||||
#define S_base01 #93a1a1
|
||||
#define S_base00 #839496
|
||||
#define S_base0 #657b83
|
||||
#define S_base1 #586e75
|
||||
#define S_base2 #073642
|
||||
#define S_base3 #002b36
|
||||
'';
|
||||
"X11/Xresource.d/urxvt-colors".source =
|
||||
let
|
||||
colorTheme =
|
||||
if (cfg.colorTheme == "dark") then ''
|
||||
#define S_base03 #002b36
|
||||
#define S_base02 #073642
|
||||
#define S_base01 #586e75
|
||||
#define S_base00 #657b83
|
||||
#define S_base0 #839496
|
||||
#define S_base1 #93a1a1
|
||||
#define S_base2 #eee8d5
|
||||
#define S_base3 #fdf6e3
|
||||
'' else ''
|
||||
#define S_base03 #fdf6e3
|
||||
#define S_base02 #eee8d5
|
||||
#define S_base01 #93a1a1
|
||||
#define S_base00 #839496
|
||||
#define S_base0 #657b83
|
||||
#define S_base1 #586e75
|
||||
#define S_base2 #073642
|
||||
#define S_base3 #002b36
|
||||
'';
|
||||
|
||||
in pkgs.writeText "Xresource-urxvt-colors" ''
|
||||
in
|
||||
pkgs.writeText "Xresource-urxvt-colors" ''
|
||||
|
||||
!! Common
|
||||
!! ------
|
||||
|
|
|
@ -9,24 +9,27 @@ let
|
|||
# show keyboard input on desktop for screencasts
|
||||
screenKey = pkgs.symlinkJoin {
|
||||
name = "screen-keys";
|
||||
paths = let
|
||||
screenKeyScript = { position ? "bottom", size ? "small", ... }:
|
||||
pkgs.writeShellScriptBin "screenkeys-${position}-${size}" # sh
|
||||
''
|
||||
${pkgs.screenkey}/bin/screenkey \
|
||||
--no-detach \
|
||||
--bg-color '#fdf6e3' \
|
||||
--font-color '#073642' \
|
||||
-p ${position} \
|
||||
-s ${size} \
|
||||
"$@"
|
||||
'';
|
||||
in lib.flatten (lib.flip map [ "large" "small" "medium" ] (size:
|
||||
lib.flip map [ "top" "center" "bottom" ]
|
||||
(position: screenKeyScript { inherit size position; })));
|
||||
paths =
|
||||
let
|
||||
screenKeyScript = { position ? "bottom", size ? "small", ... }:
|
||||
pkgs.writeShellScriptBin "screenkeys-${position}-${size}" # sh
|
||||
''
|
||||
${pkgs.screenkey}/bin/screenkey \
|
||||
--no-detach \
|
||||
--bg-color '#fdf6e3' \
|
||||
--font-color '#073642' \
|
||||
-p ${position} \
|
||||
-s ${size} \
|
||||
"$@"
|
||||
'';
|
||||
in
|
||||
lib.flatten (lib.flip map [ "large" "small" "medium" ] (size:
|
||||
lib.flip map [ "top" "center" "bottom" ]
|
||||
(position: screenKeyScript { inherit size position; })));
|
||||
};
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.programs.custom.video.enable = mkEnableOption "enable video tools";
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ let
|
|||
|
||||
}).env
|
||||
|
||||
'';
|
||||
'';
|
||||
};
|
||||
|
||||
# active plugins
|
||||
|
@ -200,7 +200,8 @@ let
|
|||
|
||||
'';
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
# no options
|
||||
options.programs.custom.vim.enable = lib.mkEnableOption "vim";
|
||||
|
|
|
@ -6,7 +6,8 @@ let
|
|||
|
||||
cfg = config.programs.custom.xterm;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.programs.custom.xterm = {
|
||||
enable = mkEnableOption "configure and enable urxvt";
|
||||
|
@ -41,17 +42,19 @@ in {
|
|||
|
||||
'';
|
||||
|
||||
"X11/Xresource.d/xterm-font".source = let
|
||||
fontFamily = "terminus";
|
||||
normalFont = fontSize:
|
||||
"-*-${fontFamily}-medium-*-*-*-${toString fontSize}-*-*-*-*-*-*-*";
|
||||
boldFont = fontSize:
|
||||
"-*-${fontFamily}-bold-*-*-*-${toString fontSize}-*-*-*-*-*-*-*";
|
||||
italicFont = normalFont;
|
||||
itallicBoldFont = boldFont;
|
||||
backupFont = fontSize:
|
||||
"xft:TerminessTTF Nerd Font:pixelsize=${toString fontSize}";
|
||||
in pkgs.writeText "Xresource-xterm-font" ''
|
||||
"X11/Xresource.d/xterm-font".source =
|
||||
let
|
||||
fontFamily = "terminus";
|
||||
normalFont = fontSize:
|
||||
"-*-${fontFamily}-medium-*-*-*-${toString fontSize}-*-*-*-*-*-*-*";
|
||||
boldFont = fontSize:
|
||||
"-*-${fontFamily}-bold-*-*-*-${toString fontSize}-*-*-*-*-*-*-*";
|
||||
italicFont = normalFont;
|
||||
itallicBoldFont = boldFont;
|
||||
backupFont = fontSize:
|
||||
"xft:TerminessTTF Nerd Font:pixelsize=${toString fontSize}";
|
||||
in
|
||||
pkgs.writeText "Xresource-xterm-font" ''
|
||||
|
||||
XTerm.allow_bold: true
|
||||
XTerm.xftAntialias: true
|
||||
|
@ -76,29 +79,32 @@ in {
|
|||
XTerm.*.bolditalicFont: ${itallicBoldFont cfg.fontSize}
|
||||
'';
|
||||
|
||||
"X11/Xresource.d/xterm-colors".source = let
|
||||
colorTheme = if (cfg.colorTheme == "dark") then ''
|
||||
#define S_base03 #002b36
|
||||
#define S_base02 #073642
|
||||
#define S_base01 #586e75
|
||||
#define S_base00 #657b83
|
||||
#define S_base0 #839496
|
||||
#define S_base1 #93a1a1
|
||||
#define S_base2 #eee8d5
|
||||
#define S_base3 #fdf6e3
|
||||
"X11/Xresource.d/xterm-colors".source =
|
||||
let
|
||||
colorTheme =
|
||||
if (cfg.colorTheme == "dark") then ''
|
||||
#define S_base03 #002b36
|
||||
#define S_base02 #073642
|
||||
#define S_base01 #586e75
|
||||
#define S_base00 #657b83
|
||||
#define S_base0 #839496
|
||||
#define S_base1 #93a1a1
|
||||
#define S_base2 #eee8d5
|
||||
#define S_base3 #fdf6e3
|
||||
|
||||
'' else ''
|
||||
#define S_base03 #fdf6e3
|
||||
#define S_base02 #eee8d5
|
||||
#define S_base01 #93a1a1
|
||||
#define S_base00 #839496
|
||||
#define S_base0 #657b83
|
||||
#define S_base1 #586e75
|
||||
#define S_base2 #073642
|
||||
#define S_base3 #002b36
|
||||
'';
|
||||
'' else ''
|
||||
#define S_base03 #fdf6e3
|
||||
#define S_base02 #eee8d5
|
||||
#define S_base01 #93a1a1
|
||||
#define S_base00 #839496
|
||||
#define S_base0 #657b83
|
||||
#define S_base1 #586e75
|
||||
#define S_base2 #073642
|
||||
#define S_base3 #002b36
|
||||
'';
|
||||
|
||||
in pkgs.writeText "Xresource-xterm-colors" ''
|
||||
in
|
||||
pkgs.writeText "Xresource-xterm-colors" ''
|
||||
|
||||
!! Color Configuration
|
||||
!! -------------------
|
||||
|
|
|
@ -6,7 +6,8 @@ let
|
|||
|
||||
cfg = config.custom.services.castget;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.custom.services.castget = {
|
||||
enable = mkEnableOption "enable custom.services.castget";
|
||||
|
@ -67,25 +68,33 @@ in {
|
|||
restartIfChanged = false;
|
||||
serviceConfig.User = cfg.user;
|
||||
|
||||
preStart = let
|
||||
mkSpools =
|
||||
mapAttrsToList (ignore: value: "mkdir -p ${value.spool}") cfg.feeds;
|
||||
in concatStringsSep "\n" mkSpools;
|
||||
script = let
|
||||
channels = mapAttrsToList (key: ignore: key) cfg.feeds;
|
||||
castget = "${pkgs.castget}/bin/castget";
|
||||
preStart =
|
||||
let
|
||||
mkSpools =
|
||||
mapAttrsToList (ignore: value: "mkdir -p ${value.spool}") cfg.feeds;
|
||||
in
|
||||
concatStringsSep "\n" mkSpools;
|
||||
script =
|
||||
let
|
||||
channels = mapAttrsToList (key: ignore: key) cfg.feeds;
|
||||
castget = "${pkgs.castget}/bin/castget";
|
||||
|
||||
configurationFile = let
|
||||
configurations = mapAttrsToList (key: value: ''
|
||||
[${key}]
|
||||
url=${value.url}
|
||||
spool=${value.spool}
|
||||
'') cfg.feeds;
|
||||
in (pkgs.writeText "castget-configuration"
|
||||
(concatStringsSep "" configurations));
|
||||
in (concatMapStringsSep "\n"
|
||||
(channel: "${castget} --rcfile ${configurationFile} ${channel}")
|
||||
channels);
|
||||
configurationFile =
|
||||
let
|
||||
configurations = mapAttrsToList
|
||||
(key: value: ''
|
||||
[${key}]
|
||||
url=${value.url}
|
||||
spool=${value.spool}
|
||||
'')
|
||||
cfg.feeds;
|
||||
in
|
||||
(pkgs.writeText "castget-configuration"
|
||||
(concatStringsSep "" configurations));
|
||||
in
|
||||
(concatMapStringsSep "\n"
|
||||
(channel: "${castget} --rcfile ${configurationFile} ${channel}")
|
||||
channels);
|
||||
};
|
||||
|
||||
systemd.timers."${cfg.serviceName}" = {
|
||||
|
|
|
@ -11,21 +11,24 @@ let
|
|||
inherit example description default;
|
||||
type = with lib.types;
|
||||
let
|
||||
valueType = nullOr (oneOf [
|
||||
bool
|
||||
int
|
||||
float
|
||||
str
|
||||
(attrsOf valueType)
|
||||
(listOf valueType)
|
||||
]) // {
|
||||
valueType = nullOr
|
||||
(oneOf [
|
||||
bool
|
||||
int
|
||||
float
|
||||
str
|
||||
(attrsOf valueType)
|
||||
(listOf valueType)
|
||||
]) // {
|
||||
description = "";
|
||||
emptyValue.value = { };
|
||||
};
|
||||
in valueType;
|
||||
in
|
||||
valueType;
|
||||
};
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.services.homeAssistantConfig = mkMagicMergeOption {
|
||||
description = ''
|
||||
|
|
|
@ -6,7 +6,8 @@ let
|
|||
|
||||
cfg = config.services.lektor;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.services.lektor = {
|
||||
enable = mkEnableOption "enable services.lektor";
|
||||
|
@ -107,57 +108,59 @@ in {
|
|||
TimeoutStartSec =
|
||||
"infinity"; # it might take some time will this thing is up
|
||||
|
||||
ExecStartPre = let
|
||||
ExecStartPre =
|
||||
let
|
||||
|
||||
sshKeyTarget = "/run/keys.lektor/id_rsa";
|
||||
sshKeyTarget = "/run/keys.lektor/id_rsa";
|
||||
|
||||
sshConfig = pkgs.writeText "sshconfig" ''
|
||||
Host ${cfg.host}
|
||||
IdentityFile ${sshKeyTarget}
|
||||
sshConfig = pkgs.writeText "sshconfig" ''
|
||||
Host ${cfg.host}
|
||||
IdentityFile ${sshKeyTarget}
|
||||
|
||||
Host *
|
||||
ForwardAgent no
|
||||
Compression no
|
||||
ServerAliveInterval 0
|
||||
HashKnownHosts no
|
||||
UserKnownHostsFile ~/.ssh/known_hosts
|
||||
ControlMaster no
|
||||
ControlPath ~/.ssh/master-%r@%n:%p
|
||||
ControlPersist no
|
||||
'';
|
||||
|
||||
sshKeyScript = pkgs.writers.writeDash "keyfile-gen" # sh
|
||||
''
|
||||
set -x
|
||||
|
||||
# setup ~/.ssh
|
||||
mkdir -p ${cfg.home}/.ssh
|
||||
chown ${cfg.user} ${cfg.home}/.ssh
|
||||
chmod 700 ${cfg.home}/.ssh
|
||||
|
||||
cp ${sshConfig} ${cfg.home}/.ssh/config
|
||||
chown ${cfg.user} ${cfg.home}/.ssh/config
|
||||
chmod 500 ${cfg.home}/.ssh/config
|
||||
|
||||
mkdir -p ${dirOf sshKeyTarget}
|
||||
chmod 700 ${dirOf sshKeyTarget}
|
||||
chown ${cfg.user} ${dirOf sshKeyTarget}
|
||||
cp ${toString cfg.sshKey} ${sshKeyTarget}
|
||||
chown ${cfg.user} ${sshKeyTarget}
|
||||
chmod 500 ${sshKeyTarget}
|
||||
Host *
|
||||
ForwardAgent no
|
||||
Compression no
|
||||
ServerAliveInterval 0
|
||||
HashKnownHosts no
|
||||
UserKnownHostsFile ~/.ssh/known_hosts
|
||||
ControlMaster no
|
||||
ControlPath ~/.ssh/master-%r@%n:%p
|
||||
ControlPersist no
|
||||
'';
|
||||
|
||||
cloneScript = pkgs.writers.writeDash "clone" # sh
|
||||
''
|
||||
set -x
|
||||
if [[ `ls ~/${cfg.user} | wc -l` == 0 ]]
|
||||
then
|
||||
rm ~/${cfg.user}
|
||||
fi
|
||||
${pkgs.git}/bin/git clone ${cfg.repository} ~/${cfg.user}
|
||||
'';
|
||||
sshKeyScript = pkgs.writers.writeDash "keyfile-gen" # sh
|
||||
''
|
||||
set -x
|
||||
|
||||
in [ "+${sshKeyScript}" "-${cloneScript}" ];
|
||||
# setup ~/.ssh
|
||||
mkdir -p ${cfg.home}/.ssh
|
||||
chown ${cfg.user} ${cfg.home}/.ssh
|
||||
chmod 700 ${cfg.home}/.ssh
|
||||
|
||||
cp ${sshConfig} ${cfg.home}/.ssh/config
|
||||
chown ${cfg.user} ${cfg.home}/.ssh/config
|
||||
chmod 500 ${cfg.home}/.ssh/config
|
||||
|
||||
mkdir -p ${dirOf sshKeyTarget}
|
||||
chmod 700 ${dirOf sshKeyTarget}
|
||||
chown ${cfg.user} ${dirOf sshKeyTarget}
|
||||
cp ${toString cfg.sshKey} ${sshKeyTarget}
|
||||
chown ${cfg.user} ${sshKeyTarget}
|
||||
chmod 500 ${sshKeyTarget}
|
||||
'';
|
||||
|
||||
cloneScript = pkgs.writers.writeDash "clone" # sh
|
||||
''
|
||||
set -x
|
||||
if [[ `ls ~/${cfg.user} | wc -l` == 0 ]]
|
||||
then
|
||||
rm ~/${cfg.user}
|
||||
fi
|
||||
${pkgs.git}/bin/git clone ${cfg.repository} ~/${cfg.user}
|
||||
'';
|
||||
|
||||
in
|
||||
[ "+${sshKeyScript}" "-${cloneScript}" ];
|
||||
};
|
||||
|
||||
# todo : add restart ruling
|
||||
|
|
|
@ -11,24 +11,27 @@ let
|
|||
inherit example description default;
|
||||
type = with lib.types;
|
||||
let
|
||||
valueType = nullOr (oneOf [
|
||||
bool
|
||||
int
|
||||
float
|
||||
str
|
||||
(attrsOf valueType)
|
||||
(listOf valueType)
|
||||
]) // {
|
||||
valueType = nullOr
|
||||
(oneOf [
|
||||
bool
|
||||
int
|
||||
float
|
||||
str
|
||||
(attrsOf valueType)
|
||||
(listOf valueType)
|
||||
]) // {
|
||||
description = "";
|
||||
emptyValue.value = { };
|
||||
};
|
||||
in valueType;
|
||||
in
|
||||
valueType;
|
||||
};
|
||||
|
||||
lightControlConfig =
|
||||
pkgs.writeText "light-control.json" (builtins.toJSON cfg.config);
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.services.mqtt.light-control = {
|
||||
enable = mkEnableOption "enable mqtt.light-control";
|
||||
|
|
|
@ -6,7 +6,8 @@ let
|
|||
|
||||
cfg = config.custom.samba-share;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.custom.samba-share = {
|
||||
enable = mkEnableOption "enable custom.samba-share";
|
||||
|
@ -61,27 +62,31 @@ in {
|
|||
disable spoolss = yes
|
||||
'';
|
||||
|
||||
shares = mapAttrs' (name: path: {
|
||||
name = name;
|
||||
value = {
|
||||
browsable = "yes";
|
||||
comment = "read only share ${name}";
|
||||
path = path;
|
||||
"read only" = "yes";
|
||||
"guest ok" = "yes";
|
||||
};
|
||||
}) cfg.folders // (mapAttrs' (name:
|
||||
{ users, folder, ... }: {
|
||||
shares = mapAttrs'
|
||||
(name: path: {
|
||||
name = name;
|
||||
value = {
|
||||
browsable = "yes";
|
||||
comment = "read only share ${name}";
|
||||
path = folder;
|
||||
"read only" = "no";
|
||||
"valid users" = users;
|
||||
"guest ok" = "false";
|
||||
path = path;
|
||||
"read only" = "yes";
|
||||
"guest ok" = "yes";
|
||||
};
|
||||
}) cfg.private);
|
||||
})
|
||||
cfg.folders // (mapAttrs'
|
||||
(name:
|
||||
{ users, folder, ... }: {
|
||||
name = name;
|
||||
value = {
|
||||
browsable = "yes";
|
||||
comment = "read only share ${name}";
|
||||
path = folder;
|
||||
"read only" = "no";
|
||||
"valid users" = users;
|
||||
"guest ok" = "false";
|
||||
};
|
||||
})
|
||||
cfg.private);
|
||||
};
|
||||
|
||||
users.users.smbguest = {
|
||||
|
|
|
@ -6,7 +6,8 @@ let
|
|||
|
||||
cfg = config.services.custom.ssh;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.services.custom.ssh = {
|
||||
tools.enable = mkEnableOption "Add ssh tools";
|
||||
|
@ -44,14 +45,16 @@ in {
|
|||
Banner /etc/sshd/banner-line
|
||||
'';
|
||||
|
||||
environment.etc."sshd/banner-line".text = let
|
||||
text = config.networking.hostName;
|
||||
size = 80 - (lib.stringLength text);
|
||||
space = lib.fixedWidthString size " " "";
|
||||
in ''
|
||||
────────────────────────────────────────────────────────────────────────────────
|
||||
${space}${text}
|
||||
'';
|
||||
environment.etc."sshd/banner-line".text =
|
||||
let
|
||||
text = config.networking.hostName;
|
||||
size = 80 - (lib.stringLength text);
|
||||
space = lib.fixedWidthString size " " "";
|
||||
in
|
||||
''
|
||||
────────────────────────────────────────────────────────────────────────────────
|
||||
${space}${text}
|
||||
'';
|
||||
|
||||
})
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ in
|
|||
default = "4:00:00";
|
||||
};
|
||||
recurrence = mkOption {
|
||||
type = enum["on" "off"];
|
||||
type = enum [ "on" "off" ];
|
||||
default = "off";
|
||||
};
|
||||
pushoverApiTokenFile = mkOption {
|
||||
|
@ -37,7 +37,7 @@ in
|
|||
certificateFile = mkOption {
|
||||
type = path;
|
||||
};
|
||||
credentials= mkOption {
|
||||
credentials = mkOption {
|
||||
type = str;
|
||||
};
|
||||
keyFile = mkOption {
|
||||
|
@ -55,43 +55,44 @@ in
|
|||
DynamicUser = true;
|
||||
StateDirectory = name;
|
||||
};
|
||||
script = let
|
||||
taskwarriorCommand = pkgs.writers.writeDash "taskwarrior-push" ''
|
||||
${pkgs.taskwarrior}/bin/task \
|
||||
rc.recurrence=${cfg.recurrence} \
|
||||
rc:/var/lib/${name}/.taskrc \
|
||||
rc.data.location=/var/lib/${name}/${cfg.dataDir} \
|
||||
rc.taskd.ca=${cfg.caFile} \
|
||||
rc.taskd.certificate=${cfg.certificateFile} \
|
||||
rc.taskd.credentials="${cfg.credentials}" \
|
||||
rc.taskd.key=${cfg.keyFile} \
|
||||
rc.taskd.server=${cfg.server} \
|
||||
"$@"
|
||||
'';
|
||||
in
|
||||
script =
|
||||
let
|
||||
taskwarriorCommand = pkgs.writers.writeDash "taskwarrior-push" ''
|
||||
${pkgs.taskwarrior}/bin/task \
|
||||
rc.recurrence=${cfg.recurrence} \
|
||||
rc:/var/lib/${name}/.taskrc \
|
||||
rc.data.location=/var/lib/${name}/${cfg.dataDir} \
|
||||
rc.taskd.ca=${cfg.caFile} \
|
||||
rc.taskd.certificate=${cfg.certificateFile} \
|
||||
rc.taskd.credentials="${cfg.credentials}" \
|
||||
rc.taskd.key=${cfg.keyFile} \
|
||||
rc.taskd.server=${cfg.server} \
|
||||
"$@"
|
||||
'';
|
||||
in
|
||||
''
|
||||
if [ -d /var/lib/${name}/${cfg.dataDir} ]
|
||||
then
|
||||
echo "synchronize {cfg.dataDir}"
|
||||
${taskwarriorCommand} sync
|
||||
else
|
||||
echo "initialize ${cfg.dataDir}"
|
||||
${pkgs.coreutils}/bin/yes | ${taskwarriorCommand} sync init
|
||||
fi
|
||||
if [ -d /var/lib/${name}/${cfg.dataDir} ]
|
||||
then
|
||||
echo "synchronize {cfg.dataDir}"
|
||||
${taskwarriorCommand} sync
|
||||
else
|
||||
echo "initialize ${cfg.dataDir}"
|
||||
${pkgs.coreutils}/bin/yes | ${taskwarriorCommand} sync init
|
||||
fi
|
||||
|
||||
${taskwarriorCommand} '${cfg.query}' export \
|
||||
| ${pkgs.jq}/bin/jq -r '.[] | @base64' | while read entry
|
||||
do
|
||||
echo $entry | base64 --decode | \
|
||||
${pkgs.jq}/bin/jq '{
|
||||
"token": "'`cat ${cfg.pushoverApiTokenFile}`'",
|
||||
"user": "'`cat ${cfg.pushoverUserKeyFile}`'",
|
||||
"titel": "taskwarrior",
|
||||
message: .description
|
||||
}' \
|
||||
| ${pkgs.curl}/bin/curl -sS -X POST -H 'Content-Type: application/json' -d @- \
|
||||
"https://api.pushover.net/1/messages.json"
|
||||
done
|
||||
${taskwarriorCommand} '${cfg.query}' export \
|
||||
| ${pkgs.jq}/bin/jq -r '.[] | @base64' | while read entry
|
||||
do
|
||||
echo $entry | base64 --decode | \
|
||||
${pkgs.jq}/bin/jq '{
|
||||
"token": "'`cat ${cfg.pushoverApiTokenFile}`'",
|
||||
"user": "'`cat ${cfg.pushoverUserKeyFile}`'",
|
||||
"titel": "taskwarrior",
|
||||
message: .description
|
||||
}' \
|
||||
| ${pkgs.curl}/bin/curl -sS -X POST -H 'Content-Type: application/json' -d @- \
|
||||
"https://api.pushover.net/1/messages.json"
|
||||
done
|
||||
'';
|
||||
};
|
||||
systemd.timers.taskwarrior-pushover = {
|
||||
|
|
|
@ -30,7 +30,8 @@ let
|
|||
fi
|
||||
'';
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.service.videoencoder = {
|
||||
enable = mkEnableOption "enable service.videoencoder";
|
||||
|
@ -91,14 +92,17 @@ in {
|
|||
systemd.services."videoEncoding" = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
enable = true;
|
||||
script = let
|
||||
myList = map (value:
|
||||
createEncoder "/tmp/videoencoder" value.inputFile value.outputFile)
|
||||
cfg.fileConfig;
|
||||
in ''
|
||||
set -x
|
||||
${concatStringsSep "\n" myList}
|
||||
'';
|
||||
script =
|
||||
let
|
||||
myList = map
|
||||
(value:
|
||||
createEncoder "/tmp/videoencoder" value.inputFile value.outputFile)
|
||||
cfg.fileConfig;
|
||||
in
|
||||
''
|
||||
set -x
|
||||
${concatStringsSep "\n" myList}
|
||||
'';
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -41,7 +41,8 @@ let
|
|||
|
||||
cfg = config.system.custom.audio;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.system.custom.audio = {
|
||||
enable = mkEnableOption "use PluseAudio";
|
||||
|
|
|
@ -4,7 +4,8 @@ let
|
|||
|
||||
cfg = config.system.custom.bluetooth;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.system.custom.bluetooth.enable =
|
||||
lib.mkEnableOption "enable bluetooth support";
|
||||
|
|
|
@ -6,7 +6,8 @@ let
|
|||
|
||||
cfg = config.system.custom.fonts;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.system.custom.fonts = {
|
||||
enable = mkEnableOption "enable fonts";
|
||||
|
|
|
@ -9,12 +9,14 @@ let
|
|||
dockerGroup =
|
||||
if (config.virtualisation.docker.enable) then [ "docker" ] else [ ];
|
||||
|
||||
vboxGroup = if (config.virtualisation.virtualbox.host.enable) then
|
||||
[ "vboxusers" ]
|
||||
else
|
||||
[ ];
|
||||
vboxGroup =
|
||||
if (config.virtualisation.virtualbox.host.enable) then
|
||||
[ "vboxusers" ]
|
||||
else
|
||||
[ ];
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.system.custom.mainUser = {
|
||||
|
||||
|
|
|
@ -55,7 +55,8 @@ let
|
|||
${cfg.url}
|
||||
'';
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.on-failure = api;
|
||||
|
||||
|
|
|
@ -6,7 +6,8 @@ let
|
|||
cfg = config.system.permown;
|
||||
nameGenerator = path: "permown.${replaceStrings [ "/" ] [ "_" ] path}";
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.system.permown = mkOption {
|
||||
default = { };
|
||||
|
@ -45,51 +46,54 @@ in {
|
|||
}));
|
||||
};
|
||||
|
||||
config = let plans = lib.attrValues cfg;
|
||||
config =
|
||||
let plans = lib.attrValues cfg;
|
||||
|
||||
in mkIf (plans != [ ]) {
|
||||
in mkIf (plans != [ ]) {
|
||||
|
||||
system.activationScripts.permown = let
|
||||
mkdir = { path, ... }: ''
|
||||
${pkgs.coreutils}/bin/mkdir -p ${path}
|
||||
'';
|
||||
in concatMapStrings mkdir plans;
|
||||
system.activationScripts.permown =
|
||||
let
|
||||
mkdir = { path, ... }: ''
|
||||
${pkgs.coreutils}/bin/mkdir -p ${path}
|
||||
'';
|
||||
in
|
||||
concatMapStrings mkdir plans;
|
||||
|
||||
systemd.services = listToAttrs (flip map plans
|
||||
({ path, directory-mode, file-mode, owner, group, umask, ... }: {
|
||||
systemd.services = listToAttrs (flip map plans
|
||||
({ path, directory-mode, file-mode, owner, group, umask, ... }: {
|
||||
name = nameGenerator path;
|
||||
value = {
|
||||
environment = {
|
||||
DIR_MODE = directory-mode;
|
||||
FILE_MODE = file-mode;
|
||||
OWNER_GROUP = "${owner}:${group}";
|
||||
ROOT_PATH = path;
|
||||
};
|
||||
path = [ pkgs.coreutils pkgs.findutils pkgs.inotifyTools ];
|
||||
serviceConfig = {
|
||||
ExecStart = pkgs.writers.writeDash "permown" ''
|
||||
set -efu
|
||||
find "$ROOT_PATH" -exec chown -h "$OWNER_GROUP" {} +
|
||||
find "$ROOT_PATH" -type d -exec chmod "$DIR_MODE" {} +
|
||||
find "$ROOT_PATH" -type f -exec chmod "$FILE_MODE" {} +
|
||||
'';
|
||||
PrivateTmp = true;
|
||||
Restart = "always";
|
||||
RestartSec = 10;
|
||||
UMask = umask;
|
||||
};
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
}));
|
||||
|
||||
systemd.timers = listToAttrs (flip map plans ({ path, timer, ... }: {
|
||||
name = nameGenerator path;
|
||||
value = {
|
||||
environment = {
|
||||
DIR_MODE = directory-mode;
|
||||
FILE_MODE = file-mode;
|
||||
OWNER_GROUP = "${owner}:${group}";
|
||||
ROOT_PATH = path;
|
||||
};
|
||||
path = [ pkgs.coreutils pkgs.findutils pkgs.inotifyTools ];
|
||||
serviceConfig = {
|
||||
ExecStart = pkgs.writers.writeDash "permown" ''
|
||||
set -efu
|
||||
find "$ROOT_PATH" -exec chown -h "$OWNER_GROUP" {} +
|
||||
find "$ROOT_PATH" -type d -exec chmod "$DIR_MODE" {} +
|
||||
find "$ROOT_PATH" -type f -exec chmod "$FILE_MODE" {} +
|
||||
'';
|
||||
PrivateTmp = true;
|
||||
Restart = "always";
|
||||
RestartSec = 10;
|
||||
UMask = umask;
|
||||
};
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
timerConfig.OnCalendar = timer;
|
||||
};
|
||||
}));
|
||||
|
||||
systemd.timers = listToAttrs (flip map plans ({ path, timer, ... }: {
|
||||
name = nameGenerator path;
|
||||
value = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
timerConfig.OnCalendar = timer;
|
||||
};
|
||||
}));
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@ let
|
|||
|
||||
cfg = config.system.custom.wifi;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.system.custom.wifi = {
|
||||
enable = mkEnableOption "enable wifi";
|
||||
|
|
|
@ -6,7 +6,8 @@ let
|
|||
|
||||
cfg = config.system.custom.x11;
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.system.custom.x11 = {
|
||||
enable = mkEnableOption "enable x11";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue