moved all to subfolder nixos
This commit is contained in:
parent
78d39395b7
commit
15c6866362
263 changed files with 638 additions and 762 deletions
251
nixos/modules/programs/browser.nix
Normal file
251
nixos/modules/programs/browser.nix
Normal file
|
|
@ -0,0 +1,251 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
# todo : this needs to be cleaned up
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.custom.browser;
|
||||
library = import ../../library { inherit pkgs lib; };
|
||||
|
||||
chromiumBin = "${pkgs.chromium}/bin/chromium";
|
||||
chromeBin = "${pkgs.google-chrome}/bin/google-chrome-stable";
|
||||
firefoxBin = "${pkgs.firefox}/bin/firefox";
|
||||
tarBin = "${pkgs.gnutar}/bin/tar";
|
||||
|
||||
# desktop file
|
||||
# ------------
|
||||
# makes it possible to be used by other programs
|
||||
desktopFile = bin:
|
||||
let browserName = bin.name;
|
||||
in pkgs.writeTextFile {
|
||||
name = "${browserName}.desktop";
|
||||
destination = "/share/applications/${browserName}.desktop";
|
||||
text = ''
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Exec=${bin}/bin/${browserName} %U
|
||||
Icon=chromium
|
||||
Comment=An open source web browser from Google
|
||||
Terminal=false
|
||||
Name=${browserName}
|
||||
GenericName=Web browser
|
||||
MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/webcal;x-scheme-handler/about
|
||||
Categories=Network;WebBrowser
|
||||
StartupWMClass=${browserName}
|
||||
'';
|
||||
};
|
||||
|
||||
killBrowser = name:
|
||||
pkgs.writeShellScriptBin "${name}-kill" "sudo killall -9 -u ${name}";
|
||||
|
||||
cleanBrowser = name: browser: home: homeBackup:
|
||||
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}
|
||||
'';
|
||||
|
||||
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
|
||||
|
||||
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;
|
||||
|
||||
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} \
|
||||
.
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
# browser chooser
|
||||
# ---------------
|
||||
browserSelect = pkgs.writeScriptBin "browser-select" ''
|
||||
# select a browser using dmenu
|
||||
# ----------------------------
|
||||
BROWSER=$( echo -e "${
|
||||
lib.concatMapStringsSep "\\n" (bin: bin.name) browserExecutableList
|
||||
}" \
|
||||
| ${pkgs.rofi}/bin/rofi -dmenu )
|
||||
|
||||
# start selected browser
|
||||
# ----------------------
|
||||
case $BROWSER in
|
||||
${lib.concatStringsSep "\n" (flip map browserExecutableList
|
||||
(bin: "${bin.name}) export BIN=${bin}/bin/${bin.name} ;;"))}
|
||||
esac
|
||||
$BIN "$@"
|
||||
'';
|
||||
|
||||
in {
|
||||
|
||||
options.programs.custom.browser = {
|
||||
enable = mkEnableOption "enable browsers";
|
||||
configList = mkOption {
|
||||
type = with types;
|
||||
attrsOf (submodule ({ name, ... }: {
|
||||
options = {
|
||||
browserType = mkOption {
|
||||
type = with types; enum [ "firefox" "chrome" "google" ];
|
||||
default = "chrome";
|
||||
description = ''
|
||||
the type of browser which is simulated
|
||||
'';
|
||||
};
|
||||
home = mkOption {
|
||||
type = with types; str;
|
||||
description = ''
|
||||
Home of the browser.
|
||||
'';
|
||||
};
|
||||
gpu = mkOption {
|
||||
type = with types; bool;
|
||||
default = true;
|
||||
description = ''
|
||||
add browser user to video group so give browser rights to use gpu.
|
||||
see : chrome://gpu/
|
||||
'';
|
||||
};
|
||||
user = mkOption {
|
||||
default = name;
|
||||
type = with types; str;
|
||||
description = ''
|
||||
user to run the browser as
|
||||
'';
|
||||
};
|
||||
sudoUsers = mkOption {
|
||||
default = [ config.users.users.mainUser.name ];
|
||||
type = with types; listOf str;
|
||||
description = ''
|
||||
user allowed to run sudo without password to start the browser
|
||||
'';
|
||||
};
|
||||
homeBackup = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
example = "~/.my-browser-backup";
|
||||
description = ''
|
||||
backup of the home, which gets rolled out if the
|
||||
home does not exists. usefull for homes in tmpfs.
|
||||
dont use file endings!
|
||||
'';
|
||||
};
|
||||
};
|
||||
}));
|
||||
};
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
# create users
|
||||
users.users = flip mapAttrs cfg.configList (name: config: {
|
||||
home = config.home;
|
||||
createHome = true;
|
||||
initialPassword = "${name}-browser";
|
||||
shell = pkgs.bashInteractive;
|
||||
isNormalUser = true;
|
||||
group = "users";
|
||||
# enable video usage
|
||||
extraGroups = if config.gpu then [ "video" "audio" ] else [ "audio" ];
|
||||
});
|
||||
|
||||
# add groups to mainUser
|
||||
system.custom.mainUser.extraGroups = builtins.attrNames cfg.configList;
|
||||
|
||||
environment.systemPackages = [ browserSelect (desktopFile browserSelect) ]
|
||||
++ browserExecutableList
|
||||
++ (map (bin: desktopFile bin) browserExecutableList) ++ allBackupScripts
|
||||
++ allCleanScripts ++ allKillScripts;
|
||||
|
||||
};
|
||||
}
|
||||
42
nixos/modules/programs/citate.nix
Normal file
42
nixos/modules/programs/citate.nix
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.custom.citate;
|
||||
|
||||
library = import ../../library { inherit pkgs lib; };
|
||||
|
||||
xdotool = "${pkgs.xdotool}/bin/xdotool";
|
||||
dmenu = "${pkgs.dmenu}/bin/dmenu";
|
||||
|
||||
citateScript = file: suffix:
|
||||
pkgs.writeShellScriptBin "citate-${suffix}" ''
|
||||
${xdotool} - <<<"type -- $( cat ${file} | ${dmenu} -l 10 -i | sed -e "s/\(.*\)/'\1'/" )"
|
||||
'';
|
||||
|
||||
scriptAxel = citateScript (toString ../../assets/sprueche-axel) "axel";
|
||||
scriptSiw = citateScript (toString ../../assets/sprueche-siw) "siw";
|
||||
|
||||
in {
|
||||
|
||||
options.programs.custom.citate = {
|
||||
enable = mkEnableOption "enable programs.custom.citate";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [
|
||||
scriptAxel
|
||||
(library.desktopFile scriptAxel {
|
||||
longName = "Citate Axel";
|
||||
command = "citate-axel";
|
||||
})
|
||||
scriptSiw
|
||||
(library.desktopFile scriptSiw {
|
||||
longName = "Citate Sinnlos im Weltall";
|
||||
command = "citate-siw";
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
31
nixos/modules/programs/curl-scripts.nix
Normal file
31
nixos/modules/programs/curl-scripts.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
weatherScript = pkgs.writeShellScriptBin "weather" ''
|
||||
${pkgs.curl}/bin/curl wttr.in/Berlin
|
||||
'';
|
||||
|
||||
qrCodeScript = pkgs.writeShellScriptBin "qrCode" ''
|
||||
${pkgs.qrencode}/bin/qrencode -t ANSI -o - "$@"
|
||||
'';
|
||||
|
||||
cheatSheetScript = pkgs.writeShellScriptBin "cheatsheet" ''
|
||||
${pkgs.curl}/bin/curl "cheat.sh/$1"
|
||||
'';
|
||||
|
||||
cfg = config.programs.custom.curlScripts;
|
||||
|
||||
in {
|
||||
|
||||
options.programs.custom.curlScripts.enable =
|
||||
mkEnableOption "enable curl scripts";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages =
|
||||
[ weatherScript qrCodeScript cheatSheetScript pkgs.qrencode ];
|
||||
};
|
||||
}
|
||||
|
||||
18
nixos/modules/programs/easytag.nix
Normal file
18
nixos/modules/programs/easytag.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.custom.easytag;
|
||||
|
||||
in {
|
||||
|
||||
options.programs.custom.easytag.enable =
|
||||
mkEnableOption "install easytag with dependencies";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [ easytag gnome3.dconf ];
|
||||
};
|
||||
}
|
||||
|
||||
24
nixos/modules/programs/elm.nix
Normal file
24
nixos/modules/programs/elm.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.custom.elm;
|
||||
|
||||
in {
|
||||
|
||||
options.programs.custom.elm.enable = mkEnableOption "enable elm stack";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
elmPackages.elm
|
||||
elmPackages.elm-compiler
|
||||
elmPackages.elm-format
|
||||
elmPackages.elm-make
|
||||
elmPackages.elm-reactor
|
||||
elm-github-install
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
50
nixos/modules/programs/espeak.nix
Normal file
50
nixos/modules/programs/espeak.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
espeak = pkgs.unstable.espeak;
|
||||
|
||||
# can't use bash aliases because programms will not pic it up
|
||||
en_espeak = pkgs.writeShellScriptBin "en-speak" ''
|
||||
exec ${espeak}/bin/espeak \
|
||||
-v en\
|
||||
-s 145 \
|
||||
-p 23 \
|
||||
"$@"
|
||||
'';
|
||||
|
||||
# read from copyq
|
||||
en_read = pkgs.writeShellScriptBin "en-read" ''
|
||||
exec ${pkgs.copyq}/bin/copyq read 0 | ${en_espeak}/bin/en-speak
|
||||
'';
|
||||
|
||||
# can't use bash aliases because programms will not pic it up
|
||||
de_espeak = pkgs.writeShellScriptBin "de-speak" ''
|
||||
exec ${espeak}/bin/espeak \
|
||||
-v de\
|
||||
-s 143 \
|
||||
-p 20 \
|
||||
"$@"
|
||||
'';
|
||||
|
||||
# read from copyq
|
||||
de_read = pkgs.writeShellScriptBin "de-read" ''
|
||||
exec ${pkgs.copyq}/bin/copyq read 0 | ${de_espeak}/bin/de-speak
|
||||
'';
|
||||
|
||||
cfg = config.programs.custom.espeak;
|
||||
|
||||
in {
|
||||
|
||||
options.programs.custom.espeak.enable =
|
||||
mkEnableOption "enable espeak scripts";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
environment.systemPackages = [ espeak en_espeak en_read de_espeak de_read ];
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
151
nixos/modules/programs/ffmpeg.nix
Normal file
151
nixos/modules/programs/ffmpeg.nix
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
|
||||
cfg = config.programs.custom.ffmpeg;
|
||||
|
||||
ffmpegTemplate = name:
|
||||
{ profile, preset, tune ? null, width ? 1280, height ? 720
|
||||
, resolution ? "720p" }:
|
||||
pkgs.writeShellScriptBin "ffmpeg-${name}" ''
|
||||
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
cat <<EOF
|
||||
ffmpeg-<profile>-<preset>-<tunes>-${resolution} <input> <output>
|
||||
|
||||
profiles =
|
||||
"baseline" - Primarily for low-cost applications that require additional data loss robustness
|
||||
"main" - This profile is used for standard-definition digital TV broadcasts that use the MPEG-4 format as defined in the DVB standard.
|
||||
"high" - The primary profile for broadcast and disc storage applications, particularly for high-definition television applications
|
||||
|
||||
presets =
|
||||
"ultrafast"
|
||||
"superfast"
|
||||
"veryfast"
|
||||
"faster"
|
||||
"fast"
|
||||
"medium"
|
||||
"slow"
|
||||
"slower"
|
||||
"veryslow"
|
||||
|
||||
tunes = (optional)
|
||||
"film" - use for high quality movie content; lowers deblockin
|
||||
"animation" - good for cartoons; uses higher deblocking and more reference frames
|
||||
"grain" - preserves the grain structure in old, grainy film material
|
||||
"stillimage" - good for slideshow-like content
|
||||
"fastdecode" - allows faster decoding by disabling certain filters
|
||||
|
||||
EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ $# -ne 2 ]
|
||||
then
|
||||
echo "ffmpeg-${name} <input> <output>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
input=$1
|
||||
output=$2
|
||||
|
||||
if [ ! -f "$input" ]
|
||||
then
|
||||
echo "input does not exist $input"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# do it stereo
|
||||
# -ac 2
|
||||
# do it sample rate 44100
|
||||
# -ar 44100
|
||||
|
||||
exec ${pkgs.ffmpeg}/bin/ffmpeg \
|
||||
-i "$input" \
|
||||
-filter:v scale=h='min(${toString height}\,ih)':w='min(${
|
||||
toString width
|
||||
}\,iw)' \
|
||||
-vcodec libx264 \
|
||||
-preset ${preset} \
|
||||
-profile:v ${profile} \
|
||||
${optionalString (tune != null) "-tune ${tune}"} \
|
||||
-acodec aac \
|
||||
-ac 2 \
|
||||
-ar 44100 \
|
||||
"$output" \
|
||||
-hide_banner
|
||||
'';
|
||||
|
||||
# https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Profiles
|
||||
profiles = [
|
||||
"baseline"
|
||||
"main"
|
||||
"high"
|
||||
#"high10"
|
||||
#"high422"
|
||||
#"high44"
|
||||
];
|
||||
presets = [
|
||||
#"ultrafast"
|
||||
#"superfast"
|
||||
#"veryfast"
|
||||
#"faster"
|
||||
"fast"
|
||||
"medium"
|
||||
"slow"
|
||||
#"slower"
|
||||
"veryslow"
|
||||
];
|
||||
tunes = [ "film" "animation" "grain" "stillimage" "fastdecode" ];
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
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";
|
||||
};
|
||||
|
||||
config =
|
||||
mkIf cfg.enable { environment.systemPackages = ffmpegs ++ ffmpegsTune; };
|
||||
}
|
||||
34
nixos/modules/programs/git.nix
Normal file
34
nixos/modules/programs/git.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.custom.git;
|
||||
|
||||
in {
|
||||
|
||||
options.programs.custom.git.enable =
|
||||
mkEnableOption "install git and all its tools";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
git
|
||||
tig
|
||||
lazygit
|
||||
git-crypt
|
||||
gitAndTools.gitflow
|
||||
gitAndTools.gitSVN
|
||||
gitAndTools.git2cl
|
||||
|
||||
# merge tools
|
||||
meld
|
||||
|
||||
# activate using :
|
||||
# git config --global core.pager "diff-so-fancy | less --tabs=4 -RFX"
|
||||
gitAndTools.diff-so-fancy
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
84
nixos/modules/programs/shell-bash.nix
Normal file
84
nixos/modules/programs/shell-bash.nix
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
let cfg = config.programs.custom.bash;
|
||||
in {
|
||||
|
||||
options.programs.custom.bash.enable = lib.mkEnableOption "enable bash config";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
programs.bash = {
|
||||
|
||||
# BashCompletion
|
||||
# --------------
|
||||
enableCompletion = true;
|
||||
|
||||
# Configure Shell
|
||||
# ---------------
|
||||
interactiveShellInit = # sh
|
||||
''
|
||||
# use vi shortcuts
|
||||
# ----------------
|
||||
set -o vi
|
||||
|
||||
# Configure ls-colors
|
||||
# -------------------
|
||||
export LS_COLORS='rs=0:di=01;35:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;33:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35::*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'
|
||||
'';
|
||||
|
||||
# Configure Prompt
|
||||
# ----------------
|
||||
promptInit = # sh
|
||||
''
|
||||
# PS1 content functions
|
||||
# ---------------------
|
||||
function nonzero_return() {
|
||||
RETVAL=$?
|
||||
[ $RETVAL -ne 0 ] && echo "[> $RETVAL <] "
|
||||
}
|
||||
|
||||
# Provide a nice prompt
|
||||
# ---------------------
|
||||
case $TERM in
|
||||
xterm*|rxvt*|Eterm)
|
||||
# used : http://ezprompt.net/
|
||||
USER_COLOR="\[\e[36m\]\u\[\e[m\]\[\e[32m\]@\[\e[m\]\[\e[36m\]\h\[\e[m\]"
|
||||
CURRENT_PATH="\[\e[33m\][\[\e[m\]\[\e[33m\]\w\[\e[m\]\[\e[33m\]]\[\e[m\]"
|
||||
if [[ $UID -eq 0 ]]
|
||||
then
|
||||
USER_COLOR="\[\e[31m\]\u\[\e[m\]\[\e[32m\]@\[\e[m\]\[\e[31m\]\h\[\e[m\]"
|
||||
fi
|
||||
export PS1="\[\e[31m\]\`nonzero_return\`\[\e[m\]\[\e[35m\]\A\[\e[m\] $USER_COLOR $CURRENT_PATH\[\e[31m\]\\$\[\e[m\] "
|
||||
;;
|
||||
screen)
|
||||
export PS1="\[\e[31m\]\`nonzero_return\`\[\e[m\]\[\e[35m\]\A\[\e[m\] \[\e[36m\]\u\[\e[m\]\[\e[32m\]@\[\e[m\]\[\e[36m\]\h\[\e[m\] \[\e[33m\][\[\e[m\]\[\e[33m\]\W\[\e[m\]\[\e[33m\]]\[\e[m\]\[\e[31m\]\\$\[\e[m\] "
|
||||
;;
|
||||
esac
|
||||
'';
|
||||
|
||||
# Shell Aliases
|
||||
# -------------
|
||||
shellAliases = {
|
||||
ls = "ls --color=tty";
|
||||
l = "ls -CFh";
|
||||
la = "ls -Ah";
|
||||
ll = "ls -lh";
|
||||
lt = "ls -lct --reverse";
|
||||
less = "less -S";
|
||||
top = "htop";
|
||||
version = "date '+%Y%m%d%H%M%S'";
|
||||
vclip = "xclip -selection clipboard";
|
||||
df = "df -h";
|
||||
|
||||
nix-search = "nix-env -qaP";
|
||||
nix-list = ''nix-env -qaP "*" --description'';
|
||||
nix-list-haskell = ''nix-env -f "<nixpkgs>" -qaP -A haskellPackages'';
|
||||
|
||||
nix-show-garbadge-roots = "ls -lh /nix/var/nix/gcroots/auto/";
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
42
nixos/modules/programs/shell-tools.nix
Normal file
42
nixos/modules/programs/shell-tools.nix
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
xterm-colors = pkgs.writeShellScriptBin "256-xterm-colors"
|
||||
# sh
|
||||
''
|
||||
for i in {0..255} ; do
|
||||
printf "\x1b[38;5;%sm%3d\e[0m " "$i" "$i"
|
||||
if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then
|
||||
printf "\n";
|
||||
fi
|
||||
done
|
||||
'';
|
||||
|
||||
xterm-background-colors = pkgs.writeShellScriptBin
|
||||
"256-xterm-colors-background"
|
||||
# sh
|
||||
''
|
||||
for i in {0..255} ; do
|
||||
printf "\x1b[48;5;%sm%3d\e[0m " "$i" "$i"
|
||||
if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then
|
||||
printf "\n";
|
||||
fi
|
||||
done
|
||||
'';
|
||||
|
||||
cfg = config.programs.custom.shellTools;
|
||||
|
||||
in {
|
||||
|
||||
options.programs.custom.shellTools.enable =
|
||||
mkEnableOption "enable shell tools";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ xterm-colors xterm-background-colors ];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
175
nixos/modules/programs/shell-zsh.nix
Normal file
175
nixos/modules/programs/shell-zsh.nix
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.custom.zsh;
|
||||
|
||||
in {
|
||||
|
||||
options.programs.custom.zsh = {
|
||||
enable = mkEnableOption "enable zsh";
|
||||
|
||||
mainUser = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
the main User if available
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
programs.zsh = {
|
||||
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
#autosuggestions.enable = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
|
||||
ohMyZsh = {
|
||||
|
||||
custom = "/etc/zshcustom/";
|
||||
enable = true;
|
||||
|
||||
# powerline themes
|
||||
# ----------------
|
||||
#theme = "agnoster";
|
||||
theme = "powerlevel9k/powerlevel9k";
|
||||
|
||||
plugins = [
|
||||
"git"
|
||||
"git-flow"
|
||||
"screen"
|
||||
"taskwarrior"
|
||||
"systemd"
|
||||
"tmux"
|
||||
"vi-mode"
|
||||
"wd"
|
||||
];
|
||||
};
|
||||
|
||||
loginShellInit = ''
|
||||
export TERM="xterm-256color"
|
||||
'';
|
||||
shellAliases = {
|
||||
ls = "ls --color=tty";
|
||||
l = "ls -CFh";
|
||||
la = "ls -Ah";
|
||||
ll = "ls -lh";
|
||||
lt = "ls -lct --reverse";
|
||||
less = "less -S";
|
||||
top = "htop";
|
||||
version = "date '+%Y%m%d%H%M%S'";
|
||||
vclip = "xclip -selection clipboard";
|
||||
df = "df -h";
|
||||
|
||||
timestamp = "date +%Y%m%d%H%M%S";
|
||||
|
||||
nix-search = "nix-env -qaP";
|
||||
nix-list = ''nix-env -qaP "*" --description'';
|
||||
nix-list-haskell = ''nix-env -f "<nixpkgs>" -qaP -A haskellPackages'';
|
||||
nix-list-node = ''nix-env -f "<nixpkgs>" -qaP -A nodePackages'';
|
||||
nix-list-beam = ''nix-env -f "<nixpkgs>" -qaP -A beamPackages'';
|
||||
# nix-find = "clear ; ${pkgs.nix-index}/bin/nix-locate -1 -w";
|
||||
|
||||
nix-show-garbadge-roots = "ls -lh /nix/var/nix/gcroots/auto/";
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
#environment.systemPackages = [
|
||||
# pkgs.nix-index # make nix-index also available to users
|
||||
#];
|
||||
|
||||
# only used to make quick config changes
|
||||
# --------------------------------------
|
||||
environment.etc."zshcustom/mainuser.zsh".source =
|
||||
pkgs.writeText "mainuser-zsh" (if (cfg.mainUser != null) then ''
|
||||
source ${config.users.users.mainUser.home}/.zshrc
|
||||
'' else
|
||||
"# programs.custom.zsh.mainUser not set ");
|
||||
|
||||
# Theme
|
||||
# -----
|
||||
# make sure powerline-fonts is set in `fonts.fonts`
|
||||
|
||||
environment.etc."zshcustom/themes/powerlevel9k".source =
|
||||
pkgs.fetchFromGitHub {
|
||||
owner = "bhilburn";
|
||||
repo = "powerlevel9k";
|
||||
rev = "v0.6.4";
|
||||
sha256 = "104wvlni3rilpw9v1dk848lnw8cm8qxl64xs70j04ly4s959dyb5";
|
||||
};
|
||||
environment.etc."zshcustom/powerlevel9kpatch.zsh".source =
|
||||
pkgs.writeText "powerlevel9kpatch.zsh" ''
|
||||
|
||||
# this shows all the colors which are available
|
||||
# ---------------------------------------------
|
||||
# for code ({000..255}) print -P -- "$code: %F{$code}This is how your text would look like%f"
|
||||
|
||||
# prompt elements
|
||||
# ---------------
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vi_mode context dir vcs custom_jail background_jobs time status)
|
||||
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
|
||||
|
||||
# vi mode
|
||||
# -------
|
||||
POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND="black"
|
||||
POWERLEVEL9K_VI_MODE_INSERT_BACKGROUND="blue"
|
||||
POWERLEVEL9K_VI_MODE_NORMAL_FOREGROUND="black"
|
||||
POWERLEVEL9K_VI_MODE_NORMAL_BACKGROUND="yellow"
|
||||
|
||||
# context
|
||||
# -------
|
||||
POWERLEVEL9K_CONTEXT_DEFAULT_FOREGROUND="green"
|
||||
POWERLEVEL9K_CONTEXT_DEFAULT_BACKGROUND="008"
|
||||
POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND="008"
|
||||
POWERLEVEL9K_CONTEXT_ROOT_BACKGROUND="red"
|
||||
POWERLEVEL9K_CONTEXT_REMOTE_FOREGROUND="008"
|
||||
POWERLEVEL9K_CONTEXT_REMOTE_BACKGROUND="red"
|
||||
|
||||
# dir
|
||||
# ---
|
||||
POWERLEVEL9K_DIR_HOME_FOREGROUND="black"
|
||||
POWERLEVEL9K_DIR_HOME_BACKGROUND="yellow"
|
||||
POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND="black"
|
||||
POWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND="yellow"
|
||||
POWERLEVEL9K_DIR_DEFAULT_FOREGROUND="black"
|
||||
POWERLEVEL9K_DIR_DEFAULT_BACKGROUND="green"
|
||||
|
||||
# root_indicator
|
||||
# --------------
|
||||
POWERLEVEL9K_ROOT_ICON="#"
|
||||
POWERLEVEL9K_ROOT_INDICATOR_FOREGROUND="black"
|
||||
POWERLEVEL9K_ROOT_INDICATOR_BACKGROUND="red"
|
||||
|
||||
# background_jobs
|
||||
# ---------------
|
||||
POWERLEVEL9K_BACKGROUND_JOBS_ICON=""
|
||||
|
||||
# status
|
||||
# ------
|
||||
POWERLEVEL9K_STATUS_OK_BACKGROUND="008"
|
||||
POWERLEVEL9K_STATUS_ERROR_BACKGROUND="008"
|
||||
|
||||
# time
|
||||
# ----
|
||||
POWERLEVEL9K_TIME_FOREGROUND="008"
|
||||
POWERLEVEL9K_TIME_BACKGROUND="006"
|
||||
|
||||
|
||||
# jail indicator
|
||||
# --------------
|
||||
POWERLEVEL9K_CUSTOM_JAIL="[ -z $JAIL ] || echo $JAIL"
|
||||
POWERLEVEL9K_CUSTOM_JAIL_BACKGROUND="red"
|
||||
POWERLEVEL9K_CUSTOM_JAIL_FOREGROUND="black"
|
||||
|
||||
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
122
nixos/modules/programs/slack.nix
Normal file
122
nixos/modules/programs/slack.nix
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
# name of the program
|
||||
# -------------------
|
||||
program = "slack";
|
||||
|
||||
tarBin = "${pkgs.gnutar}/bin/tar";
|
||||
|
||||
# command that will be jailed
|
||||
# ---------------------------
|
||||
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
|
||||
'';
|
||||
};
|
||||
|
||||
# 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} ]]
|
||||
then
|
||||
cp ${backupFile} ${rolloutFile}
|
||||
sudo -u ${program} ${tarBin} xf ${rolloutFile} --directory ${cfg.home}
|
||||
rm ${rolloutFile}
|
||||
touch ${lockFile}
|
||||
fi
|
||||
fi
|
||||
|
||||
sudo -u ${program} ${command}
|
||||
'';
|
||||
|
||||
backupScript = pkgs.writeShellScriptBin "${program}-backup" ''
|
||||
sudo -u ${program} \
|
||||
${tarBin} \
|
||||
--exclude=.cache \
|
||||
--exclude=".config/**/*Cache*" \
|
||||
--exclude-cache-all \
|
||||
--exclude=Downloads \
|
||||
--create \
|
||||
--verbos \
|
||||
--lzma \
|
||||
--file ${cfg.home}.tar.lzma \
|
||||
--directory ${cfg.home} \
|
||||
.
|
||||
|
||||
cp ${cfg.home}.tar.lzma ${cfg.homeBackup}.tar.lzma
|
||||
'';
|
||||
|
||||
cfg = config.programs.custom.slack;
|
||||
|
||||
in {
|
||||
|
||||
options.programs.custom.slack = {
|
||||
enable = mkEnableOption "install slack";
|
||||
|
||||
homeBackup = mkOption {
|
||||
type = with types; nullOr string;
|
||||
description = ''
|
||||
folder where to backup
|
||||
'';
|
||||
};
|
||||
|
||||
# todo : make sure the folder /home/sudoers belongs to mainUser
|
||||
home = mkOption {
|
||||
type = with types; string;
|
||||
default = "/home/sudoers/slack";
|
||||
description = ''
|
||||
home folder of this
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
security.sudo.extraConfig = ''
|
||||
${config.users.users.mainUser.name} ALL=(${program}) NOPASSWD: ALL
|
||||
'';
|
||||
|
||||
# create users
|
||||
users.users."${program}" = {
|
||||
home = cfg.home;
|
||||
createHome = true;
|
||||
# initialPassword = "${program}";
|
||||
shell = pkgs.bashInteractive;
|
||||
isNormalUser = true;
|
||||
group = "users";
|
||||
# enable video usage
|
||||
extraGroups = [ "video" "audio" ];
|
||||
};
|
||||
|
||||
environment.systemPackages = [ bin backupScript desktopFile ];
|
||||
};
|
||||
}
|
||||
|
||||
47
nixos/modules/programs/steam.nix
Normal file
47
nixos/modules/programs/steam.nix
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
# steam
|
||||
# -------
|
||||
# Don't forget to run 'xhost +' with your user
|
||||
# to make sure the browser user can write to X
|
||||
let
|
||||
|
||||
bin = pkgs.writeShellScriptBin "steam" ''
|
||||
/var/run/wrappers/bin/sudo -u steam -i ${pkgs.steam}/bin/steam $@
|
||||
'';
|
||||
|
||||
cfg = config.programs.custom.steam;
|
||||
|
||||
in {
|
||||
|
||||
options.programs.custom.steam.enable = mkEnableOption "enable steam";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
environment.systemPackages = [
|
||||
bin
|
||||
pkgs.xorg.xhost
|
||||
# to use xbox controllers
|
||||
pkgs.xboxdrv
|
||||
];
|
||||
|
||||
users.users.steam = {
|
||||
isNormalUser = true;
|
||||
home = "/home/steam";
|
||||
createHome = true;
|
||||
extraGroups = [ "audio" "input" "video" ];
|
||||
};
|
||||
|
||||
# for steam
|
||||
# ---------
|
||||
hardware.opengl.driSupport = true;
|
||||
hardware.opengl.driSupport32Bit = true;
|
||||
|
||||
security.sudo.extraConfig = ''
|
||||
${config.users.extraUsers.mainUser.name} ALL=(steam) NOPASSWD: ALL
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
88
nixos/modules/programs/taskwarrior.nix
Normal file
88
nixos/modules/programs/taskwarrior.nix
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.custom.taskwarrior;
|
||||
|
||||
taskNextWeek = pkgs.writeShellScriptBin "taskweek" # sh
|
||||
''
|
||||
${pkgs.taskwarrior}/bin/task \
|
||||
export \
|
||||
status:pending and \( due.before:6days \) \
|
||||
| ${pkgs.jq}/bin/jq '[.[] | { Day: .due, ID: .id, Description: .description } ] | sort_by(.Day)' \
|
||||
| ${pkgs.miller}/bin/mlr --ijson --opprint put "\$Day = strftime(strptime(\$Day,\"%Y%m%dT%H%M%SZ\")$(date +%z)00,\"%A\")"
|
||||
'';
|
||||
|
||||
tsak = pkgs.writeShellScriptBin "tsak" # sh
|
||||
''
|
||||
${pkgs.taskwarrior}/bin/task "$@"
|
||||
'';
|
||||
taskwarrior-tui = pkgs.unstable.taskwarrior-tui;
|
||||
|
||||
vit = pkgs.unstable.vit.overrideAttrs (old: rec {
|
||||
name = "vit-${version}";
|
||||
version = "master";
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://github.com/scottkosty/vit.git";
|
||||
#rev = "7200949214362139e8073b6ca1a58cc756b2ebd0";
|
||||
#sha256 = "1s0rvqn8xjy3qiw9034wfzz2r7mwary70x32fqprz2w2h5r73j2m";
|
||||
rev = "cfe5975bd054fe8ffe79527a1af6356528b60c63";
|
||||
sha256 = "12fjx91l7cxxan3pg0xqmizpabp5g482vxqq5f3r8b6dw70l15hk";
|
||||
};
|
||||
});
|
||||
#vit = pkgs.vit;
|
||||
|
||||
in {
|
||||
|
||||
options.programs.custom.taskwarrior.enable =
|
||||
mkEnableOption "Enable Taskwarrior services";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
||||
taskwarrior-tui
|
||||
taskwarrior
|
||||
timewarrior
|
||||
tasksh
|
||||
taskNextWeek
|
||||
tsak
|
||||
|
||||
(pkgs.writers.writeBashBin "calendar" ''
|
||||
${pkgs.taskwarrior}/bin/task calendar
|
||||
${pkgs.taskwarrior}/bin/task calendar_report
|
||||
'')
|
||||
|
||||
vit
|
||||
(pkgs.writers.writeBashBin "active" "${vit}/bin/vit active")
|
||||
(pkgs.writers.writeBashBin "todo" "${vit}/bin/vit todo")
|
||||
|
||||
taskwarrior-hooks
|
||||
vdirsyncer
|
||||
khal
|
||||
(pkgs.writers.writeBashBin "kalendar" ''
|
||||
${pkgs.vdirsyncer}/bin/vdirsyncer sync
|
||||
${pkgs.khal}/bin/ikhal
|
||||
'')
|
||||
|
||||
python3Packages.bugwarrior
|
||||
|
||||
# bugwarrior
|
||||
#(let
|
||||
# mypython = let
|
||||
# packageOverrides = self: super: {
|
||||
# bugwarrior = super.bugwarrior.overridePythonAttrs (old: {
|
||||
# propagatedBuildInputs = old.propagatedBuildInputs
|
||||
# ++ [ super.setuptools ];
|
||||
# });
|
||||
# };
|
||||
# in pkgs.python3.override { inherit packageOverrides; };
|
||||
#in mypython.pkgs.bugwarrior)
|
||||
|
||||
];
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
180
nixos/modules/programs/urxvt.nix
Normal file
180
nixos/modules/programs/urxvt.nix
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.custom.urxvt;
|
||||
|
||||
in {
|
||||
|
||||
options.programs.custom.urxvt = {
|
||||
|
||||
enable = mkEnableOption "configure and enable urxvt";
|
||||
|
||||
fontSize = mkOption {
|
||||
type = types.int;
|
||||
default = 17;
|
||||
description = ''
|
||||
size of the terminal font
|
||||
'';
|
||||
};
|
||||
|
||||
colorTheme = mkOption {
|
||||
type = types.enum [ "dark" "light" ];
|
||||
default = "dark";
|
||||
description = ''
|
||||
solarized color theme
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
environment.systemPackages = [ pkgs.rxvt_unicode ];
|
||||
|
||||
environment.etc = {
|
||||
|
||||
"X11/Xresource.d/urxvt".source = pkgs.writeText "Xresource-urxvt" ''
|
||||
!! Perl extensions
|
||||
!! ---------------
|
||||
URxvt.perl-ext-common: default,matcher
|
||||
|
||||
! Urgency
|
||||
URxvt.urgentOnBell: true
|
||||
|
||||
!! Highlight URLs
|
||||
!! --------------
|
||||
URxvt.url-launcher: /run/current-system/sw/bin/browser-select
|
||||
URxvt.matcher.button: 1
|
||||
|
||||
!! History
|
||||
!! -------
|
||||
URxvt.scrollStyle: rxvt
|
||||
URxvt.scrollBar: false
|
||||
URxvt.saveLines: 1000000
|
||||
|
||||
!! Color Configuration
|
||||
!! -------------------
|
||||
|
||||
!! do not graded out unselected shells
|
||||
!! -----------------------------------
|
||||
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}";
|
||||
|
||||
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" ''
|
||||
|
||||
URxvt.allow_bold: true
|
||||
URxvt.xftAntialias: true
|
||||
|
||||
!! use xfontsel or fontmatrix to choose line
|
||||
!URxvt.font: ${normalFont cfg.fontSize},${
|
||||
backupFont cfg.fontSize
|
||||
}
|
||||
!URxvt.boldFont: ${boldFont cfg.fontSize},${
|
||||
backupFont cfg.fontSize
|
||||
}
|
||||
!URxvt.italicFont: ${italicFont cfg.fontSize},${
|
||||
backupFont cfg.fontSize
|
||||
}
|
||||
!URxvt.bolditalicFont: ${itallicBoldFont cfg.fontSize},${
|
||||
backupFont cfg.fontSize
|
||||
}
|
||||
|
||||
URxvt.font: ${normalFont cfg.fontSize}
|
||||
URxvt.boldFont: ${boldFont cfg.fontSize}
|
||||
URxvt.italicFont: ${italicFont cfg.fontSize}
|
||||
URxvt.bolditalicFont: ${itallicBoldFont cfg.fontSize}
|
||||
|
||||
${fontCommand "F1" cfg.fontSize}
|
||||
${fontCommand "F2" (cfg.fontSize + 5)}
|
||||
${fontCommand "F3" (cfg.fontSize + 10)}
|
||||
${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
|
||||
'';
|
||||
|
||||
in pkgs.writeText "Xresource-urxvt-colors" ''
|
||||
|
||||
!! Common
|
||||
!! ------
|
||||
#define S_yellow #b58900
|
||||
#define S_orange #cb4b16
|
||||
#define S_red #dc322f
|
||||
#define S_magenta #d33682
|
||||
#define S_violet #6c71c4
|
||||
#define S_blue #268bd2
|
||||
#define S_cyan #2aa198
|
||||
#define S_green #859900
|
||||
|
||||
!! ColorTheme
|
||||
!! ----------
|
||||
${colorTheme}
|
||||
|
||||
URxvt*background: S_base03
|
||||
URxvt*foreground: S_base0
|
||||
URxvt*fading: 40
|
||||
URxvt*fadeColor: S_base03
|
||||
URxvt*cursorColor: S_base1
|
||||
URxvt*pointerColorBackground: S_base01
|
||||
URxvt*pointerColorForeground: S_base1
|
||||
|
||||
URxvt*color0: S_base02
|
||||
URxvt*color1: S_red
|
||||
URxvt*color2: S_green
|
||||
URxvt*color3: S_yellow
|
||||
URxvt*color4: S_blue
|
||||
URxvt*color5: S_magenta
|
||||
URxvt*color6: S_cyan
|
||||
URxvt*color7: S_base2
|
||||
URxvt*color9: S_orange
|
||||
URxvt*color8: S_base03
|
||||
URxvt*color10: S_base01
|
||||
URxvt*color11: S_base00
|
||||
URxvt*color12: S_base0
|
||||
URxvt*color13: S_violet
|
||||
URxvt*color14: S_base1
|
||||
URxvt*color15: S_base3
|
||||
'';
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
56
nixos/modules/programs/video.nix
Normal file
56
nixos/modules/programs/video.nix
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.custom.video;
|
||||
|
||||
# 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; })));
|
||||
};
|
||||
|
||||
in {
|
||||
|
||||
options.programs.custom.video.enable = mkEnableOption "enable video tools";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
youtube-dl
|
||||
mplayer
|
||||
mpv
|
||||
|
||||
# to record your screen
|
||||
# ---------------------
|
||||
simplescreenrecorder
|
||||
screenKey
|
||||
|
||||
# to transcode video material
|
||||
# ---------------------------
|
||||
handbrake
|
||||
ffmpeg-full
|
||||
|
||||
# video editing
|
||||
# -------------
|
||||
openshot-qt
|
||||
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
224
nixos/modules/programs/vim.nix
Normal file
224
nixos/modules/programs/vim.nix
Normal file
|
|
@ -0,0 +1,224 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.custom.vim;
|
||||
|
||||
nix-xptemplates = pkgs.writeTextFile {
|
||||
name = "nix-xptemplates";
|
||||
destination = "/ftplugin/nix/nix.xpt.vim";
|
||||
text = # vim
|
||||
''
|
||||
XPTemplate priority=personal
|
||||
|
||||
XPT option " tips
|
||||
`name^ = mkOption {
|
||||
type = with types; `type^;
|
||||
description = ${"''"}
|
||||
`cursor^
|
||||
${"''"};
|
||||
};
|
||||
|
||||
XPT package " tips
|
||||
{ config, lib, ... }:
|
||||
{
|
||||
`cursor^
|
||||
}
|
||||
|
||||
XPT terranix" tips
|
||||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.`name^;
|
||||
in {
|
||||
|
||||
options.`name^ = mkOption {
|
||||
default = {};
|
||||
type = with types; attrsOf (submodule ({ name, ... }:{
|
||||
options = {
|
||||
enable = mkEnableOption "`name^.name";
|
||||
};
|
||||
}));
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
allConfigs = cfg
|
||||
in
|
||||
mkIf (cfg != {} ){
|
||||
`cursor^
|
||||
};
|
||||
}
|
||||
|
||||
XPT module " tips
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.`name^;
|
||||
|
||||
in {
|
||||
|
||||
options.`name^ = {
|
||||
enable = mkEnableOption "enable `name^";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
`cursor^
|
||||
};
|
||||
}
|
||||
|
||||
XPT shell " tips
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
pkgs.mkShell {
|
||||
|
||||
# needed pkgs
|
||||
# -----------
|
||||
buildInputs = with pkgs; [
|
||||
`name^
|
||||
];
|
||||
|
||||
# run this on start
|
||||
# -----------------
|
||||
shellHook = ${"''"}
|
||||
HISTFILE=${"$"}{toString ./.}/.history
|
||||
${"''"};
|
||||
}
|
||||
|
||||
XPT fhsUser " tips
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
(pkgs.buildFHSUserEnv {
|
||||
name = "fhs-user-env";
|
||||
|
||||
targetPkgs = pkgs: with pkgs; [
|
||||
# core stuff
|
||||
# ----------
|
||||
vim silver-searcher curl coreutils git tig
|
||||
|
||||
# common X dependencies
|
||||
# ---------------------
|
||||
atk cairo dbus eudev expat fontconfig freetype gdk_pixbuf glib gnome3.GConf gtk2-x11
|
||||
mesa_glu nspr nss pango xlibs.libXScrnSaver xlibs.libXcomposite xlibs.libXcursor
|
||||
xlibs.libXdamage xlibs.libXfixes xlibs.libXi xlibs.libXrender xlibs.libXtst xorg.libX11
|
||||
xorg.libXext xorg.libXinerama xorg.libxcb
|
||||
liblo zlib fftw minixml libcxx alsaLib glibc
|
||||
|
||||
# new stuff
|
||||
# ---------
|
||||
`cursor^
|
||||
|
||||
];
|
||||
|
||||
# multilib packages
|
||||
# -----------------
|
||||
# these are packages compiled 32bit and 64bit
|
||||
multiPkgs = pkgs: with pkgs; [
|
||||
];
|
||||
|
||||
# environment variables
|
||||
# ---------------------
|
||||
profile = ${"''"}
|
||||
export TERM="xterm"
|
||||
${"''"};
|
||||
|
||||
}).env
|
||||
|
||||
'';
|
||||
};
|
||||
|
||||
# active plugins
|
||||
# --------------
|
||||
extra-runtimepath = with pkgs;
|
||||
lib.concatMapStringsSep "," (pkg: "${pkg.rtp}") [
|
||||
vimPlugins.Syntastic
|
||||
vimPlugins.ack-vim
|
||||
vimPlugins.airline
|
||||
vimPlugins.vim-nix
|
||||
vimPlugins.xptemplate
|
||||
];
|
||||
|
||||
# the vimrc
|
||||
# ---------
|
||||
vimrc = pkgs.writeText "vimrc" ''
|
||||
|
||||
" turn on linenumbers
|
||||
" to turn of :set nonumber
|
||||
:set number
|
||||
|
||||
" show Trailing Whitespaces
|
||||
:set list listchars=tab:»·,trail:¶
|
||||
|
||||
" Map leader is the key for shortcuts
|
||||
nnoremap <SPACE> <Nop>
|
||||
let mapleader = "\<Space>"
|
||||
|
||||
" move blocks of text in visual mode
|
||||
" does not work correctly
|
||||
vmap <up> xkP`[V`]
|
||||
vmap <down> xp`[V`]
|
||||
|
||||
" search/grep case insensitive
|
||||
:set ignorecase
|
||||
|
||||
" tabs should always be 2 spaces
|
||||
set et ts=2 sts=2 sw=2
|
||||
|
||||
" installed vim-plugins
|
||||
set runtimepath=${extra-runtimepath},$VIMRUNTIME,$HOME/.vim,${nix-xptemplates}
|
||||
|
||||
" syntax highlighting on
|
||||
syntax on
|
||||
|
||||
" xptemplates
|
||||
" -----------
|
||||
" a plugin to insert snippets on demand
|
||||
set nocompatible
|
||||
filetype plugin on
|
||||
|
||||
" enable cursor cross
|
||||
" -------------------
|
||||
":hi CursorLine cterm=NONE ctermbg=darkred ctermfg=white guibg=darkred guifg=white
|
||||
":hi CursorColumn cterm=NONE ctermbg=darkred ctermfg=white guibg=darkred guifg=white
|
||||
:hi CursorLine cterm=NONE ctermbg=0 guibg=#073642
|
||||
:hi CursorColumn cterm=NONE ctermbg=0 guibg=#073642
|
||||
set cursorline
|
||||
set cursorcolumn
|
||||
|
||||
" save view
|
||||
" ---------
|
||||
augroup AutoSaveFolds
|
||||
autocmd!
|
||||
autocmd BufWinLeave * mkview
|
||||
autocmd BufWinEnter * silent loadview
|
||||
augroup END
|
||||
|
||||
" some language stuff
|
||||
" -------------------
|
||||
:map <leader>s :setlocal spell spelllang=en
|
||||
|
||||
'';
|
||||
|
||||
in {
|
||||
|
||||
# no options
|
||||
options.programs.custom.vim.enable = lib.mkEnableOption "vim";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# create vimrc
|
||||
# ------------
|
||||
# and load it as config for vim
|
||||
environment.variables.VIMINIT = ":so /etc/vimrc";
|
||||
environment.etc.vimrc.source = vimrc;
|
||||
|
||||
# set vim to the default editor
|
||||
# -----------------------------
|
||||
programs.vim.defaultEditor = true;
|
||||
|
||||
# install vim
|
||||
# -----------
|
||||
environment.systemPackages = [ pkgs.vim ];
|
||||
};
|
||||
|
||||
}
|
||||
151
nixos/modules/programs/xterm.nix
Normal file
151
nixos/modules/programs/xterm.nix
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.custom.xterm;
|
||||
|
||||
in {
|
||||
|
||||
options.programs.custom.xterm = {
|
||||
enable = mkEnableOption "configure and enable urxvt";
|
||||
fontSize = mkOption {
|
||||
type = types.int;
|
||||
default = 17;
|
||||
description = ''
|
||||
size of the terminal font
|
||||
'';
|
||||
};
|
||||
colorTheme = mkOption {
|
||||
type = types.enum [ "dark" "light" ];
|
||||
default = "dark";
|
||||
description = ''
|
||||
solarized color theme
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
environment.systemPackages = [ pkgs.xterm ];
|
||||
|
||||
environment.etc = {
|
||||
|
||||
"X11/Xresource.d/xterm".source = pkgs.writeText "Xresource-xterm" ''
|
||||
|
||||
XTerm*termName: xterm-256color
|
||||
XTerm*selectToClipboard: true
|
||||
|
||||
XTerm.*.bellIsUrgent: true
|
||||
|
||||
'';
|
||||
|
||||
"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
|
||||
|
||||
!! use xfontsel or fontmatrix to choose line
|
||||
!XTerm.*.font: ${normalFont cfg.fontSize},${
|
||||
backupFont cfg.fontSize
|
||||
}
|
||||
!XTerm.*.boldFont: ${boldFont cfg.fontSize},${
|
||||
backupFont cfg.fontSize
|
||||
}
|
||||
!XTerm.*.italicFont: ${italicFont cfg.fontSize},${
|
||||
backupFont cfg.fontSize
|
||||
}
|
||||
!XTerm.*.bolditalicFont: ${itallicBoldFont cfg.fontSize},${
|
||||
backupFont cfg.fontSize
|
||||
}
|
||||
|
||||
XTerm.*.font: ${normalFont cfg.fontSize}
|
||||
XTerm.*.boldFont: ${boldFont cfg.fontSize}
|
||||
XTerm.*.italicFont: ${italicFont cfg.fontSize}
|
||||
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
|
||||
|
||||
'' 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" ''
|
||||
|
||||
!! Color Configuration
|
||||
!! -------------------
|
||||
|
||||
!! Common
|
||||
!! ------
|
||||
#define S_yellow #b58900
|
||||
#define S_orange #cb4b16
|
||||
#define S_red #dc322f
|
||||
#define S_magenta #d33682
|
||||
#define S_violet #6c71c4
|
||||
#define S_blue #268bd2
|
||||
#define S_cyan #2aa198
|
||||
#define S_green #859900
|
||||
|
||||
!! ColorTheme
|
||||
!! ----------
|
||||
${colorTheme}
|
||||
|
||||
XTerm*background: S_base03
|
||||
XTerm*foreground: S_base0
|
||||
XTerm*fading: 40
|
||||
XTerm*fadeColor: S_base03
|
||||
XTerm*cursorColor: S_base1
|
||||
XTerm*pointerColorBackground: S_base01
|
||||
XTerm*pointerColorForeground: S_base1
|
||||
|
||||
XTerm*color0: S_base02
|
||||
XTerm*color1: S_red
|
||||
XTerm*color2: S_green
|
||||
XTerm*color3: S_yellow
|
||||
XTerm*color4: S_blue
|
||||
XTerm*color5: S_magenta
|
||||
XTerm*color6: S_cyan
|
||||
XTerm*color7: S_base2
|
||||
XTerm*color9: S_orange
|
||||
XTerm*color8: S_base03
|
||||
XTerm*color10: S_base01
|
||||
XTerm*color11: S_base00
|
||||
XTerm*color12: S_base0
|
||||
XTerm*color13: S_violet
|
||||
XTerm*color14: S_base1
|
||||
XTerm*color15: S_base3
|
||||
'';
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue