flakes: Migrate the config and miku to flakes

This commit is contained in:
2021-11-01 21:33:21 +01:00
parent 09d385806a
commit 1d8f2f8053
64 changed files with 2612 additions and 1739 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,21 +0,0 @@
{ pkgs, ... }:
{
boot.binfmt.emulatedSystems = [ "i686-linux" "aarch64-linux" ]; # For remote building
environment.systemPackages = with pkgs; [ openssh ];
nix.trustedUsers = [ "builder" ];
# TODO: Specify a firewall rule to only allow this from my other NixOS machines
users = {
groups.builder = {};
extraUsers."builder" = {
group = "builder";
isSystemUser = true;
useDefaultShell = true;
openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCYfZ6FF3I7Bc8h1VmRxNDHOL08OffetE4DaOZKgw3ZFYSYub80eGN14jevx4Ie525MptFIYbvO5FUcpXx3d6Dh7AE7WUsGzbvPPCmaRy/wiwn2mpCKWqSC3EVxabPakTfVD2+OWDVUW/LWDb2bK40NegBykxf9Vo7112lBFXD8xcq1p8cyhCaq/vsnWUr/8T5z029ySp5UnzuesqrXpfVwnBVzj7xaZizs3Y0bUxdP6vWQSqrTl9KXUveRt3AL+TG3ny4KESvFzGo4YZQCQ2WgCGWgf8SLeHm8UDp8h7dPWkzmT/y7ZSWKGp2R0VDklsjJQqi91l+NXBmKs/uLTVMVqGTYeO04z2mzwzI7aBLrN7A2n3/SmFHz6gW64BYkWNh6iRaDAnu0CgDM4rWyBD/vrgjlojJv6tmSCA3hNGm2ndRfsjiv49+K9NEAxkiijnf0277KHgPHstzlhFq6hYT9qEbaPtqfbKUeWMhj3FpqTHfNVznOXR6+bsGW7h28uLc= alexander@ayame"
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCnhM7E78tisAJuHpLURXXuR3Ya6bFXgh0gLAPU41EAw4QXg77NvW5vuSwGoGLsGmJCYUQSkQbzoqDpjDkdIzuJFMlkQrSBgHSm1g5BdQSY+g/Coey452vd8Xw/tHejlB102ZQI6Pp7IuWTVvJR0jZDosd3igEUmlWN7EVhtS4BIYioZTYS03XPHhZLsLvpXBtX9PST/iHINg1BkvVMAwHd3sRotTCFkJD8dlLrstKDPWijWNjnAmXuTFYPe0PQFUJFaM9JqoXbbu8JuOITtJDNnbh/3z6FNBnn7waJBL5hY+CRaDTnL5icNXzn+L3pcSNUMIm9/AlciqADf9gKx89+bdsM87KFVoFHYWkqHVEo1vBHxssMFFEF9hyTd68bav6rCLlF4CCH+TWG/wUbFR+s2eM+OEAhOl4fcfXMCOKRIMa2N8mAUm5Ms/1Ix1pWQ3MVqfidq7TXhh3Nu91jEoAVjVHihcpfDoNcwPVGXcQY/HcscR6A8VKiQt3ektKTan8= alexander@miku"
];
};
};
}

View File

@@ -1,24 +0,0 @@
{ pkgs, ... }:
let
network = import ../../network.nix;
in {
nix = {
distributedBuilds = true;
buildMachines = [{
hostName = "miku";
systems = [ "x86_64-linux" "i686-linux" ];
maxJobs = 4;
speedFactor = 2;
supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
}];
};
programs.ssh.extraConfig = ''
Host miku
HostName ${network.miku}
User builder
IdentitiesOnly yes
IdentityFile /root/.ssh/id_builder
'';
}

View File

@@ -0,0 +1,293 @@
(defconst dd/using-native-comp-p (fboundp 'native-comp-available-p))
(when dd/using-native-comp-p
(setq comp-async-query-on-exit t)
(setq comp-async-jobs-number 8)
(setq comp-async-report-warnings-errors nil)
(setq comp-deferred-compilation t))
(setq redisplay-dont-pause t)
(setq jit-lock-defer-time 0)
(setq fast-but-imprecise-scrolling t)
(setq make-backup-files nil)
(setq create-lockfiles nil)
;; A trick for faster startup is to just disable GC for the init phase
;;; See: https://github.com/nilcons/emacs-use-package-fast#a-trick-less-gc-during-startup
(setq gc-cons-threshold 64000000)
(add-hook 'after-init-hook #'(lambda ()
;; restore after startup
(setq gc-cons-threshold 800000)))
(defun http-download-verify-and-exec (url sha256-hash name func)
(let ((actual-hash ""))
(with-temp-buffer
;; Somewhat not documented function. Based on https://emacs.stackexchange.com/a/38482
;; The problem is that url-retrieve-synchronously prints the HTTP headers at
;; the top, which are, since they include time, non-deterministic and thus cannot
;; be used for hashing.
(url-insert-file-contents url)
(setq actual-hash (secure-hash 'sha256 (current-buffer)))
(unless (string= sha256-hash actual-hash)
(error "Unexpected hash for %s: Got %s, expected %s" name actual-hash sha256-hash))
func)))
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5)
(install-hash ""))
(unless (file-exists-p bootstrap-file)
(http-download-verify-and-exec
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
"5bbeee903a90a0fda88a6b8516697c121400facb36a2c349e9447a53baef154e"
"straight's install.el"
(lambda ()
(goto-char (point-max))
(eval-print-last-sexp))))
(load bootstrap-file nil 'nomessage))
(setq straight-use-package-by-default t)
(straight-use-package 'use-package)
; Visual things
(defvar emacs-font "SourceCodePro:style=Light-7")
(add-to-list 'default-frame-alist `(font . ,emacs-font))
(set-face-attribute 'default t :height 150 :font emacs-font)
(tool-bar-mode -1)
(menu-bar-mode -1)
(toggle-scroll-bar -1)
(setq inhibit-startup-screen t)
;; We cannot exactly use use-package, so we just download it "manually".
(let* ((theme-dir (expand-file-name "themes" user-emacs-directory))
(theme-file (expand-file-name "weyland-yutani-theme.el" theme-dir)))
(unless (file-exists-p theme-file)
(unless (file-exists-p theme-dir)
(make-directory theme-dir))
(http-download-verify-and-exec
"https://raw.githubusercontent.com/jstaursky/weyland-yutani-theme/246410e1c03f7d8d8e76102f7c5e3cda83acb36b/weyland-yutani-theme.el"
"6593a0a7e46710e25f9b9caf9888106c93230bd20f9af87c5fc883a98b187253"
"weyland-yutani-theme.el"
(lambda ()
(write-file theme-file))))
(add-to-list 'custom-theme-load-path theme-dir)
(load-theme 'weyland-yutani t))
(use-package rainbow-delimiters
:straight t
:config
(add-hook 'prog-mode-hook
#'rainbow-delimiters-mode))
(use-package hl-todo
:straight t
:config
(add-hook 'prog-mode-hook
#'hl-todo-mode))
(global-hl-line-mode 1)
(use-package nlinum
:straight t
:config
(add-hook 'prog-mode-hook
(lambda ()
(nlinum-mode 1))))
(add-hook 'prog-mode-hook
(lambda ()
(show-paren-mode 1)
(setq show-parens-delay 0)))
(use-package ivy
:straight t
:config
(defvar ivy-use-virtual-buffers t)
(ivy-mode 1))
(setq enable-recursive-minibuffers t)
; This function allows us to exit EVIL states with C-c
; (https://www.emacswiki.org/emacs/Evil#toc16)
(defun escape (prompt)
(cond ((or (evil-insert-state-p) (evil-normal-state-p) (evil-replace-state-p) (evil-visual-state-p)) [escape])
(t (kbd "C-g"))))
(use-package evil
:init
(setq evil-want-keybinding nil)
:config
(define-key key-translation-map (kbd "C-c") 'escape)
(evil-mode 1))
(use-package evil-collection
:after evil
:ensure t
:config
(evil-collection-init))
; Vim-like buffer navigation
(global-set-key (kbd "C-h") 'windmove-left)
(global-set-key (kbd "C-l") 'windmove-right)
(global-set-key (kbd "C-k") 'windmove-up)
(global-set-key (kbd "C-j") 'windmove-down)
(use-package rainbow-delimiters
:config
(add-hook 'prog-mode-hook
#'rainbow-delimiters-mode))
(use-package highlight-parentheses
:straight t
:config
(highlight-parentheses-mode))
(use-package smartparens
:straight t
:config
(smartparens-global-mode t))
(use-package undo-tree
:straight t
:config
(global-undo-tree-mode))
(use-package hl-todo
:config
(add-hook 'prog-mode-hook
#'hl-todo-mode))
(global-hl-line-mode 1)
(setq-default indent-tab-mode t)
(setq tab-width 4)
(use-package perspective
:bind
("C-x C-b" . (lambda (arg)
(interactive "P")
(if (fboundp 'persp-bs-show)
(persp-bs-show arg)
(bs-show "all"))))
:config
(message "Persp-mode")
(persp-mode))
;; mu4e config
(unless (string= (system-name) "miku")
; I don't need mu4e on my desktop
(load-file (expand-file-name "mu4e.el" user-emacs-directory))
(use-package mu4e
:straight t
:config
(ptw/init-mu4e)))
(use-package calfw
:straight (calfw
:host github
:repo "kiwanami/emacs-calfw"
:files ("calfw.el" "calfw-cal.el")))
;; Org mode stuff
;(use-package org-evil
; :straight t)
(use-package graphviz-dot-mode
:straight t)
(use-package org
:straight t
:bind
("C-x P" . (lambda ()
(interactive)
(org-babel-execute-src-block)
(org-redisplay-inline-images)))
:config
(org-babel-do-load-languages
'org-babel-load-languages
'((dot . t)))
(add-hook 'org-mode-hook
(lambda ()
(local-set-key
(kbd "C-x q")
(lambda ()
(interactive)
(org-present-quit)))
(local-set-key
(kbd "C-x p")
(lambda ()
(interactive)
(org-present))))))
(use-package org-present
:straight (org-present
:host github
:repo "rlister/org-present"
:files ("org-present.el"))
:config
(add-hook 'org-present-mode-hook
(lambda ()
(org-present-big)
(org-display-inline-images)
(org-present-hide-cursor)
(org-present-read-only)
(org-hide-block-all)
; Disable evil, but bind left (prev) and right (next)
(turn-off-evil-mode)
(local-set-key
(kbd "l")
(lambda ()
(interactive)
(org-present-next)
;; NOTE: Workaround for images not being shown wen
;; the slide has been changed
(org-redisplay-inline-images)))
(local-set-key
(kbd "h")
(lambda ()
(interactive)
(org-present-prev)
;; NOTE: Workaround for images not being shown wen
;; the slide has been changed
(org-redisplay-inline-images)))
;; Disable the modeline. But save it before so that we
;; can restore it
(set (make-local-variable 'saved-mode-line-format) mode-line-format)
(setq mode-line-format nil)))
(add-hook 'org-present-mode-quit-hook
(lambda ()
(org-present-small)
(org-remove-inline-images)
(org-present-show-cursor)
(org-present-read-write)
(org-show-all)
(turn-on-evil-mode)
(local-unset-key (kbd "h"))
(local-unset-key (kbd "l"))
;; Restore the modeline.
;; NOTE: We need to call redraw-display or else the modeline
;; won't be complete
(setq mode-line-format saved-mode-line-format)
(redraw-display))))
;; Development
(use-package tide
:straight t
:config
(defun setup-tide-mode ()
(interactive)
(tide-setup)
(tide-hl-identifier-mode +1))
(add-hook 'typescript-mode-hook #'setup-tide-mode)
(add-hook 'web-mode-hook
(lambda ()
(when (string-equal "tsx" (file-name-extension buffer-file-name))
(setup-tide-mode))))
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode)))
(use-package nix-mode
:straight t)
(use-package go-mode
:straight t)
(use-package json-mode
:straight t)
(use-package rust-mode
:straight t)
;; Debugging
(use-package explain-pause-mode
:straight
(explain-pause-mode
:type git
:host github
:repo "lastquestion/explain-pause-mode")
:config
(explain-pause-mode))

View File

@@ -1,11 +1,19 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
{
services.emacs.package = pkgs.emacsPgtkGcc;
let
cfg = config.ptw.programs.emacs;
in {
options.ptw.programs.emacs = {
enable = lib.mkEnableOption "Configure emacs";
};
home-manager.users."${config.system.singleUser}".home.file = {
".emacs".source = ./dotemacs;
".emacs.d/early-init.el".source = ./early-init.el;
".emacs.d/mu4e.el".source = ./mu4e.el;
config = lib.mkIf cfg.enable {
services.emacs.package = pkgs.emacsPgtkGcc;
home-manager.users."${config.ptw.system.singleUser}".home.file = {
".emacs".source = ./dotemacs;
".emacs.d/early-init.el".source = ./early-init.el;
".emacs.d/mu4e.el".source = ./mu4e.el;
};
};
}

View File

@@ -1,9 +1,15 @@
{ config, pkgs, ... }:
{ inputs, config, lib, pkgs, ... }:
{
config = {
let
cfg = config.ptw.programs.firefox;
in {
options.ptw.programs.firefox = {
enable = lib.mkEnableOption "Configure Firefox using HomeManager";
};
config = lib.mkIf cfg.enable {
environment = {
systemPackages = with pkgs; [ unstable.firefox-wayland tor-browser-bundle-bin ];
systemPackages = with pkgs; [ firefox-wayland tor-browser-bundle-bin ];
# Deploy a Firefox policy to set the search engine and do some other things
etc."firefox/policies/policies.json".source = ./policies.json;
@@ -16,7 +22,7 @@
};
};
home-manager.users."${config.system.singleUser}".programs.firefox = {
home-manager.users."${config.ptw.system.singleUser}".programs.firefox = {
enable = true;
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
https-everywhere

View File

@@ -1,36 +0,0 @@
[general]
reaper_freq=5
desiredgov=performance
; TODO: Maybe set this
;defaultgov=powersave
; The iGPU desired governor is used when the integrated GPU is under heavy load
igpu_desiredgov=powersave
igpu_power_threshold=0.3
softrealtime=on;
renice=0
ioprio=0
inhibit_screensaver=1
[filter]
; If "whitelist" entry has a value(s)
; gamemode will reject anything not in the whitelist
;whitelist=RiseOfTheTombRaide
; Gamemode will always reject anything in the blacklist
;blacklist=HalfLife3
; glxgears
[gpu]
[supervisor]
[custom]
start=systemctl --user start replaysorcery-kms
systemctl --user start replaysorcery
end=systemctl --user stop replaysorcery-kms
systemctl --user stop replaysorcery
script_timeout=10

View File

@@ -1,21 +0,0 @@
{ ... }:
{
config.programs.gamemode = {
enable = true;
enableRenice = true;
settings = {
general = {
reaper_freq = 5;
desiredgov = "performance";
igpu_desiredgov = "powersave";
igpu_power_threshold = 0.3;
softrealtime = "on";
renice = 0;
ioprio = 0;
inhibit_screensaver = 1;
};
};
};
}

View File

@@ -1,36 +0,0 @@
[general]
reaper_freq=5
desiredgov=performance
; TODO: Maybe set this
;defaultgov=powersave
; The iGPU desired governor is used when the integrated GPU is under heavy load
igpu_desiredgov=powersave
igpu_power_threshold=0.3
softrealtime=on;
renice=0
ioprio=0
inhibit_screensaver=1
[filter]
; If "whitelist" entry has a value(s)
; gamemode will reject anything not in the whitelist
;whitelist=RiseOfTheTombRaider
; Gamemode will always reject anything in the blacklist
;blacklist=HalfLife3
; glxgears
[gpu]
[supervisor]
[custom]
start=systemctl --user start replaysorcery-kms
systemctl --user start replaysorcery
end=systemctl --user stop replaysorcery-kms
systemctl --user stop replaysorcery
script_timeout=10

View File

@@ -1,9 +1,14 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
{
config = {
let
cfg = config.ptw.programs.git;
in {
options.ptw.programs.git = {
enable = lib.mkEnableOption "Configure git using HomeManager";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkgs.diff-so-fancy ];
home-manager.users."${config.system.singleUser}".programs.git = {
home-manager.users."${config.ptw.system.singleUser}".programs.git = {
enable = true;
userEmail = "papatutuwawa@polynom.me";
userName = "Alexander \"PapaTutuWawa\"";

View File

@@ -1,9 +1,15 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
{
config = {
let
cfg = config.ptw.programs.gnome-terminal;
in {
options.ptw.programs.gnome-terminal = {
enable = lib.mkEnableOption "Configure GNOME Terminal using HomeManager";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkgs.gnome.gnome-terminal ];
home-manager.users."${config.system.singleUser}".programs.gnome-terminal = {
home-manager.users."${config.ptw.system.singleUser}".programs.gnome-terminal = {
enable = true;
profile.default = {
visibleName = "default";

View File

@@ -1,7 +1,13 @@
{ pkgs, config, lib, ... }:
{
config = {
let
cfg = config.ptw.services.gnome;
in {
options.ptw.services.gnome = {
enable = lib.mkEnableOption "Configure GNOME using HomeManager";
};
config = lib.mkIf cfg.enable {
environment = {
systemPackages = with pkgs; [
arc-theme
@@ -68,7 +74,7 @@
gtkUsePortal = true;
};
home-manager.users."${config.system.singleUser}" = {
home-manager.users."${config.ptw.system.singleUser}" = {
xdg.configFile = {
# Make QT apps use a dark theme
"Kvantum/kvantum.kvconfig".text = ''

View File

@@ -1,15 +1,23 @@
{ pkgs, ... }:
{ config, lib, pkgs, ... }:
{
i18n.inputMethod = {
enabled = "ibus";
ibus.engines = with pkgs.ibus-engines; [ mozc ];
let
cfg = config.ptw.system.i18n;
in {
options.ptw.system.i18n = {
enable = lib.mkEnableOption "Configure i18n services on the system";
};
#environment.variables = {
# # TODO: Use pam_environment
# "GTK_IM_MODULE" = "xim";
# "XMODIFIERS" = "@im=ibus";
# "QT_IM_MODULE" = "xim";
#};
config = lib.mkIf cfg.enable {
i18n.inputMethod = {
enabled = "ibus";
ibus.engines = with pkgs.ibus-engines; [ mozc ];
};
#environment.variables = {
# # TODO: Use pam_environment
# "GTK_IM_MODULE" = "xim";
# "XMODIFIERS" = "@im=ibus";
# "QT_IM_MODULE" = "xim";
#};
};
}

View File

@@ -1,105 +0,0 @@
{
config
, lib
, pkgs
, ...
}:
let
kanshi = pkgs.kanshi;
writeShellScript = pkgs.writeShellScript;
wallpapersPath = "/home/${config.system.singleUser}/Data/Wallpaper";
wallpapersHorizontal = "${wallpapersPath}/horizontal";
wallpapersVertical = "${wallpapersPath}/vertical";
wallpaperScript = writeShellScript "wallpaper.sh" ''
set -x
[[ $# -lt 1 ]] && echo "No profile specified" && exit 1
random_file() {
find "$1" -maxdepth 1 -type f | shuf -n 1
}
setbg() {
# Sets the background of $1 to $2
swaymsg "output \"$1\" background $2 fill"
}
case $1 in
homeMultihead)
horiz=$(random_file ${wallpapersHorizontal})
vert=$(random_file ${wallpapersVertical})
setbg "DP-2" $horiz
setbg "HDMI-A-3" $vert
;;
genericMultihead)
horiz1=$(random_file ${wallpapersHorizontal})
horiz2=$(random_file ${wallpapersHorizontal})
setbg "eDP-1" $horiz1
setbg "HDMI-A-1" $horiz2
;;
laptop)
horiz=$(random_file ${wallpapersHorizontal})
setbg "eDP-1" $horiz
;;
esac
'';
mkProfile = name: outputs: {
outputs = outputs;
exec = "${wallpaperScript} ${name}";
};
in {
environment.systemPackages = [ kanshi ];
home-manager.users."${config.system.singleUser}".services.kanshi = {
enable = true;
profiles = let
horizontal = "Samsung Electric Company C27F398 H4ZR101145";
vertical = "Goldstar Company Ltd IPS235 305NDPHKN600";
in {
homeMultihead = mkProfile "homeMultihead" [
{
criteria = vertical;
status = "enable";
mode = "1920x1080";
transform = "90";
position = "-1080,0";
}
{
criteria = horizontal;
status = "enable";
mode = "1920x1080";
position = "0,0";
}
#{
# criteria = "eDP-1";
# status = "enable";
# mode = "1920x1080";
# position = "0,0";
#}
];
#genericMultihead = mkProfile "genericMultihead" [
# {
# criteria = "eDP-1";
# mode = "1920x1080";
# status = "enable";
# }
# {
# criteria = "HDMI-A-1";
# status = "enable";
# }
#];
#laptop = mkProfile "laptop" [
# {
# criteria = "eDP-1";
# status = "enable";
# mode = "1920x1080";
# position = "0,0";
# }
#];
};
};
}

View File

@@ -1,12 +1,21 @@
{
config
, mako
, lib
, pkgs
}:
{
environment.systemPackages = [ mako ];
home-manager.users."${config.system.singleUser}".programs.mako = {
enable = true;
let
cfg = config.ptw.services.mako;
in {
options.ptw.services.mako = {
enable = lib.mkEnableOption "Enable and configure mako using HomeManager";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [ mako ];
home-manager.users."${config.ptw.system.singleUser}".programs.mako = {
enable = true;
};
};
}

View File

@@ -12,13 +12,15 @@ let
video-sync = "display-resample";
interpolation = "";
tscale = "oversample";
} // additional // (if config.programs.mpv != "" then {
} // additional // (if config.ptw.programs.mpv != "" then {
# Make mpv pop up on the primary screen
screen-name = config.programs.mpv.primaryScreen;
fs-screen-name = config.programs.mpv.primaryScreen;
screen-name = config.ptw.programs.mpv.primaryScreen;
fs-screen-name = config.ptw.programs.mpv.primaryScreen;
} else {});
cfg = config.ptw.programs.mpv;
in {
options.programs.mpv = {
options.ptw.programs.mpv = {
enable = lib.mkEnableOption "Enable and configure mpv using HomeManager";
primaryScreen = lib.mkOption {
type = lib.types.str;
default = "";
@@ -26,10 +28,10 @@ in {
};
};
config = {
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [ mpv ];
home-manager.users."${config.system.singleUser}" = {
home-manager.users."${config.ptw.system.singleUser}" = {
programs.mpv = {
enable = true;
config = {

View File

@@ -30,54 +30,63 @@ let
nwggridWrapper = mkWrapperScript "${pkgs.nwg-launchers}/bin/nwggrid-server" "";
# TODO: Fuse this with kanshi
swayIdleWrapper = mkWrapperScript "${pkgs.swayidle}/bin/swayidle" "-w before-sleep '${pkgs.swaylock}/bin/swaylock -f --image $(find ~/Data/Wallpaper/horizontal/ -maxdepth 1 -type f | shuf -n 1)'";
cfg = config.ptw.programs.sway;
in {
home-manager.users."${config.system.singleUser}" = {
wayland.windowManager.sway = {
enable = true;
config = {
bars = [ ];
startup = [
{ command = "${nwggridWrapper}"; always = true; }
{ command = "${swayncWrapper}"; always = true; }
{ command = "${waybarWrapper}"; always = true; }
{ command = "${kanshiWrapper}"; always = true; }
{ command = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; always = true; }
{ command = "${swayIdleWrapper}"; always = true; }
];
modifier = "${modifier}";
gaps = {
inner = 5;
outer = 7;
};
input = {
"*" = { xkb_layout = "de"; };
"2:7:SynPS/2_Synaptics_TouchPad" = {
tap = "enabled";
natural_scroll = "disabled";
dwt = "enabled";
options.ptw.programs.sway = {
enable = lib.mkEnableOption "Configure sway using HomeManager";
};
config = lib.mkIf cfg.enable {
programs.sway.enable = true;
home-manager.users."${config.ptw.system.singleUser}" = {
wayland.windowManager.sway = {
enable = true;
config = {
bars = [ ];
startup = [
{ command = "${nwggridWrapper}"; always = true; }
{ command = "${swayncWrapper}"; always = true; }
{ command = "${waybarWrapper}"; always = true; }
{ command = "${kanshiWrapper}"; always = true; }
{ command = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; always = true; }
{ command = "${swayIdleWrapper}"; always = true; }
];
modifier = "${modifier}";
gaps = {
inner = 5;
outer = 7;
};
input = {
"*" = { xkb_layout = "de"; };
"2:7:SynPS/2_Synaptics_TouchPad" = {
tap = "enabled";
natural_scroll = "disabled";
dwt = "enabled";
};
"2:10:TPPS/2_Elan_TrackPoint" = { dwt = "enabled"; };
};
output = {
"*" = { adaptive_sync = "on"; };
};
keybindings = let
speakers = "alsa_output.pci-0000_00_1f.3.analog-stereo";
in lib.mkOptionDefault {
"${modifier}+Return" = "exec alacritty";
"${modifier}+e" = "exec emacs";
"${modifier}+Shift+q" = "kill";
"${modifier}+f" = "exec firefox";
"${modifier}+d" = "exec ${pkgs.nwg-launchers}/bin/nwggrid -client";
"${modifier}+p" = "exec ${passwordDmenu}";
"Mod4+s" = "exec systemctl suspend";
# TODO: Screenlock
#"Mod4+l" = "exec ..."
"F1" = "exec pactl set-sink-volume ${speakers} toggle";
"F2" = "exec pactl set-sink-volume ${speakers} -10%";
"F3" = "exec pactl set-sink-volume ${speakers} +10%";
"F5" = "exec brightnessctl --device=intel_backlight set 10%-";
"F6" = "exec brightnessctl --device=intel_backlight set +10%";
};
"2:10:TPPS/2_Elan_TrackPoint" = { dwt = "enabled"; };
};
output = {
"*" = { adaptive_sync = "on"; };
};
keybindings = let
speakers = "alsa_output.pci-0000_00_1f.3.analog-stereo";
in lib.mkOptionDefault {
"${modifier}+Return" = "exec alacritty";
"${modifier}+e" = "exec emacs";
"${modifier}+Shift+q" = "kill";
"${modifier}+f" = "exec firefox";
"${modifier}+d" = "exec ${pkgs.nwg-launchers}/bin/nwggrid -client";
"${modifier}+p" = "exec ${passwordDmenu}";
"Mod4+s" = "exec systemctl suspend";
# TODO: Screenlock
#"Mod4+l" = "exec ..."
"F1" = "exec pactl set-sink-volume ${speakers} toggle";
"F2" = "exec pactl set-sink-volume ${speakers} -10%";
"F3" = "exec pactl set-sink-volume ${speakers} +10%";
"F5" = "exec brightnessctl --device=intel_backlight set 10%-";
"F6" = "exec brightnessctl --device=intel_backlight set +10%";
};
};
};

View File

@@ -1,8 +1,16 @@
{ config, ... }:
{ lib, config, ... }:
{
home-manager.users."${config.system.singleUser}".xdg.configFile = {
"swaync/config.json".source = ./config.json;
"swaync/style.css".source = ./style.css;
let
cfg = config.ptw.services.swaync;
in {
options.ptw.services.swaync = {
enable = lib.mkEnableOption "Configure swaync using HomeManager";
};
config = lib.mkIf cfg.enable {
home-manager.users."${config.ptw.system.singleUser}".xdg.configFile = {
"swaync/config.json".source = ./config.json;
"swaync/style.css".source = ./style.css;
};
};
}

View File

@@ -1,9 +1,15 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
{
config = {
let
cfg = config.ptw.programs.tmux;
in {
options.ptw.programs.tmux = {
enable = lib.mkEnableOption "Enable and configure tmux using HomeManager";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkgs.tmux ];
home-manager.users."${config.system.singleUser}".programs.tmux = {
home-manager.users."${config.ptw.system.singleUser}".programs.tmux = {
enable = true;
extraConfig = ''
set -g mouse on

View File

@@ -1,55 +1,63 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
{
home-manager.users."${config.system.singleUser}" = {
xdg.configFile."waybar/style.css".source = ./style.css;
programs.waybar = {
enable = true;
style = builtins.readFile ./style.css;
settings = [
{
output = [ "DP-2" ];
layer = "bottom";
position = "left";
gtk-layer-shell = true;
let
cfg = config.ptw.programs.waybar;
in {
options.ptw.programs.waybar = {
enable = lib.mkEnableOption "Enable and configure waybar using HomeManager";
};
modules-left = [ "custom/applauncher" "sway/workspaces" "sway/mode" ];
modules-center = [ "clock" ];
modules-right = [ "tray" "idle_inhibitor" "pulseaudio" "custom/notifications" "custom/menu" ];
config = lib.mkIf cfg.enable {
home-manager.users."${config.ptw.system.singleUser}" = {
xdg.configFile."waybar/style.css".source = ./style.css;
programs.waybar = {
enable = true;
style = builtins.readFile ./style.css;
settings = [
{
output = [ "DP-2" ];
layer = "bottom";
position = "left";
gtk-layer-shell = true;
modules = {
"idle_inhibitor" = {
format = "{icon}";
format-icons = {
activated = "";
deactivated = "";
};
modules-left = [ "custom/applauncher" "sway/workspaces" "sway/mode" ];
modules-center = [ "clock" ];
modules-right = [ "tray" "idle_inhibitor" "pulseaudio" "custom/notifications" "custom/menu" ];
modules = {
"idle_inhibitor" = {
format = "{icon}";
format-icons = {
activated = "";
deactivated = "";
};
};
"sway/workspaces" = {
disable-scroll = true;
all-outputs = true;
};
"custom/applauncher" = {
format = " ";
on-click = "${pkgs.nwg-launchers}/bin/nwggrid -client";
tooltip = "false";
};
"custom/notifications" = {
format = " ";
on-click = "${pkgs.swaync}/bin/swaync-client --toggle-panel";
tooltip = "false";
};
"custom/menu" = {
format = " ";
on-click = "${pkgs.wlogout}/bin/wlogout";
tooltip = "false";
};
"pulseaudio" = {
#on-click = "${pkgs.stable.myxer}/bin/myxer";
};
};
"sway/workspaces" = {
disable-scroll = true;
all-outputs = true;
};
"custom/applauncher" = {
format = " ";
on-click = "${pkgs.nwg-launchers}/bin/nwggrid -client";
tooltip = "false";
};
"custom/notifications" = {
format = " ";
on-click = "${pkgs.swaync}/bin/swaync-client --toggle-panel";
tooltip = "false";
};
"custom/menu" = {
format = " ";
on-click = "${pkgs.wlogout}/bin/wlogout";
tooltip = "false";
};
"pulseaudio" = {
on-click = "${pkgs.stable.myxer}/bin/myxer";
};
};
}
];
}
];
};
};
};
}

View File

@@ -1,10 +1,19 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
{
environment.systemPackages = with pkgs; [ xournalpp-git ];
let
cfg = config.ptw.programs.xournalpp;
in {
options.ptw.programs.xournalpp = {
enable = lib.mkEnableOption "Install xournalpp";
configure = lib.mkEnableOption "Configure xournalpp using HomeManager";
};
#home-manager.users."${config.system.singleUser}".home.file = {
# ".xournalpp/settings.xml".source = ./settings.xml;
# ".xournalpp/toolbar.ini".source = ./toolbar.ini;
#};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [ xournalpp-git ];
home-manager.users."${config.ptw.system.singleUser}".home.file = lib.mkIf cfg.configure {
".xournalpp/settings.xml".source = ./settings.xml;
".xournalpp/toolbar.ini".source = ./toolbar.ini;
};
};
}

View File

@@ -1,42 +1,49 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
{
environment = {
systemPackages = [ pkgs.zsh ];
shells = [ pkgs.zsh ];
pathsToLink = [ "/share/zsh" ];
let
cfg = config.ptw.programs.zsh;
in {
options.ptw.programs.zsh = {
enable = lib.mkEnableOption "Enable and configure zsh using HomeManager";
};
# Otherwise the user won't appear on the GDM login screen
programs.zsh.enable = true;
home-manager.users."${config.system.singleUser}".programs.zsh = {
enable = true;
history.ignoreSpace = true;
shellAliases = {
ls = "ls --color=always";
".." = "cd ..";
"..." = "cd ../../";
dev = "cd $HOME/Development";
home = "cd $HOME";
reload = "$SHELL -l";
gs = "git status";
gd = "git diff";
gds = "git diff --staged";
c = "clear";
suspend = "systemctl suspend";
config = lib.mkIf cfg.enable {
environment = {
systemPackages = [ pkgs.zsh ];
waifu2x = "flatpak run com.github.nihui.waifu2x-ncnn-vulkan";
shells = [ pkgs.zsh ];
pathsToLink = [ "/share/zsh" ];
};
initExtra = ''
# Otherwise the user won't appear on the GDM login screen
programs.zsh.enable = true;
home-manager.users."${config.ptw.system.singleUser}".programs.zsh = {
enable = true;
history.ignoreSpace = true;
shellAliases = {
ls = "ls --color=always";
".." = "cd ..";
"..." = "cd ../../";
dev = "cd $HOME/Development";
home = "cd $HOME";
reload = "$SHELL -l";
gs = "git status";
gd = "git diff";
gds = "git diff --staged";
c = "clear";
suspend = "systemctl suspend";
waifu2x = "flatpak run com.github.nihui.waifu2x-ncnn-vulkan";
};
initExtra = ''
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
bindkey "\e[3~" delete-char
'';
history.share = true;
# TODO: Maybe move this somewhere else
initExtraFirst = ''
history.share = true;
# TODO: Maybe move this somewhere else
initExtraFirst = ''
wcurl() {
[[ -z "$1" ]] && echo "Error: No URL specified" && exit 1
@@ -44,54 +51,55 @@
curl -fLo "$filename" "$1"
}
'';
plugins = [
{
name = "pure.zsh";
file = "pure.zsh";
src = pkgs.fetchFromGitHub {
owner = "sindresorhus";
repo = "pure";
rev = "v1.17.0";
sha256 = "0qfs7rvpyd8jb7x4ziqrkh0b6g9ldds8sn6qbqgrir80vdk90gpa";
};
}
{
name = "zsh-history-substring-search";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-history-substring-search";
rev = "0f80b8eb3368b46e5e573c1d91ae69eb095db3fb";
sha256 = "0y8va5kc2ram38hbk2cibkk64ffrabfv1sh4xm7pjspsba9n5p1y";
};
}
{
name = "completion";
file = "init.zsh";
src = pkgs.fetchFromGitHub {
owner = "zimfw";
repo = "completion";
rev = "db079f405397a9dc9af93883e47d8adff817e3b1";
sha256 = "1vakjj8l10discmzrzjq6nd0bg0jf4chxhwpiq7ldkirzy7lmm9c";
};
}
{
name = "zsh-completions";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-completions";
rev = "d4511c23659381b56dec8be8c8553b7ff3dc5fd8";
sha256 = "1y8wkmhgkkyfz91y1f8crh6cg912n87gmcchc8xhnwji11n1mqrq";
};
}
{
name = "zsh-syntax-highlighting";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-syntax-highlighting";
rev = "6e0e950154a4c6983d9e077ed052298ad9126144";
sha256 = "09bkg1a7qs6kvnq17jnw5cbcjhz9sk259mv0d5mklqaifd0hms4v";
};
}
];
plugins = [
{
name = "pure.zsh";
file = "pure.zsh";
src = pkgs.fetchFromGitHub {
owner = "sindresorhus";
repo = "pure";
rev = "v1.17.0";
sha256 = "0qfs7rvpyd8jb7x4ziqrkh0b6g9ldds8sn6qbqgrir80vdk90gpa";
};
}
{
name = "zsh-history-substring-search";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-history-substring-search";
rev = "0f80b8eb3368b46e5e573c1d91ae69eb095db3fb";
sha256 = "0y8va5kc2ram38hbk2cibkk64ffrabfv1sh4xm7pjspsba9n5p1y";
};
}
{
name = "completion";
file = "init.zsh";
src = pkgs.fetchFromGitHub {
owner = "zimfw";
repo = "completion";
rev = "db079f405397a9dc9af93883e47d8adff817e3b1";
sha256 = "1vakjj8l10discmzrzjq6nd0bg0jf4chxhwpiq7ldkirzy7lmm9c";
};
}
{
name = "zsh-completions";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-completions";
rev = "d4511c23659381b56dec8be8c8553b7ff3dc5fd8";
sha256 = "1y8wkmhgkkyfz91y1f8crh6cg912n87gmcchc8xhnwji11n1mqrq";
};
}
{
name = "zsh-syntax-highlighting";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-syntax-highlighting";
rev = "6e0e950154a4c6983d9e077ed052298ad9126144";
sha256 = "09bkg1a7qs6kvnq17jnw5cbcjhz9sk259mv0d5mklqaifd0hms4v";
};
}
];
};
};
}