Update passwords

This commit is contained in:
Alexander Bantyev 2020-02-17 16:00:59 +03:00
commit ad2c5a239a
Signed by: balsoft
GPG Key ID: E081FF12ADCB4AD5
93 changed files with 5702 additions and 0 deletions

1
.dir-locals.el Normal file
View File

@ -0,0 +1 @@
((nil . ((projectile-project-compilation-cmd . "./install"))))

8
.gitignore vendored Executable file
View File

@ -0,0 +1,8 @@
secret.nix
*~
\#*\#
auto-save-list
tramp
.\#*
result
*\.qcow2

0
.projectile Normal file
View File

28
LICENSE Normal file
View File

@ -0,0 +1,28 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>
This software was originally created by Alexander Bantyev aka balsoft,
but you may omit any notices of original author in your dealings with
software.

7
Makefile Normal file
View File

@ -0,0 +1,7 @@
.PHONY: install result
install: result; SHELL=/bin/sh pkexec $$PWD/switch $$PWD
secret.nix: secret.nix.gpg; gpg -dq $< > $@
result: secret.nix; ./build

15
README.md Normal file
View File

@ -0,0 +1,15 @@
# balsofts nixos configuration
## Trying it out in VM
If you happen to run NixOS, you can quite easily check out my configuration by running
```
git clone https://github.com/balsoft/nixos-config --recursive && cd nixos-config && cat vm && read && ./vm
```
I recommend you inspect `vm` script before running it. Press Ctrl-C if something seems wrong (after all, Microsoft owns Github now; you never know if its Windows 10 installation script)
## Creating your own secret.nix for better experience
You can check out the structure of `./secret.nix` in `./modules/secrets.nix`
## Installing it on your machine
Run `./install`

32
bootstrap Executable file
View File

@ -0,0 +1,32 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p git gnupg
export IN_NIX_SHELL=
set -e
mkdir -p /mnt/home/balsoft/projects
nixos-generate-config --root /mnt
echo 'import /home/balsoft/projects/nixos-config "$(hostname)"' > /mnt/etc/nixos/configuration.nix
cd /mnt/home/balsoft/projects
git clone ssh://git@github.com/balsoft/nixos-config
cd nixos-config
touch secret.nix
while [[ -s secret.nix ]]
do gpg -dq secret.nix.gpg > secret.nix
done
mv /mnt/etc/nixos/hardware-configuration.nix hardware-configuration/$(hostname).nix
mkdir /home/balsoft
mount --rbind /mnt/home/balsoft /home/balsoft
mount --rbind /mnt/etc/nixos /etc/nixos
umount -l /nix/.rw-store
cp /nix/ /mnt -r
mount --rbind /mnt/nix /nix
./build --substituters "https://cache.balsoft.ru https://cache.nixos.org" --no-require-sigs
nixos-install --system ./result
cd /mnt/home/balsoft
chmod 777 -R .

24
build Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env nix-shell
#!nix-shell -p git -i bash
unset IN_NIX_SHELL
nixpkgs=$(nix eval --raw '(import ./nix/sources.nix).nixpkgs')
nix-store --realise $nixpkgs
export NIX_PATH=nixpkgs=$nixpkgs:nixos-config=/etc/nixos/configuration.nix
if [[ -n $INSIDE_EMACS ]]
then
nix-build $nixpkgs/nixos -A system $@
else
nix build -f $nixpkgs/nixos system $@
fi &&
{
git add .
d=$(date +%s)
# The quickest way to commit
git commit -t <(echo -n "Update "; echo -n $(git diff HEAD --name-only) | tr "\n" ", ") --no-edit --no-gpg-sign
git tag latestBuild --force
}

25
default.nix Executable file
View File

@ -0,0 +1,25 @@
# This is balsoft's configuration file.
#
# https://github.com/balsoft/nixos-config
#
# This is main nixos configuration
# To use this configuration:
# 1. Add your own secret.nix to this folder
# 2. Replace /etc/nixos/configuration.nix with the following:
# import /path/to/this/nixos-config "Vendor-Type"
# 3. Log in to application and services where neccesary
device: # This is the device we're on now
{ config, pkgs, lib, ... }:
let sources = import ./nix/sources.nix;
in {
imports = [
"${./hardware-configuration}/${device}.nix"
"${sources.home-manager}/nixos"
(import ./modules device)
];
inherit device;
system.stateVersion = "18.03";
}

View File

@ -0,0 +1,34 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:
{
imports =
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "sd_mod" ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/nvme0n1p2";
fsType = "ext4";
};
fileSystems."/home" =
{ device = "/dev/disk/by-label/Home";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/nvme0n1p1";
fsType = "vfat";
};
swapDevices = [ ];
nix.maxJobs = lib.mkDefault 16;
}

View File

@ -0,0 +1,4 @@
{...}:
{
}

View File

@ -0,0 +1,30 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:
{
imports =
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/29edff1b-4457-4d0c-9dfc-2cf5b6afcb46";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/4976-D10F";
fsType = "vfat";
};
swapDevices = [ ];
nix.maxJobs = lib.mkDefault 4;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
}

View File

@ -0,0 +1,30 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:
{
imports =
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/e50bd1d6-3613-465e-895a-9dde6ffaad46";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/621A-6414";
fsType = "vfat";
};
swapDevices = [ ];
nix.maxJobs = lib.mkDefault 8;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
}

4
install Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env nix-shell
#!nix-shell -p gnumake gnupg -i bash
make

BIN
misc/Passwords.kdbx Normal file

Binary file not shown.

BIN
misc/programs.sqlite Normal file

Binary file not shown.

102
modules/applications.nix Executable file
View File

@ -0,0 +1,102 @@
{ pkgs, config, lib, ... }:
with import ../support.nix { inherit lib config; }; {
options.defaultApplications = lib.mkOption {
type = lib.types.attrs;
description = "Preferred applications";
};
config = rec {
defaultApplications = {
term = {
cmd = "${pkgs.konsole}/bin/konsole";
desktop = "konsole";
};
editor = {
cmd = toString (pkgs.writeTextFile {
name = "emacsclient";
text = ''
#!${pkgs.bash}/bin/bash
${pkgs.emacs}/bin/emacsclient -s /tmp/emacs1000/server -c $@'';
executable = true;
});
desktop = "emacsclient";
};
browser = {
cmd = "${pkgs.firefox-wayland}/bin/firefox";
desktop = "firefox";
};
fm = {
cmd = "${pkgs.dolphin}/bin/dolphin";
desktop = "dolphin";
};
monitor = {
cmd = "${pkgs.ksysguard}/bin/ksysguard";
desktop = "ksysguard";
};
torrent = {
cmd = "${pkgs.ktorrent}/bin/ktorrent";
desktop = "ktorrent";
};
archive = {
cmd = "${pkgs.ark}/bin/ark";
desktop = "org.kde.ark";
};
mail = {
cmd = "${pkgs.trojita}/bin/trojita";
desktop = "trojita";
};
text_processor = {
cmd = "${pkgs.abiword}/bin/abiword";
desktop = "abiword";
};
spreadsheet = {
cmd = "${pkgs.gnumeric}/bin/gnumeric";
desktop = "gnumeric";
};
};
home-manager.users.balsoft.xdg.configFile."mimeapps.list.home".text =
with config.defaultApplications;
let
apps = builtins.mapAttrs (name: value: "${value.desktop}.desktop;") {
"text/html" = browser;
"image/*" = { desktop = "org.kde.gwenview"; };
"application/x-bittorrent" = torrent;
"application/zip" = archive;
"application/rar" = archive;
"application/7z" = archive;
"application/*tar" = archive;
"application/x-kdenlive" = archive;
"x-scheme-handler/http" = browser;
"x-scheme-handler/https" = browser;
"x-scheme-handler/about" = browser;
"x-scheme-handler/unknown" = browser;
"x-scheme-handler/mailto" = mail;
"application/pdf" = { desktop = "org.kde.okular"; };
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" =
text_processor;
"application/msword" = text_processor;
"application/vnd.oasis.opendocument.text" = text_processor;
"text/csv" = spreadsheet;
"application/vnd.oasis.opendocument.spreadsheet" = spreadsheet;
"text/plain" =
editor; # This actually makes Emacs an editor for everything... XDG is wierd
};
in genIni {
"Default Applications" = apps;
"Added Associations" = apps;
};
home-manager.users.balsoft.xdg.configFile."filetypesrc".text = genIni {
EmbedSettings = {
"embed-application/*" = false;
"embed-text/*" = false;
"embed-text/plain" = false;
};
};
home-manager.users.balsoft.home.activation.mimeapps = {
before = [ ];
after = [ "linkGeneration" ];
data =
"$DRY_RUN_CMD cp ~/.config/mimeapps.list.home ~/.config/mimeapps.list";
};
};
}

View File

@ -0,0 +1,72 @@
{ pkgs, config, lib, ... }: {
home-manager.users.balsoft = {
programs.emacs = {
enable = true;
package = pkgs.emacs;
extraPackages = epkgs:
with epkgs; [
use-package
nix-mode
haskell-mode
wakib-keys
exec-path-from-shell
counsel
projectile
which-key
markdown-mode
frames-only-mode
company
rainbow-delimiters
diff-hl
mode-line-bell
hasklig-mode
flycheck
flycheck-pkg-config
auto-indent-mode
clipmon
org-gcal
company-ghci
xresources-theme
company-tabnine
expand-region
ivy
smex
quickrun
counsel-tramp
ix
magit
xah-fly-keys
arduino-mode
elixir-mode
];
};
home.packages = [
(pkgs.makeDesktopItem {
terminal = "False";
type = "Application";
name = "emacsclient";
genericName = "Text editor";
desktopName = "Emacs client";
mimeType = "text/plain";
exec = "emacsclient -s /tmp/emacs1000/server -c %F";
categories = "Development;TextEditor;";
icon = "emacs";
})
pkgs.clang
];
services.emacs.enable = true;
systemd.user.services.emacs.Service.Environment =
"PATH=/run/current-system/sw/bin:/etc/profiles/per-user/balsoft/bin";
home.file.".emacs.d/init.el".source = ./init.el;
home.file.".emacs.d/elisp/gud-lldb.el".source = ./gud-lldb.el;
home.activation.emacs = {
before = [ ];
after = [ ];
data = "$DRY_RUN_CMD mkdir -p ~/.emacs.d/autosave";
};
};
}

View File

@ -0,0 +1,198 @@
;;; gud-lldb.el --- Grand Unified Debugger mode for running LLDB
;; Copyright (C) 1992-1996, 1998, 2000-2014 Free Software Foundation,
;; Inc.
;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
;; Maintainer: emacs-devel@gnu.org
;; Keywords: unix, tools, osx
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; This file contains an extract of the gud.el version from
;; `http://opensource.apple.com/source/lldb/lldb-69/utils/emacs/gud.el'
;;; Code:
(require 'gud)
;; History of argument lists passed to lldb.
(defvar gud-lldb-history nil)
;; Keeps track of breakpoint created. In the following case, the id is "1".
;; It is used to implement temporary breakpoint.
;; (lldb) b main.c:39
;; breakpoint set --file 'main.c' --line 39
;; Breakpoint created: 1: file ='main.c', line = 39, locations = 1
(defvar gud-breakpoint-id nil)
(defun lldb-extract-breakpoint-id (string)
;; Search for "Breakpoint created: \\([^:\n]*\\):" pattern.
;(message "gud-marker-acc string is: |%s|" string)
(if (string-match "Breakpoint created: \\([^:\n]*\\):" string)
(progn
(setq gud-breakpoint-id (match-string 1 string))
(message "breakpoint id: %s" gud-breakpoint-id)))
)
(defun gud-lldb-marker-filter (string)
(setq gud-marker-acc
(if gud-marker-acc (concat gud-marker-acc string) string))
(lldb-extract-breakpoint-id gud-marker-acc)
(let (start)
;; Process all complete markers in this chunk
(while (or
;; (lldb) r
;; Process 15408 launched: '/Volumes/data/lldb/svn/trunk/test/conditional_break/a.out' (x86_64)
;; (lldb) Process 15408 stopped
;; * thread #1: tid = 0x2e03, 0x0000000100000de8 a.out`c + 7 at main.c:39, stop reason = breakpoint 1.1, queue = com.apple.main-thread
(string-match " at \\([^:\n]*\\):\\([0-9]*\\), stop reason = .*\n"
gud-marker-acc start)
;; (lldb) frame select -r 1
;; frame #1: 0x0000000100000e09 a.out`main + 25 at main.c:44
(string-match "^[ ]*frame.* at \\([^:\n]*\\):\\([0-9]*\\)\n"
gud-marker-acc start))
;(message "gud-marker-acc matches our pattern....")
(setq gud-last-frame
(cons (match-string 1 gud-marker-acc)
(string-to-number (match-string 2 gud-marker-acc)))
start (match-end 0)))
;; Search for the last incomplete line in this chunk
(while (string-match "\n" gud-marker-acc start)
(setq start (match-end 0)))
;; If we have an incomplete line, store it in gud-marker-acc.
(setq gud-marker-acc (substring gud-marker-acc (or start 0))))
string)
;; Keeps track of whether the Python lldb_oneshot_break function definition has
;; been exec'ed.
(defvar lldb-oneshot-break-defined nil)
;;;###autoload
(defun lldb (command-line)
"Run lldb on program FILE in buffer *gud-FILE*.
The directory containing FILE becomes the initial working directory
and source-file directory for your debugger."
(interactive (list (gud-query-cmdline 'lldb)))
(gud-common-init command-line nil 'gud-lldb-marker-filter)
(set (make-local-variable 'gud-minor-mode) 'lldb)
(setq lldb-oneshot-break-defined nil)
;; Make lldb dump fullpath instead of basename for a file.
;; See also gud-lldb-marker-filter where gud-last-frame is grokked from lldb output.
(progn
(gud-call "settings set frame-format frame #${frame.index}: ${frame.pc}{ ${module.file.basename}{`${function.name}${function.pc-offset}}}{ at ${line.file.fullpath}:${line.number}}\\n")
(sit-for 1)
(gud-call "settings set thread-format thread #${thread.index}: tid = ${thread.id}{, ${frame.pc}}{ ${module.file.basename}{`${function.name}${function.pc-offset}}}{ at ${line.file.fullpath}:${line.number}}{, stop reason = ${thread.stop-reason}}\\n")
(sit-for 1))
(gud-def gud-listb "breakpoint list"
"l" "List all breakpoints.")
(gud-def gud-bt "thread backtrace"
"b" "Show stack for the current thread.")
(gud-def gud-bt-all "thread backtrace all"
"B" "Show stacks for all the threads.")
(gud-def gud-break "breakpoint set -f %f -l %l"
"\C-b" "Set breakpoint at current line.")
(gud-def gud-tbreak
(progn (gud-call "breakpoint set -f %f -l %l")
(sit-for 1)
(if (not lldb-oneshot-break-defined)
(progn
;; The "\\n"'s are required to escape the newline chars
;; passed to the lldb process.
(gud-call (concat "script exec \"def lldb_oneshot_break(frame, bp_loc):\\n"
" target=frame.GetThread().GetProcess().GetTarget()\\n"
" bp=bp_loc.GetBreakpoint()\\n"
" print 'Deleting oneshot breakpoint:', bp\\n"
" target.BreakpointDelete(bp.GetID())\""))
(sit-for 1)
;; Set the flag since Python knows about the function def now.
(setq lldb-oneshot-break-defined t)))
(gud-call "breakpoint command add -p %b -o 'lldb_oneshot_break(frame, bp_loc)'"))
"\C-t" "Set temporary breakpoint at current line.")
(gud-def gud-remove "breakpoint clear -f %f -l %l"
"\C-d" "Remove breakpoint at current line")
(gud-def gud-step "thread step-in"
"\C-s" "Step one source line with display.")
(gud-def gud-stepi "thread step-inst"
"\C-i" "Step one instruction with display.")
(gud-def gud-next "thread step-over"
"\C-n" "Step one line (skip functions).")
(gud-def gud-nexti "thread step-inst-over"
nil "Step one instruction (skip functions).")
(gud-def gud-cont "process continue"
"\C-r" "Continue with display.")
(gud-def gud-finish "thread step-out"
"\C-f" "Finish executing current function.")
(gud-def gud-up
(progn (gud-call "frame select -r 1")
(sit-for 1))
"<" "Up 1 stack frame.")
(gud-def gud-down
(progn (gud-call "frame select -r -1")
(sit-for 1))
">" "Down 1 stack frame.")
(gud-def gud-print "expression -- %e"
"\C-p" "Evaluate C expression at point.")
(gud-def gud-pstar "expression -- *%e"
nil "Evaluate C dereferenced pointer expression at point.")
(gud-def gud-run "run"
"r" "Run the program.")
(gud-def gud-stop-subjob "process kill"
"s" "Stop the program.")
(setq comint-prompt-regexp "\\(^\\|\n\\)\\*")
(setq paragraph-start comint-prompt-regexp)
(run-hooks 'lldb-mode-hook)
)
;; ;; tooltip
;; (defun gud-lldb-tooltip-print-command (expr)
;; "Return a suitable command to print the expression EXPR."
;; (pcase gud-minor-mode
;; ;; '-o' to print the objc object description if available
;; (`lldb (concat "expression -o -- " expr))
;; (`gdbmi (concat "-data-evaluate-expression \"" expr "\""))
;; (`guiler expr)
;; (`dbx (concat "print " expr))
;; ((or `xdb `pdb) (concat "p " expr))
;; (`sdb (concat expr "/"))))
;; (advice-add 'gud-tooltip-print-command :override #'gud-lldb-tooltip-print-command)
;; menu
(setcdr (nth 2 (nth 7 (assoc 'nexti gud-menu-map))) '((lldb gdbmi gdb dbx)))
(setcdr (nth 2 (nth 7 (assoc 'stepi gud-menu-map))) '((lldb gdbmi gdb dbx)))
(setcdr (nth 2 (nth 7 (assoc 'finish gud-menu-map))) '((lldb gdbmi gdb guiler xdb jdb pdb)))
(setcdr (nth 2 (nth 7 (assoc 'print* gud-menu-map))) '((lldb gdbmi gdb jdb)))
(setcdr (nth 2 (nth 7 (assoc 'down gud-menu-map))) '((lldb gdbmi gdb guiler dbx xdb jdb pdb)))
(setcdr (nth 2 (nth 7 (assoc 'up gud-menu-map))) '((lldb gdbmi gdb guiler dbx xdb jdb pdb)))
(setcdr (nth 2 (nth 7 (assoc 'tbreak gud-menu-map))) '((lldb gdbmi gdb sdb xdb)))
(setcdr (nth 2 (nth 7 (assoc 'run gud-menu-map))) '((lldb gdbmi gdb dbx jdb)))
;; (setcdr (nth 2 (nth 7 (assoc 'tooltips gud-menu-map))) '((lldb gdbmi guiler dbx sdb xdb pdb)))
(provide 'gud-lldb)
;;; gud-lldb.el ends here

View File

@ -0,0 +1,405 @@
;;; init.el --- balsoft's config
;;; Commentary:
;;; None
;; -*- lexical-binding: t -*-
;;; Code:
;;----------------------------------------------------------------------------
;; Adjust garbage collection
;;----------------------------------------------------------------------------
(setq gc-cons-threshold (* 20 1024 1024))
;; ---------------------
;; Setup Load Path
;; ---------------------
(nconc load-path
(list (expand-file-name "local" user-emacs-directory)
(expand-file-name "wakib" user-emacs-directory)))
;; -----------------------
;; use-package
;; -----------------------
(setq load-prefer-newer t) ; Don't load outdated byte code
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
(add-to-list 'package-archives '("cselpa" . "https://elpa.thecybershadow.net/packages/"))
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)
(setq package-enable-at-startup nil)
;; Bootstrap `use-package'
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile
(require 'use-package))
(setq use-package-always-ensure nil)
(setq-default tab-width 2)
(mode-line-bell-mode)
(line-number-mode)
(column-number-mode)
;; backup in one place. flat, no tree structure
(setq backup-directory-alist '(("" . "~/.emacs.d/backup")))
(setq auto-save-file-name-transforms
`((".*" "~/.emacs.d/autosave/" t)))
(setq-default indent-tabs-mode nil)
(setq-default tab-always-indent 'complete)
(setq-default compilation-scroll-output 'first-error)
(add-to-list 'load-path "~/.emacs.d/elisp/")
(require 'gud-lldb)
(use-package auto-indent-mode
:config
(auto-indent-global-mode))
(global-auto-revert-mode)
(electric-indent-mode 1)
;; (use-package ergoemacs-mode
;; :config
;; (ergoemacs-mode 1))
(use-package xah-fly-keys
:config
(xah-fly-keys-set-layout "qwerty")
(xah-fly-keys 1)
(defun xah-fly-keys-russian-on ()
"Add Russian layout keys.
Hook function for `xah-fly-command-mode-activate-hook'
2018-10-26 Thanks to TechiBech
Version 2018-10-27"
(interactive)
(progn
(define-key xah-fly-key-map (kbd "й") 'xah-reformat-lines)
(define-key xah-fly-key-map (kbd "ц") 'xah-shrink-whitespaces)
(define-key xah-fly-key-map (kbd "э") 'xah-cycle-hyphen-underscore-space)
(define-key xah-fly-key-map (kbd "у") 'xah-backward-kill-word)
(define-key xah-fly-key-map (kbd "я") 'xah-comment-dwim)
(define-key xah-fly-key-map (kbd "х") 'hippie-expand)
(define-key xah-fly-key-map (kbd "ф") 'execute-extended-command)
(define-key xah-fly-key-map (kbd "т") 'isearch-forward)
(define-key xah-fly-key-map (kbd "ш") 'previous-line)
(define-key xah-fly-key-map (kbd "р") 'xah-beginning-of-line-or-block)
(define-key xah-fly-key-map (kbd "в") 'xah-delete-backward-char-or-bracket-text)
(define-key xah-fly-key-map (kbd "н") 'undo)
(define-key xah-fly-key-map (kbd "г") 'backward-word)
(define-key xah-fly-key-map (kbd "о") 'backward-char)
(define-key xah-fly-key-map (kbd "п") 'xah-delete-current-text-block)
(define-key xah-fly-key-map (kbd "с") 'xah-copy-line-or-region)
(define-key xah-fly-key-map (kbd "м") 'xah-paste-or-paste-previous)
(define-key xah-fly-key-map (kbd "з") 'xah-insert-space-before)
(define-key xah-fly-key-map (kbd "ь") 'xah-backward-left-bracket)
(define-key xah-fly-key-map (kbd "д") 'forward-char)
(define-key xah-fly-key-map (kbd "ы") 'open-line)
(define-key xah-fly-key-map (kbd "к") 'xah-kill-word)
(define-key xah-fly-key-map (kbd "ч") 'xah-cut-line-or-region)
(define-key xah-fly-key-map (kbd "щ") 'forward-word)
(define-key xah-fly-key-map (kbd "ж") 'xah-end-of-line-or-block)
(define-key xah-fly-key-map (kbd "л") 'next-line)
(define-key xah-fly-key-map (kbd "а") 'xah-fly-insert-mode-activate)
(define-key xah-fly-key-map (kbd "б") 'xah-next-window-or-frame)
(define-key xah-fly-key-map (kbd "и") 'xah-toggle-letter-case)
(define-key xah-fly-key-map (kbd "е") 'set-mark-command)))
(defun xah-fly-keys-russian-off ()
"Remove Russian layout keys.
Hook function for `xah-fly-insert-mode-activate-hook'
2018-10-26 Thanks to TechiBech
Version 2018-10-27"
(interactive)
(progn
(define-key xah-fly-key-map (kbd "й") 'nil)
(define-key xah-fly-key-map (kbd "ц") 'nil)
(define-key xah-fly-key-map (kbd "э") 'nil)
(define-key xah-fly-key-map (kbd "у") 'nil)
(define-key xah-fly-key-map (kbd "я") 'nil)
(define-key xah-fly-key-map (kbd "х") 'nil)
(define-key xah-fly-key-map (kbd "ф") 'nil)
(define-key xah-fly-key-map (kbd "т") 'nil)
(define-key xah-fly-key-map (kbd "ш") 'nil)
(define-key xah-fly-key-map (kbd "р") 'nil)
(define-key xah-fly-key-map (kbd "в") 'nil)
(define-key xah-fly-key-map (kbd "н") 'nil)
(define-key xah-fly-key-map (kbd "г") 'nil)
(define-key xah-fly-key-map (kbd "о") 'nil)
(define-key xah-fly-key-map (kbd "п") 'nil)
(define-key xah-fly-key-map (kbd "с") 'nil)
(define-key xah-fly-key-map (kbd "м") 'nil)
(define-key xah-fly-key-map (kbd "з") 'nil)
(define-key xah-fly-key-map (kbd "ь") 'nil)
(define-key xah-fly-key-map (kbd "д") 'nil)
(define-key xah-fly-key-map (kbd "ы") 'nil)
(define-key xah-fly-key-map (kbd "к") 'nil)
(define-key xah-fly-key-map (kbd "ч") 'nil)
(define-key xah-fly-key-map (kbd "щ") 'nil)
(define-key xah-fly-key-map (kbd "ж") 'nil)
(define-key xah-fly-key-map (kbd "л") 'nil)
(define-key xah-fly-key-map (kbd "а") 'nil)
(define-key xah-fly-key-map (kbd "б") 'nil)
(define-key xah-fly-key-map (kbd "и") 'nil)
(define-key xah-fly-key-map (kbd "е") 'nil)))
(add-hook 'xah-fly-command-mode-activate-hook 'xah-fly-keys-russian-on )
(add-hook 'xah-fly-insert-mode-activate-hook 'xah-fly-keys-russian-off )
(define-key key-translation-map (kbd "ESC") (kbd "C-g"))
)
(global-set-key (kbd "C-b") 'switch-to-buffer)
(global-set-key (kbd "C-TAB") 'org-cycle-level)
(global-display-line-numbers-mode)
(electric-pair-mode)
(electric-indent-mode)
(use-package flycheck
:config
(global-flycheck-mode))
;; -------------------
;; Initial Setup
;; -------------------
(menu-bar-mode -1)
(scroll-bar-mode -1)
(tool-bar-mode -1)
(cua-selection-mode 1)
;;(define-key cua--rectangle-keymap (kbd "ESC") nil)
;;(define-key cua-global-keymap (kbd "<C-return>") nil)
;;(define-key cua-global-keymap (kbd "C-x SPC") 'cua-rectangle-mark-mode)
(when (not window-system)
(xterm-mouse-mode 1))
(use-package hasklig-mode
:hook (haskell-mode))
(use-package company-ghci
:config
(push 'company-ghci company-backends))
(global-set-key (kbd "M-RET") 'execute-extended-command)
(defun smart-beginning-of-line ()
"Move point to first non-whitespace character or beginning of line.
Move point to the first non-whitespace character on this line.
If point was already at that position, move point to beginning of line."
(interactive "^") ; Use (interactive) in Emacs 22 or older
(let ((oldpos (point)))
(back-to-indentation)
(and (= oldpos (point))
(beginning-of-line))))
(global-set-key [home] 'smart-beginning-of-line)
(global-unset-key [menu-bar options cua-mode])
(fringe-mode '(0 . 0))
;; scroll one line at a time (less "jumpy" than defaults)
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
(setq scroll-step 1) ;; keyboard scroll one line at a time
(use-package frames-only-mode)
;; Make new frames instead of new windows
(set 'pop-up-frames 'graphic-only)
(set 'gdb-use-separate-io-buffer nil)
(set 'gdb-many-windows nil)
(use-package counsel
:config
(counsel-mode 1))
;; -------------------
;; Projectile
;; -------------------
;; No deferred loading as bind-keymap
;; doesn't handle wakib C-d keymaps
(use-package projectile
:config
(setq projectile-completion-system 'ivy)
(define-key projectile-mode-map (kbd "C-c p") nil)
(define-key projectile-mode-map (kbd "C-x p") 'projectile-command-map)
(projectile-mode 1)
(global-unset-key [menu-bar tools Projectile])
(projectile-register-project-type 'nix-shell '("shell.nix")
:compile "nix-build shell.nix"
:run "nix-shell")
(setq projectile-project-search-path '("~/projects/"))
(global-set-key (kbd "<f9>") 'projectile-compile-project)
(global-set-key (kbd "<f5>") 'projectile-run-project))
;; -------------------
;; Yasnippet
;; -------------------
(use-package nix-mode
:hook
((nix-mode . (lambda () (local-set-key (kbd "<f7>") 'nix-format-buffer))))
((nix-mode . (lambda () (setq indent-line-function 'nix-indent-line)))))
;; -------------------
;; expand-region
;; -------------------
(use-package company
:config
(global-company-mode 1)
;; Trigger completion immediately.
(setq company-idle-delay 0)
;; Number the candidates (use M-1, M-2 etc to select completions).
(setq company-show-numbers t)
;; Use the tab-and-go frontend.
;; Allows TAB to select and complete at the same time.
(company-tng-configure-default)
(setq company-frontends
'(company-tng-frontend
company-pseudo-tooltip-frontend
company-echo-metadata-frontend))
(require 'color)
(let ((bg (face-attribute 'default :background)))
(custom-set-faces
`(company-tooltip ((t (:inherit default :background ,(color-lighten-name bg 2)))))
`(company-scrollbar-bg ((t (:background ,(color-lighten-name bg 10)))))
`(company-scrollbar-fg ((t (:background ,(color-lighten-name bg 5)))))
`(company-tooltip-selection ((t (:inherit font-lock-function-name-face))))
`(company-tooltip-common ((t (:inherit font-lock-constant-face)))))))
(use-package company-tabnine
:config
(add-to-list 'company-backends #'company-tabnine))
;; -------------------
;; Ivy
;; -------------------
(use-package ivy
:config
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(define-key ivy-minibuffer-map [remap keyboard-quit] 'minibuffer-keyboard-quit)
;; (setq enable-recursive-minibuffers t)
(setq ivy-count-format "")
(setq ivy-initial-inputs-alist nil))
(use-package smex)
;; TODO (change defun rewrite to advice)
(use-package quickrun
:init
(global-set-key [menu-bar tools quickrun] `(menu-item ,"Run Buffer" quickrun))
:config
(setq quickrun-focus-p nil)
;; Move cursor out of the way when displaying output
(advice-add 'quickrun--recenter
:after (lambda (&optional _)
(with-selected-window
(get-buffer-window quickrun--buffer-name)
(end-of-buffer))))
:bind
(([f8] . quickrun )))
(show-paren-mode 1)
;; TODO - MOVE Electric Pair Mode to user local
;; MAJOR MODES
(use-package markdown-mode
:mode "\\.\\(m\\(ark\\)?down\\|md\\)$")
;; Setup Splash Screen
;; (setq inhibit-startup-screen t)
;; (setq-default major-mode 'fundamental-mode)
;; (setq-default initial-scratch-message "")
(setq custom-file (expand-file-name "custom" user-emacs-directory))
(load custom-file t t)
(defun compile-on-save-start ()
"Recompile when compilation is not going."
(let ((buffer (compilation-find-buffer)))
(unless (get-buffer-process buffer)
(recompile))))
(define-minor-mode compile-on-save-mode
"Minor mode to automatically call `recompile' whenever the
current buffer is saved. When there is ongoing compilation,
nothing happens."
:lighter " CoS"
(if compile-on-save-mode
(progn (make-local-variable 'after-save-hook)
(add-hook 'after-save-hook 'compile-on-save-start nil t))
(kill-local-variable 'after-save-hook)))
(auto-fill-mode)
;; -------------------
;; Theme
;; -------------------
(use-package xresources-theme
:config
(load-theme 'xresorces t)
(setq after-init-hook (load-theme 'xresources t))
(add-hook 'after-make-frame-functions
(lambda (frame)
(with-selected-frame frame
(load-theme 'xresources t)))))
(setq inhibit-startup-screen t)
;;; init.el ends here

View File

@ -0,0 +1,72 @@
{ config, pkgs, lib, ... }:
with import ../../support.nix { inherit lib config; };
let thm = config.themes.colors;
in {
environment.sessionVariables.MOZ_USE_XINPUT2 = "1";
home-manager.users.balsoft = lib.mkIf (config.deviceSpecific.goodMachine) {
home.packages = with pkgs; [
plasma-integration
plasma5.xdg-desktop-portal-kde
plasma-browser-integration
];
home.file.".mozilla/native-messaging-hosts".source = pkgs.symlinkJoin {
name = "native-messaging-hosts";
paths = [
"${pkgs.plasma-browser-integration}/lib/mozilla/native-messaging-hosts"
];
};
programs.firefox = {
enable = true;
package = pkgs.firefox-wayland;
profiles.default = {
id = 0;
userChrome = ''
#TabsToolbar {
visibility: collapse;
}
toolbar#nav-bar, nav-bar-customization-target {
background: ${thm.bg} !important;
}
@-moz-document url("about:newtab") {
* { background-color: ${thm.bg} !important; }
}
'';
settings = {
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"extensions.autoDisableScopes" = 0;
"browser.search.defaultenginename" = "Google";
"browser.search.selectedEngine" = "Google";
"browser.urlbar.placeholderName" = "Google";
"browser.search.region" = "US";
"browser.uidensity" = 1;
"browser.search.openintab" = true;
"xpinstall.signatures.required" = false;
"extensions.update.enabled" = false;
"font.name.monospace.x-western" = "Roboto Mono";
"font.name.sans-serif.x-western" = "Roboto";
"font.name.serif.x-western" = "Roboto Slab";
"browser.display.background_color" = thm.bg;
"browser.display.foreground_color" = thm.fg;
"browser.display.document_color_use" = 2;
"browser.anchor_color" = thm.fg;
"browser.visited_color" = thm.blue;
"browser.display.use_document_fonts" = true;
"pdfjs.disabled" = true;
"media.videocontrols.picture-in-picture.enabled" = true;
};
};
extensions = with pkgs.nur.rycee.firefox-addons; [
torswitch
close-other-windows
adsum-notabs
ublock-origin
plasma-integration
];
};
};
}

View File

@ -0,0 +1,51 @@
{ pkgs, lib, config, ... }:
with (import ../../support.nix { inherit lib config; }); {
home-manager.users.balsoft.xdg.dataFile = {
"konsole/Default.profile".text = genIni {
Appearance.ColorScheme = "generated";
"Cursor Options".CursorShape = 1;
General = {
Command = "zsh";
Name = "Default";
Parent = "FALLBACK/";
};
Scrolling = {
HistoryMode = 2;
ScrollBarPosition = 2;
};
"Terminal Features".BlinkingCursorEnabled = true;
};
"konsole/generated.colorscheme".text = genIni {
General = {
Description = "generated";
Opacity = 1;
Wallpaper = "";
};
Background.Color = thmDec.bg;
BackgroundIntense.Color = thmDec.bg;
Foreground.Color = thmDec.fg;
Color0.Color = thmDec.dark;
Color0Intense.Color = thmDec.alt;
Color1.Color = thmDec.red;
Color2.Color = thmDec.green;
Color3.Color = thmDec.yellow;
Color4.Color = thmDec.blue;
Color5.Color = thmDec.purple;
Color6.Color = thmDec.cyan;
Color7.Color = thmDec.fg;
};
};
home-manager.users.balsoft.xdg.configFile."konsolerc.home".text = genIni {
"Desktop Entry".DefaultProfile = "Default.profile";
KonsoleWindow = {
SaveGeometryOnExit = false;
ShowMenuBarByDefault = false;
UseSingleInstance = true;
};
};
home-manager.users.balsoft.home.activation.konsole = {
data = "$DRY_RUN_CMD cp -f ~/.config/konsolerc.home ~/.config/konsolerc";
before = [ ];
after = [ "linkGeneration" ];
};
}

View File

@ -0,0 +1,19 @@
{ pkgs, lib, config, ... }:
with import ../../support.nix { inherit lib config; }; {
home-manager.users.balsoft.xdg.configFile."okularpartrc".text = genIni {
"Dlg Accessibility" = {
RecolorBackground = thmDec.bg;
RecolorForeground = thmDec.fg;
};
"Document" = {
ChangeColors = true;
PaperColor = thmDec.bg;
RenderMode = "Recolor";
};
"Main View" = { ShowLeftPanel = false; };
PageView = {
BackgroundColor = thmDec.bg;
UseCustomBackgroundColor = true;
};
};
}

View File

@ -0,0 +1,98 @@
{ pkgs, config, lib, ... }: {
programs.adb.enable = true;
environment.systemPackages = with pkgs;
lib.optionals config.deviceSpecific.goodMachine [
kded
ntfs3g
];
home-manager.users.balsoft.home.packages = with pkgs;
[
# Internet
wget
curl
unrar
] ++ lib.optionals config.deviceSpecific.goodMachine ([
steamcmd
steam
kdenlive
frei0r
ffmpeg-full
ghc
(all-hies.selection {
selector = p:
let
ghcVersion =
builtins.concatStringsSep "" (builtins.splitVersion ghc.version);
in { ${"ghc${ghcVersion}"} = p.${"ghc${ghcVersion}"}; };
})
haskellPackages.hoogle
haskellPackages.hindent
clang
clang-tools
lldb
appimage-run
nixfmt
niv
stdman
libqalculate
# Messaging
libnotify
# Audio/Video
vlc
cantata
lxqt.pavucontrol-qt
# Tools
zip
unrar
wireshark
micro
python3
qalculate-gtk
breeze-qt5
gnome3.adwaita-icon-theme
papirus-icon-theme
breeze-icons
ksysguard
wl-clipboard
grim
slurp
abiword
gnumeric
gcalcli
google-drive-ocamlfuse
kdeconnect
trojita
nix-zsh-completions
papirus-icon-theme
breeze-icons
kde-cli-tools
xdg_utils
nheko
gitAndTools.hub
nix-patch
waypipe
] ++ (with pkgs.kdeApplications; [
ark
dolphin
dolphin-plugins
eventviews
ffmpegthumbs
filelight
gwenview
kcachegrind
kcolorchooser
kdenlive
kolourpaint
kompare
krdc
krfb
ktnef
marble
okteta
okular
print-manager
ktorrent
]));
}

View File

@ -0,0 +1,59 @@
{ pkgs, config, lib, ... }:
with import ../../support.nix { inherit lib config; }; {
home-manager.users.balsoft.xdg.configFile."flaska.net/trojita.conf".text =
if !isNull config.secrets.mail then
genIni {
General = {
"app.updates.checkEnabled" = false;
"imap.auth.user" = "${config.secrets.mail.user}@${config.secrets.mail.host}";
"imap.auth.pass" = config.secrets.mail.password;
"imap.host" = config.secrets.mail.host;
"imap.archiveFolderName" = "Archive";
"imap.startmode" = "ONLINE";
"imap.method" = "SSL";
"imap.needsNetwork" = true;
"imap.numberRefreshInterval" = 300;
"imap.port" = 993;
"imap.proxy.system" = true;
"imap.starttls" = true;
"imapIdleRenewal" = 29;
"msa.method" = "SMTP";
"msa.smtp.auth" = true;
"msa.smtp.auth.reuseImapCredentials" = true;
"msa.smtp.burl" = false;
"msa.smtp.starttls" = true;
"msa.smtp.host" = config.secrets.mail.host;
"msa.smtp.port" = 25;
"offline.cache" = "days";
"offline.cache.numDays" = "30";
};
autoMarkRead = {
enabled = true;
seconds = 0;
};
composer = {
imapSentName = "Sent";
saveToImapEnabled = true;
};
gui = {
"mainWindow.layout" = "compact";
preferPlaintextRendering = true;
showSystray = false;
startMinimized = false;
};
identities = {
"1\\address" = "${config.secrets.mail.user}@${config.secrets.mail.host}";
"1\\organisation" = "serokell.io";
"1\\realName" = "Alexander Bantyev";
"1\\signature" = ''\x410\x43b\x435\x43a\x441\x430\x43d\x434\x440 \x411\x430\x43d\x442\x44c\x435\x432 /Alexander Bantyev/ aka balsoft\n\nNix DevOPS/SRE at serokell.io\n\n<balsoft@balsoft.ru>\n<alexander.bantyev@serokell.io>\n\nmatrix://@balsoft:balsoft.ru \n(https://matrix.to/#/@balsoft:balsoft.ru)\nhttps://t.me/balsoft\nhttps://github.com/balsoft\n'';
size = 1;
};
interoperability.revealVersions = true;
plugin = {
addressbook = "abookaddressbook";
password = "cleartextpassword";
};
}
else
"";
}

View File

@ -0,0 +1,754 @@
{ pkgs, config, ... }:
let
weechat = pkgs.weechat.override {
configure = { availablePlugins, ... }: {
scripts = with pkgs.weechatScripts; [ wee-slack ];
};
};
in {
home-manager.users.balsoft = {
home.file.".weechat/python/autoload/notify_send.py".source =
"${(import ../../nix/sources.nix).weechat-notify-send}/notify_send.py";
home.file.".weechat/perl/autoload/multiline.pl".source =
"${pkgs.imports.scripts}/perl/multiline.pl";
home.file.".weechat/python/autoload/go.py".source =
"${pkgs.imports.scripts}/python/go.py";
home.file.".weechat/plugins.conf".text = ''
[var]
lua.matrix.autojoin_on_invite = "on"
lua.matrix.backlog_lines = "120"
lua.matrix.debug = "off"
lua.matrix.encrypted_message_color = "lightgreen"
lua.matrix.homeserver_url = "https://matrix.balsoft.ru/"
lua.matrix.local_echo = "on"
lua.matrix.nick_style = "nick"
lua.matrix.password = "${config.secrets.matrix.password}"
lua.matrix.presence_filter = "on"
lua.matrix.read_receipts = "on"
lua.matrix.timeout = "20"
lua.matrix.typing_notices = "on"
lua.matrix.user = "${config.secrets.matrix.user}"
python.slack.auto_open_threads = "true"
python.slack.background_load_all_history = "true"
python.slack.channel_name_typing_indicator = "true"
python.slack.color_buflist_muted_channels = "darkgray"
python.slack.color_edited_suffix = "095"
python.slack.color_reaction_suffix = "darkgray"
python.slack.color_thread_suffix = "lightcyan"
python.slack.colorize_private_chats = "false"
python.slack.debug_level = "3"
python.slack.debug_mode = "false"
python.slack.distracting_channels = ""
python.slack.external_user_suffix = "*"
python.slack.files_download_location = "/home/balsoft/Downloads/slack"
python.slack.group_name_prefix = "&"
python.slack.map_underline_to = "_"
python.slack.migrated = "true"
python.slack.muted_channels_activity = "personal_highlights"
python.slack.never_away = "false"
python.slack.notify_usergroup_handle_updated = "false"
python.slack.record_events = "false"
python.slack.render_bold_as = "bold"
python.slack.render_italic_as = "italic"
python.slack.send_typing_notice = "true"
python.slack.server_aliases = ""
python.slack.shared_name_prefix = "%"
python.slack.short_buffer_names = "false"
python.slack.show_buflist_presence = "true"
python.slack.show_reaction_nicks = "true"
python.slack.slack_api_token = "${config.secrets.slack-term}"
python.slack.slack_timeout = "20000"
python.slack.switch_buffer_on_join = "true"
python.slack.thread_messages_in_channel = "false"
python.slack.unfurl_auto_link_display = "both"
python.slack.unfurl_ignore_alt_text = "false"
python.slack.unhide_buffers_with_activity = "false"
'';
home.file.".weechat/weechat.conf".text = ''
#
# weechat -- weechat.conf
#
# WARNING: It is NOT recommended to edit this file by hand,
# especially if WeeChat is running.
#
# Use /set or similar command to change settings in WeeChat.
#
# For more info, see: https://weechat.org/doc/quickstart
#
[debug]
[startup]
command_after_plugins = ""
command_before_plugins = ""
display_logo = on
display_version = on
sys_rlimit = ""
[look]
align_end_of_lines = message
align_multiline_words = on
bar_more_down = "++"
bar_more_left = "<<"
bar_more_right = ">>"
bar_more_up = "--"
bare_display_exit_on_input = on
bare_display_time_format = "%H:%M"
buffer_auto_renumber = on
buffer_notify_default = all
buffer_position = end
buffer_search_case_sensitive = off
buffer_search_force_default = off
buffer_search_regex = off
buffer_search_where = prefix_message
buffer_time_format = "%H:%M:%S"
buffer_time_same = ""
color_basic_force_bold = off
color_inactive_buffer = on
color_inactive_message = on
color_inactive_prefix = on
color_inactive_prefix_buffer = on
color_inactive_time = off
color_inactive_window = on
color_nick_offline = off
color_pairs_auto_reset = 5
color_real_white = off
command_chars = ""
command_incomplete = off
confirm_quit = off
confirm_upgrade = off
day_change = on
day_change_message_1date = "-- %a, %d %b %Y --"
day_change_message_2dates = "-- %%a, %%d %%b %%Y (%a, %d %b %Y) --"
eat_newline_glitch = off
emphasized_attributes = ""
highlight = ""
highlight_regex = ""
highlight_tags = ""
hotlist_add_conditions = "''${away} || ''${buffer.num_displayed} == 0 || ''${
"info:relay_client_count,weechat,connected"
} > 0"
hotlist_buffer_separator = ", "
hotlist_count_max = 2
hotlist_count_min_msg = 2
hotlist_names_count = 3
hotlist_names_length = 0
hotlist_names_level = 12
hotlist_names_merged_buffers = off
hotlist_prefix = "H: "
hotlist_remove = merged
hotlist_short_names = on
hotlist_sort = group_time_asc
hotlist_suffix = ""
hotlist_unique_numbers = on
input_cursor_scroll = 20
input_share = none
input_share_overwrite = off
input_undo_max = 32
item_away_message = on
item_buffer_filter = "*"
item_buffer_zoom = "!"
item_mouse_status = "M"
item_time_format = "%H:%M"
jump_current_to_previous_buffer = on
jump_previous_buffer_when_closing = on
jump_smart_back_to_buffer = on
key_bind_safe = on
key_grab_delay = 800
mouse = on
mouse_timer_delay = 100
nick_color_force = ""
nick_color_hash = djb2
nick_color_stop_chars = "_|["
nick_prefix = ""
nick_suffix = ""
paste_auto_add_newline = on
paste_bracketed = on
paste_bracketed_timer_delay = 10
paste_max_lines = 1
prefix_action = " *"
prefix_align = right
prefix_align_max = 0
prefix_align_min = 0
prefix_align_more = "+"
prefix_align_more_after = on
prefix_buffer_align = right
prefix_buffer_align_max = 0
prefix_buffer_align_more = "+"
prefix_buffer_align_more_after = on
prefix_error = "=!="
prefix_join = "-->"
prefix_network = "--"
prefix_quit = "<--"
prefix_same_nick = ""
prefix_same_nick_middle = ""
prefix_suffix = "|"
quote_nick_prefix = "<"
quote_nick_suffix = ">"
quote_time_format = "%H:%M:%S"
read_marker = line
read_marker_always_show = off
read_marker_string = "- "
save_config_on_exit = on
save_config_with_fsync = off
save_layout_on_exit = none
scroll_amount = 3
scroll_bottom_after_switch = off
scroll_page_percent = 100
search_text_not_found_alert = on
separator_horizontal = "-"
separator_vertical = ""
tab_width = 1
time_format = "%a, %d %b %Y %T"
window_auto_zoom = off
window_separator_horizontal = on
window_separator_vertical = on
window_title = ""
word_chars_highlight = "!\u00A0,-,_,|,alnum"
word_chars_input = "!\u00A0,-,_,|,alnum"
[palette]
[color]
bar_more = lightmagenta
chat = default
chat_bg = default
chat_buffer = white
chat_channel = white
chat_day_change = cyan
chat_delimiters = green
chat_highlight = yellow
chat_highlight_bg = magenta
chat_host = cyan
chat_inactive_buffer = default
chat_inactive_window = default
chat_nick = lightcyan
chat_nick_colors = "cyan,magenta,green,brown,lightblue,default,lightcyan,lightmagenta,lightgreen,blue"
chat_nick_offline = default
chat_nick_offline_highlight = default
chat_nick_offline_highlight_bg = blue
chat_nick_other = cyan
chat_nick_prefix = green
chat_nick_self = white
chat_nick_suffix = green
chat_prefix_action = white
chat_prefix_buffer = brown
chat_prefix_buffer_inactive_buffer = default
chat_prefix_error = yellow
chat_prefix_join = lightgreen
chat_prefix_more = lightmagenta
chat_prefix_network = magenta
chat_prefix_quit = lightred
chat_prefix_suffix = green
chat_read_marker = magenta
chat_read_marker_bg = default
chat_server = brown
chat_tags = red
chat_text_found = yellow
chat_text_found_bg = lightmagenta
chat_time = default
chat_time_delimiters = brown
chat_value = cyan
chat_value_null = blue
emphasized = yellow
emphasized_bg = magenta
input_actions = lightgreen
input_text_not_found = red
item_away = yellow
nicklist_away = cyan
nicklist_group = green
separator = blue
status_count_highlight = magenta
status_count_msg = brown
status_count_other = default
status_count_private = green
status_data_highlight = lightmagenta
status_data_msg = yellow
status_data_other = default
status_data_private = lightgreen
status_filter = green
status_more = yellow
status_mouse = green
status_name = white
status_name_ssl = lightgreen
status_nicklist_count = default
status_number = yellow
status_time = default
[completion]
base_word_until_cursor = on
command_inline = on
default_template = "%(nicks)|%(irc_channels)"
nick_add_space = on
nick_case_sensitive = off
nick_completer = ": "
nick_first_only = off
nick_ignore_chars = "[]`_-^"
partial_completion_alert = on
partial_completion_command = off
partial_completion_command_arg = off
partial_completion_count = on
partial_completion_other = off
partial_completion_templates = "config_options"
[history]
display_default = 5
max_buffer_lines_minutes = 0
max_buffer_lines_number = 4096
max_commands = 100
max_visited_buffers = 50
[proxy]
[network]
connection_timeout = 60
gnutls_ca_file = "/etc/ssl/certs/ca-certificates.crt"
gnutls_handshake_timeout = 30
proxy_curl = ""
[plugin]
autoload = "*"
debug = off
extension = ".so,.dll"
path = "%h/plugins"
save_config_on_unload = on
[bar]
buflist.color_bg = default
buflist.color_delim = default
buflist.color_fg = default
buflist.conditions = ""
buflist.filling_left_right = vertical
buflist.filling_top_bottom = columns_vertical
buflist.hidden = off
buflist.items = "buflist"
buflist.position = left
buflist.priority = 0
buflist.separator = on
buflist.size = 0
buflist.size_max = 0
buflist.type = root
fset.color_bg = default
fset.color_delim = cyan
fset.color_fg = default
fset.conditions = "''${buffer.full_name} == fset.fset"
fset.filling_left_right = vertical
fset.filling_top_bottom = horizontal
fset.hidden = off
fset.items = "fset"
fset.position = top
fset.priority = 0
fset.separator = on
fset.size = 3
fset.size_max = 3
fset.type = window
input.color_bg = default
input.color_delim = cyan
input.color_fg = default
input.conditions = ""
input.filling_left_right = vertical
input.filling_top_bottom = horizontal
input.hidden = off
input.items = "[input_prompt]+(away),[input_search],[input_paste],input_text"
input.position = bottom
input.priority = 1000
input.separator = off
input.size = 0
input.size_max = 0
input.type = window
nicklist.color_bg = default
nicklist.color_delim = cyan
nicklist.color_fg = default
nicklist.conditions = "''${nicklist}"
nicklist.filling_left_right = vertical
nicklist.filling_top_bottom = columns_vertical
nicklist.hidden = off
nicklist.items = "buffer_nicklist"
nicklist.position = right
nicklist.priority = 200
nicklist.separator = on
nicklist.size = 0
nicklist.size_max = 0
nicklist.type = window
status.color_bg = blue
status.color_delim = cyan
status.color_fg = default
status.conditions = ""
status.filling_left_right = vertical
status.filling_top_bottom = horizontal
status.hidden = off
status.items = "[time],[buffer_last_number],[buffer_plugin],buffer_number+:+buffer_name+(buffer_modes)+{buffer_nicklist_count}+buffer_zoom+buffer_filter,scroll,[lag],[hotlist],completion"
status.position = bottom
status.priority = 500
status.separator = off
status.size = 1
status.size_max = 0
status.type = window
title.color_bg = blue
title.color_delim = cyan
title.color_fg = default
title.conditions = ""
title.filling_left_right = vertical
title.filling_top_bottom = horizontal
title.hidden = off
title.items = "buffer_title"
title.position = top
title.priority = 500
title.separator = off
title.size = 1
title.size_max = 0
title.type = window
[layout]
[notify]
[filter]
[key]
ctrl-? = "/input delete_previous_char"
ctrl-A = "/input move_beginning_of_line"
ctrl-B = "/input move_previous_char"
ctrl-C_ = "/input insert \x1F"
ctrl-Cb = "/input insert \x02"
ctrl-Cc = "/input insert \x03"
ctrl-Ci = "/input insert \x1D"
ctrl-Co = "/input insert \x0F"
ctrl-Cv = "/input insert \x16"
ctrl-D = "/input delete_next_char"
ctrl-E = "/input move_end_of_line"
ctrl-F = "/input move_next_char"
ctrl-H = "/input delete_previous_char"
ctrl-I = "/input complete_next"
ctrl-J = "/input return"
ctrl-K = "/input delete_end_of_line"
ctrl-L = "/window refresh"
ctrl-M = "/input return"
ctrl-N = "/buffer +1"
ctrl-P = "/buffer -1"
ctrl-R = "/input search_text_here"
ctrl-Sctrl-U = "/input set_unread"
ctrl-T = "/input transpose_chars"
ctrl-U = "/input delete_beginning_of_line"
ctrl-W = "/input delete_previous_word"
ctrl-X = "/input switch_active_buffer"
ctrl-Y = "/input clipboard_paste"
meta-meta-OP = "/bar scroll buflist * b"
meta-meta-OQ = "/bar scroll buflist * e"
meta-meta2-11~ = "/bar scroll buflist * b"
meta-meta2-12~ = "/bar scroll buflist * e"
meta-meta2-1~ = "/window scroll_top"
meta-meta2-23~ = "/bar scroll nicklist * b"
meta-meta2-24~ = "/bar scroll nicklist * e"
meta-meta2-4~ = "/window scroll_bottom"
meta-meta2-5~ = "/window scroll_up"
meta-meta2-6~ = "/window scroll_down"
meta-meta2-7~ = "/window scroll_top"
meta-meta2-8~ = "/window scroll_bottom"
meta-meta2-A = "/buffer -1"
meta-meta2-B = "/buffer +1"
meta-meta2-C = "/buffer +1"
meta-meta2-D = "/buffer -1"
meta-- = "/filter toggle @"
meta-/ = "/input jump_last_buffer_displayed"
meta-0 = "/buffer *10"
meta-1 = "/buffer *1"
meta-2 = "/buffer *2"
meta-3 = "/buffer *3"
meta-4 = "/buffer *4"
meta-5 = "/buffer *5"
meta-6 = "/buffer *6"
meta-7 = "/buffer *7"
meta-8 = "/buffer *8"
meta-9 = "/buffer *9"
meta-< = "/input jump_previously_visited_buffer"
meta-= = "/filter toggle"
meta-> = "/input jump_next_visited_buffer"
meta-OA = "/input history_global_previous"
meta-OB = "/input history_global_next"
meta-OC = "/input move_next_word"
meta-OD = "/input move_previous_word"
meta-OF = "/input move_end_of_line"
meta-OH = "/input move_beginning_of_line"
meta-OP = "/bar scroll buflist * -100%"
meta-OQ = "/bar scroll buflist * +100%"
meta-Oa = "/input history_global_previous"
meta-Ob = "/input history_global_next"
meta-Oc = "/input move_next_word"
meta-Od = "/input move_previous_word"
meta2-11^ = "/bar scroll buflist * -100%"
meta2-11~ = "/bar scroll buflist * -100%"
meta2-12^ = "/bar scroll buflist * +100%"
meta2-12~ = "/bar scroll buflist * +100%"
meta2-15~ = "/buffer -1"
meta2-17~ = "/buffer +1"
meta2-18~ = "/window -1"
meta2-19~ = "/window +1"
meta2-1;3A = "/buffer -1"
meta2-1;3B = "/buffer +1"
meta2-1;3C = "/buffer +1"
meta2-1;3D = "/buffer -1"
meta2-1;3F = "/window scroll_bottom"
meta2-1;3H = "/window scroll_top"
meta2-1;3P = "/bar scroll buflist * b"
meta2-1;3Q = "/bar scroll buflist * e"
meta2-1;5A = "/input history_global_previous"
meta2-1;5B = "/input history_global_next"
meta2-1;5C = "/input move_next_word"
meta2-1;5D = "/input move_previous_word"
meta2-1;5P = "/bar scroll buflist * -100%"
meta2-1;5Q = "/bar scroll buflist * +100%"
meta2-1~ = "/input move_beginning_of_line"
meta2-200~ = "/input paste_start"
meta2-201~ = "/input paste_stop"
meta2-20~ = "/bar scroll title * -30%"
meta2-21~ = "/bar scroll title * +30%"
meta2-23;3~ = "/bar scroll nicklist * b"
meta2-23;5~ = "/bar scroll nicklist * -100%"
meta2-23^ = "/bar scroll nicklist * -100%"
meta2-23~ = "/bar scroll nicklist * -100%"
meta2-24;3~ = "/bar scroll nicklist * e"
meta2-24;5~ = "/bar scroll nicklist * +100%"
meta2-24^ = "/bar scroll nicklist * +100%"
meta2-24~ = "/bar scroll nicklist * +100%"
meta2-3~ = "/input delete_next_char"
meta2-4~ = "/input move_end_of_line"
meta2-5;3~ = "/window scroll_up"
meta2-5~ = "/window page_up"
meta2-6;3~ = "/window scroll_down"
meta2-6~ = "/window page_down"
meta2-7~ = "/input move_beginning_of_line"
meta2-8~ = "/input move_end_of_line"
meta2-A = "/input history_previous"
meta2-B = "/input history_next"
meta2-C = "/input move_next_char"
meta2-D = "/input move_previous_char"
meta2-F = "/input move_end_of_line"
meta2-G = "/window page_down"
meta2-H = "/input move_beginning_of_line"
meta2-I = "/window page_up"
meta2-Z = "/input complete_previous"
meta2-[E = "/buffer -1"
meta-_ = "/input redo"
meta-a = "/input jump_smart"
meta-b = "/input move_previous_word"
meta-d = "/input delete_next_word"
meta-f = "/input move_next_word"
meta-h = "/input hotlist_clear"
meta-jmeta-f = "/buffer -"
meta-jmeta-l = "/buffer +"
meta-jmeta-r = "/server raw"
meta-jmeta-s = "/server jump"
meta-j01 = "/buffer *1"
meta-j02 = "/buffer *2"
meta-j03 = "/buffer *3"
meta-j04 = "/buffer *4"
meta-j05 = "/buffer *5"
meta-j06 = "/buffer *6"
meta-j07 = "/buffer *7"
meta-j08 = "/buffer *8"
meta-j09 = "/buffer *9"
meta-j10 = "/buffer *10"
meta-j11 = "/buffer *11"
meta-j12 = "/buffer *12"
meta-j13 = "/buffer *13"
meta-j14 = "/buffer *14"
meta-j15 = "/buffer *15"
meta-j16 = "/buffer *16"
meta-j17 = "/buffer *17"
meta-j18 = "/buffer *18"
meta-j19 = "/buffer *19"
meta-j20 = "/buffer *20"
meta-j21 = "/buffer *21"
meta-j22 = "/buffer *22"
meta-j23 = "/buffer *23"
meta-j24 = "/buffer *24"
meta-j25 = "/buffer *25"
meta-j26 = "/buffer *26"
meta-j27 = "/buffer *27"
meta-j28 = "/buffer *28"
meta-j29 = "/buffer *29"
meta-j30 = "/buffer *30"
meta-j31 = "/buffer *31"
meta-j32 = "/buffer *32"
meta-j33 = "/buffer *33"
meta-j34 = "/buffer *34"
meta-j35 = "/buffer *35"
meta-j36 = "/buffer *36"
meta-j37 = "/buffer *37"
meta-j38 = "/buffer *38"
meta-j39 = "/buffer *39"
meta-j40 = "/buffer *40"
meta-j41 = "/buffer *41"
meta-j42 = "/buffer *42"
meta-j43 = "/buffer *43"
meta-j44 = "/buffer *44"
meta-j45 = "/buffer *45"
meta-j46 = "/buffer *46"
meta-j47 = "/buffer *47"
meta-j48 = "/buffer *48"
meta-j49 = "/buffer *49"
meta-j50 = "/buffer *50"
meta-j51 = "/buffer *51"
meta-j52 = "/buffer *52"
meta-j53 = "/buffer *53"
meta-j54 = "/buffer *54"
meta-j55 = "/buffer *55"
meta-j56 = "/buffer *56"
meta-j57 = "/buffer *57"
meta-j58 = "/buffer *58"
meta-j59 = "/buffer *59"
meta-j60 = "/buffer *60"
meta-j61 = "/buffer *61"
meta-j62 = "/buffer *62"
meta-j63 = "/buffer *63"
meta-j64 = "/buffer *64"
meta-j65 = "/buffer *65"
meta-j66 = "/buffer *66"
meta-j67 = "/buffer *67"
meta-j68 = "/buffer *68"
meta-j69 = "/buffer *69"
meta-j70 = "/buffer *70"
meta-j71 = "/buffer *71"
meta-j72 = "/buffer *72"
meta-j73 = "/buffer *73"
meta-j74 = "/buffer *74"
meta-j75 = "/buffer *75"
meta-j76 = "/buffer *76"
meta-j77 = "/buffer *77"
meta-j78 = "/buffer *78"
meta-j79 = "/buffer *79"
meta-j80 = "/buffer *80"
meta-j81 = "/buffer *81"
meta-j82 = "/buffer *82"
meta-j83 = "/buffer *83"
meta-j84 = "/buffer *84"
meta-j85 = "/buffer *85"
meta-j86 = "/buffer *86"
meta-j87 = "/buffer *87"
meta-j88 = "/buffer *88"
meta-j89 = "/buffer *89"
meta-j90 = "/buffer *90"
meta-j91 = "/buffer *91"
meta-j92 = "/buffer *92"
meta-j93 = "/buffer *93"
meta-j94 = "/buffer *94"
meta-j95 = "/buffer *95"
meta-j96 = "/buffer *96"
meta-j97 = "/buffer *97"
meta-j98 = "/buffer *98"
meta-j99 = "/buffer *99"
meta-k = "/go"
meta-l = "/window bare"
meta-m = "/mute mouse toggle"
meta-n = "/window scroll_next_highlight"
meta-p = "/window scroll_previous_highlight"
meta-r = "/input delete_line"
meta-s = "/mute aspell toggle"
meta-u = "/window scroll_unread"
meta-wmeta-meta2-A = "/window up"
meta-wmeta-meta2-B = "/window down"
meta-wmeta-meta2-C = "/window right"
meta-wmeta-meta2-D = "/window left"
meta-wmeta2-1;3A = "/window up"
meta-wmeta2-1;3B = "/window down"
meta-wmeta2-1;3C = "/window right"
meta-wmeta2-1;3D = "/window left"
meta-wmeta-b = "/window balance"
meta-wmeta-s = "/window swap"
meta-x = "/input zoom_merged_buffer"
meta-z = "/window zoom"
ctrl-_ = "/input undo"
[key_search]
ctrl-I = "/input search_switch_where"
ctrl-J = "/input search_stop_here"
ctrl-M = "/input search_stop_here"
ctrl-Q = "/input search_stop"
ctrl-R = "/input search_switch_regex"
meta2-A = "/input search_previous"
meta2-B = "/input search_next"
meta-c = "/input search_switch_case"
[key_cursor]
ctrl-J = "/cursor stop"
ctrl-M = "/cursor stop"
meta-meta2-A = "/cursor move area_up"
meta-meta2-B = "/cursor move area_down"
meta-meta2-C = "/cursor move area_right"
meta-meta2-D = "/cursor move area_left"
meta2-1;3A = "/cursor move area_up"
meta2-1;3B = "/cursor move area_down"
meta2-1;3C = "/cursor move area_right"
meta2-1;3D = "/cursor move area_left"
meta2-A = "/cursor move up"
meta2-B = "/cursor move down"
meta2-C = "/cursor move right"
meta2-D = "/cursor move left"
@chat(python.*):D = "hsignal:slack_cursor_delete"
@chat(python.*):L = "hsignal:slack_cursor_linkarchive"
@chat(python.*):M = "hsignal:slack_cursor_message"
@chat(python.*):R = "hsignal:slack_cursor_reply"
@chat(python.*):T = "hsignal:slack_cursor_thread"
@item(buffer_nicklist):K = "/window ''${_window_number};/kickban ''${nick}"
@item(buffer_nicklist):b = "/window ''${_window_number};/ban ''${nick}"
@item(buffer_nicklist):k = "/window ''${_window_number};/kick ''${nick}"
@item(buffer_nicklist):q = "/window ''${_window_number};/query ''${nick};/cursor stop"
@item(buffer_nicklist):w = "/window ''${_window_number};/whois ''${nick}"
@chat:Q = "hsignal:chat_quote_time_prefix_message;/cursor stop"
@chat:m = "hsignal:chat_quote_message;/cursor stop"
@chat:q = "hsignal:chat_quote_prefix_message;/cursor stop"
[key_mouse]
@bar(buflist):ctrl-wheeldown = "hsignal:buflist_mouse"
@bar(buflist):ctrl-wheelup = "hsignal:buflist_mouse"
@bar(input):button2 = "/input grab_mouse_area"
@bar(nicklist):button1-gesture-down = "/bar scroll nicklist ''${_window_number} +100%"
@bar(nicklist):button1-gesture-down-long = "/bar scroll nicklist ''${_window_number} e"
@bar(nicklist):button1-gesture-up = "/bar scroll nicklist ''${_window_number} -100%"
@bar(nicklist):button1-gesture-up-long = "/bar scroll nicklist ''${_window_number} b"
@chat(fset.fset):button1 = "/window ''${_window_number};/fset -go ''${_chat_line_y}"
@chat(fset.fset):button2* = "hsignal:fset_mouse"
@chat(fset.fset):wheeldown = "/fset -down 5"
@chat(fset.fset):wheelup = "/fset -up 5"
@chat(python.*):button2 = "hsignal:slack_mouse"
@chat(script.scripts):button1 = "/window ''${_window_number};/script go ''${_chat_line_y}"
@chat(script.scripts):button2 = "/window ''${_window_number};/script go ''${_chat_line_y};/script installremove -q ''${script_name_with_extension}"
@chat(script.scripts):wheeldown = "/script down 5"
@chat(script.scripts):wheelup = "/script up 5"
@item(buffer_nicklist):button1 = "/window ''${_window_number};/query ''${nick}"
@item(buffer_nicklist):button1-gesture-left = "/window ''${_window_number};/kick ''${nick}"
@item(buffer_nicklist):button1-gesture-left-long = "/window ''${_window_number};/kickban ''${nick}"
@item(buffer_nicklist):button2 = "/window ''${_window_number};/whois ''${nick}"
@item(buffer_nicklist):button2-gesture-left = "/window ''${_window_number};/ban ''${nick}"
@item(buflist):button1* = "hsignal:buflist_mouse"
@item(buflist):button2* = "hsignal:buflist_mouse"
@item(buflist2):button1* = "hsignal:buflist_mouse"
@item(buflist2):button2* = "hsignal:buflist_mouse"
@item(buflist3):button1* = "hsignal:buflist_mouse"
@item(buflist3):button2* = "hsignal:buflist_mouse"
@bar:wheeldown = "/bar scroll ''${_bar_name} ''${_window_number} +20%"
@bar:wheelup = "/bar scroll ''${_bar_name} ''${_window_number} -20%"
@chat:button1 = "/window ''${_window_number}"
@chat:button1-gesture-left = "/window ''${_window_number};/buffer -1"
@chat:button1-gesture-left-long = "/window ''${_window_number};/buffer 1"
@chat:button1-gesture-right = "/window ''${_window_number};/buffer +1"
@chat:button1-gesture-right-long = "/window ''${_window_number};/input jump_last_buffer"
@chat:ctrl-wheeldown = "/window scroll_horiz -window ''${_window_number} +10%"
@chat:ctrl-wheelup = "/window scroll_horiz -window ''${_window_number} -10%"
@chat:wheeldown = "/window scroll_down -window ''${_window_number}"
@chat:wheelup = "/window scroll_up -window ''${_window_number}"
@*:button3 = "/cursor go ''${_x},''${_y}"
'';
home.packages = [ weechat ];
xsession.windowManager.i3.config.startup = [{
command =
"${config.defaultApplications.term.cmd} -e ${weechat}/bin/weechat";
}];
};
}

View File

@ -0,0 +1,15 @@
{ pkgs, config, lib, ... }: {
home-manager.users.balsoft = lib.mkIf (config.deviceSpecific.goodMachine) {
home.file.".yt.yaml".text = builtins.toJSON {
yt-token = config.secrets.yt-utilities.token;
user = config.secrets.yt-utilities.user;
from = {
org = "/home/balsoft/cloud/Google Drive/serokell.org";
full-file = true;
};
since = "1997-11-19";
severity = "Info";
};
home.packages = [ pkgs.yt-utilities ];
};
}

45
modules/default.nix Executable file
View File

@ -0,0 +1,45 @@
device:
{ pkgs, lib, ... }: {
imports = [
./applications/packages.nix
./applications/emacs
./applications/konsole.nix
./applications/trojita.nix
./applications/weechat.nix
./applications/okular.nix
./applications/yt-utilities.nix
./applications/firefox.nix
./workspace/autofs.nix
./workspace/i3
./workspace/i3blocks
./workspace/zsh.nix
./workspace/gtk.nix
./workspace/misc.nix
./workspace/kde
./workspace/ssh.nix
./workspace/locale.nix
./workspace/fonts.nix
./workspace/light.nix
./workspace/mako.nix
./workspace/mopidy.nix
./workspace/gcalcli.nix
./workspace/rclone.nix
./workspace/xresources.nix
./themes.nix
./applications.nix
./secrets.nix
./devices.nix
./packages.nix
./users.nix
./hardware.nix
./services.nix
./power.nix
./network.nix
] ++ lib.optionals (device == "AMD-Workstation") [
./mailserver.nix
./matrix-synapse.nix
./workspace/kanshi.nix
./openvpn.nix
./nginx.nix
];
}

112
modules/devices.nix Normal file
View File

@ -0,0 +1,112 @@
{ pkgs, lib, config, ... }:
with lib;
with types; {
options = {
device = mkOption { type = strMatching "[A-z|0-9]*-(Laptop|Workstation|VM)"; };
devices = mkOption { type = attrs; };
deviceSpecific = mkOption { type = attrs; };
};
config = {
deviceSpecific = let
device = config.device;
devInfo = config.devices.${config.device};
in rec {
isLaptop = (!isNull (builtins.match ".*Laptop" device));
smallScreen = (device == "Prestigio-Laptop");
isShared = device == "Lenovo-Workstation";
cpu = devInfo.cpu.vendor;
inherit devInfo;
isSSD = devInfo.drive.type == "ssd";
# Whether machine is powerful enough for heavy stuff
goodMachine = devInfo.cpu.clock * devInfo.cpu.cores >= 4000
&& devInfo.drive.size >= 100 && devInfo.ram >= 8;
isHost = isSSD;
bigScreen = devInfo ? bigScreen;
};
devices = {
T490s-Laptop = {
cpu = {
vendor = "intel";
clock = 4600;
cores = 4;
};
drive = {
type = "ssd";
speed = 2000;
size = 250;
};
ram = 16;
};
T420-Laptop = {
legacy = false;
cpu = {
vendor = "intel";
clock = 2500;
cores = 2;
};
drive = {
type = "ssd";
speed = 1000;
size = 120;
};
ram = 8;
};
Lenovo-Workstation = {
legacy = true;
cpu = {
vendor = "intel";
clock = 2500;
cores = 2;
};
drive = {
type = "ssd";
speed = 250;
size = 120;
};
ram = 8;
};
AMD-Workstation = {
cpu = {
vendor = "amd";
clock = 4200;
cores = 8;
};
drive = {
type = "ssd";
speed = 6000;
size = 250;
};
bigScreen = true;
ram = 32;
};
Prestigio-Laptop = {
cpu = {
vendor = "intel";
clock = 1400;
cores = 2;
};
drive = {
type = "flash";
speed = 100;
size = 32;
};
ram = 2;
};
NixOS-VM = {
cpu = {
vendor = "intel";
clock = 1000;
cores = 1;
};
drive = {
type = "ssd";
speed = 50;
size = 1;
};
ram = 4;
};
};
};
}

149
modules/hardware.nix Normal file
View File

@ -0,0 +1,149 @@
{ pkgs, config, lib, ... }:
with rec { inherit (config) device devices deviceSpecific; };
with deviceSpecific; {
hardware.sensor.iio.enable = (device == "HP-Laptop");
hardware.cpu.${devices.${device}.cpu.vendor}.updateMicrocode =
true; # Update microcode
hardware.enableRedistributableFirmware = true; # For some unfree drivers
hardware.opengl.enable = true;
hardware.opengl.driSupport = true;
hardware.opengl.driSupport32Bit = true; # For steam
hardware.bluetooth.enable = true;
hardware.bluetooth.package = pkgs.bluezFull;
hardware.sane.enable = true;
services.throttled = {
enable = device == "T490s-Laptop";
extraConfig = ''
[GENERAL]
# Enable or disable the script execution
Enabled: True
# SYSFS path for checking if the system is running on AC power
Sysfs_Power_Path: /sys/class/power_supply/AC*/online
## Settings to apply while connected to Battery power
[BATTERY]
# Update the registers every this many seconds
Update_Rate_s: 30
# Max package power for time window #1
PL1_Tdp_W: 29
# Time window #1 duration
PL1_Duration_s: 28
# Max package power for time window #2
PL2_Tdp_W: 44
# Time window #2 duration
PL2_Duration_S: 0.002
# Max allowed temperature before throttling
Trip_Temp_C: 85
# Set cTDP to normal=0, down=1 or up=2 (EXPERIMENTAL)
cTDP: 1
## Settings to apply while connected to AC power
[AC]
# Update the registers every this many seconds
Update_Rate_s: 5
# Max package power for time window #1
PL1_Tdp_W: 44
# Time window #1 duration
PL1_Duration_s: 28
# Max package power for time window #2
PL2_Tdp_W: 44
# Time window #2 duration
PL2_Duration_S: 0.002
# Max allowed temperature before throttling
Trip_Temp_C: 95
# Set HWP energy performance hints to 'performance' on high load (EXPERIMENTAL)
HWP_Mode: True
# Set cTDP to normal=0, down=1 or up=2 (EXPERIMENTAL)
cTDP: 2
[UNDERVOLT]
# CPU core voltage offset (mV)
CORE: -200
# Integrated GPU voltage offset (mV)
GPU: -60
# CPU cache voltage offset (mV)
CACHE: -50
# System Agent voltage offset (mV)
UNCORE: 0
# Analog I/O voltage offset (mV)
ANALOGIO: 0
'';
};
systemd.services.thinkpad_leds = {
enable = config.device == "T490s-Laptop";
description = "Set up thinkpad leds";
wantedBy = [ "multi-user.target" ];
script = ''
modprobe -r ec_sys
modprobe ec_sys write_support=1
echo -n -e "\x0e" | dd of="/sys/kernel/debug/ec/ec0/io" bs=1 seek=12 count=1 conv=notrunc 2> /dev/null
modprobe -r ec_sys
'';
serviceConfig.Type = "oneshot";
};
boot = {
loader = {
grub.enable = true;
grub.version = 2;
grub.useOSProber = true;
timeout = 1;
} // (if deviceSpecific.devInfo.legacy or false then { # Non-UEFI config
grub.device = "/dev/sda";
} else { # UEFI config
grub.efiSupport = true;
grub.device = "nodev";
grub.efiInstallAsRemovable = true; # NVRAM is unreliable
});
consoleLogLevel = 3;
blacklistedKernelModules = lib.optionals (device == "Prestigio-Laptop") [
"axp288_charger"
"axp288_fuel_gauge"
"axp288_adc"
]; # Disable battery driver as it hangs this piece of shit
extraModulePackages = [ pkgs.linuxPackages.v4l2loopback ];
extraModprobeConfig = if (device == "ASUS-Laptop") then
"options iwlwifi swcrypto=1 power_save=0 power_level=5 11n_disable=8 bt_coex_active=1"
else
""; # Attempt to fix broken wireless
kernel.sysctl."vm.swappiness" = 0;
kernelPackages = pkgs.linuxPackages;
kernel.sysctl."kernel/sysrq" = 1;
kernelParams = [
"quiet"
"scsi_mod.use_blk_mq=1"
"modeset"
"nofb"
"rd.systemd.show_status=auto"
"rd.udev.log_priority=3"
"pti=off"
"spectre_v2=off"
] ++ lib.optionals (device == "Prestigio-Laptop") [
"intel_idle.max_cstate=1" # Otherwise it hangs
];
};
services.logind.lidSwitchExternalPower = "ignore";
services.logind.extraConfig = "HandlePowerKey=suspend";
sound.enable = true;
hardware.pulseaudio = {
enable = true;
package = pkgs.pulseaudioFull;
support32Bit = true;
# systemWide = true;
extraConfig = ''
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1
'';
extraModules = [ pkgs.pulseaudio-modules-bt ];
};
services.dbus.packages = [ pkgs.blueman ];
}

29
modules/mailserver.nix Normal file
View File

@ -0,0 +1,29 @@
{ pkgs, config, lib, ... }:
let
module = toString (import ../nix/sources.nix).simple-nixos-mailserver;
readCommandResult = command:
builtins.readFile (pkgs.runCommand "cmd" { preferLocalBuild = true; }
"echo -n $(${command}) > $out");
hashedPassword = readCommandResult
"${pkgs.mkpasswd}/bin/mkpasswd -m sha-512 '${config.secrets.mail.password}'";
in {
imports = [ module ];
mailserver = {
enable = true;
fqdn = config.secrets.mail.host;
domains = [ config.secrets.mail.host ];
loginAccounts = {
"balsoft@balsoft.ru" = {
aliases = [ "balsoft" ];
inherit hashedPassword;
};
};
localDnsResolver = false;
certificateScheme = 1;
certificateFile = builtins.toFile "balsoft.crt" config.secrets.ssl.cert;
keyFile = builtins.toFile "balsoft.key" config.secrets.ssl.priv;
enableImap = true;
enableImapSsl = true;
virusScanning = false;
};
}

122
modules/matrix-synapse.nix Normal file
View File

@ -0,0 +1,122 @@
{ pkgs, config, lib, ... }: {
services.matrix-synapse = {
enable = true;
allow_guest_access = true;
listeners = [{
bind_address = "0.0.0.0";
port = 13748;
resources = [
{
compress = true;
names = [ "client" ];
}
{
compress = false;
names = [ "federation" ];
}
];
tls = true;
type = "http";
x_forwarded = false;
}];
registration_shared_secret = config.secrets.matrix.shared_secret;
public_baseurl = "https://balsoft.ru:13748/";
server_name = "balsoft.ru";
tls_certificate_path = toString (pkgs.writeTextFile {
name = "matrix.crt";
text = config.secrets.ssl.cert;
});
tls_private_key_path = toString (pkgs.writeTextFile {
name = "matrix_rsa";
text = config.secrets.ssl.priv;
});
app_service_config_files = [
(builtins.toFile "registration_tg.yaml"
(builtins.toJSON config.secrets.matrix.mautrix-telegram.registration))
(builtins.toFile "registration_wa.yaml"
(builtins.toJSON config.secrets.matrix.mautrix-whatsapp.registration))
];
};
systemd.services.whatsapp-vm = {
description = "Android VM with WhatsApp";
wantedBy = [ "multi-user.target" ];
requires = [ "network-online.target" ];
preStart = "mkdir -p /var/lib/whatsapp";
path = [ pkgs.coreutils ];
serviceConfig = {
Restart = "always";
RestartSec = 1;
TimeoutStartSec = "60";
Type = "forking";
};
script = ''
NIX_ANDROID_EMULATOR_FLAGS="-no-audio -no-window -read-only" ${
with import (import ../nix/sources.nix).nixpkgs {
config.android_sdk.accept_license = true;
};
androidenv.emulateApp {
name = "WhatsApp";
app = fetchurl {
name = "WhatsApp.apk";
url =
"https://scontent.whatsapp.net/v/t61/69881048_788414318339970_5200101795019358208_n.apk/WhatsApp.apk?_nc_ohc=KuY9gcFeMBEAX_CssFG&_nc_ht=scontent.whatsapp.net&oh=ccfa509a03cd16f148e62b2ee5aa47cc&oe=5E3F4CBC";
sha256 = "1gc4lilpf2gaa61hbqiafnhqy3xvcnvjr6bmyb59cmmx8b4zmql1";
};
platformVersion = "18";
abiVersion = "x86";
package = "com.whatsapp";
activity = ".HomeActivity";
avdHomeDir = "/var/lib/whatsapp";
}
}/bin/run-test-emulator
'';
};
systemd.services.mautrix-whatsapp = {
description = "A bridge between whatsapp and matrix";
path = with pkgs; [ coreutils mautrix-whatsapp ];
wantedBy = [ "multi-user.target" ];
requires = [
"matrix-synapse.service"
"whatsapp-vm.service"
"network-online.target"
];
serviceConfig = {
Restart = "always";
RestartSec = 1;
};
script = ''
mkdir -p /var/lib/mautrix-whatsapp
cd /var/lib/mautrix-whatsapp
sleep 5
timeout 900 mautrix-whatsapp -c ${
builtins.toFile "config_wa.yaml"
(builtins.toJSON config.secrets.matrix.mautrix-whatsapp.config)
}
'';
};
systemd.services.mautrix-telegram = {
description = "A bridge between telegram and matrix";
requires = [ "matrix-synapse.service" "openvpn-client.service" ];
path = with pkgs; [ coreutils mautrix-telegram ];
serviceConfig = {
Restart = "always";
RestartSec = 1;
};
wantedBy = [ "network-online.target" ];
script = ''
mkdir -p /var/lib/mautrix-telegram
cp -r ${pkgs.mautrix-telegram}/* /var/lib/mautrix-telegram
cd /var/lib/mautrix-telegram
alembic upgrade head || echo "update failed"
sleep 5
cp ${
builtins.toFile "config.yaml"
(builtins.toJSON config.secrets.matrix.mautrix-telegram.config)
} ./config.yaml
timeout 900 mautrix-telegram
'';
};
users.users.matrix-synapse.name = lib.mkForce "matrix-synapse";
}

14
modules/mpd-mpris.patch Normal file
View File

@ -0,0 +1,14 @@
diff --git a/mpd/file.go b/mpd/file.go
index 340338e..b0d6634 100644
--- a/mpd/file.go
+++ b/mpd/file.go
@@ -67,6 +67,9 @@ func FileFromAttrs(attr mpd.Attrs) (s File, err error) {
// metadata field
durationF := 0.0
p.Float("duration", &durationF, true)
+ if durationF == 0.0 {
+ p.Float("Time", &durationF, true)
+ }
s.Duration = time.Duration(durationF * float64(time.Second))
err = p.Err

27
modules/network.nix Normal file
View File

@ -0,0 +1,27 @@
{ pkgs, lib, config, ... }: {
networking = {
networkmanager.enable = true;
firewall = {
enable = true;
allowedTCPPorts = [ 13748 13722 5000 22 80 443 ];
allowedTCPPortRanges = [{
from = 1714;
to = 1764;
}];
allowedUDPPortRanges = [{
from = 1714;
to = 1764;
}];
};
resolvconf.extraConfig = ''
local_nameservers=""
name_server_blacklist="0.0.0.0 127.0.0.1"
resolv_conf_local_only=NO
'';
usePredictableInterfaceNames = false;
hostName = config.device;
};
systemd.services.ModemManager.wantedBy =
lib.optional (config.device == "ThinkPad-Laptop") "network.target";
}

30
modules/nginx.nix Normal file
View File

@ -0,0 +1,30 @@
{ pkgs, config, lib, ... }: {
services.nginx = {
enable = true;
appendHttpConfig = "charset utf-8;";
virtualHosts = let
default = {
forceSSL = true;
enableACME = true;
};
in {
"balsoft.ru" = {
locations."/" = { root = "/var/lib/balsoft.ru"; index = "index.txt"; };
enableACME = true;
addSSL = true;
};
"cache.balsoft.ru" = {
locations."/" = { proxyPass = "http://localhost:5000"; };
} // default;
"matrix.balsoft.ru" = {
locations."/" = { proxyPass = "https://localhost:13748"; };
} // default;
"mai.balsoft.ru" = {
locations."/" = { root = "/var/lib/important"; };
} // default;
"share.balsoft.ru" = {
locations."/" = { root = "/var/lib/share"; };
} // default;
};
};
}

92
modules/openvpn.nix Normal file
View File

@ -0,0 +1,92 @@
{ pkgs, config, lib, ... }:
{
services.openvpn = {
servers = {
client = {
config = ''
proto tcp-client
remote cz2.getstaticip.com 443 # non-stadard port for OpenVPN
dev tun
nobind
persist-key
tls-client
remote-cert-tls server
#uncomment following line and comment verify-x509-name line if older OpenVPN version is installed on your device
#tls-remote eu3.finevpn.com
verify-x509-name eu3.finevpn.com name
verb 3
cipher AES-256-CBC
auth SHA1
pull
auth-user-pass
#if connection is terminated, it will attempt to connect without promting username and pass
auth-retry nointeract
# redirect-gateway def1
#dhcp-option DNS 8.8.8.8
#dhcp-option DNS 8.8.4.4
route 149.154.160.0 255.255.240.0
route 149.154.164.0 255.255.252.0
route 91.108.4.0 255.255.252.0
route 91.108.56.0 255.255.252.0
route 91.108.8.0 255.255.252.0
<ca>
-----BEGIN CERTIFICATE-----
MIIEyzCCA7OgAwIBAgIJAKPYkg7opAaCMA0GCSqGSIb3DQEBCwUAMIGaMQswCQYD
VQQGEwJDWjEVMBMGA1UECBMMVXN0ZWNreSBLcmFqMRcwFQYDVQQHEw5Vc3RpIG5h
ZCBMYWJlbTEUMBIGA1UEChMLRmluZVZQTi5jb20xCzAJBgNVBAsTAklUMRcwFQYD
VQQDEw5GaW5lVlBOLmNvbSBDQTEfMB0GCSqGSIb3DQEJARYQaW5mb0BmaW5ldnBu
LmNvbTAeFw0xODAyMjYxMjIzMzVaFw0yODAyMjQxMjIzMzVaMIGaMQswCQYDVQQG
EwJDWjEVMBMGA1UECBMMVXN0ZWNreSBLcmFqMRcwFQYDVQQHEw5Vc3RpIG5hZCBM
YWJlbTEUMBIGA1UEChMLRmluZVZQTi5jb20xCzAJBgNVBAsTAklUMRcwFQYDVQQD
Ew5GaW5lVlBOLmNvbSBDQTEfMB0GCSqGSIb3DQEJARYQaW5mb0BmaW5ldnBuLmNv
bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALyWG6suxMedT1coO5Gc
F/lTCARRK3vh6I5HWb9Rhbxq0fkxHn8vp3haHX2uJXf/udv7wR43Z+1p+nhdwGMD
5rNUVf7AqSYAWprWI4GB5twuYQnh+Iqoj+T527WlYG0kEl47W0Yk/8EortcQtCg7
yvM4+CF5LC9Kfy1rWGtcxWohYSw4KrDRbL8EVE7cJSGC/Mxphkfe3Vwop+Moa9ww
b9USOocxHzI2hGq9M0hNtXUcMxwzhNVek+4JEKTm5cf28X0DIPvVOLRFbUBHAYXA
L0/WqkZiW8A56h6Agwg8dgm7n9qsHY51A36Es5X05QVaL0XCJ7pVDQzDkkejTZpZ
cl8CAwEAAaOCARAwggEMMB0GA1UdDgQWBBTb+GbEL1EZefoHABF/VZsw5UGy6zCB
zwYDVR0jBIHHMIHEgBTb+GbEL1EZefoHABF/VZsw5UGy66GBoKSBnTCBmjELMAkG
A1UEBhMCQ1oxFTATBgNVBAgTDFVzdGVja3kgS3JhajEXMBUGA1UEBxMOVXN0aSBu
YWQgTGFiZW0xFDASBgNVBAoTC0ZpbmVWUE4uY29tMQswCQYDVQQLEwJJVDEXMBUG
A1UEAxMORmluZVZQTi5jb20gQ0ExHzAdBgkqhkiG9w0BCQEWEGluZm9AZmluZXZw
bi5jb22CCQCj2JIO6KQGgjAMBgNVHRMEBTADAQH/MAsGA1UdDwQEAwIBBjANBgkq
hkiG9w0BAQsFAAOCAQEANZNy+OEKNoAFNo0TjBCCyaXL6Pr3rD++I8C2X6QtGY1E
+754H3h4/vfSDMZFT8QvVrfOXnYrN+anjM5wGXLuYlECZ69zaINdkA5NCjoFSnhG
EnArMcDeOfuCJJEIN9hsILvRdS+WW/UrMjF/minrACAAnwQInB0AVXinglzqvnYf
WOogFS9WvQeNn+moWzEkpBipdpXn7flgrPQsU29kK8HEI3bek2YRJoCjhe5S3rGB
73mS0NORGcpDwlUuQeU54Qtl9i/cs6PrbGia9AvrKcHipLJC9dTq1mMKvmEupDBm
DtHIEdmbuqGBHTJvKERSSdPiqfwUP11hfXyCfoty5g==
-----END CERTIFICATE-----
</ca>
'';
up = ''
ip route delete 0.0.0.0/1
ip route delete 128.0.0.0/1
ip route add table 42 default via 93.190.51.91
# When we recieve traffic from our VPN ip, reply to it there
ip rule add from 93.190.51.91 table 42
# Also send all smtp traffic via VPN ip
ip rule add dport 25 table 42
ip rule add dport 465 table 42
ip rule add dport 587 table 42
'';
authUserPass.username = config.secrets.openvpn.user;
authUserPass.password = config.secrets.openvpn.password;
};
};
};
}

193
modules/packages.nix Normal file
View File

@ -0,0 +1,193 @@
let
imports = import ../nix/sources.nix;
new = import imports.nixpkgs-unstable { config.allowUnfree = true; };
filterGit =
builtins.filterSource (type: name: name != ".git" || type != "directory");
old = import imports.nixpkgs-old { };
in { pkgs, config, lib, ... }: {
nixpkgs.overlays = [
(self: super:
rec {
inherit imports;
unstable = new;
nur = (import imports.NUR { pkgs = old; }).repos;
inherit (nur.balsoft.pkgs) termNote lambda-launcher nix-patch;
nixfmt = self.callPackage imports.nixfmt { };
inherit (import imports.niv { }) niv;
all-hies = import imports.all-hies { };
firefox-wayland = old.firefox-wayland.overrideAttrs (oa: {
meta = oa.meta // { platforms = [ "x86_64-linux" ]; };
});
yt-utilities =
import (self.fetchgit config.secrets.yt-utilities.source) { };
mtxclient = super.mtxclient.overrideAttrs (oa: rec {
name = "${pname}-${version}";
buildInputs = with self; [
boost170
nlohmann_json
openssl
zlib
libsodium
olm
];
pname = "mtxclient";
cmakeFlags = oa.cmakeFlags ++ [
"-DBoost_NO_BOOST_CMAKE=ON"
"-DBoost_LIBRARY_DIR_RELEASE=${pkgs.boost170}"
];
version = "0.3.0";
src = imports.mtxclient;
});
nheko = super.nheko.overrideAttrs (oa: rec {
name = "${pname}-${version}";
buildInputs = with self; [
nlohmann_json
qt5.qtquickcontrols2
mtxclient
olm
boost170
lmdb
spdlog
cmark
qt5.qtbase
qt5.qtmultimedia
qt5.qttools
qt5.qtgraphicaleffects
];
cmakeFlags = oa.cmakeFlags ++ [
"-DBUILD_SHARED_LIBS=ON"
"-DBoost_NO_BOOST_CMAKE=ON"
"-DBoost_LIBRARY_DIR_RELEASE=${pkgs.boost170}"
];
pname = "nheko";
version = "0.7.0";
src = imports.nheko;
});
sway-unwrapped = (new.sway-unwrapped.override { wlroots = wlroots'; }).overrideAttrs
(oa: rec {
name = "${pname}-${version}";
pname = "sway";
version = "master";
patches = [ ];
src = imports.sway;
});
wlroots' = new.wlroots.overrideAttrs (oa: rec {
name = "${pname}-${version}";
outputs = [ "out" ];
postFixup = "true";
postInstall = "true";
pname = "wlroots";
patches = [ ];
version = "master";
src = imports.wlroots;
});
wl-clipboard = new.wl-clipboard.overrideAttrs (oa: rec {
name = "${pname}-${version}";
pname = "wl-clipboard";
version = "master";
src = imports.wl-clipboard;
});
inherit (new) kanshi mautrix-whatsapp;
nerdfonts = nur.balsoft.pkgs.roboto-mono-nerd;
mopidy = super.mopidy.overridePythonAttrs (oa: {
src = imports.mopidy;
propagatedBuildInputs = with self.pythonPackages; [
gst-python
pygobject3
pykka2
tornado_4
requests
setuptools
dbus-python
protobuf
];
});
mopidy-youtube = super.mopidy-youtube.overridePythonAttrs (oa: {
propagatedBuildInputs = oa.propagatedBuildInputs
++ (with self.pythonPackages; [ cachetools requests-cache ]);
src = imports.mopidy-youtube;
});
mopidy-gmusic = super.mopidy-gmusic.overridePythonAttrs (oa: {
propagatedBuildInputs = oa.propagatedBuildInputs ++ [ self.pythonPackages.protobuf ];
});
mpd-mpris = super.mpd-mpris.overrideAttrs (oa: {
patches = [ ./mpd-mpris.patch ];
});
mautrix-telegram = old.mautrix-telegram;
pythonPackages = super.pythonPackages.override {
overrides = (self: super: {
pykka2 = super.pykka.overridePythonAttrs (oa: {
src = imports.pykka;
version = "2.0.1";
name = "pykka-2.0.1";
});
backports_functools_lru_cache =
super.backports_functools_lru_cache.overrideAttrs
(oldAttrs: oldAttrs // { meta.priority = 1000; });
});
};
ebtables = old.ebtables;
} // (if config.device == "Prestigio-Laptop" then {
grub2 = super.pkgsi686Linux.grub2;
} else
{ }))
];
nixpkgs.pkgs = import imports.nixpkgs {
config.allowUnfree = true;
config.android_sdk.accept_license = true;
config.firefox.enablePlasmaBrowserIntegration = true;
} // config.nixpkgs.config;
systemd.services.setup_root = {
serviceConfig.User = "root";
script = ''
mkdir -p /root/.ssh
cat << EOF > /root/.ssh/id_rsa
${config.secrets.id_rsa}
EOF
chmod 100 /root/.ssh/id_rsa
'';
};
environment.etc.nixpkgs.source = imports.nixpkgs;
nix = rec {
nixPath = lib.mkForce [
"nixpkgs=/etc/nixpkgs"
"nixos-config=/etc/nixos/configuration.nix"
];
binaryCaches = [
"https://cache.nixos.org"
"https://all-hies.cachix.org"
"https://cache.balsoft.ru"
];
trustedUsers = [ "root" "balsoft" "@wheel" ];
optimise.automatic = true;
binaryCachePublicKeys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"all-hies.cachix.org-1:JjrzAOEUsD9ZMt8fdFbzo3jNAyEWlPAwdVuHw4RD43k="
];
};
}

55
modules/power.nix Normal file
View File

@ -0,0 +1,55 @@
{ config, pkgs, lib, ... }:
with rec {
inherit (config) device devices deviceSpecific;
};
with deviceSpecific; {
services.udev.extraRules = if isLaptop then
''
ACTION=="add|change", KERNEL=="sd*[!0-9]|sr*", ATTR{queue/scheduler}="bfq"
ACTION=="change", SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="${
pkgs.systemd
}/bin/systemctl start battery"
ACTION=="change", SUBSYSTEM=="power_supply", ATTR{online}=="1", RUN+="${
pkgs.systemd
}/bin/systemctl start ac"
ACTION=="add|change", SUBSYSTEM=="backlight", MODE:="0777"
'' + (if device == "ASUS-Laptop" then ''
ACTION=="add|change", SUBSYSTEM=="net", KERNEL=="wlan*" RUN+="${
pkgs.iw
}/bin/iw dev %k set power_save off"
'' else
"")
else
"";
systemd.services.battery = {
enable = isLaptop;
description = "Executes commands needed on battery power";
script = ''
${
pkgs.linuxPackages_latest.cpupower
}/bin/cpupower frequency-set -g powersave
${pkgs.hdparm}/bin/hdparm -B 1 /dev/sda
echo "500" > /sys/class/backlight/*/brightness
'';
};
systemd.services.ac = {
enable = isLaptop;
description = "Executes commands needed on ac power";
script = ''
${
pkgs.linuxPackages_latest.cpupower
}/bin/cpupower frequency-set -g performance
${pkgs.hdparm}/bin/hdparm -B 255 /dev/sda
echo "900" > /sys/class/backlight/*/brightness
'';
};
systemd.services.leds_setup = {
enable = (device == "ASUS-Laptop");
description = "Set up leds triggers";
wantedBy = ["multi-user.target"];
script = ''
echo "phy0rx" > /sys/class/leds/asus-wireless\:\:airplane/trigger
'';
};
}

102
modules/secrets.nix Executable file
View File

@ -0,0 +1,102 @@
{ pkgs, config, lib, ... }:
with lib;
with types;
let
secret = description:
mkOption {
inherit description;
type = nullOr str;
};
mkCredOption = service: extra:
mkOption {
description = "Credentials for ${service}";
type = nullOr (submodule {
options = {
user = mkOption {
type = str;
description = "Username for ${service}";
};
password = mkOption {
type = str;
description = "Password for ${service}";
};
} // extra;
});
};
in rec {
options.secrets = {
owm-key = secret "OpenWeatherMap key";
irc = mkCredOption "IRC (konversation)" { };
slack-term = mkOption { type = str; };
yt-utilities = {
user = secret "youtrack user";
url = secret "youtrack url";
token = secret "youtrack token";
source = {
url = secret "A url to yt-utilities source";
rev = secret "revision";
sha256 = secret "sha256";
};
};
wage = secret "wage (sum CURRENCY/TIME, like 10EUR/h)";
gcal = {
email = mkOption { type = lib.types.str; };
client-id = mkOption { type = lib.types.str; };
client-secret = mkOption { type = lib.types.str; };
refresh-token = mkOption { type = lib.types.str; };
};
mail = mkCredOption "email" {
host = mkOption {
type = str;
description = "Mail server";
};
};
gpmusic = mkCredOption "Google Play Music (mopidy)" {
deviceid = mkOption {
type = str;
description = "Android device ID";
};
};
openvpn = mkCredOption "openvpn" {};
rclone = mkOption {
type = nullOr str;
description = "Rclone config";
};
id_rsa = mkOption {
type = nullOr str;
description = "SSH RSA private key";
};
ssl = rec {
cert = mkOption {
type = nullOr str;
description = "SSL certificate";
};
priv = mkOption {
type = nullOr str;
description = "SSL RSA private key";
};
};
matrix = mkCredOption "matrix" rec {
shared_secret = mkOption {
type = nullOr str;
description = "A shared secret for matrix instance";
};
mautrix-whatsapp = {
config = mkOption {
type = attrs;
};
registration = mkOption {
type = attrs;
};
};
mautrix-telegram = mautrix-whatsapp;
};
};
config = let
secretnix = import ../secret.nix;
secrets = if isNull secretnix then
mapAttrs (n: v: null) options.secrets
else
secretnix;
in { inherit secrets; };
}

43
modules/services.nix Normal file
View File

@ -0,0 +1,43 @@
{ config, lib, pkgs, ... }: {
services.acpid.enable = true;
programs.ssh.startAgent = true;
services.apcupsd = { enable = config.device == "AMD-Workstation"; };
services.earlyoom = {
enable = config.devices.${config.device}.ram < 16;
freeMemThreshold = 5;
freeSwapThreshold = 100;
};
services.printing = {
enable = true;
drivers = [ pkgs.gutenprint ];
};
programs.dconf.enable = true;
services.tor = {
enable = true;
client.enable = true;
client.privoxy.enable = true;
torsocks.enable = true;
client.socksListenAddressFaster = "127.0.0.1:9063";
};
programs.mosh.enable = true;
services.fwupd.enable = true;
services.avahi.enable = true;
systemd.services.systemd-udev-settle.enable = false;
services.nix-serve.enable = config.device == "AMD-Workstation";
services.upower.enable = true;
virtualisation.docker.enable = config.deviceSpecific.isHost;
virtualisation.libvirtd = {
enable = config.deviceSpecific.isHost;
};
}

84
modules/themes.nix Executable file
View File

@ -0,0 +1,84 @@
{ config, lib, pkgs, ... }:
with lib;
let
colorType = types.str;
color = (name:
(mkOption {
description = "${name} color of palette";
type = colorType;
}));
fromBase16 = { base00, base01, base02, base03, base04, base05, base06, base07
, base08, base09, base0A, base0B, base0C, base0D, base0E, base0F, ... }:
builtins.mapAttrs (_: v: "#" + v) {
bg = base00;
fg = base07;
gray = base03;
alt = base02;
dark = base01;
red = base08;
orange = base09;
yellow = base0A;
green = base0B;
cyan = base0C;
blue = base0D;
purple = base0E;
};
fromYAML = yaml:
builtins.fromJSON (builtins.readFile (pkgs.stdenv.mkDerivation {
name = "fromYAML";
phases = [ "buildPhase" ];
buildPhase = "echo '${yaml}' | ${pkgs.yaml2json}/bin/yaml2json > $out";
}));
in {
options = {
themes = {
colors = mkOption {
description =
"Set of colors from which the themes for various applications will be generated";
type = with types;
submodule {
options = {
bg = color "background";
fg = color "foreground";
gray = color "gray";
alt = color "alternative";
dark = color "darker";
blue = color "blue";
green = color "green";
red = color "red";
orange = color "orange";
yellow = color "yellow";
cyan = color "cyan";
purple = color "purple";
};
};
};
};
};
config = {
themes.colors = fromBase16 (fromYAML (builtins.readFile
"${pkgs.imports.base16-unclaimed-schemes}/irblack.yaml"));
# themes.colors = {
# bg = "#114c00";
# bg = "#000000";
# fg = "#ffffff";
#
# gray = "#9bb953";
# alt = "#27a6a2";
# dark = "#169300";
#
# red = "#d12d17";
# orange = "#cf7a02";
# yellow = "#386c34";
# green = "#386c34";
# cyan = "#09d0a5";
# blue = "#a5d048";
# purple = "#d083be";
# };
};
}

47
modules/users.nix Normal file
View File

@ -0,0 +1,47 @@
{ config, pkgs, lib, ... }: {
security.apparmor.enable = true;
programs.firejail.enable = true;
users.mutableUsers = false;
users.users.balsoft = {
isNormalUser = true;
extraGroups = [
"sudo"
"wheel"
"networkmanager"
"disk"
"dbus"
"audio"
"docker"
"sound"
"pulse"
"adbusers"
"input"
"libvirtd"
"vboxusers"
"wireshark"
];
description = "Александр Бантьев";
uid = 1000;
password = "";
};
systemd.services."user@" = {
serviceConfig = {
Restart = "always";
};
};
home-manager.users.balsoft.home.sessionVariables.XDG_RUNTIME_DIR = "/run/user/1000";
security.sudo = {
enable = true;
extraConfig = ''
balsoft ALL = (root) NOPASSWD: /run/current-system/sw/bin/nixos-rebuild switch
balsoft ALL = (root) NOPASSWD: ${pkgs.light}/bin/light -A 5
balsoft ALL = (root) NOPASSWD: ${pkgs.light}/bin/light -U 5
'';
};
nix.requireSignedBinaryCaches = false;
home-manager.useUserPackages = true;
}

View File

@ -0,0 +1,14 @@
{ pkgs, config, lib, ... }: rec {
services.autofs.enable = true;
services.autofs.autoMaster = let
mapConf = pkgs.writeText "auto" (builtins.concatStringsSep "\n" (map (n:
"${n} -fstype=fuse,rw,nodev,noatime,allow_other,max_read=65536 :sshfs#balsoft@${n}:")
([ "balsoft.ru" ]
++ builtins.map (n: "${n}.lan") (builtins.attrNames config.devices))));
in ''
/auto file:${mapConf} uid=1000,gid=100,--timeout=30,--ghost
'';
environment.etc."autofs.conf".text = services.autofs.autoMaster;
environment.systemPackages = with pkgs; [ fuse sshfs ];
}

View File

@ -0,0 +1,42 @@
{ pkgs, config, lib, ... }: {
home-manager.users.balsoft.xsession.windowManager.i3.config.startup = [{
command = "${pkgs.autorandr}/bin/autorandr -c --force --default horizontal";
always = true;
}];
home-manager.users.balsoft.xsession.windowManager.i3.config.keybindings."${
config.home-manager.users.balsoft.xsession.windowManager.i3.config.modifier
}+p" = "exec ${pkgs.autorandr}/bin/autorandr -c --default horizontal";
home-manager.users.balsoft.programs.autorandr = {
enable = true;
profiles = {
dacha = {
fingerprint = {
HDMI1 =
"00ffffffffffff0010ac14a0505441322e0f010380221b782ec5c6a3574a9c23124f54a54b00714f8180010101010101010101010101302a009851002a4030701300520e1100001e000000fd003c4b1f500e000a202020202020000000fc0044454c4c204531373646500a20000000ff004d43303433354248324154500a013a02031b61230907078301000067030c002000802d43908402e2000f8c0ad08a20e02d10103e9600a05a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000029";
HDMI2 =
"00ffffffffffff0006b3cc24010101011a1a010380351e78ea0565a756529c270f5054afcf80714f8180818fb30081409500a9408bc0023a801871382d40582c45000f282100001e000000fd00304b1e5311000a202020202020000000fc00565a3234390a20202020202020000000ff0047364c4d52533034383636390a018902031df14a900403011412051f1013230907078301000065030c001000023a801871382d40582c45000f282100001e011d8018711c1620582c25000f282100009e011d007251d01e206e2855000f282100001e8c0ad08a20e02d10103e96000f282100001800000000000000000000000000000000000000000000000000004a";
eDP1 =
"00ffffffffffff000dae61130000000007180104a51d117802ce85a3574e9d2612505400000001010101010101010101010101010101363680a0703820402e1e240025a510000018242480a0703820402e1e240025a510000018000000fe00434d4e0a202020202020202020000000fe004e3133334853452d4541330a2000a1";
};
config = {
eDP1 = {
enable = true;
position = "0x1024";
mode = "1368x768";
};
HDMI1 = {
enable = true;
position = "0x0";
mode = "1280x1024";
};
HDMI2 = {
enable = true;
position = "1368x1024";
mode = "1920x1080";
primary = true;
};
};
};
};
};
}

View File

@ -0,0 +1,14 @@
{ pkgs, lib, config, ... }: {
home-manager.users.balsoft = {
programs.autorandr.hooks.preswitch.compton = "systemctl --user stop compton";
programs.autorandr.hooks.postswitch.compton = "systemctl --user start compton";
services.compton = {
enable = true;
backend = "glx";
noDNDShadow = false;
shadow = true;
shadowExclude = [ "!(I3_FLOATING_WINDOW@:c = 1)" ];
vSync = "opengl-swc";
};
};
}

View File

@ -0,0 +1,50 @@
{ pkgs, config, lib, ... }:
let thm = config.themes.colors;
in {
home-manager.users.balsoft = {
services.dunst = {
enable = true;
iconTheme = {
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
};
settings = {
global = {
geometry = "500x5-30+50";
transparency = 10;
frame_color = thm.blue;
font = "Roboto 13";
padding = 15;
horizontal_padding = 17;
word_wrap = true;
follow = "keyboard";
format = ''
%s %p %I
%b'';
markup = "full";
};
urgency_low = {
background = thm.bg;
foreground = thm.fg;
timeout = 5;
};
urgency_normal = {
background = thm.alt;
foreground = thm.fg;
timeout = 10;
};
urgency_critical = {
background = thm.fg;
foreground = thm.bg;
timeout = 15;
};
};
};
xsession.windowManager.i3.config.startup =
[{ command = "${pkgs.dunst}/bin/dunst"; }];
};
}

View File

@ -0,0 +1,51 @@
{ pkgs, config, ... }: {
home-manager.users.balsoft = {
accounts.email.accounts."${config.secrets.gmail.user}@gmail.com" = {
address = "${config.secrets.gmail.user}@gmail.com";
flavor = "gmail.com";
passwordCommand = "${pkgs.coreutils}/bin/echo ${config.secrets.gmail.password}";
realName = "Alexander Bantyev";
primary = true;
userName = config.secrets.gmail.user;
getmail = {
readAll = false;
enable = true;
mailboxes = [ "INBOX" "Junk" "Trash" ];
};
msmtp = { enable = true; };
imapnotify = {
enable = true;
boxes = [ "INBOX" ];
onNotifyPost = "${pkgs.libnotify}/bin/notify-send 'New mail in %s'";
};
notmuch.enable = true;
signature = {
showSignature = "append";
text = ''
Александр Бантьев /Alexander Bantyev/ aka balsoft
Nix, NixOS DevOPS/SRE at serokell.io
<balsoft75@gmail.com>
<alexander.bantyev@serokell.io>
https://matrix.to/#/@balsoft:balsoft.ru
https://t.me/balsoft
https://github.com/balsoft
'';
};
};
services = {
getmail = {
enable = true;
frequency = "*-*-* *:*:00,15,30,45";
};
imapnotify.enable = true;
};
programs = {
msmtp.enable = true;
notmuch.enable = true;
alot.enable = true;
};
};
}

View File

@ -0,0 +1,26 @@
{ pkgs, config, lib, ... }: {
fonts = {
fonts = with pkgs; [
terminus_font
opensans-ttf
roboto
roboto-mono
roboto-slab
nerdfonts
noto-fonts
noto-fonts-emoji
hasklig
material-design-icons
material-icons
];
fontconfig = {
enable = true;
defaultFonts = {
monospace = ["Roboto Mono 13"];
sansSerif = ["Roboto 13"];
serif = ["Roboto Slab 13"];
};
};
enableDefaultFonts = true;
};
}

View File

@ -0,0 +1,37 @@
{ pkgs, lib, config, ... }: {
home-manager.users.balsoft = {
home.file.".gcalcli_oauth.home".text = lib.optionals
(!(isNull config.secrets.gcal)) (builtins.toJSON {
access_token = "";
client_id = config.secrets.gcal.client-id;
client_secret = config.secrets.gcal.client-secret;
refresh_token = config.secrets.gcal.refresh-token;
token_expiry = "2019-03-31T11:26:27Z";
token_uri = https://oauth2.googleapis.com/token;
user_agent = "gcalcli/v4.0.4";
revoke_uri = "https=//oauth2.googleapis.com/revoke";
id_token = null;
id_token_jwt = null;
token_response = {
access_token = "";
expires_in = 0;
scope =
"https=//www.googleapis.com/auth/urlshortener https=//www.googleapis.com/auth/calendar";
token_type = "Bearer";
};
scopes = [
"https=//www.googleapis.com/auth/calendar"
"https=//www.googleapis.com/auth/urlshortener"
];
token_info_uri = "https=//oauth2.googleapis.com/tokeninfo";
invalid = false;
_class = "OAuth2Credentials";
_module = "oauth2client.client";
});
home.activation.gcalcli = {
after = ["linkGeneration"];
before = [];
data = "cp .gcalcli_oauth.home .gcalcli_oauth";
};
};
}

69
modules/workspace/gtk.nix Normal file
View File

@ -0,0 +1,69 @@
{ pkgs, config, lib, ... }:
let
thm = config.themes.colors;
thm' = builtins.mapAttrs (name: value: builtins.substring 1 7 value) thm;
materia_colors = pkgs.writeTextFile {
name = "gtk-generated-colors";
text = ''
BG=${thm'.bg}
FG=${thm'.fg}
BTN_BG=${thm'.bg}
BTN_FG=${thm'.fg}
MENU_BG=${thm'.bg}
MENU_FG=${thm'.fg}
ACCENT_BG=${thm'.blue}
SEL_BG=${thm'.blue}
SEL_FG=${thm'.bg}
TXT_BG=${thm'.bg}
TXT_FG=${thm'.fg}
HDR_BTN_BG=${thm'.bg}
HDR_BTN_FG=${thm'.fg}
WM_BORDER_FOCUS=${thm'.blue}
WM_BORDER_UNFOCUS=${thm'.alt}
MATERIA_STYLE_COMPACT=True
MATERIA_COLOR_VARIANT=dark
UNITY_DEFAULT_LAUNCHER_STYLE=False
NAME=generated
'';
};
in {
nixpkgs.overlays = [(self: super: {
generated-gtk-theme = self.stdenv.mkDerivation rec {
name = "generated-gtk-theme";
src = pkgs.imports.materia-theme;
buildInputs = with self; [ sassc bc which inkscape optipng ];
installPhase = ''
HOME=/build
chmod 777 -R .
patchShebangs .
mkdir -p $out/share/themes
substituteInPlace change_color.sh --replace "\$HOME/.themes" "$out/share/themes"
echo "Changing colours:"
./change_color.sh -o Generated ${materia_colors}
chmod 555 -R .
'';
};
})];
home-manager.users.balsoft = {
home.packages = [pkgs.generated-gtk-theme];
gtk = {
enable = true;
iconTheme = {
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
};
theme = {
name = "Generated";
package = pkgs.generated-gtk-theme;
};
font =
{
package = pkgs.roboto;
name = "Roboto 11";
};
gtk3.extraConfig.gtk-cursor-theme-name = "breeze";
};
};
environment.sessionVariables.GTK_THEME = "Generated";
environment.sessionVariables.GDK_BACKEND = "x11";
}

208
modules/workspace/i3/default.nix Executable file
View File

@ -0,0 +1,208 @@
{ pkgs, lib, config, ... }:
let
thm = config.themes.colors;
apps = config.defaultApplications;
in {
environment.sessionVariables._JAVA_AWT_WM_NONREPARENTING = "1";
home-manager.users.balsoft.xsession.windowManager.i3 = {
enable = true;
package = pkgs.i3-gaps;
config = rec {
assigns = {
"" = [ { class = "Chromium"; } { app_id = "firefox"; } { class = "Firefox"; } ];
"" = [
{ app_id = "org.kde.trojita"; }
{ title = "balsoft : weechat.*"; }
{ title = "nheko"; }
{ title = "Slack"; }
];
"" = [{ app_id = "cantata"; }];
};
fonts = [ "RobotoMono 9" ];
bars = [ ];
colors = rec {
background = thm.bg;
unfocused = {
text = thm.alt;
border = thm.dark;
background = thm.bg;
childBorder = thm.dark;
indicator = thm.fg;
};
focusedInactive = unfocused;
urgent = unfocused // {
text = thm.fg;
border = thm.orange;
childBorder = thm.orange;
};
focused = unfocused // {
childBorder = thm.blue;
border = thm.blue;
background = thm.dark;
text = thm.fg;
};
};
gaps = {
inner = 6;
smartGaps = true;
smartBorders = "on";
};
focus.followMouse = false;
modifier = "Mod4";
window = {
border = 1;
titlebar = true;
commands = [
{
command = "border pixel 2px";
criteria = { window_role = "popup"; };
}
{
command = "floating enable";
criteria = { app_id = "org.kde.polkit-kde-authentication-1"; };
}
{
command = "sticky enable";
criteria = { floating = ""; };
}
];
};
startup = map (a: { notification = false; } // a) [
{ command = apps.browser.cmd; }
{ command = "${pkgs.kdeconnect}/libexec/kdeconnectd"; }
{
command =
"${pkgs.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1";
}
{
command =
"${pkgs.keepassxc}/bin/keepassxc /home/balsoft/projects/nixos-config/misc/Passwords.kdbx";
}
{ command = "${pkgs.trojita}/bin/trojita"; }
{ command = "${pkgs.termNote}/bin/noted"; }
{ command = "${pkgs.nheko}/bin/nheko"; }
{ command = "${pkgs.xorg.xrdb}/bin/xrdb -merge ~/.Xresources"; }
{ command = "${pkgs.cantata}/bin/cantata"; }
];
keybindings = let
script = name: content: "exec ${pkgs.writeScript name content}";
workspaces = (builtins.genList (x: [ (toString x) (toString x) ]) 10)
++ [ [ "c" "" ] [ "t" "" ] [ "m" "" ] ];
moveMouse = ''
exec "sh -c 'eval `${pkgs.xdotool}/bin/xdotool \
getactivewindow \
getwindowgeometry --shell`; ${pkgs.xdotool}/bin/xdotool \
mousemove \
$((X+WIDTH/2)) $((Y+HEIGHT/2))'"'';
in ({
"${modifier}+q" = "kill";
"${modifier}+Return" = "exec ${apps.term.cmd}";
"${modifier}+e" = "exec ${apps.editor.cmd}";
"${modifier}+l" = "layout toggle all";
"${modifier}+Left" = "focus child; focus left; ${moveMouse}";
"${modifier}+Right" = "focus child; focus right; ${moveMouse}";
"${modifier}+Up" = "focus child; focus up; ${moveMouse}";
"${modifier}+Down" = "focus child; focus down; ${moveMouse}";
"${modifier}+Control+Left" = "focus parent; focus left; ${moveMouse}";
"${modifier}+Control+Right" = "focus parent; focus right; ${moveMouse}";
"${modifier}+Control+Up" = "focus parent; focus up; ${moveMouse}";
"${modifier}+Control+Down" = "focus parent; focus down; ${moveMouse}";
"${modifier}+Shift+Up" = "move up";
"${modifier}+Shift+Down" = "move down";
"${modifier}+Shift+Right" = "move right";
"${modifier}+Shift+Left" = "move left";
"${modifier}+a" = "focus child; focus left; ${moveMouse}";
"${modifier}+d" = "focus child; focus right; ${moveMouse}";
"${modifier}+w" = "focus child; focus up; ${moveMouse}";
"${modifier}+s" = "focus child; focus down; ${moveMouse}";
"${modifier}+Control+a" = "focus parent; focus left; ${moveMouse}";
"${modifier}+Control+d" = "focus parent; focus right; ${moveMouse}";
"${modifier}+Control+w" = "focus parent; focus up; ${moveMouse}";
"${modifier}+Control+s" = "focus parent; focus down; ${moveMouse}";
"${modifier}+Shift+w" = "move up";
"${modifier}+Shift+s" = "move down";
"${modifier}+Shift+d" = "move right";
"${modifier}+Shift+a" = "move left";
"${modifier}+f" = "fullscreen toggle; floating toggle";
"${modifier}+r" = "mode resize";
"${modifier}+Shift+f" = "floating toggle";
"${modifier}+j" = "focus mode_toggle";
"${modifier}+Escape" = "exec ${apps.monitor.cmd}";
"${modifier}+Print" = script "screenshot"
"${pkgs.grim}/bin/grim Pictures/$(date +'%Y-%m-%d+%H:%M:%S').png";
"${modifier}+Control+Print" = script "screenshot-copy"
"${pkgs.grim}/bin/grim - | ${pkgs.wl-clipboard}/bin/wl-copy";
"--release ${modifier}+Shift+Print" = script "screenshot-area" ''
${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" Pictures/$(date +'%Y-%m-%d+%H:%M:%S').png'';
"--release ${modifier}+Control+Shift+Print" =
script "screenshot-area-copy" ''
${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" - | ${pkgs.wl-clipboard}/bin/wl-copy'';
"${modifier}+x" = "move workspace to output right";
"${modifier}+k" = "exec '${pkgs.xorg.xkill}/bin/xkill'";
"${modifier}+F5" = "reload";
"${modifier}+Shift+F5" = "exit";
"${modifier}+Shift+h" = "layout splith";
"${modifier}+Shift+v" = "layout splitv";
"${modifier}+h" = "split h";
"${modifier}+v" = "split v";
"${modifier}+F1" = "move to scratchpad";
"${modifier}+F2" = "scratchpad show";
"${modifier}+F11" = "output * dpms off";
"${modifier}+F12" = "output * dpms on";
"${modifier}+p" = "sticky toggle";
"${modifier}+i" =
script "0x0" ''wl-paste | curl -F"file=@-" https://0x0.st | wl-copy'';
"${modifier}+b" = "focus mode_toggle";
"${modifier}+z" = script "lambda-launcher"
"${pkgs.lambda-launcher}/bin/lambda-launcher";
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
"button2" = "kill";
"--whole-window ${modifier}+button2" = "kill";
} // builtins.listToAttrs (builtins.map (x: {
name = "${modifier}+${builtins.elemAt x 0}";
value = "workspace ${builtins.elemAt x 1}";
}) workspaces) // builtins.listToAttrs (builtins.map (x: {
name = "${modifier}+Shift+${builtins.elemAt x 0}";
value = "move container to workspace ${builtins.elemAt x 1}";
}) workspaces));
keycodebindings = {
"122" = "exec ${pkgs.pamixer}/bin/pamixer -d 2";
"123" = "exec ${pkgs.pamixer}/bin/pamixer -i 2";
"121" = "exec ${pkgs.pamixer}/bin/pamixer -t";
};
workspaceLayout = "tabbed";
};
extraConfig = ''
output * bg ${thm.bg} solid_color
input 2:14:ETPS/2_Elantech_Touchpad {
tap enabled
natural_scroll enabled
dwt enabled
}
input 2:14:ETPS/2_Elantech_TrackPoint pointer_accel -0.7
default_border pixel 1
mouse_warping container
hide_edge_borders --i3 smart
exec pkill swaynag
'';
};
}

View File

@ -0,0 +1,54 @@
#!/usr/bin/env nix-shell
#!nix-shell -p perlPackages.AnyEvent perlPackages.AnyEventI3 perl -i perl
# vim:ts=4:sw=4:expandtab
# © 2012 Michael Stapelberg
# Licensed under BSD license, see https://github.com/i3/i3/blob/next/LICENSE
#
# Append this line to your i3 config file:
# exec_always ~/per-workspace-layout.pl
#
# Then, change the %layouts hash like you want your workspaces to be set up.
# This script requires i3 >= v4.4 for the extended workspace event.
use strict;
use warnings;
use AnyEvent;
use AnyEvent::I3;
use v5.10;
use utf8;
my %layouts = (
'' => 'tabbed',
'' => 'tabbed',
);
my $i3 = i3();
die "Could not connect to i3: $!" unless $i3->connect->recv();
die "Could not subscribe to the workspace event: $!" unless
$i3->subscribe({
workspace => sub {
my ($msg) = @_;
return unless $msg->{change} eq 'focus';
die "Your version of i3 is too old. You need >= v4.4"
unless exists($msg->{current});
my $ws = $msg->{current};
my $name = $ws->{name};
my $con_id = $ws->{id};
return unless exists $layouts{$name};
$i3->command(qq|[con_id="$con_id"] layout | . $layouts{$name});
},
_error => sub {
my ($msg) = @_;
say "AnyEvent::I3 error: $msg";
say "Exiting.";
exit 1;
},
})->recv->{success};
# Run forever.
AnyEvent->condvar->recv

View File

@ -0,0 +1,61 @@
{ pkgs, config, lib, ... }:
with import ../../../support.nix { inherit pkgs config lib; };
with lib;
let scripts = import ./scripts pkgs config;
in {
home-manager.users.balsoft.xsession.windowManager.i3.extraConfig = ''
bar {
id top
font pango:Material Icons 11, Roboto Mono 11
mode dock
hidden_state hide
position top
status_command ${pkgs.i3blocks}/bin/i3blocks
workspace_buttons yes
strip_workspace_numbers no
tray_output none
colors {
background ${config.themes.colors.bg}
statusline ${config.themes.colors.fg}
separator ${config.themes.colors.alt}
focused_workspace ${config.themes.colors.bg} ${config.themes.colors.bg} ${config.themes.colors.blue}
active_workspace ${config.themes.colors.bg} ${config.themes.colors.bg} ${config.themes.colors.green}
inactive_workspace ${config.themes.colors.bg} ${config.themes.colors.bg} ${config.themes.colors.fg}
urgent_workspace ${config.themes.colors.bg} ${config.themes.colors.bg} ${config.themes.colors.orange}
binding_mode ${config.themes.colors.bg} ${config.themes.colors.bg} ${config.themes.colors.yellow}
}
}
'';
home-manager.users.balsoft.xdg.configFile."i3blocks/config".text = let
scr = x: {
name = x;
command = scripts.${x};
};
scrint = x: interval: (scr x) // { inherit interval; };
in ''
interval=60
markup=pango
'' + genIniOrdered (
optional (config.secrets ? mail) (scr "email") ++ [
(scrint "weather" 600)
(scr "calendar")
(scr "emacs")
(scrint "youtrack-wage" 3600)
(scrint "music" 10)
(scrint "sound" 5)
] ++ [
(scrint "cpu" 5)
(scrint "freq" 10)
(scr "temperature")
(scrint "free" 10)
] ++ optionals config.deviceSpecific.isLaptop [
(scr "battery")
(scrint "brightness" 5)
] ++ [
(scrint "connections" 10)
(scr "df")
(scr "date")
(scrint "time" 1)
]);
}

View File

@ -0,0 +1,48 @@
{ acpi, bash, iconfont, low_threshold ? 10, ... }: ''
#!${bash}/bin/bash
BATTERY="`${acpi}/bin/acpi -b | grep --invert-match unavailable | head -1`"
STATUS=`awk -F'[,:] ' '{print $2}' <<< "$BATTERY"`
CHARGE=`awk -F'[,%] ' '{print $2}' <<< "$BATTERY" | tr -d "%"`
TIME=`awk -F', ' '{print $3}' <<< "$BATTERY" | cut -d " " -f 1 | cut -d: -f1-2`
case "$STATUS" in
Full) ;& "Not charging") icon=; TEXT="FULL"; status=0
;;
Charging)
TEXT="$CHARGE% ($TIME)"
status=0
case $CHARGE in
[2-3]*) icon=;;
[4-5]*) icon=;;
[6-7]*) icon=;;
[8-9]*) icon=;;
100) icon=;;
*) icon=;;
esac
;;
Discharging)
if [[ $CHARGE -gt ${toString low_threshold} ]]
then
status=0
else
status=33
fi
TEXT="$CHARGE% ($TIME)";
case $CHARGE in
1?) icon=;;
2?) icon=;;
3?) icon=;;
4?) icon=;;
5?) icon=;;
6?) icon=;;
7?) icon=;;
8?) icon=;;
9?) icon=;;
100) icon=;;
*) ;;
esac
;;
esac
[[ -n $BLOCK_BUTTON ]] && text=" $TEXT"
echo "<span font=\"${iconfont}\">$icon</span>$text"
exit $status
''

View File

@ -0,0 +1,27 @@
{ iconfont, light, config, ... }: ''
case $BLOCK_BUTTON in
4) sudo ${light}/bin/light -A 5;;
5) sudo ${light}/bin/light -U 5;;
esac
LIGHT=`${light}/bin/light | cut -f 1 -d '.'`
if [[ $LIGHT -lt 33 ]]
then
icon=
else
if [[ $LIGHT -lt 66 ]]
then
icon=
else
icon=
fi
fi
${if config.device == "ASUS-Laptop" then ''
if [[ `cat /sys/devices/platform/asus-nb-wmi/als_enable` -eq 1 ]]
then
icon=""
fi
'' else
""}
[[ -n $BLOCK_BUTTON ]] && text=" $LIGHT"
echo "<span font='${iconfont}'>$icon</span>$text"
''

View File

@ -0,0 +1,26 @@
{ config, gcalcli, bash, iconfont, ... }: ''
#!${bash}/bin/bash
ping -c 1 calendar.google.com &> /dev/null || exit 1
AGENDA_NEXT="`PYTHONIOENCODING=utf8 ${
gcalcli
}/bin/gcalcli --nocolor search "*" 'now' 'now+6d' --nostarted --tsv | head -1`"
DATE="`awk '{print $1 " " $2}' <<< "$AGENDA_NEXT"`"
echo -n "<span font='${iconfont}'></span> "
if [[ `date -d "$DATE" +'%u'` -eq `date +'%u'` ]]
then
echo -n `date -d "$DATE" +'%H:%M'`
else
echo -n `date -d "$DATE" +'%H:%M %a'`
fi
if [[ $BLOCK_BUTTON == "1" ]]
then
${config.defaultApplications.term.cmd} --hold -e "${gcalcli}/bin/gcalcli agenda"
fi
if [[ $((`date -d "$DATE" +%s`-`date +%s`)) -lt 1800 ]]
then
code=33
else
code=0
fi
echo ":`awk '{$1=""; $2=""; $3=""; $4=""; print}' <<< "$AGENDA_NEXT" | tr -s " " | tr -s " "`"
''

View File

@ -0,0 +1,63 @@
{ bash, networkmanager, iconfont, config, modemmanager, ... }: ''
#!${bash}/bin/bash
[[ $BLOCK_BUTTON -eq 1 ]] && ${config.defaultApplications.term.cmd} -e ${networkmanager}/bin/nmtui-connect
CONNECTIONS=$(${networkmanager}/bin/nmcli con show --active | tail +2 | tr -s ' ' | rev | cut -d' ' -f3 | rev)
text=""
for connection in $CONNECTIONS
do
grep wifi <<< $connection > /dev/null && {
SIGNAL=$(${networkmanager}/bin/nmcli d w | grep '^\*' | tr -s ' ' | cut -d' ' -f7)
if [[ $SIGNAL -lt 20 ]]
then
text+=
elif [[ $SIGNAL -lt 40 ]]
then
text+=
elif [[ $SIGNAL -lt 60 ]]
then
text+=
elif [[ $SIGNAL -lt 80 ]]
then
text+=
else
text+=
fi
}
grep gsm <<< $connection >/dev/null && {
MODEM=$(${modemmanager}/bin/mmcli -K -L | tail -1 | cut -d: -f2 | tr -d ' ')
STATUS=$(${modemmanager}/bin/mmcli -K -m $MODEM)
TECH=$(grep "modem.generic.access-technologies.value\[1\]" <<< $STATUS | cut -d: -f2 | tr -d ' ')
SIGNAL=$(grep "modem.generic.signal-quality.value" <<< $STATUS | cut -d: -f2 | tr -d ' ')
if [[ $SIGNAL -lt 20 ]]
then
text+=""
elif [[ $SIGNAL -lt 40 ]]
then
text+=""
elif [[ $SIGNAL -lt 60 ]]
then
text+=""
elif [[ $SIGNAL -lt 80 ]]
then
text+=""
else
text+=""
fi
if [[ $TECH == lte ]]
then
text+=""
else
text+=""
fi
}
grep ethernet <<< $connection > /dev/null && text+=""
done
code=0
[[ $text == "" ]] && {
text=
code=33
}
echo "<span font='${iconfont}'>$text</span>"
exit $code
''

View File

@ -0,0 +1,43 @@
p: c:
with p;
builtins.mapAttrs (name: value:
stdenv.mkDerivation {
inherit name;
src = value;
unpackPhase = "true";
buildInputs = [ghc];
buildPhase = "ghc -o $out $src";
installPhase = "true";
}) {
free = ./free.hs;
temperature = ./temperature.hs;
network = ./network.hs;
} // builtins.mapAttrs (name: value:
writeTextFile {
inherit name;
text = callPackage value {
iconfont = "Material Design Icons";
config = c;
};
executable = true;
checkPhase =
"${bash}/bin/bash -n $src || ${python3}/bin/python3 -m compileall $src";
}) {
battery = ./battery.nix;
brightness = ./brightness.nix;
calendar = ./calendar.nix;
email = ./email.nix;
emacs = ./emacs.nix;
connections = ./connections.nix;
weather = ./weather.nix;
sound = ./sound.nix;
music = ./music.nix;
youtrack-wage = ./youtrack-wage.nix;
cpu = {...}: ''top -b -n1 -p 1 | fgrep "Cpu(s)" | tail -1 | awk -F'id,' -v prefix="$prefix" '{ split($1, vs, ","); v=vs[length(vs)]; sub("%", "", v); printf "%s%.1f%%\n", prefix, 100 - v }' '';
freq = {...}: ''echo $(${pkgs.bc}/bin/bc -l <<< "scale=2; `cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq|sort|tail -1`/1000000") GHz'';
df = {...}: ''echo '<span font="Material Icons 11"></span>' `df / | tail -1 | grep -o '..%'`'';
date = {...}: "${pkgs.coreutils}/bin/date +'<span font=\"Material Icons 11\"></span> %a %y-%m-%d'";
time = {...}: "${pkgs.coreutils}/bin/date +'<span font=\"Material Icons 11\"></span> %T'";
#temperature = ./temperature.nix;
#free = ./free.nix;
}

View File

@ -0,0 +1,4 @@
{...}: ''
[[ $BLOCK_BUTTON -eq 2 ]] && emacsclient --eval "(org-clock-out)" > /dev/null
emacsclient --eval "org-mode-line-string" | head -1 | cut -d\" -f 2
''

View File

@ -0,0 +1,10 @@
{ python3, iconfont, config, ... }: ''
#!${python3}/bin/python3
import imaplib
obj = imaplib.IMAP4_SSL('imap.${config.secrets.mail.host}', 993)
obj.login("${config.secrets.mail.user}@${config.secrets.mail.host}", "${config.secrets.mail.password}")
obj.select()
l = len(obj.search(None, 'unseen')[1][0].split())
print('<span font="${iconfont}"></span> %s' % str(l))
exit(33 if l != 0 else 0)
''

View File

@ -0,0 +1,10 @@
import System.Exit
main :: IO ()
main = do
freeMemory <- read
<$> (!!1) <$> words
<$> (!!2) <$> lines
<$> readFile "/proc/meminfo"
putStrLn $ (take 5 $ show $ freeMemory / 1000000) ++ "GB"
exitWith $ if freeMemory > 500000 then ExitSuccess else ExitFailure 33

View File

@ -0,0 +1,5 @@
{ bc, ... }: ''
echo `free | tail -2 | head -1 | awk '{print "scale=3; "$7"/1000000"}' | ${
bc
}/bin/bc -l`GB
''

View File

@ -0,0 +1,14 @@
{ bash, curl, libnotify, sox, iconfont, ... }:
''
#!${bash}/bin/bash
STATUS=$(${curl}/bin/curl -sw "%{http_code}" https://hydra.typeable.io/ping)
if [ $STATUS -eq 200 ]
then
echo '<span font="${iconfont}">🐍</span>'
exit 0
else
msg="HYDRA DOWN"
echo $msg
exit 33
fi
''

View File

@ -0,0 +1,19 @@
{ python3, playerctl, iconfont, ...}: ''
#!${python3}/bin/python
from subprocess import getoutput, call
from os import environ
status = getoutput("${playerctl}/bin/playerctl status")
if "BLOCK_BUTTON" in environ:
BLOCK_BUTTON = environ["BLOCK_BUTTON"]
if BLOCK_BUTTON == "1": call(["${playerctl}/bin/playerctl", "play-pause"])
if BLOCK_BUTTON == "2": call(["${playerctl}/bin/playerctl", "stop"])
if BLOCK_BUTTON == "3": call(["${playerctl}/bin/playerctl", "next"])
if status == "Paused":
icon=""
elif status == "Playing":
icon=""
else:
icon = ""
text = getoutput("${playerctl}/bin/playerctl metadata title")[:20:]
print("<span font='${iconfont}'>%s</span> %s" % (icon, text.replace('&', '&amp;')))
''

View File

@ -0,0 +1,39 @@
{-# LANGUAGE BangPatterns #-}
import Control.Concurrent (threadDelay)
import Control.Monad (mapM)
import System.Directory (listDirectory)
import Data.Bool (bool)
path :: String
path = "/sys/class/net/"
data Statistics = Statistics !Float !Float
instance Semigroup Statistics where
Statistics a b <> Statistics c d = Statistics (a + c) (b + d)
instance Monoid Statistics where
mempty = Statistics 0 0
icon :: String -> String
icon i = "<span font='Material Icons 11'>" ++ i ++ "</span>"
readInterface :: FilePath -> IO Statistics
readInterface interface = do
rx <- read <$> readFile (path ++ interface ++ "/statistics/rx_bytes")
tx <- read <$> readFile (path ++ interface ++ "/statistics/tx_bytes")
return $ Statistics rx tx
readInterfaces :: [FilePath] -> IO Statistics
readInterfaces interfaces = mconcat <$> (mapM readInterface interfaces)
main :: IO ()
main = do
interfaces <- listDirectory path
Statistics rx tx <- readInterfaces interfaces
threadDelay 1000000
Statistics rx' tx' <- readInterfaces interfaces
putStrLn
$ (bool (icon "\58052") "" (rx' - rx > 100))
++ (bool (icon "\58054") "" (tx' - tx > 100))

View File

@ -0,0 +1,33 @@
{ pamixer, lxqt, iconfont, ... }: ''
case $BLOCK_BUTTON in
2) ${pamixer}/bin/pamixer -t;;
3) ${lxqt.pavucontrol-qt}/bin/pavucontrol-qt & ;;
4) ${pamixer}/bin/pamixer -i 5;;
5) ${pamixer}/bin/pamixer -d 5;;
esac
code=0
if [[ `${pamixer}/bin/pamixer --get-mute` = "true" ]]
then
volume=""
end=""
icon=""
else
volume=`${pamixer}/bin/pamixer --get-volume`
end="%"
if [[ $volume -lt 33 ]]
then
icon=""
else
if [[ $volume -lt 66 ]]
then
icon=""
else
icon=""
code=33
fi
fi
fi
[[ -n $BLOCK_BUTTON ]] && text=" $volume$end"
echo "<span font='${iconfont}'>$icon</span>$text"
exit $code
''

View File

@ -0,0 +1,47 @@
import System.Directory
import System.FilePath
import Control.Monad (forM)
import System.Posix.Files
import Data.List (isPrefixOf, isInfixOf)
import System.Exit
-- | Traverse from 'top' directory and return all the files by
-- filtering with 'include' predicate.
traverseDir :: FilePath -> (FilePath -> Bool) -> IO [FilePath]
traverseDir top include = do
ds <- getDirectoryContents top
paths <- forM (filter include ds) $ \d -> do
let path = top </> d
s <- getFileStatus path
if isDirectory s
then traverseDir path include
else return [path]
return $ concat paths
-- | Get temperatures from hardware sensors in </sys/class/hwmon>
getTemps :: IO [Int]
getTemps = do
hwmons <- traverseDir "/sys/class/hwmon"
(
\name
-> ("hwmon" `isPrefixOf` name)
|| ("temp" `isInfixOf` name) && ("input" `isInfixOf` name)
)
fmap (round .(/1000) . read) <$> traverse (readFile) hwmons
-- | Get a symbol corresponding to the temperature
getSymbol :: Integral n => n -> String
getSymbol t
| t < 50 = "\57868" -- 
| t < 80 = "\57866" -- 
| otherwise = "\57867" -- 
main :: IO ()
main = do
maxTemp <- maximum <$> getTemps
putStrLn $ (getSymbol <> show) maxTemp <> "°"
exitWith $ if maxTemp < 80 then ExitSuccess else ExitFailure 33

View File

@ -0,0 +1,6 @@
{ ... }:
''
temp=$((`cat /sys/class/thermal/thermal_zone*/temp | sort | tail -1`/1000))
echo $temp °
[[ $temp -gt 80 ]] && exit 33
''

View File

@ -0,0 +1,10 @@
{ bash, config, curl, iconfont, ... }: ''
#!${bash}/bin/bash
WTTR=$(curl wttr.in/?format=1)
echo "<span font=\"Roboto Mono 11\">$WTTR</span>"
if [[ $BLOCK_BUTTON == 1 ]]
then
${config.defaultApplications.term.cmd} --hold -e "${curl}/bin/curl wttr.in"
fi
''

View File

@ -0,0 +1,16 @@
{ bash, yt-utilities, libqalculate, config, lib, ... }:
''
#!${bash}/bin/bash
HOURS_DAY=$(yt org local --since $(date +'%Y-%m-%d') | tail -1)
HOURS_MONTH=$(yt org local --since $(date +'%Y-%m-01') | tail -1)
HOURS_YEAR=$(yt org local --since $(date +'%Y-01-01') | tail -1)
HOURS_TASK=$(emacsclient --eval "org-mode-line-string" | head -1 | cut -d\" -f 2 | cut -d\[ -f2 | cut -d\] -f1)h
MONEY_TASK=$(qalc -t -e "$HOURS_TASK * (${config.secrets.wage})" )
MONEY_DAY=$(qalc -t "($HOURS_DAY) * (${config.secrets.wage})")
MONEY_MONTH=$(qalc -t "($HOURS_MONTH) * (${config.secrets.wage})")
MONEY_YEAR=$(qalc -t "($HOURS_YEAR) * (${config.secrets.wage})")
'' + (if config.deviceSpecific.bigScreen then ''
echo "$MONEY_TASK/$MONEY_DAY($HOURS_DAY)/$MONEY_MONTH($HOURS_MONTH)/$MONEY_YEAR"
'' else ''
echo "$MONEY_MONTH($HOURS_MONTH)"
'')

View File

@ -0,0 +1,18 @@
{ config, pkgs, lib, ... }: {
home-manager.users.balsoft = {
xsession.windowManager.i3.config.startup = [{
command = "${pkgs.kanshi}/bin/kanshi";
notification = false;
always = true;
}];
xdg.configFile."kanshi/config".text = ''
{
output "Samsung Electric Company C27JG5x HTOM901267" position 0,1025
output "Dell Inc. DELL E176FP MC0435BH2ATP" position 1400,0
}
{
output "Samsung Electric Company C27JG5x HTOM901267" position 0,0
}
'';
};
}

View File

@ -0,0 +1,139 @@
{ pkgs, lib, config, ... }:
with import ../../../support.nix { inherit lib config; }; {
xdg.portal.enable = true;
# services.flatpak.enable = true;
xdg.portal.extraPortals = [pkgs.plasma5.xdg-desktop-portal-kde];
services.dbus.packages =
[ pkgs.plasma5.xdg-desktop-portal-kde pkgs.flatpak pkgs.firefox pkgs.systemd ];
nixpkgs.config.firefox.enablePlasmaBrowserIntegration = true;
home-manager.users.balsoft.home.packages = [pkgs.qt5ct];
environment.sessionVariables = {
DESKTOP_SESSION = "kde";
QT_XFT = "true";
QT_SELECT = "5";
XDG_CURRENT_DESKTOP = "KDE";
KDE_SESSION_VERSION = "5";
QT_SCALE_FACTOR = "1";
QT_AUTO_SCREEN_SCALE_FACTOR = "0";
GTK_USE_PORTAL = "1";
DE = "kde";
QT_QPA_PLATFORMTHEME="kde";
};
#home-manager.users.balsoft.xdg.configFile."qt5ct/qt5ct.conf".source = ./qt5ct.conf;
home-manager.users.balsoft.xdg.configFile."kdeglobals".text = genIni {
"Colors:Button" = {
BackgroundAlternate = thmDec.dark;
BackgroundNormal = thmDec.bg;
DecorationFocus = thmDec.blue;
DecorationHover = thmDec.blue;
ForegroundActive = thmDec.blue;
ForegroundInactive = thmDec.alt;
ForegroundLink = thmDec.blue;
ForegroundNegative = thmDec.red;
ForegroundNeutral = thmDec.orange;
ForegroundNormal = thmDec.fg;
ForegroundPositive = thmDec.green;
ForegroundVisited = thmDec.gray;
};
"Colors:Complementary" = {
BackgroundAlternate = thmDec.dark;
BackgroundNormal = thmDec.bg;
DecorationFocus = thmDec.blue;
DecorationHover = thmDec.blue;
ForegroundActive = thmDec.orange;
ForegroundInactive = thmDec.alt;
ForegroundLink = thmDec.blue;
ForegroundNegative = thmDec.red;
ForegroundNeutral = thmDec.yellow;
ForegroundNormal = thmDec.fg;
ForegroundPositive = thmDec.green;
ForegroundVisited = thmDec.blue;
};
"Colors:Selection" = {
BackgroundAlternate = thmDec.blue;
BackgroundNormal = thmDec.blue;
DecorationFocus = thmDec.blue;
DecorationHover = thmDec.blue;
ForegroundActive = thmDec.fg;
ForegroundInactive = thmDec.fg;
ForegroundLink = thmDec.blue;
ForegroundNegative = thmDec.red;
ForegroundNeutral = thmDec.orange;
ForegroundNormal = thmDec.fg;
ForegroundPositive = thmDec.green;
ForegroundVisited = thmDec.alt;
};
"Colors:Tooltip" = {
BackgroundAlternate = thmDec.dark;
BackgroundNormal = thmDec.bg;
DecorationFocus = thmDec.blue;
DecorationHover = thmDec.blue;
ForegroundActive = thmDec.blue;
ForegroundInactive = thmDec.alt;
ForegroundLink = thmDec.blue;
ForegroundNegative = thmDec.red;
ForegroundNeutral = thmDec.orange;
ForegroundNormal = thmDec.fg;
ForegroundPositive = thmDec.green;
ForegroundVisited = thmDec.gray;
};
"Colors:View" = {
BackgroundAlternate = thmDec.dark;
BackgroundNormal = thmDec.bg;
DecorationFocus = thmDec.blue;
DecorationHover = thmDec.blue;
ForegroundActive = thmDec.blue;
ForegroundInactive = thmDec.alt;
ForegroundLink = thmDec.blue;
ForegroundNegative = thmDec.red;
ForegroundNeutral = thmDec.orange;
ForegroundNormal = thmDec.fg;
ForegroundPositive = thmDec.green;
ForegroundVisited = thmDec.gray;
};
"Colors:Window" = {
BackgroundAlternate = thmDec.dark;
BackgroundNormal = thmDec.bg;
DecorationFocus = thmDec.blue;
DecorationHover = thmDec.blue;
ForegroundActive = thmDec.blue;
ForegroundInactive = thmDec.alt;
ForegroundLink = thmDec.blue;
ForegroundNegative = thmDec.red;
ForegroundNeutral = thmDec.orange;
ForegroundNormal = thmDec.fg;
ForegroundPositive = thmDec.green;
ForegroundVisited = thmDec.gray;
};
General = {
ColorScheme = "Generated";
Name = "Generated";
fixed = "Roboto Mono,11,-1,5,50,0,0,0,0,0";
font = "Roboto,11,-1,5,50,0,0,0,0,0";
menuFont = "Roboto,11,-1,5,50,0,0,0,0,0";
shadeSortColumn = true;
smallestReadableFont = "Roboto,8,-1,5,57,0,0,0,0,0,Medium";
toolBarFont = "Roboto,11,-1,5,50,0,0,0,0,0";
};
KDE = {
DoubleClickInterval = 400;
ShowDeleteCommand = true;
SingleClick = false;
StartDragDist = 4;
StartDragTime = 500;
WheelScrollLines = 3;
contrast = 4;
widgetStyle = "Breeze";
};
Icons = { Theme = "Papirus-Dark"; };
};
home-manager.users.balsoft.home.activation."user-places.xbel" = {
data = ''
$DRY_RUN_CMD rm -f ~/.local/share/user-places.xbel
$DRY_RUN_CMD cp ${./user-places.xbel} ~/.local/share/user-places.xbel
$DRY_RUN_CMD chmod 777 ~/.local/share/user-places.xbel
'';
before = [];
after = ["linkGeneration"];
};
}

View File

@ -0,0 +1,23 @@
[Appearance]
color_scheme_path=/home/balsoft/.nix-profile/share/qt5ct/colors/airy.conf
custom_palette=false
icon_theme=Papirus-Dark
standard_dialogs=kde
style=Breeze
[Fonts]
fixed=@Variant(\0\0\0@\0\0\0\x16\0R\0o\0\x62\0o\0t\0o\0 \0M\0o\0n\0o@&\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10)
general=@Variant(\0\0\0@\0\0\0\f\0R\0o\0\x62\0o\0t\0o@&\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10)
[Interface]
activate_item_on_single_click=0
buttonbox_layout=0
cursor_flash_time=1000
dialog_buttons_have_icons=1
double_click_interval=400
gui_effects=@Invalid()
menus_have_icons=true
stylesheets=@Invalid()
toolbutton_style=4
underline_shortcut=1
wheel_scroll_lines=1

View File

@ -0,0 +1,351 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xbel>
<xbel xmlns:kdepriv="http://www.kde.org/kdepriv" xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks" xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info">
<bookmark href="file:///home/balsoft">
<title>Home</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="user-home"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1539244233/0</ID>
<isSystemItem>true</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="file:///home/balsoft/cloud/Google Drive">
<title>Google Drive</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="google-drive"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1540478729/2</ID>
<isSystemItem>false</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="file:///home/balsoft/cloud/Yandex Disk/">
<title>Yandex Disk</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="yandex-disk"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1554507064/0</ID>
<isSystemItem>false</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="remote:/">
<title>Network</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="network-workgroup"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1539244233/2</ID>
<isSystemItem>true</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="file:///">
<title>Root</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="folder-red"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1539244233/3</ID>
<isSystemItem>true</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="trash:/">
<title>Trash</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="user-trash-full"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1539244233/4</ID>
<isSystemItem>true</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="file:///home/balsoft/Downloads">
<title>Downloads</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="folder-downloads"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1539244233/1</ID>
<isSystemItem>true</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="file:///home/balsoft/Documents/">
<title>Documents</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="folder-documents-symbolic"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1540414173/0</ID>
<isSystemItem>false</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<info>
<metadata owner="http://www.kde.org">
<GroupState-Places-IsHidden>false</GroupState-Places-IsHidden>
<GroupState-Remote-IsHidden>false</GroupState-Remote-IsHidden>
<GroupState-Devices-IsHidden>false</GroupState-Devices-IsHidden>
<GroupState-RemovableDevices-IsHidden>false</GroupState-RemovableDevices-IsHidden>
<withBaloo>true</withBaloo>
<GroupState-SearchFor-IsHidden>false</GroupState-SearchFor-IsHidden>
<GroupState-RecentlySaved-IsHidden>false</GroupState-RecentlySaved-IsHidden>
</metadata>
</info>
<bookmark href="timeline:/today">
<title>Today</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="go-jump-today"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1539244233/5</ID>
<isSystemItem>true</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="timeline:/yesterday">
<title>Yesterday</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="view-calendar-day"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1539244233/6</ID>
<isSystemItem>true</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="search:/documents">
<title>Documents</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="folder-text"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1539244233/7</ID>
<isSystemItem>true</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="search:/images">
<title>Images</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="folder-images"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1539244233/8</ID>
<isSystemItem>true</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="search:/audio">
<title>Audio Files</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="folder-sound"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1539244233/9</ID>
<isSystemItem>true</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="search:/videos">
<title>Videos</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="folder-videos"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1539244233/10</ID>
<isSystemItem>true</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="">
<title>Project Folder</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="folder-favorites"/>
</metadata>
<metadata owner="http://www.kde.org">
<OnlyInApp>kdenlive</OnlyInApp>
</metadata>
</info>
</bookmark>
<separator href="file:///">
<info>
<metadata owner="http://www.kde.org">
<UDI>/org/freedesktop/UDisks2/block_devices/sda2</UDI>
<isSystemItem>true</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="drive-harddisk-root"/>
</metadata>
</info>
<title>Linux filesystem</title>
</separator>
<bookmark href="file:///home/balsoft/Videos/">
<title>Videos</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="folder-videos-symbolic"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1540409511/0</ID>
<isSystemItem>false</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="file:///home/balsoft/Pictures">
<title>Pictures</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="folder-pictures-symbolic"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1540409539/1</ID>
<isSystemItem>false</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="file:///home/balsoft/projects">
<title>projects</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="user-bookmarks-symbolic"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1540463794/11</ID>
<isSystemItem>false</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="timeline:/calendar/">
<title>Calendar</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="view-calendar-timeline"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1540478496/0</ID>
<isSystemItem>false</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="fish://asus-laptop">
<title>ASUS</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="laptop"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1540585036/0</ID>
<isSystemItem>false</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="fish://hp-laptop">
<title>HP</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="laptop"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1540585062/1</ID>
<isSystemItem>false</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="fish://prestigio-laptop">
<title>Prestigio</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="laptop"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1540585084/2</ID>
<isSystemItem>false</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="fish://lenovo-workstation">
<title>Lenovo</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="computer"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1540585120/3</ID>
<isSystemItem>false</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="fish://amd-workstation">
<title>AMD</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="computer"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1540585120/3</ID>
<isSystemItem>false</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
<bookmark href="fish://192.168.1.1">
<title>Router</title>
<info>
<metadata owner="http://freedesktop.org">
<bookmark:icon name="network-server-symbolic"/>
</metadata>
<metadata owner="http://www.kde.org">
<ID>1540585202/4</ID>
<isSystemItem>false</isSystemItem>
<IsHidden>false</IsHidden>
</metadata>
</info>
</bookmark>
</xbel>

View File

@ -0,0 +1,35 @@
{ config, pkgs, lib, ... }: {
programs.light.enable = config.deviceSpecific.isLaptop;
services.actkbd = {
enable = config.deviceSpecific.isLaptop;
bindings = map (x:
x // {
events = [ "key" ];
attributes = [ "exec" ];
}) [
{
keys = [ 225 ];
command = "${pkgs.light}/bin/light -A 10";
}
{
keys = [ 224 ];
command = "${pkgs.light}/bin/light -U 10";
}
{
keys = [ 431 ];
command = (toString (pkgs.writeTextFile {
name = "dark-script";
text = ''
if [[ `${pkgs.light}/bin/light` -eq 0 ]]
then
${pkgs.light}/bin/light -I
else
${pkgs.light}/bin/light -O
${pkgs.light}/bin/light -S 0
fi'';
executable = true;
}));
}
];
};
}

View File

@ -0,0 +1,19 @@
{ pkgs, config, lib, ... }: {
i18n = {
defaultLocale = "en_GB.UTF-8";
consoleFont = "cyr-sun16";
consoleKeyMap = "ruwin_cplk-UTF-8";
};
time.timeZone = "Europe/Moscow"; # Mother Russia
home-manager.users.balsoft.home.language = let
en = "en_GB.UTF-8";
ru = "ru_RU.UTF-8";
in {
address = ru;
monetary = ru;
paper = ru;
time = en;
base = en;
};
}

View File

@ -0,0 +1,4 @@
{ pkgs, config, ...}:
{
home-manager.users.balsoft.xsession.windowManager.i3.config.startup = [ { command = "${pkgs.mako}/bin/mako --layer overlay --font 'Roboto 13' --width 500 --height 80 --default-timeout 10000 --max-visible 10 --background-color '${config.themes.colors.bg}' --text-color '${config.themes.colors.fg}' --border-color '${config.themes.colors.blue}'"; } ];
}

View File

@ -0,0 +1,59 @@
{ pkgs, lib, config, ... }: {
programs.sway.enable = true;
users.users.balsoft.extraGroups = [ "sway" ];
systemd.coredump.enable = true;
programs.ssh.askPassword = "${pkgs.plasma5.ksshaskpass}/bin/ksshaskpass";
environment.sessionVariables = {
EDITOR = config.defaultApplications.editor.cmd;
VISUAL = config.defaultApplications.editor.cmd;
LESS = "-asrRix8";
XDG_SESSION_TYPE = "wayland";
XKB_DEFAULT_LAYOUT = "us,ru";
XKB_DEFAULT_OPTIONS = "grp:lctrl_toggle,grp_led:caps,ctrl:nocaps";
QT_QPA_PLATFORM = "wayland";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
NIX_AUTO_RUN = "1";
};
services.atd.enable = true;
home-manager.users.balsoft = {
xdg.enable = true;
home.activation."mimeapps-remove" = {
before = [ "linkGeneration" ];
after = [ ];
data = "rm -f /home/balsoft/.config/mimeapps.list";
};
programs.gpg.enable = true;
services.gpg-agent = {
enable = true;
extraConfig = ''
pinentry-program ${pkgs.pinentry}/bin/pinentry
allow-emacs-pinentry
allow-loopback-pinentry
'';
};
services.udiskie.enable = true;
programs.git = {
enable = true;
userEmail = "balsoft@balsoft.ru";
userName = "Alexander Bantyev";
extraConfig.pull.rebase = true;
signing = {
signByDefault = true;
key = "687558B21E04FE92B255BED0E081FF12ADCB4AD5";
};
};
news.display = "silent";
programs.command-not-found = {
enable = true;
dbPath = ../../misc/programs.sqlite;
};
home.keyboard = {
options = [ "grp:win_space_toggle,grp_led:caps,ctrl:nocaps" ];
layout = "us,ru";
};
home.file.".icons/default".source =
"${pkgs.breeze-qt5}/share/icons/breeze_cursors";
systemd.user.startServices = true;
};
}

View File

@ -0,0 +1,25 @@
{ pkgs, config, lib, ... }:
{
services.mopidy = {
enable = true;
extensionPackages = with pkgs; [ mopidy-gmusic mopidy-youtube ];
configuration = (if (!isNull config.secrets.gpmusic) then ''
[gmusic]
username = ${config.secrets.gpmusic.user}
password = ${config.secrets.gpmusic.password}
deviceid = ${config.secrets.gpmusic.deviceid}
bitrate = 128
'' else
"") + ''
[mpd]
hostname = 0.0.0.0
[audio]
output = pulsesink server=127.0.0.1
'';
};
systemd.services.mopidy = {
after = [ "network-online.target" ];
};
}

View File

@ -0,0 +1,31 @@
{ pkgs, config, lib, ... }: {
home-manager.users.balsoft = {
xdg.configFile."rclone/rclone.conf.home".text = config.secrets.rclone;
home.activation."rclone" = {
after = [ "linkGeneration" ];
before = [ ];
data = ''
cp ./.config/rclone/rclone.conf.home ./.config/rclone/rclone.conf
chmod 700 ./.config/rclone/rclone.conf
mkdir -p cloud; cd cloud
mkdir -p 'Google Drive' || true
mkdir -p 'Yandex Disk' || true
mkdir -p 'Dropbox' || true
'';
};
xsession.windowManager.i3.config.startup = [
{
command =
"${pkgs.rclone}/bin/rclone mount google:/ '/home/balsoft/cloud/Google Drive' --daemon";
}
{
command =
"${pkgs.rclone}/bin/rclone mount Yandex:/ '/home/balsoft/cloud/Yandex Disk' --daemon";
}
{
command =
"${pkgs.rclone}/bin/rclone mount Dropbox:/ '/home/balsoft/cloud/Dropbox' --daemon";
}
];
};
}

27
modules/workspace/ssh.nix Normal file
View File

@ -0,0 +1,27 @@
{ pkgs, config, lib, ... }: {
services.openssh = {
enable = true;
passwordAuthentication = false;
permitRootLogin = "no";
forwardX11 = true;
ports = [ 22 13722 ];
};
users.users.balsoft.openssh.authorizedKeys.keys =
["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDd2OdcSHUsgezuV+cpFqk9+Svtup6PxIolv1zokVZdqvS8qxLsA/rwYmQgTnuq4/zK/GIxcUCH4OxYlW6Or4M4G7qrDKcLAUrRPWkectqEooWRflZXkfHduMJhzeOAsBdMfYZQ9024GwKr/4yriw2BGa8GbbAnQxiSeTipzvXHoXuRME+/2GsMFAfHFvxzXRG7dNOiLtLaXEjUPUTcw/fffKy55kHtWxMkEvvcdyR53/24fmO3kLVpEuoI+Mp1XFtX3DvRM9ulgfwZUn8/CLhwSLwWX4Xf9iuzVi5vJOJtMOktQj/MwGk4tY/NPe+sIk+nAUKSdVf0y9k9JrJT98S/ comment"];
home-manager.users.balsoft.programs.ssh =
if (!isNull config.secrets.id_rsa) then {
enable = true;
matchBlocks = {
"*" = {
identityFile = toString (pkgs.writeTextFile {
name = "id_rsa";
text = config.secrets.id_rsa;
});
compression = false;
};
};
} else
{ };
}

View File

@ -0,0 +1,28 @@
{ pkgs, config, lib, ... }: {
services.synergy = if config.device == "AMD-Workstation" then {
server.enable = true;
server.configFile = pkgs.writeTextFile {
name = "synergy.conf";
text = ''
section: screens
AMD-Workstation
ASUS-Laptop:
HP-Laptop:
end
section: links
ASUS-Laptop:
right = AMD-Workstation
HP-Laptop:
left = AMD-Workstation
end
section: options
keystroke(super+alt+left) = switchInDirection(left)
keystroke(super+alt+right) = switchInDirection(right)
end
'';
};
} else {
client.enable = true;
client.serverAddress = "AMD-Workstation";
};
}

View File

@ -0,0 +1,48 @@
{ config, lib, pkgs, ... }:
{
home-manager.users.balsoft = {
xresources.properties = with config.themes.colors; {
"*background" = bg;
"*foreground" = fg;
"*color0" = dark;
"*color1" = red;
"*color2" = green;
"*color3" = yellow;
"*color4" = blue;
"*color5" = purple;
"*color6" = cyan;
"*color7" = fg;
"*color8" = dark;
"*color9" = red;
"*color10" = green;
"*color11" = yellow;
"*color12" = blue;
"*color13" = purple;
"*color14" = cyan;
"*color15" = fg;
# "emacs.color0" = dark;
# "emacs.color1" = green;
# "emacs.color2" = alt;
# "emacs.color3" = yellow;
# "emacs.color4" = gray;
# "emacs.color5" = purple;
# "emacs.color6" = cyan;
# "emacs.color7" = gray;
# "emacs.color8" = alt;
# "emacs.color9" = green;
# "emacs.color10" = green;
# "emacs.color11" = yellow;
# "emacs.color12" = green;
# "emacs.color13" = purple;
# "emacs.color14" = cyan;
# "emacs.color15" = fg;
};
home.activation.xrdb = {
after = ["linkGeneration"];
before = [];
data = "DISPLAY=:0 ${pkgs.xorg.xrdb}/bin/xrdb -merge ${config.users.users.balsoft.home}/.Xresources";
};
};
}

98
modules/workspace/zsh.nix Executable file
View File

@ -0,0 +1,98 @@
{ pkgs, config, ... }: {
environment.pathsToLink = [ "/share/zsh" ];
environment.sessionVariables.SHELL = "zsh";
home-manager.users.balsoft.programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
oh-my-zsh = {
enable = true;
theme = "agnoster";
plugins = [ "git" "dirhistory" ];
};
plugins = [
{
name = "zsh-nix-shell";
file = "nix-shell.plugin.zsh";
src = pkgs.fetchFromGitHub {
owner = "chisui";
repo = "zsh-nix-shell";
rev = "b2609ca787803f523a18bb9f53277d0121e30389";
sha256 = "01w59zzdj12p4ag9yla9ycxx58pg3rah2hnnf3sw4yk95w3hlzi6";
};
}
{
name = "zsh-autosuggestions";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-autosuggestions";
rev = "v0.4.0";
sha256 = "0z6i9wjjklb4lvr7zjhbphibsyx51psv50gm07mbb0kj9058j6kc";
};
}
{
name = "you-should-use";
src = pkgs.fetchFromGitHub {
owner = "MichaelAquilina";
repo = "zsh-you-should-use";
rev = "2be37f376c13187c445ae9534550a8a5810d4361";
sha256 = "0yhwn6av4q6hz9s34h4m3vdk64ly6s28xfd8ijgdbzic8qawj5p1";
};
}
];
shellAliases = {
"b" = ''nix-build "<nixpkgs>" --no-out-link -A'';
"p" = "nix-shell --run zsh -p";
"o" = "xdg-open";
"post" = ''curl -F"file=@-" https://0x0.st'';
"clip" = "${pkgs.xclip}/bin/xclip -selection clipboard";
};
initExtra = ''
r(){nix run nixpkgs.$1 -c $@ }
cmdignore=(htop tmux top vim)
function active_window_id () {
if [[ -n $DISPLAY ]] ; then
${pkgs.xorg.xprop}/bin/xprop -root _NET_ACTIVE_WINDOW | awk '{print $5}'
return
fi
echo nowindowid
}
# end and compare timer, notify-send if needed
function notifyosd-precmd() {
retval=$?
if [ ! -z "$cmd" ]; then
cmd_end=`date +%s`
((cmd_time=$cmd_end - $cmd_start))
fi
if [ $retval -eq 0 ]; then
cmdstat=""
else
cmdstat=""
fi
if [ ! -z "$cmd" -a ! $term_window = $(active_window_id) ]; then
${pkgs.libnotify}/bin/notify-send -i utilities-terminal -u low "$cmdstat $cmd" "in `date -u -d @$cmd_time +'%T'`"
fi
unset cmd
}
# make sure this plays nicely with any existing precmd
precmd_functions+=( notifyosd-precmd )
# get command name and start the timer
function notifyosd-preexec() {
cmd=$1
term_window=$(active_window_id)
cmd_start=`date +%s`
}
# make sure this plays nicely with any existing preexec
preexec_functions+=( notifyosd-preexec )
XDG_DATA_DIRS=$XDG_DATA_DIRS:$GSETTINGS_SCHEMAS_PATH
PS1="$PS1
$ "
'';
};
}

38
modules/xserver.nix Normal file
View File

@ -0,0 +1,38 @@
{ pkgs, lib, config, ... }:
let
cpu = config.deviceSpecific.cpu;
device = config.device;
isShared = config.deviceSpecific.isShared;
in {
services.xserver = {
enable = true;
enableTCP = true;
libinput = {
enable = true;
sendEventsMode = "disabled-on-external-mouse";
middleEmulation = false;
naturalScrolling = true;
};
videoDrivers = if cpu == "amd" then
["amdgpu"]
else if device == "Lenovo-Workstation" then
["radeon"]
else
["intel"];
displayManager.lightdm = {
enable = true;
greeter.enable = isShared;
autoLogin.enable = !isShared;
autoLogin.user = "balsoft";
};
desktopManager.plasma5.enable = true;
desktopManager.default = "none";
windowManager.i3 = {
enable = true;
package = pkgs.i3-gaps;
};
windowManager.default = "i3";
layout = "us,ru";
xkbOptions = "grp:caps_toggle,grp_led:caps";
};
}

273
nix/sources.json Normal file
View File

@ -0,0 +1,273 @@
{
"NUR": {
"branch": "master",
"description": "Nix User Repository: User contributed nix packages [maintainer=@Mic92]",
"homepage": "",
"owner": "nix-community",
"repo": "NUR",
"rev": "ffd4ab4b9e3de6f695dd4501125b6cbe002edc62",
"sha256": "15hw02m5mwbp7smy462kjzzqb4i0g4c5ncc4maq59mhgiy0cdn4x",
"type": "tarball",
"url": "https://github.com/nix-community/NUR/archive/ffd4ab4b9e3de6f695dd4501125b6cbe002edc62.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"UserChrome-Tweaks": {
"branch": "master",
"description": "A community maintained repository of userChrome.css tweaks for Firefox",
"homepage": null,
"owner": "Timvde",
"repo": "UserChrome-Tweaks",
"rev": "76affa52fd040f703fa7cdcc9f0459643c9883d1",
"sha256": "1nz70d1l0mf4zqk5ng1cizzx8r4hxgkkx8wsw93wld3wdyhk7k3a",
"type": "tarball",
"url": "https://github.com/Timvde/UserChrome-Tweaks/archive/76affa52fd040f703fa7cdcc9f0459643c9883d1.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"all-hies": {
"branch": "master",
"description": "Cached Haskell IDE Engine Nix builds for all GHC versions",
"homepage": "",
"owner": "Infinisil",
"repo": "all-hies",
"rev": "4b984030c8080d944372354a7b558c49858057e7",
"sha256": "0109l0ls7gh2gydrgx45168lg45kgmgwaw9jpjm8mwvwd1brssfk",
"type": "tarball",
"url": "https://github.com/Infinisil/all-hies/archive/4b984030c8080d944372354a7b558c49858057e7.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"base16-unclaimed-schemes": {
"branch": "master",
"description": "A collection of themes that have no repositories for homes :(",
"homepage": null,
"owner": "chriskempson",
"repo": "base16-unclaimed-schemes",
"rev": "d6b93456dc1012628faec572387814f59e0b854a",
"sha256": "043ny56snl4w2ri1i0zzfh00zm2gf2h5jz57kgmf5jb9xj0sspb1",
"type": "tarball",
"url": "https://github.com/chriskempson/base16-unclaimed-schemes/archive/d6b93456dc1012628faec572387814f59e0b854a.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"home-manager": {
"branch": "master",
"description": "Manage a user environment using Nix",
"homepage": "",
"owner": "rycee",
"repo": "home-manager",
"rev": "95c8007b8fe4433cd217db83ce26b8e29875ba06",
"sha256": "1f5fbpsaizz1hrsajprn2bcbjzgjs5jy72yir6gszg6360j61w5q",
"type": "tarball",
"url": "https://github.com/rycee/home-manager/archive/95c8007b8fe4433cd217db83ce26b8e29875ba06.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"materia-theme": {
"branch": "master",
"description": "A Material Design theme for GNOME/GTK based desktop environments",
"homepage": "",
"owner": "nana-4",
"repo": "materia-theme",
"rev": "b1e4c563146ae34fff6a697393b6a1bc66b612f5",
"sha256": "1w65v7jl8v5h41d27gj79rnkbn8rw0avrj4gi57l8lvlhpn9q6a2",
"type": "tarball",
"url": "https://github.com/nana-4/materia-theme/archive/b1e4c563146ae34fff6a697393b6a1bc66b612f5.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"mopidy": {
"branch": "v2.3.1",
"description": "Mopidy is an extensible music server written in Python",
"homepage": "https://mopidy.com",
"owner": "mopidy",
"repo": "mopidy",
"rev": "6ee0379b0f4eee0da5721b3c415f520626e56b20",
"sha256": "1qdflxr0an6l2m3j90h55bzyj7rjlkkwmxx945hwv8xi472rcgdj",
"type": "tarball",
"url": "https://github.com/mopidy/mopidy/archive/6ee0379b0f4eee0da5721b3c415f520626e56b20.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"mopidy-gmusic": {
"branch": "master",
"description": "Mopidy extension for playing music from Google Play Music",
"homepage": "https://www.mopidy.com",
"owner": "mopidy",
"repo": "mopidy-gmusic",
"rev": "88e71a18fd8b20b302b990abd97e2bf52cf678b8",
"sha256": "08xi0pn1zvkfy1d27pll1dwj2m08mdf07g1bw4aqz2p59vy67v6v",
"type": "tarball",
"url": "https://github.com/mopidy/mopidy-gmusic/archive/88e71a18fd8b20b302b990abd97e2bf52cf678b8.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"mopidy-youtube": {
"branch": "develop",
"description": "Mopidy extension for playing music from YouTube",
"homepage": "",
"owner": "natumbri",
"repo": "mopidy-youtube",
"rev": "d2d9999111f382ce3cf2f6600701649deadaafde",
"sha256": "1ld1w56nh8b527rr2g3a81dh0lxmabvn2pa3y8kv22m2vjbr7b04",
"type": "tarball",
"url": "https://github.com/natumbri/mopidy-youtube/archive/d2d9999111f382ce3cf2f6600701649deadaafde.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"mtxclient": {
"branch": "0.3.0-dev",
"description": "Client API library for Matrix, built on top of Boost.Asio",
"homepage": "",
"owner": "nheko-reborn",
"repo": "mtxclient",
"rev": "84c6778cc367bca79755e73e77b2cc69950375b2",
"sha256": "13h5a0kdsirsfrgvmyi0r441cbjx247ymif5gk1b35h27vk1613k",
"type": "tarball",
"url": "https://github.com/nheko-reborn/mtxclient/archive/84c6778cc367bca79755e73e77b2cc69950375b2.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nheko": {
"branch": "0.7.0-dev",
"description": "Desktop client for Matrix using Qt and C++14.",
"homepage": "",
"owner": "nheko-reborn",
"repo": "nheko",
"rev": "1943d1c74d5253ec9d2b7ee38f69d791d28e84c1",
"sha256": "1r9fm3wzcw8jcg5amabpdj5rs3099dcx1mw1r6j559s9ymcfimwi",
"type": "tarball",
"url": "https://github.com/nheko-reborn/nheko/archive/1943d1c74d5253ec9d2b7ee38f69d791d28e84c1.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"niv": {
"branch": "master",
"description": "Easy dependency management for Nix projects",
"homepage": "https://github.com/nmattia/niv",
"owner": "nmattia",
"repo": "niv",
"rev": "49157afd2298749b8a5062fd21079542a6b2de35",
"sha256": "0q7ymfrcgagcsw6kr93kprag7k358qj8znyzyri53ci1mrsak5y1",
"type": "tarball",
"url": "https://github.com/nmattia/niv/archive/49157afd2298749b8a5062fd21079542a6b2de35.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixfmt": {
"branch": "master",
"description": "A formatter for Nix code",
"homepage": "https://nixfmt.serokell.io",
"owner": "serokell",
"repo": "nixfmt",
"rev": "921bbd3bb9c95cf2d677a8558b1a27fca6cee597",
"sha256": "0x08xsjal6db95y1sxxinwv9ks2k6fayvg8435s6zqy7zq42jxm4",
"type": "tarball",
"url": "https://github.com/serokell/nixfmt/archive/921bbd3bb9c95cf2d677a8558b1a27fca6cee597.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
"branch": "nixos-unstable",
"builtin": false,
"description": "The nix packages collection stable",
"homepage": "https://github.com/nixos/nixpkgs",
"owner": "nixos",
"repo": "nixpkgs-channels",
"rev": "8130f3c1c2bb0e533b5e150c39911d6e61dcecc2",
"sha256": "154nrhmm3dk5kmga2w5f7a2l6j79dvizrg4wzbrcwlbvdvapdgkb",
"type": "tarball",
"url": "https://github.com/nixos/nixpkgs-channels/archive/8130f3c1c2bb0e533b5e150c39911d6e61dcecc2.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs-old": {
"branch": "nixos-19.03",
"description": "Nix Packages collection",
"homepage": null,
"owner": "nixos",
"repo": "nixpkgs",
"rev": "c8db7a8a16ee9d54103cade6e766509e1d1c8d7b",
"sha256": "1b3h4mwpi10blzpvgsc0191k4shaw3nw0qd2p82hygbr8vv4g9dv",
"type": "tarball",
"url": "https://github.com/nixos/nixpkgs/archive/c8db7a8a16ee9d54103cade6e766509e1d1c8d7b.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs-unstable": {
"branch": "nixos-unstable",
"description": "The nix packages collection unstable",
"homepage": "https://github.com/nixos/nixpkgs",
"owner": "nixos",
"repo": "nixpkgs-channels",
"rev": "90441b4b47fc7280de6a5bd1a228017caaa0f97f",
"sha256": "1nz9lhk53m8j6xm1frs8hk7mb76axbs3wz8xg5mrvi28cv9jldbn",
"type": "tarball",
"url": "https://github.com/nixos/nixpkgs-channels/archive/90441b4b47fc7280de6a5bd1a228017caaa0f97f.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"pykka": {
"branch": "v2.0.1",
"description": "Pykka is a Python implementation of the actor model, which makes it easier to build concurrent applications",
"homepage": "https://www.pykka.org",
"owner": "jodal",
"repo": "pykka",
"rev": "1982e1caf63726c66b28616c80d548ae1bb4fe87",
"sha256": "011rvv3vzj9rpwaq6vfpz9hfwm6gx1jmad4iri6z12g8nnlpydhs",
"type": "tarball",
"url": "https://github.com/jodal/pykka/archive/1982e1caf63726c66b28616c80d548ae1bb4fe87.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"scripts": {
"branch": "master",
"description": "Official scripts for WeeChat.",
"homepage": "https://weechat.org/scripts/",
"owner": "weechat",
"repo": "scripts",
"rev": "a69d3ff2fce34958f78395a85c0b8676f3d03b15",
"sha256": "1x88bvdi9pqvpfqqwp8q59ic2ia937q07hcj2dkia17ncj2v27wd",
"type": "tarball",
"url": "https://github.com/weechat/scripts/archive/a69d3ff2fce34958f78395a85c0b8676f3d03b15.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"simple-nixos-mailserver": {
"sha256": "08wcwc54b1k9gnx5z97yv4gm28lx50vnnsvk93l98zq209rpf7rq",
"type": "tarball",
"url": "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/0bf2bb0b54736df944c657a15069d19e01ab78a8/nixos-mailserver-0bf2bb0b54736df944c657a15069d19e01ab78a8.tar.gz",
"url_template": "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/0bf2bb0b54736df944c657a15069d19e01ab78a8/nixos-mailserver-0bf2bb0b54736df944c657a15069d19e01ab78a8.tar.gz"
},
"sway": {
"branch": "master",
"description": "i3-compatible Wayland compositor",
"homepage": "https://swaywm.org/",
"owner": "swaywm",
"repo": "sway",
"rev": "ab77efc6caba50acc4c87e02ae3e6712ea808772",
"sha256": "1wmjv8sj4zkmcfgfk5can2zmnq2dxggh2viaw575hzbn34nxi2pz",
"type": "tarball",
"url": "https://github.com/swaywm/sway/archive/ab77efc6caba50acc4c87e02ae3e6712ea808772.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"weechat-notify-send": {
"branch": "master",
"description": "A WeeChat script that sends highlight and message notifications through notify-send.",
"homepage": "",
"owner": "s3rvac",
"repo": "weechat-notify-send",
"rev": "b491e6acc1fe00fd1b91409444f9904587b2e588",
"sha256": "1f9558a78ismd645c9v6p3lgda6hkgn3f63i8s4y5r8zdymx08d0",
"type": "tarball",
"url": "https://github.com/s3rvac/weechat-notify-send/archive/b491e6acc1fe00fd1b91409444f9904587b2e588.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"wl-clipboard": {
"branch": "master",
"description": "Command-line copy/paste utilities for Wayland",
"homepage": "",
"owner": "bugaevc",
"repo": "wl-clipboard",
"rev": "f3a45f69f7d14e7f7050bca4cbf6fea6697d1455",
"sha256": "0c4w87ipsw09aii34szj9p0xfy0m00wyjpll0gb0aqmwa60p0c5d",
"type": "tarball",
"url": "https://github.com/bugaevc/wl-clipboard/archive/f3a45f69f7d14e7f7050bca4cbf6fea6697d1455.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"wlroots": {
"branch": "master",
"description": "A modular Wayland compositor library",
"homepage": "https://swaywm.org",
"owner": "swaywm",
"repo": "wlroots",
"rev": "57ffb35de009611d8edecb297bc2fd10a9a86702",
"sha256": "0c0q1p9yss5kx4430ik3n89drqpmm2bvgl8fjlf6prac1a7xzqn8",
"type": "tarball",
"url": "https://github.com/swaywm/wlroots/archive/57ffb35de009611d8edecb297bc2fd10a9a86702.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}

134
nix/sources.nix Normal file
View File

@ -0,0 +1,134 @@
# This file has been generated by Niv.
let
#
# The fetchers. fetch_<type> fetches specs of type <type>.
#
fetch_file = pkgs: spec:
if spec.builtin or true then
builtins_fetchurl { inherit (spec) url sha256; }
else
pkgs.fetchurl { inherit (spec) url sha256; };
fetch_tarball = pkgs: spec:
if spec.builtin or true then
builtins_fetchTarball { inherit (spec) url sha256; }
else
pkgs.fetchzip { inherit (spec) url sha256; };
fetch_git = spec:
builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; };
fetch_builtin-tarball = spec:
builtins.trace
''
WARNING:
The niv type "builtin-tarball" will soon be deprecated. You should
instead use `builtin = true`.
$ niv modify <package> -a type=tarball -a builtin=true
''
builtins_fetchTarball { inherit (spec) url sha256; };
fetch_builtin-url = spec:
builtins.trace
''
WARNING:
The niv type "builtin-url" will soon be deprecated. You should
instead use `builtin = true`.
$ niv modify <package> -a type=file -a builtin=true
''
(builtins_fetchurl { inherit (spec) url sha256; });
#
# Various helpers
#
# The set of packages used when specs are fetched using non-builtins.
mkPkgs = sources:
let
sourcesNixpkgs =
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) {};
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
in
if builtins.hasAttr "nixpkgs" sources
then sourcesNixpkgs
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
import <nixpkgs> {}
else
abort
''
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
add a package called "nixpkgs" to your sources.json.
'';
# The actual fetching function.
fetch = pkgs: name: spec:
if ! builtins.hasAttr "type" spec then
abort "ERROR: niv spec ${name} does not have a 'type' attribute"
else if spec.type == "file" then fetch_file pkgs spec
else if spec.type == "tarball" then fetch_tarball pkgs spec
else if spec.type == "git" then fetch_git spec
else if spec.type == "builtin-tarball" then fetch_builtin-tarball spec
else if spec.type == "builtin-url" then fetch_builtin-url spec
else
abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
# Ports of functions for older nix versions
# a Nix version of mapAttrs if the built-in doesn't exist
mapAttrs = builtins.mapAttrs or (
f: set: with builtins;
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
);
# fetchTarball version that is compatible between all the versions of Nix
builtins_fetchTarball = { url, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchTarball;
in
if lessThan nixVersion "1.12" then
fetchTarball { inherit url; }
else
fetchTarball attrs;
# fetchurl version that is compatible between all the versions of Nix
builtins_fetchurl = { url, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchurl;
in
if lessThan nixVersion "1.12" then
fetchurl { inherit url; }
else
fetchurl attrs;
# Create the final "sources" from the config
mkSources = config:
mapAttrs (
name: spec:
if builtins.hasAttr "outPath" spec
then abort
"The values in sources.json should not have an 'outPath' attribute"
else
spec // { outPath = fetch config.pkgs name spec; }
) config.sources;
# The "config" used by the fetchers
mkConfig =
{ sourcesFile ? ./sources.json
, sources ? builtins.fromJSON (builtins.readFile sourcesFile)
, pkgs ? mkPkgs sources
}: rec {
# The sources, i.e. the attribute set of spec name to spec
inherit sources;
# The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
inherit pkgs;
};
in
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }

BIN
secret.nix.gpg Normal file

Binary file not shown.

62
support.nix Executable file
View File

@ -0,0 +1,62 @@
{ lib, config, ... }:
let
mkKeyValue = key: value:
let
mvalue = if builtins.isBool value then
(if value then "true" else "false")
else if (builtins.isString value && key != "include-file") then
value
else
builtins.toString value;
in "${key}=${mvalue}";
attrsToList = with builtins;
x:
(map (key: {
name = key;
value = getAttr key x;
}) (attrNames x));
in rec {
genIni = lib.generators.toINI { inherit mkKeyValue; };
genIniOrdered = lst:
(builtins.concatStringsSep "\n" (map ({ name ? "widget", ... }@attrs:
builtins.concatStringsSep "\n" ([ "[${name}]" ]
++ (map ({ name, value }: mkKeyValue name value)
(attrsToList (builtins.removeAttrs attrs [ "name" ]))))) lst)) + "\n";
thm = config.themes.colors;
splitHex = hexStr:
map (x: builtins.elemAt x 0) (builtins.filter (a: a != "" && a != [ ])
(builtins.split "(.{2})" (builtins.substring 1 6 hexStr)));
hex2decDigits = rec {
"0" = 0;
"1" = 1;
"2" = 2;
"3" = 3;
"4" = 4;
"5" = 5;
"6" = 6;
"7" = 7;
"8" = 8;
"9" = 9;
"a" = 10;
"b" = 11;
"c" = 12;
"d" = 13;
"e" = 14;
"f" = 15;
A = a;
B = b;
C = c;
D = d;
E = e;
F = f;
};
doubleDigitHexToDec = hex:
16 * hex2decDigits."${builtins.substring 0 1 hex}"
+ hex2decDigits."${builtins.substring 1 2 hex}";
thmDec = builtins.mapAttrs (name: color: colorHex2Dec color) thm;
colorHex2Dec = color:
builtins.concatStringsSep ","
(map (x: toString (doubleDigitHexToDec x)) (splitHex color));
}

6
switch Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
PATH=/run/current-system/sw/bin
nix-env --profile /nix/var/nix/profiles/system --set $(readlink $1/result)
$1/result/bin/switch-to-configuration switch

6
vm Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
[[ -z ./secret.nix ]] && echo null > secret.nix
nixpkgs=$(nix eval --raw "(with import ./nix/sources.nix; nixpkgs)")
NIX_PATH=nixpkgs=$nixpkgs:nixos-config=./vm.nix nix build -f $nixpkgs/nixos vm
./result/bin/run-NixOS-VM-vm -m size=4G # Sorry, my apps are way too large

1
vm.nix Normal file
View File

@ -0,0 +1 @@
import ./. "NixOS-VM"