🧹 restructure layout

nixos
Moritz Böhme 2022-07-15 13:11:54 +02:00
parent 40c2a5fb29
commit 268374ad58
Signed by: moritz
GPG Key ID: 970C6E89EB0547A9
115 changed files with 2641 additions and 2085 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
*.log
tmp/
.direnv/
.pre-commit-config.yaml

View File

@ -1,4 +0,0 @@
#!/bin/sh
pushd ~/.dotfiles
sudo nixos-rebuild switch --flake .#
popd

View File

@ -1,17 +0,0 @@
{ config, lib, pkgs, ... }:
{
modules = {
gaming = true;
editors = {
idea = true;
code = true;
};
desktop.apps.email = {
enable = true;
passwordFile = ../secrets/email-desktop.age;
};
};
}

View File

@ -1,11 +0,0 @@
{ config, lib, pkgs, ... }:
{
modules = {
editors.code = true;
desktop.apps.email = {
enable = true;
passwordFile = ../secrets/email-desktop.age;
};
};
}

View File

@ -232,6 +232,21 @@
"type": "github"
}
},
"flake-utils_4": {
"locked": {
"lastModified": 1644229661,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"forgit-git": {
"flake": false,
"locked": {
@ -417,6 +432,20 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1645655918,
"narHash": "sha256-ZfbEFRW7o237+A1P7eTKhXje435FCAoe0blj2n20Was=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "77a7a4197740213879b9a1d2e1788c6c8ade4274",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nur": {
"locked": {
"lastModified": 1657272425,
@ -432,6 +461,25 @@
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1656169028,
"narHash": "sha256-y9DRauokIeVHM7d29lwT8A+0YoGUBXV3H0VErxQeA8s=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "db3bd555d3a3ceab208bed48f983ccaa6a71a25e",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"agenix": "agenix",
@ -447,6 +495,7 @@
"nixpkgs": "nixpkgs",
"nixpkgs-review-checks": "nixpkgs-review-checks",
"nur": "nur",
"pre-commit-hooks": "pre-commit-hooks",
"stable": "stable",
"statix": "statix",
"utils": "utils_3"
@ -539,7 +588,7 @@
},
"utils_3": {
"inputs": {
"flake-utils": "flake-utils_3"
"flake-utils": "flake-utils_4"
},
"locked": {
"lastModified": 1657226504,

View File

@ -15,6 +15,8 @@
inputs.nixpkgs.follows = "nixpkgs";
};
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
utils = {
url = "github:gytis-ivaskevicius/flake-utils-plus";
inputs.nixpkgs.follows = "nixpkgs";
@ -80,7 +82,12 @@
};
};
outputs = inputs@{ self, nixpkgs, utils, ... }:
outputs =
inputs @ { self
, nixpkgs
, utils
, ...
}:
utils.lib.mkFlake {
inherit self inputs;
@ -90,11 +97,9 @@
### Overlays ###
################
overlay = import ./overlays { inherit inputs; };
# overlays = utils.lib.exportOverlays { inherit (self) pkgs inputs; };
overlays.default = import ./overlays { inherit inputs; };
channels.nixpkgs.overlaysBuilder = channels: [
self.overlay
self.overlays.default
inputs.utils.overlay
inputs.emacs-overlay.overlay
inputs.nur.overlay
@ -104,9 +109,14 @@
### Modules ###
###############
nixosModules = utils.lib.exportModules [ ./modules/default.nix ];
nixosModules = utils.lib.exportModules [
./modules/profiles/base.nix
./modules/profiles/gaming.nix
./modules/profiles/desktop.nix
];
hostDefaults.modules = [
./modules
./modules/default.nix
self.nixosModules.base
inputs.home-manager.nixosModule
{
home-manager = {
@ -115,16 +125,19 @@
extraSpecialArgs = { inherit inputs self; };
};
}
self.nixosModules.default
inputs.agenix.nixosModules.age
inputs.base16.nixosModule
];
hosts.nixos-laptop.modules =
[ ./hosts/nixos-laptop ./config/nixos-laptop.nix ];
hosts.nixos-desktop.modules =
[ ./hosts/nixos-desktop ./config/nixos-desktop.nix ];
hosts.nixos-laptop.modules = [
./hosts/nixos-laptop
self.nixosModules.desktop
];
hosts.nixos-desktop.modules = [
./hosts/nixos-desktop
self.nixosModules.desktop
self.nixosModules.gaming
];
###############
### Outputs ###
@ -132,30 +145,24 @@
outputsBuilder = channels:
with channels.nixpkgs; {
devShell = mkShell {
devShells.default = mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook;
name = "dotfiles";
shellHook = ''
alias "lint"='echo "Running nixpkgs-fmt ..."
nixpkgs-fmt --check $(find . -name "*.nix")
echo ""
echo "Running statix ..."
statix check'
alias "fix"='echo "Running nixpkgs-fmt ..."
nixpkgs-fmt $(find . -name "*.nix")
echo ""
echo "Running statix ..."
statix fix'
'';
packages = [
# Linting
nixpkgs-fmt
statix
# Secrets
pkgs.agenix
# chachix
# cachix
cachix
];
};
checks.pre-commit-check = inputs.pre-commit-hooks.lib."${system}".run {
src = ./.;
hooks = {
nixpkgs-fmt.enable = true;
statix.enable = true;
shellcheck.enable = true;
};
};
};
};
}

View File

@ -1,15 +1,22 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ lib, config, pkgs, ... }:
{
{ lib
, config
, pkgs
, ...
}: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
];
# MY MODULES
my.email = {
enable = true;
passwordFile = ../../secrets/email-desktop.age;
};
# BOOT
boot = {
supportedFilesystems = [ "btrfs" "ntfs" ];
@ -32,14 +39,18 @@
nameservers = [ "192.168.0.4" ];
useDHCP = false;
interfaces.enp42s0 = {
ipv4.addresses = [{
ipv4.addresses = [
{
address = "192.168.0.14";
prefixLength = 24;
}];
ipv6.addresses = [{
}
];
ipv6.addresses = [
{
address = "fe80::60fb:ffc:df6f:e29e";
prefixLength = 64;
}];
}
];
};
networkmanager = {
enable = true;
@ -77,6 +88,4 @@
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "21.05"; # Did you read the comment?
}

View File

@ -1,13 +1,15 @@
# 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, modulesPath, ... }:
{
{ config
, lib
, pkgs
, modulesPath
, ...
}: {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules =
[ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
@ -18,8 +20,7 @@
options = [ "subvol=root" ];
};
boot.initrd.luks.devices."enc".device =
"/dev/disk/by-uuid/30025a9f-44cf-4074-8ae2-d4925efd67dd";
boot.initrd.luks.devices."enc".device = "/dev/disk/by-uuid/30025a9f-44cf-4074-8ae2-d4925efd67dd";
fileSystems."/home" = {
device = "/dev/disk/by-uuid/668a49b3-d169-461f-861d-0c3e6a1642d1";
@ -56,8 +57,7 @@
fsType = "ext4";
};
swapDevices =
[{ device = "/dev/disk/by-uuid/00ad6f74-f23e-4ac0-abfb-89bdfe5ab8ae"; }];
swapDevices = [{ device = "/dev/disk/by-uuid/00ad6f74-f23e-4ac0-abfb-89bdfe5ab8ae"; }];
hardware.cpu.amd.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;

View File

@ -1,15 +1,22 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, inputs, ... }:
{
{ config
, pkgs
, inputs
, ...
}: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
];
# MY MODULES
my.email = {
enable = true;
passwordFile = ../../secrets/email-desktop.age;
};
# BOOT
boot = {
supportedFilesystems = [ "btrfs" ];
@ -65,13 +72,18 @@
OnBootSec = "120";
};
};
systemd.services.hibernate-on-low-battery = let
batteryLevelSufficient = let batteryPath = "/sys/class/power_supply/BATT";
in pkgs.writeShellScriptBin "battery-level-sufficient" ''
systemd.services.hibernate-on-low-battery =
let
batteryLevelSufficient =
let
batteryPath = "/sys/class/power_supply/BATT";
in
pkgs.writeShellScriptBin "battery-level-sufficient" ''
test "$(cat ${batteryPath}/status)" != Discharging \
|| test "$(cat ${batteryPath}/capacity)" -ge 5
'';
in {
in
{
serviceConfig.Type = "oneshot";
onFailure = [ "hibernate.target" ];
script = "${batteryLevelSufficient}/bin/battery-level-sufficient";
@ -81,10 +93,8 @@
# i2c for https://github.com/mohamed-badaoui/asus-touchpad-numpad-driver
hardware.i2c.enable = true;
systemd.services.asus-touchpad-numpad = {
description =
"Activate Numpad inside the touchpad with top right corner switch";
documentation =
[ "https://github.com/mohamed-badaoui/asus-touchpad-numpad-driver" ];
description = "Activate Numpad inside the touchpad with top right corner switch";
documentation = [ "https://github.com/mohamed-badaoui/asus-touchpad-numpad-driver" ];
path = [ pkgs.i2c-tools ];
script = ''
cd ${inputs.asus-touchpad-numpad-driver}
@ -105,13 +115,15 @@
nix = {
distributedBuilds = true;
buildMachines = [{
buildMachines = [
{
hostName = "builder";
system = "x86_64-linux";
maxJobs = 6;
speedFactor = 2;
supportedFeatures = [ "nixos.test" "benchmark" "big-parallel" "kvm" ];
}];
}
];
extraOptions = ''
builders-use-substitutes = true
'';
@ -134,5 +146,4 @@
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "21.05"; # Did you read the comment?
}

View File

@ -1,13 +1,15 @@
# 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, modulesPath, ... }:
{
{ config
, lib
, pkgs
, modulesPath
, ...
}: {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules =
[ "nvme" "xhci_pci" "ahci" "rtsx_pci_sdmmc" ];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
@ -18,8 +20,7 @@
options = [ "subvol=root" ];
};
boot.initrd.luks.devices."enc".device =
"/dev/disk/by-uuid/078b81ba-238e-471d-9951-b743588532b8";
boot.initrd.luks.devices."enc".device = "/dev/disk/by-uuid/078b81ba-238e-471d-9951-b743588532b8";
fileSystems."/log" = {
device = "/dev/disk/by-uuid/4a91d3eb-1633-42d9-8304-c10e49a61154";
@ -51,7 +52,5 @@
options = [ "subvol=home" ];
};
swapDevices =
[{ device = "/dev/disk/by-uuid/29ebf65f-e6ca-4625-9f72-a9321152be1b"; }];
swapDevices = [{ device = "/dev/disk/by-uuid/29ebf65f-e6ca-4625-9f72-a9321152be1b"; }];
}

View File

@ -1,13 +0,0 @@
# WARN: this file will get overwritten by $ cachix use <name>
{ pkgs, lib, ... }:
let
folder = ./cachix;
toImport = name: value: folder + ("/" + name);
filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key;
imports = lib.mapAttrsToList toImport
(lib.filterAttrs filterCaches (builtins.readDir folder));
in {
inherit imports;
nix.settings.substituters = [ "https://cache.nixos.org/" ];
}

View File

@ -1,8 +0,0 @@
{
nix.settings = {
substituters = [ "https://jupyterwith.cachix.org" ];
trusted-public-keys = [
"jupyterwith.cachix.org-1:/kDy2B6YEhXGJuNguG1qyqIodMyO4w8KwWH4/vAc7CI="
];
};
}

View File

@ -1,8 +0,0 @@
{
nix.settings = {
substituters = [ "https://nix-community.cachix.org" ];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
}

View File

@ -1,6 +0,0 @@
{ config, lib, pkgs, ... }:
{
programs.adb.enable = true;
users.users.moritz.extraGroups = [ "adbusers" ];
}

View File

@ -1,12 +0,0 @@
{ config, lib, pkgs, ... }:
let
cycleSinks = import ./cycleSinks.nix { inherit pkgs; };
protonge = import ./protonge.nix { inherit pkgs; };
randomWallpaper = import ./randomWallpaper.nix { inherit pkgs; };
share = import ./share.nix { inherit pkgs; };
sxhkdHelp = import ./sxhkdHelp.nix { inherit pkgs; };
in {
home-manager.users.moritz.home.packages =
[ cycleSinks protonge randomWallpaper share sxhkdHelp ];
}

View File

@ -1,115 +0,0 @@
{ config, lib, pkgs, ... }:
{
imports = [
./adb.nix
./bin
./direnv.nix
./git.nix
./ledger
./nix.nix
./shell
./spotify.nix
./ssh.nix
./yubikey.nix
];
modules.cli.shell = let
editor = "emacsclient -t -a 'emacs -t'";
cmdSub = command:
"${
if (config.modules.cli.shell.name == "fish") then "" else "$"
}${command}";
in {
name = "fish";
abbreviations = {
us = "systemctl --user";
rs = "doas systemctl";
ga = "git add";
gb = "git branch";
gc = "git commit";
gco = "git checkout";
gd = "git diff";
gds = "git diff --staged";
gp = "git push";
gf = "git fetch";
gF = "git pull";
gs = "git status";
};
aliases = {
ls = "exa -lh --icons --git";
cat = "bat";
feh = "feh --auto-zoom --scale-down";
grep = "rg";
rm = "rm -i";
mv = "mv -i";
ssh = "kitty +kitten ssh";
nix-switch = "doas nixos-rebuild switch --flake ~/.dotfiles";
nix-boot = "doas nixos-rebuild boot --flake ~/.dotfiles";
nix-lock = "pushd ~/.dotfiles && nix flake update && popd";
emacs = editor;
nixpkgs-review = "nixpkgs-review-checks";
latexwatch =
''find -type f -name "*.tex" | entr -c latexmk -pdf -silent'';
};
variables = { EDITOR = editor; };
};
home-manager.users.moritz = {
home.packages = with pkgs; [
# archives
p7zip
unzip
zip
# file management
ranger
trash-cli
# monitoring
htop
bottom
# ripping
abcde
handbrake
# nix
nixpkgs-review
comma
nix-index
# other
arduino
cht-sh
du-dust
duf
entr
hub
neofetch
tmux
ttyper
up
viu
];
programs = {
bat.enable = true;
command-not-found.enable = true;
exa.enable = true;
fzf.enable = true;
gpg.enable = true;
starship.enable = true;
};
};
age.secrets = {
github = {
file = ../../secrets/github.age;
owner = "1000";
};
};
}

View File

@ -1,8 +0,0 @@
{ config, lib, pkgs, ... }:
{
home-manager.users.moritz.programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
}

View File

@ -1,22 +0,0 @@
{ config, lib, pkgs, ... }:
{
home-manager.users.moritz = {
programs.git = {
enable = true;
userName = "Moritz Böhme";
userEmail = "mail@moritzboeh.me";
extraConfig.init.defaultBranch = "main";
delta.enable = true;
signing = {
key = "0x970C6E89EB0547A9";
signByDefault = true;
};
lfs.enable = true;
};
};
programs.git = {
enable = true;
config.safe.directory = "/home/moritz/.dotfiles";
};
}

View File

@ -1,26 +0,0 @@
{ config, lib, pkgs, ... }:
{
modules.cli.shell.aliases = {
bal = "ledger bal";
balcash = "ledger bal -R -X --current --flat ^assets:bank ^liabilities";
balnet = "ledger bal -R -X --current --depth 2 ^assets ^liabilities";
bud = ''ledger --budget --unbudgeted bal ^expenses -p "this month"'';
budr = ''ledger --budget reg -p "this month" ^expenses'';
reg = "ledger reg -R -V --tail 15";
};
home-manager.users.moritz = {
home.packages = with pkgs; [ ledger ];
xdg.configFile = {
"fish/completions/ledger.fish" = {
text = builtins.readFile ./ledger.fish;
};
"ledger/ledgerrc".text = ''
--strict
--explicit
--payee note
--file ~/Notes/ledger/main.ledger
'';
};
};
}

View File

@ -1,14 +0,0 @@
{ config, lib, pkgs, ... }:
{
nix = {
gc = {
automatic = true;
options = "--max-freed $((32 * 1024**3)) --delete-older-than 14d";
dates = "weekly";
};
optimise.automatic = true;
settings.trusted-users = [ "root" "@wheel" ];
};
}

View File

@ -1,35 +0,0 @@
{ config, lib, pkgs, inputs, ... }:
let cfg = config.modules.cli.shell;
in {
config = lib.mkIf (cfg.name == "zsh") {
environment.pathsToLink = [ "/share/zsh" ];
users.users.moritz.shell = pkgs.zsh;
home-manager.users.moritz = {
home.packages = with pkgs; [ du-dust ];
programs = {
zsh = {
enable = true;
dotDir = ".config/zsh";
history.expireDuplicatesFirst = true;
localVariables = cfg.variables;
shellAliases = lib.trivial.mergeAttrs cfg.aliases cfg.abbreviations;
enableSyntaxHighlighting = true;
enableAutosuggestions = true;
enableCompletion = true;
initExtra = ''
function nix-which() {
readlink -f $(which $1)
}
'';
plugins = [{
name = "forgit";
src = inputs.forgit-git;
}];
};
fzf.enableZshIntegration = true;
starship.enableZshIntegration = true;
};
};
};
}

View File

@ -1,69 +0,0 @@
{ config, lib, pkgs, ... }:
{
age.secrets.spotifyd = {
file = ../../secrets/spotifyd.age;
owner = "1000";
};
home-manager.users.moritz = {
home.packages = with pkgs; [ spotify-tui sptlrx ];
services.spotifyd = {
enable = true;
package = pkgs.spotifyd.override { withMpris = true; };
settings = {
global = {
# A command that gets executed and can be used to
# retrieve your username.
username_cmd = "${pkgs.coreutils}/bin/head -n 1 /run/agenix/spotifyd";
# A command that gets executed and can be used to
# retrieve your password.
password_cmd = "${pkgs.coreutils}/bin/tail -n 1 /run/agenix/spotifyd";
# The name that gets displayed under the connect tab on
# official clients. Spaces are not allowed!
device_name = "spotifyd";
# The audio bitrate. 96, 160 or 320 kbit/s
bitrate = 320;
# Volume on startup between 0 and 100
initial_volume = "71";
# The directory used to cache audio data.
cache_path = "/tmp/spotifyd-cache";
# The displayed device type in Spotify clients.
device_type = "computer";
# set backend to pulseaudio
backend = "pulseaudio";
};
};
};
xdg.configFile."spotify-tui/config.yml".text = ''
# Dracula theme
theme:
active: "139,233,253" # current playing song in list
banner: "80,250,123" # the "spotify-tui" banner on launch
error_border: "241,250,140" # error dialog border
error_text: "248,248,242" # error message text (e.g. "Spotify API
# reported error 404")
hint: "241,250,140" # hint text in errors
hovered: "255,184,108" # hovered pane border
inactive: "248,248,242" # borders of inactive panes
playbar_background: "68,71,90" # background of progress bar
playbar_progress: "248,248,242" # filled-in part of the progress bar
playbar_progress_text: "248,248,242" # song length and time played/left
# indicator in the progress bar
playbar_text: "248,248,242" # artist name in player pane
selected: "80,250,123" # a) selected pane border, b) hovered item
# in list, & c) track title in player
text: "248,248,242" # text in panes
header: "248,248,242" # header text in panes (e.g. 'Title',
# 'Artist', etc.)
behavior:
volume_increment: 5
'';
};
}

View File

@ -1,10 +0,0 @@
{ config, lib, pkgs, ... }:
{
users.users.moritz.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGoAqa2m7hIzZ2LS96Z+RCIlRvhBM/j7h27tMBCwMT+a" # Moritz
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDhtwHDGAZshiQWKkCcPWV9tC83b+bKBgjDcjP/N2CKO" # Laptop
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKl8gMhwSf1NsP5gp14xbbyjqQLZzcHLb/XKRMoHdXgI" # Desktop
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDHlemuKagHwz2T5rEwgJNlVUdUdOXyPtCEzD73CrwY2zmpR4AMj7y9u3Rm7HwHUDjLap1ZFwg+53bAsVP6HFZccCXoIfO/8BL0WDGQJrfgb+A+UiRhSqSvyZ77bGJkadbBkadguz3qR3PHcb41DOlhuqVcHxsY8ceHMxAuyb0pLJVJLeytMD+CHS/r7hoj2hckTNAZ+VhCXBtdZfZ7uPUBxLfluYRNNMmdwCglsg3RUS242nJUzy3A84+CXIGeWmNG9Fu45IDkwMthxSW9klyU9R38R9DBDcugkyb6vz+JKSuRVAa47qh/kmtsYekfL3ul9D2JN32P8S+6ZoXx+gXupGJ0ltwJWAFkhLJ+yeXj9kCOv/mIUmCB14jMGsvKiSwV25O/twyjqe2LEkMVgimgrjEYoHu+ZTyp0iFtUvSrFo4tsAhfWPV9yj4F/hUksW7xKIwq5Niyx7he5M/XddudtnAximyiBDGCdJm1Ejl0UaGa6ZQv7y6VZdx0PyZuraT7l9ub8so6JlE4cVgSSU9vE0IS2QqBuHhsIjh8RVksoTR2NQbeDdGaGpGnq2C8y0rDXwE/EJA4LK45khX/GPn73n8F0kBG8dBrWgRDAEODpmebScO7d5mCeM0z3lPcRmh+3e3DPnVVOl+uR7udlc7NauLzl7q913UtxZaF1PlD7Q==" # GPG
];
}

View File

@ -1,19 +0,0 @@
{ config, lib, pkgs, ... }:
{
services.udev.packages = [ pkgs.yubikey-personalization ];
environment.shellInit = ''
export GPG_TTY="$(tty)"
gpg-connect-agent /bye
export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh"
'';
home-manager.users.moritz.home.packages = with pkgs; [
# cli
yubikey-manager
yubikey-personalization
paperkey
# graphical
yubikey-manager-qt
yubikey-personalization-gui
];
}

View File

@ -1,5 +1,4 @@
{ pkgs }:
pkgs.writeShellApplication {
name = "cycle_sinks";

View File

@ -0,0 +1,34 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.bin;
cycleSinks = import ./cycleSinks.nix { inherit pkgs; };
protonge = import ./protonge.nix { inherit pkgs; };
randomWallpaper = import ./randomWallpaper.nix { inherit pkgs; };
share = import ./share.nix { inherit pkgs; };
sxhkdHelp = import ./sxhkdHelp.nix { inherit pkgs; };
in
{
options.my.bin = {
enable = mkOption {
default = true;
type = types.bool;
example = false;
};
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
cycleSinks
protonge
randomWallpaper
share
sxhkdHelp
];
};
}

View File

@ -1,5 +1,4 @@
{ pkgs }:
pkgs.writeShellApplication {
name = "protonge";
runtimeInputs = with pkgs; [ curl ];

View File

@ -1,5 +1,4 @@
{ pkgs }:
pkgs.writeShellApplication {
name = "randomWallpaper";

View File

@ -1,5 +1,4 @@
{ pkgs }:
pkgs.writeShellApplication {
name = "share";

View File

@ -1,5 +1,4 @@
{ pkgs }:
pkgs.writeShellApplication {
name = "sxhkd-help";
runtimeInputs = with pkgs; [ rofi ];

View File

@ -0,0 +1,17 @@
{ config
, lib
, pkgs
, ...
}:
{
imports = [
./theming.nix
./nix.nix
./bin
./shell.nix
./yubikey.nix
./email.nix
./wallpapers.nix
];
}

98
modules/config/email.nix Normal file
View File

@ -0,0 +1,98 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.email;
name = "Moritz Böhme";
email = "mail@moritzboeh.me";
mailDirectory = "/home/moritz/.mail";
in
{
options.my.email = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
passwordFile = mkOption {
default = null;
type = types.path;
description = "File containing the email password.";
};
};
config = mkIf cfg.enable {
# Protonbridge Setup
environment.systemPackages = with pkgs; [ protonmail-bridge ];
systemd.user.services.protonmail-bridge = {
description = "Protonmail Bridge";
enable = true;
script = "${pkgs.protonmail-bridge}/bin/protonmail-bridge --log-level debug";
path = [
pkgs.gnome3.gnome-keyring
]; # HACK: https://github.com/ProtonMail/proton-bridge/issues/176
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
};
age.secrets.email = {
file = cfg.passwordFile;
owner = "1000";
};
# Email Applications
home-manager.users.moritz = {
home.packages = with pkgs; [ thunderbird ];
programs = {
msmtp.enable = true;
mbsync.enable = true;
};
services.mbsync = {
enable = true;
frequency = "*:0/15";
preExec = "${pkgs.isync}/bin/mbsync -Ha";
postExec = "${pkgs.mu}/bin/mu index -m ${mailDirectory}";
};
accounts.email = {
maildirBasePath = mailDirectory;
accounts.default = {
address = email;
userName = email;
flavor = "plain";
primary = true;
passwordCommand = "${pkgs.coreutils}/bin/cat /run/agenix/email";
mbsync = {
enable = true;
create = "both";
expunge = "both";
patterns = [ "*" ];
};
realName = name;
msmtp.enable = true;
imap = {
host = "127.0.0.1";
port = 1143;
tls = {
enable = true;
useStartTls = true;
certificatesFile = "/home/moritz/.config/protonmail/bridge/cert.pem";
};
};
smtp = {
host = "127.0.0.1";
port = 1025;
tls = {
enable = true;
useStartTls = true;
certificatesFile = "/home/moritz/.config/protonmail/bridge/cert.pem";
};
};
};
};
};
networking.firewall.allowedTCPPorts = [ 33728 1025 1143 ];
};
}

54
modules/config/nix.nix Normal file
View File

@ -0,0 +1,54 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.nix;
in
{
options.my.nix = {
gc.enable = mkOption {
default = true;
type = types.bool;
example = false;
};
optimise.enable = mkOption {
default = true;
type = types.bool;
example = false;
};
};
config.nix = {
gc = {
automatic = cfg.gc.enable;
options = "--max-freed $((32 * 1024**3)) --delete-older-than 14d";
dates = "weekly";
};
optimise = {
automatic = cfg.optimise.enable;
dates = [ "weekly" ];
};
settings = {
substituters = [
"https://cache.nixos.org/"
"https://jupyterwith.cachix.org"
"https://nix-community.cachix.org"
"https://pre-commit-hooks.cachix.org"
];
trusted-public-keys = [
"jupyterwith.cachix.org-1:/kDy2B6YEhXGJuNguG1qyqIodMyO4w8KwWH4/vAc7CI="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"pre-commit-hooks.cachix.org-1:Pkk3Panw5AW24TOv6kz3PvLhlH8puAsJTBbOPmBo7Rc="
];
trusted-users = [ "root" "@wheel" ];
};
};
}

View File

@ -1,14 +1,15 @@
{ config, lib, pkgs, ... }:
{ config
, lib
, pkgs
, ...
}:
with lib;
let cfg = config.module.cli.shell;
in {
options.modules.cli.shell = {
name = mkOption {
default = "fish";
type = types.enum [ "fish" "zsh" ];
example = "zsh";
};
let
cfg = config.my.shell;
in
{
options.my.shell = {
abbreviations = mkOption {
default = { };
type = with types; attrsOf str;
@ -23,6 +24,4 @@ in {
type = with types; attrsOf str;
};
};
imports = [ ./fish.nix ./zsh.nix ];
}

553
modules/config/theming.nix Normal file
View File

@ -0,0 +1,553 @@
{ config
, lib
, pkgs
, inputs
, ...
}:
with lib;
let
cfg = config.my.theming;
schemes = {
dracula = {
slug = "Dracula";
scheme = "Dracula";
author = "Moritz Boehme based on Dracula Theme";
base00 = "282a36"; # Background
base01 = "69ff94"; # Green 2
base02 = "ffffa5"; # Yellow 2
base03 = "6272a4"; # Black 2
base04 = "d6acff"; # Blue 2
base05 = "f8f8f2"; # Foreground
base06 = "ff92df"; # Magenta 2
base07 = "44475a"; # White 2
base08 = "ff5555"; # Red 1
base09 = "ff6e6e"; # Red 2
base0A = "f1fa8c"; # Yellow 1
base0B = "50fa7b"; # Green 1
base0C = "8be9fd"; # Cyan 1
base0D = "bd93f9"; # Blue 1
base0E = "ff79c6"; # Magenta 1
base0F = "a4ffff"; # Cyan 2
};
catppuccin = {
slug = "Catpuccin";
scheme = "Catpuccin";
author = "Moritz Boehme based on Catppuccin Theme";
base00 = "1e1e2e"; # Background
base01 = "abe9b3"; # Green 2
base02 = "fae380"; # Yellow 2
base03 = "988ba2"; # Black 2
base04 = "96cdf8"; # Blue 2
base05 = "d9e0ee"; # Foreground
base06 = "ddb6f2"; # Magenta 2
base07 = "d9e0ee"; # White 2
base08 = "f28fad"; # Red 1
base09 = "f28fad"; # Red 2
base0A = "fae3b0"; # Yellow 1
base0B = "abe9b3"; # Green 1
base0C = "89dceb"; # Cyan 1
base0D = "96cdfb"; # Blue 1
base0E = "f5c2e7"; # Magenta 1
base0F = "89dceb"; # Cyan 2
};
nord = {
slug = "Nord";
scheme = "Nord";
author = "arcticicestudio";
base00 = "2E3440";
base01 = "ECEFF4";
base02 = "B48EAD";
base03 = "4C566A";
base04 = "D8DEE9";
base05 = "E5E9F0";
base06 = "434C5E";
base07 = "8FBCBB";
base08 = "BF616A";
base09 = "3B4252";
base0A = "EBCB8B";
base0B = "A3BE8C";
base0C = "88C0D0";
base0D = "5E81AC";
base0E = "D08770";
base0F = "81A1C1";
};
onedark = {
slug = "onedark";
scheme = "OneDark";
author = "Lalit Magant (http://github.com/tilal6991)";
base00 = "282c34";
base01 = "353b45";
base02 = "3e4451";
base03 = "545862";
base04 = "565c64";
base05 = "abb2bf";
base06 = "b6bdca";
base07 = "c8ccd4";
base08 = "e06c75";
base09 = "d19a66";
base0A = "e5c07b";
base0B = "98c379";
base0C = "56b6c2";
base0D = "61afef";
base0E = "c678dd";
base0F = "be5046";
};
};
in
{
options.my.theming = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
scheme = mkOption {
default = "dracula";
type = types.enum (builtins.attrNames schemes);
apply = name: schemes."${name}";
example = "nord";
};
};
config = mkIf cfg.enable {
inherit (cfg) scheme;
home-manager.users.moritz = {
programs = {
kitty.extraConfig =
mkIf config.my.programs.kitty.enable
(builtins.readFile (config.scheme {
template = ''
# Base16 {{scheme-name}} - kitty color config
# Scheme by {{scheme-author}}
background #{{base00-hex}}
foreground #{{base05-hex}}
selection_background #{{base05-hex}}
selection_foreground #{{base00-hex}}
url_color #{{base04-hex}}
cursor #{{base03-hex}}
active_border_color #{{base03-hex}}
inactive_border_color #{{base01-hex}}
active_tab_background #{{base00-hex}}
active_tab_foreground #{{base05-hex}}
inactive_tab_background #{{base01-hex}}
inactive_tab_foreground #{{base04-hex}}
tab_bar_background #{{base01-hex}}
# normal
color0 #{{base00-hex}}
color1 #{{base08-hex}}
color2 #{{base0B-hex}}
color3 #{{base0A-hex}}
color4 #{{base0D-hex}}
color5 #{{base0E-hex}}
color6 #{{base0C-hex}}
color7 #{{base05-hex}}
# bright
color8 #{{base03-hex}}
color9 #{{base09-hex}}
color10 #{{base01-hex}}
color11 #{{base02-hex}}
color12 #{{base04-hex}}
color13 #{{base06-hex}}
color14 #{{base0F-hex}}
color15 #{{base07-hex}}
'';
}));
zathura.extraConfig = builtins.readFile (config.scheme {
template = ''
# Base16 {{scheme-name}}
# Author: {{scheme-author}}
set completion-bg "#{{base00-hex}}"
set completion-fg "#{{base05-hex}}"
set completion-group-bg "#{{base00-hex}}"
set completion-group-fg "#{{base03-hex}}"
set completion-highlight-bg "#{{base07-hex}}"
set completion-highlight-fg "#{{base06-hex}}"
set notification-bg "#{{base00-hex}}"
set notification-fg "#{{base05-hex}}"
set notification-warning-bg "#{{base0A-hex}}"
set notification-warning-fg "#{{base05-hex}}"
set notification-error-bg "#{{base08-hex}}"
set notification-error-fg "#{{base05-hex}}"
set index-bg "#{{base00-hex}}"
set index-fg "#{{base05-hex}}"
set index-active-bg "#{{base07-hex}}"
set index-active-fg "#{{base05-hex}}"
set default-bg "#{{base00-hex}}"
set default-fg "#{{base05-hex}}"
set inputbar-bg "#{{base00-hex}}"
set inputbar-fg "#{{base0C-hex}}"
set statusbar-bg "#{{base00-hex}}"
set statusbar-fg "#{{base05-hex}}"
set highlight-color "#{{base0A-hex}}"
set highlight-active-color "#{{base06-hex}}"
set recolor-lightcolor "#{{base00-hex}}"
set recolor-darkcolor "#{{base05-hex}}"
'';
});
rofi.theme = config.scheme {
template = ''
* {
drac-bgd: #{{base00-hex}};
drac-cur: #{{base07-hex}};
drac-fgd: #{{base05-hex}};
drac-cmt: #{{base03-hex}};
drac-cya: #{{base0C-hex}};
drac-grn: #{{base0B-hex}};
drac-ora: #{{base0A-hex}};
drac-pnk: #{{base0E-hex}};
drac-pur: #{{base0D-hex}};
drac-red: #{{base08-hex}};
drac-yel: #{{base0A-hex}};
font: "FiraCode Nerd Font 14";
foreground: @drac-fgd;
background-color: @drac-bgd;
active-background: @drac-pnk;
urgent-background: @drac-red;
selected-background: @active-background;
selected-urgent-background: @urgent-background;
selected-active-background: @active-background;
separatorcolor: @active-background;
bordercolor: #6272a4;
}
#window {
background-color: @background;
border: 3;
border-radius: 6;
border-color: @bordercolor;
padding: 25;
}
#mainbox {
border: 0;
padding: 5;
}
#message {
border: 1px dash 0px 0px ;
border-color: @separatorcolor;
padding: 1px ;
}
#textbox {
text-color: @foreground;
}
#listview {
fixed-height: 0;
border: 2px dash 0px 0px ;
border-color: @bordercolor;
spacing: 2px ;
scrollbar: false;
padding: 2px 0px 0px ;
}
#element-text {
border: 0;
padding: 1px ;
text-color: @foreground;
}
#element-text normal.normal {
background-color: @background;
}
#element-text normal.urgent {
background-color: @urgent-background;
text-color: @urgent-foreground;
}
#element-text normal.active {
backgroundr: @active-background;
}
#element-text selected.normal {
background-color: @selected-background;
}
#element-text selected.urgent {
background-color: @selected-urgent-background;
}
#element-text selected.active {
background-color: @selected-active-background;
}
#element-text alternate.normal {
background-color: @background;
}
#element-text alternate.urgent {
background-color: @urgent-background;
}
#element-text alternate.active {
background-color: @active-background;
}
#scrollbar {
width: 2px ;
border: 0;
handle-width: 8px ;
padding: 0;
}
#sidebar {
border: 2px dash 0px 0px ;
border-color: @separatorcolor;
}
#button selected {
background-color: @selected-background;
text-color: @foreground;
}
#inputbar {
spacing: 0;
text-color: @foreground;
padding: 1px ;
}
#case-indicator {
spacing: 0;
text-color: @foreground;
}
#entry {
spacing: 0;
text-color: @drac-cya;
}
#prompt {
spacing: 0;
text-color: @drac-grn;
}
#inputbar {
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
}
#textbox-prompt-colon {
expand: false;
str: ":";
margin: 0px 0.3em 0em 0em ;
text-color: @drac-grn;
}
'';
};
firefox.profiles."default" = {
userChrome = with config.scheme; ''
toolbar#nav-bar, nav-bar-customization-target {
background: #${base00} !important;
}
@-moz-document url("about:newtab"),
@-moz-document url("about:blank") {
* { background-color: #${base00} !important; }
}
#urlbar-background {
background-color: #${base00} !important
}
#urlbar {
color: #${base05} !important
}
#sidebar-splitter {
border-color: #${base01} !important;
color: #${base01} !important;
background-color: #${base01} !important;
}
'';
settings = with config.scheme; {
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"browser.anchor_color" = "#${base0D}";
"browser.visited_color" = "#${base0C}";
};
};
};
xsession.windowManager.bspwm = {
settings = with config.scheme.withHashtag; {
focused_border_color = base0D;
normal_border_color = base03;
active_border_color = base03;
};
};
services.polybar = {
config = with config.scheme.withHashtag; {
"bar/bottom" = {
# position
monitor = "\${env:MONITOR}";
bottom = true;
width = "100%";
heigth = 20;
background = base00;
foreground = base05;
border-size = 5;
border-color = base00;
separator = " ";
font-0 = "FiraCode Nerd Font:size=9;0";
font-1 = "FiraCode Nerd Font:size=9;1";
font-2 = "FiraCode Nerd Font:size=9;2";
modules-left = "cpu memory network battery";
modules-center = "bspwm";
modules-right = "pulseaudio date time";
tray-position = "right";
tray-padding = 2;
wm-restack = "bspwm";
cursor-click = "pointer";
cursor-scroll = "ns-resize";
};
"module/battery" = {
type = "internal/battery";
battery = "BATT";
adapter = "ACAD";
time-format = "%H:%M";
format-charging = "<animation-charging> <label-charging>";
format-discharging = "<animation-discharging> <label-discharging>";
format-full = " <label-full>";
label-charging = "%percentage%% %time% remaining";
label-discharging = "%percentage%% %time% remaining";
label-full = "Fully charged";
animation-charging-0 = " ";
animation-charging-1 = " ";
animation-charging-2 = " ";
animation-charging-3 = " ";
animation-charging-4 = " ";
animation-charging-framerate = 500;
animation-discharging-0 = " ";
animation-discharging-1 = " ";
animation-discharging-2 = " ";
animation-discharging-3 = " ";
animation-discharging-4 = " ";
animation-discharging-framerate = 500;
};
"module/bspwm" = {
type = "internal/bspwm";
label-focused = "";
label-focused-foreground = base0E;
label-focused-padding = 1;
label-occupied = "";
label-occupied-foreground = base03;
label-occupied-padding = 1;
label-urgent = "";
label-urgent-foreground = base08;
label-urgent-padding = 1;
label-empty = "";
label-empty-foreground = base03;
label-empty-padding = 1;
label-separator = " ";
label-separator-foreground = base0C;
label-separator-padding = 1;
pin-workspaces = true;
};
"module/cpu" = {
type = "internal/cpu";
interval = 2;
format = "<ramp-load><label>";
format-foreground = base00;
format-background = base0B;
format-padding = 1;
format-font = 3;
ramp-load-0 = " ";
ramp-load-1 = " ";
ramp-load-2 = " ";
ramp-load-3 = " ";
label = "%percentage:2%%";
};
"module/time" = {
type = "internal/date";
interval = 1;
time = "%H:%M";
time-alt = "%H:%M:%S";
label = "%time%";
format-prefix = " ";
format-prefix-font = 2;
format-foreground = base00;
format-background = base0C;
format-padding = 1;
label-font = 3;
};
"module/date" = {
type = "internal/date";
interval = 5;
format = "<label>";
format-prefix = " ";
format-prefix-font = 2;
format-foreground = base00;
format-background = base0A;
format-padding = 1;
format-font = 3;
date = "%A";
date-alt = "%Y-%m-%d";
label = "%date%";
label-font = 3;
};
"module/memory" = {
type = "internal/memory";
interval = 2;
format = "<label>";
format-prefix = " ";
format-foreground = base00;
format-background = base0C;
format-padding = 1;
format-font = 2;
label = "%gb_used%";
label-font = 3;
};
"module/pulseaudio" = {
type = "internal/pulseaudio";
format-volume = "<ramp-volume> <label-volume>";
label-volume = "%percentage%%";
format-volume-foreground = base00;
format-volume-background = base04;
format-volume-padding = 1;
format-volume-font = 2;
label-muted = "%{F${base08}} %{F${base00}}muted";
format-muted-foreground = base00;
format-muted-background = base04;
format-muted-padding = 1;
format-muted-font = 2;
ramp-volume-0 = "";
ramp-volume-1 = "";
ramp-volume-2 = "奔";
ramp-volume-3 = "";
ramp-volume-4 = "";
click-middle = "${pkgs.pavucontrol}/bin/pavucontrol";
};
"module/network" = {
type = "internal/network";
interface =
builtins.head (builtins.attrNames config.networking.interfaces);
interval = 3;
format-connected = "<label-connected>";
label-connected = "%{T2}%{T3} %upspeed% %{T2}%{T3} %downspeed%";
format-connected-foreground = base00;
format-connected-background = base0E;
format-connected-padding = 1;
format-connected-font = 3;
};
};
};
};
};
}

View File

@ -0,0 +1,31 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.wallpapers;
in
{
options.my.wallpapers = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = mkIf cfg.enable {
home-manager.users.moritz.xdg = {
enable = true;
configFile = {
"wallpapers/" = {
source = ./wallpapers;
recursive = true;
};
};
};
};
}

View File

Before

Width:  |  Height:  |  Size: 12 MiB

After

Width:  |  Height:  |  Size: 12 MiB

View File

Before

Width:  |  Height:  |  Size: 5.2 MiB

After

Width:  |  Height:  |  Size: 5.2 MiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 MiB

After

Width:  |  Height:  |  Size: 4.6 MiB

View File

Before

Width:  |  Height:  |  Size: 4.8 MiB

After

Width:  |  Height:  |  Size: 4.8 MiB

View File

Before

Width:  |  Height:  |  Size: 501 KiB

After

Width:  |  Height:  |  Size: 501 KiB

View File

Before

Width:  |  Height:  |  Size: 635 KiB

After

Width:  |  Height:  |  Size: 635 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

@ -0,0 +1,32 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.yubikey;
in
{
options.my.yubikey = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = {
services.udev.packages = [ pkgs.yubikey-personalization ];
environment.systemPackages = with pkgs; [
# cli
yubikey-manager
yubikey-personalization
paperkey
# graphical
yubikey-manager-qt
yubikey-personalization-gui
];
};
}

View File

@ -1,64 +1,15 @@
{ lib, pkgs, ... }:
{ config
, lib
, pkgs
, ...
}:
{
imports = [
./cachix.nix
./cli
./desktop
./editors
./gaming.nix
./podman.nix
./security.nix
./config
./programs
./security
./services
./theming.nix
./virtualisation
];
# USERS
users.users.moritz = {
isNormalUser = true;
home = "/home/moritz";
extraGroups = [
"wheel"
"networkmanager"
"video"
"dialout"
]; # Enable sudo for the user.
initialPassword = "password"; # CHANGE ME PLEASE
};
fonts.fonts = with pkgs;
[
(nerdfonts.override {
fonts = [ "FiraCode" "DroidSansMono" "JetBrainsMono" ];
})
];
time.timeZone = "Europe/Berlin";
# PACKAGES
environment.systemPackages = with pkgs; [ vim wget firefox git ];
programs.mtr.enable = true;
home-manager.users.moritz = {
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# paths it should manage.
home.username = "moritz";
home.homeDirectory = "/home/moritz";
xdg.userDirs = {
enable = true;
createDirectories = true;
};
home.language = {
base = "en_US.UTF-8";
time = "de_DE.UTF-8";
numeric = "de_DE.UTF-8";
paper = "de_DE.UTF-8";
};
home.stateVersion = "21.05";
};
}

View File

@ -1,40 +0,0 @@
{ config, lib, pkgs, ... }:
{
imports = [
./email.nix
./firefox.nix
./kitty.nix
./rofi
./zathura.nix
./virtualisation.nix
];
home-manager.users.moritz = {
services.nextcloud-client = {
enable = true;
startInBackground = true;
};
home.packages = with pkgs; [
tlaplusToolbox
anki
calibre
gparted
jellyfin-media-player
keepassxc
libreoffice
neofetch
pavucontrol
picard
signal-desktop
vlc
xfce.exo
xfce.thunar
xfce.tumbler
xfce.xfconf
];
};
services.gvfs = {
enable = true;
package = lib.mkForce pkgs.gnome3.gvfs;
};
}

View File

@ -1,98 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.modules.desktop.apps.email;
name = "Moritz Böhme";
email = "mail@moritzboeh.me";
mailDirectory = "/home/moritz/.mail";
in {
options.modules.desktop.apps.email = {
enable = mkEnableOption "email module";
passwordFile = mkOption {
default = null;
type = types.path;
description = "File containing the email password.";
};
};
config = mkIf cfg.enable {
# Protonbridge Setup
environment.systemPackages = with pkgs; [ protonmail-bridge ];
systemd.user.services.protonmail-bridge = {
description = "Protonmail Bridge";
enable = true;
script =
"${pkgs.protonmail-bridge}/bin/protonmail-bridge --log-level debug";
path = [
pkgs.gnome3.gnome-keyring
]; # HACK: https://github.com/ProtonMail/proton-bridge/issues/176
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
};
age.secrets.email = {
file = cfg.passwordFile;
owner = "1000";
};
# Email Applications
home-manager.users.moritz = {
home = { packages = with pkgs; [ thunderbird ]; };
programs = {
msmtp.enable = true;
mbsync.enable = true;
};
services = {
mbsync = {
enable = true;
frequency = "*:0/15";
preExec = "${pkgs.isync}/bin/mbsync -Ha";
postExec = "${pkgs.mu}/bin/mu index -m ${mailDirectory}";
};
};
accounts.email = {
maildirBasePath = mailDirectory;
accounts = {
default = {
address = email;
userName = email;
flavor = "plain";
primary = true;
passwordCommand = "${pkgs.coreutils}/bin/cat /run/agenix/email";
mbsync = {
enable = true;
create = "both";
expunge = "both";
patterns = [ "*" ];
};
realName = name;
msmtp.enable = true;
imap = {
host = "127.0.0.1";
port = 1143;
tls = {
enable = true;
useStartTls = true;
certificatesFile =
"/home/moritz/.config/protonmail/bridge/cert.pem";
};
};
smtp = {
host = "127.0.0.1";
port = 1025;
tls = {
enable = true;
useStartTls = true;
certificatesFile =
"/home/moritz/.config/protonmail/bridge/cert.pem";
};
};
};
};
};
};
networking.firewall.allowedTCPPorts = [ 33728 1025 1143 ];
};
}

View File

@ -1,62 +0,0 @@
{ config, lib, pkgs, inputs, ... }:
let
arkenfox = builtins.readFile "${inputs.arkenfox-userjs}/user.js";
overrides = {
## arkenfox overrides
# automatic search
"keyword.enabled" = true;
"browser.search.suggest.enabled" = true;
"browser.urlbar.suggest.searches" = true;
# startup page
"browser.startup.homepage" = "https://searxng.moritzboeh.me/";
"browser.startup.page" = 1;
# drm
"media.eme.enabled" = true;
# sanitisation
"privacy.clearOnShutdown.history" = false;
# disable letterboxing
"privacy.resistFingerprinting.letterboxing" = false;
## OTHER
# Dont show warning when accessing about:config
"browser.aboutConfig.showWarning" = false;
# Hide bookmarks
"browser.toolbars.bookmarks.visibility" = "never";
# Smooth scrolling
"general.smoothScroll.lines.durationMaxMS" = 125;
"general.smoothScroll.lines.durationMinMS" = 125;
"general.smoothScroll.mouseWheel.durationMaxMS" = 200;
"general.smoothScroll.mouseWheel.durationMinMS" = 100;
"general.smoothScroll.msdPhysics.enabled" = true;
"general.smoothScroll.other.durationMaxMS" = 125;
"general.smoothScroll.other.durationMinMS" = 125;
"general.smoothScroll.pages.durationMaxMS" = 125;
"general.smoothScroll.pages.durationMinMS" = 125;
"mousewheel.min_line_scroll_amount" = 40;
"mousewheel.system_scroll_override_on_root_content.enabled" = true;
"mousewheel.system_scroll_override_on_root_content.horizontal.factor" = 175;
"mousewheel.system_scroll_override_on_root_content.vertical.factor" = 175;
"toolkit.scrollbox.horizontalScrollDistance" = 6;
"toolkit.scrollbox.verticalScrollDistance" = 2;
};
fullUserJs = ''
// Arkenfox user.js
${arkenfox}
// Overrides
${lib.concatStrings (lib.mapAttrsToList (name: value: ''
user_pref("${name}", ${builtins.toJSON value});
'') overrides)}'';
in {
home-manager.users.moritz.programs.firefox = {
enable = true;
profiles."default".extraConfig = fullUserJs;
};
}

View File

@ -1,29 +0,0 @@
{ config, lib, pkgs, ... }:
{
home-manager.users.moritz = {
programs.kitty = {
enable = true;
settings = {
scrollback_lines = 10000;
enable_audio_bell = false;
cursor_shape = "underline";
window_padding_width = 3;
confirm_os_window_close = 0;
};
keybindings = {
"ctrl+plus" = "change_font_size all +2.0";
"ctrl+minus" = "change_font_size all -2.0";
};
font = {
name = "FiraCode Nerd Font";
size = 10;
};
};
xdg.configFile."kitty/ssh.conf" = {
text = ''
env TERM=xterm-color
'';
};
};
}

View File

@ -1,24 +0,0 @@
{ config, lib, pkgs, ... }:
{
home-manager.users.moritz = {
programs.rofi = {
enable = true;
package =
pkgs.rofi.override { plugins = with pkgs; [ rofi-calc rofi-emoji ]; };
extraConfig = { combi-modi = "drun,window,emoji"; };
};
home.packages = with pkgs;
[
(lib.mkIf config.networking.networkmanager.enable networkmanager_dmenu)
];
xdg = {
enable = true;
configFile."networkmanager-dmenu/config.ini".text = ''
[dmenu]
dmenu_command = rofi
'';
};
};
}

View File

@ -1,10 +0,0 @@
{ config, lib, pkgs, ... }:
{
virtualisation.libvirtd = {
enable = true;
package = pkgs.stable.libvirt;
};
home-manager.users.moritz.home.packages = with pkgs; [ virt-manager ];
users.users.moritz.extraGroups = [ "libvirtd" ];
}

View File

@ -1,13 +0,0 @@
{ config, lib, pkgs, ... }:
{
home-manager.users.moritz.programs.zathura = {
enable = true;
options = {
recolor = true;
adjust-open = "width";
font = "Jetbrains Mono 9";
selection-clipboard = "clipboard";
};
};
}

View File

@ -1,12 +0,0 @@
#!/usr/bin/env bash
# MONITORS #
monitors=($(bspc query -M --names | sort -r))
desktops=$(expr 10 / ${#monitors[@]})
start=1
end=$desktops
for monitor in ${monitors[@]}; do
bspc monitor $monitor -d $(seq -s ' ' $start $end)
start=$(expr $start + $desktops)
end=$(expr $end + $desktops)
done

View File

@ -1,76 +0,0 @@
{ config, lib, pkgs, ... }:
let cfg = config.modules.desktop;
in {
imports = [ ./polybar.nix ];
config = lib.mkIf (cfg.name == "bspwm") {
services = {
xserver = {
enable = true;
layout = "de";
displayManager = {
defaultSession = "none+bspwm";
autoLogin = {
enable = true;
user = "moritz";
};
lightdm.enable = true;
};
windowManager.bspwm.enable = true;
};
};
console.keyMap = "de";
home-manager.users.moritz = {
xsession.windowManager.bspwm = {
enable = true;
rules = {
"Zathura" = { state = "tiled"; };
"Emacs" = { state = "tiled"; };
"feh" = { state = "floating"; };
"Vampire_Survivors" = { state = "fullscreen"; };
};
settings = with config.scheme.withHashtag; {
border_width = 2;
window_gap = 5;
borderless_monocle = true;
gapless_monocle = true;
focus_follows_pointer = true;
# Dracula theme #
focused_border_color = base0D;
normal_border_color = base03;
active_border_color = base03;
};
startupPrograms = [
"${pkgs.systemd}/bin/systemctl --user start polybar.service"
"randomWallpaper"
"synology-drive"
];
extraConfig = ''
# MONITORS #
monitors=($(bspc query -M --names | sort -r))
desktops=$(expr 10 / ''${#monitors[@]})
start=1
end=$desktops
for monitor in ''${monitors[@]}; do
bspc monitor $monitor -d $(seq -s ' ' $start $end)
start=$(expr $start + $desktops)
end=$(expr $end + $desktops)
done
'';
};
services.sxhkd = {
enable = true;
extraConfig = builtins.readFile ./sxhkdrc;
};
home.packages = with pkgs; [ feh playerctl pamixer brightnessctl ];
};
};
}

View File

@ -1,206 +0,0 @@
{ config, lib, pkgs, ... }:
let cfg = config.modules.desktop;
in {
config = lib.mkIf (cfg.name == "bspwm") {
home-manager.users.moritz = {
services.polybar = {
enable = true;
package = pkgs.polybar.override { pulseSupport = true; };
script = ''
for m in $(polybar --list-monitors | ${pkgs.coreutils}/bin/cut -d":" -f1); do
MONITOR=$m polybar --reload bottom &
done
'';
config = with config.scheme.withHashtag; {
"bar/bottom" = {
# position
monitor = "\${env:MONITOR}";
bottom = true;
width = "100%";
heigth = 20;
background = base00;
foreground = base05;
border-size = 5;
border-color = base00;
separator = " ";
font-0 = "FiraCode Nerd Font:size=9;0";
font-1 = "FiraCode Nerd Font:size=9;1";
font-2 = "FiraCode Nerd Font:size=9;2";
modules-left = "cpu memory network battery";
modules-center = "bspwm";
modules-right = "pulseaudio date time";
tray-position = "right";
tray-padding = 2;
wm-restack = "bspwm";
cursor-click = "pointer";
cursor-scroll = "ns-resize";
};
"module/battery" = {
type = "internal/battery";
battery = "BATT";
adapter = "ACAD";
time-format = "%H:%M";
format-charging = "<animation-charging> <label-charging>";
format-discharging = "<animation-discharging> <label-discharging>";
format-full = " <label-full>";
label-charging = "%percentage%% %time% remaining";
label-discharging = "%percentage%% %time% remaining";
label-full = "Fully charged";
animation-charging-0 = " ";
animation-charging-1 = " ";
animation-charging-2 = " ";
animation-charging-3 = " ";
animation-charging-4 = " ";
animation-charging-framerate = 500;
animation-discharging-0 = " ";
animation-discharging-1 = " ";
animation-discharging-2 = " ";
animation-discharging-3 = " ";
animation-discharging-4 = " ";
animation-discharging-framerate = 500;
};
"module/bspwm" = {
type = "internal/bspwm";
label-focused = "";
label-focused-foreground = base0E;
label-focused-padding = 1;
label-occupied = "";
label-occupied-foreground = base03;
label-occupied-padding = 1;
label-urgent = "";
label-urgent-foreground = base08;
label-urgent-padding = 1;
label-empty = "";
label-empty-foreground = base03;
label-empty-padding = 1;
label-separator = " ";
label-separator-foreground = base0C;
label-separator-padding = 1;
pin-workspaces = true;
};
"module/cpu" = {
type = "internal/cpu";
interval = 2;
format = "<ramp-load><label>";
format-foreground = base00;
format-background = base0B;
format-padding = 1;
format-font = 3;
ramp-load-0 = " ";
ramp-load-1 = " ";
ramp-load-2 = " ";
ramp-load-3 = " ";
label = "%percentage:2%%";
};
"module/time" = {
type = "internal/date";
interval = 1;
time = "%H:%M";
time-alt = "%H:%M:%S";
label = "%time%";
format-prefix = " ";
format-prefix-font = 2;
format-foreground = base00;
format-background = base0C;
format-padding = 1;
label-font = 3;
};
"module/date" = {
type = "internal/date";
interval = 5;
format = "<label>";
format-prefix = " ";
format-prefix-font = 2;
format-foreground = base00;
format-background = base0A;
format-padding = 1;
format-font = 3;
date = "%A";
date-alt = "%Y-%m-%d";
label = "%date%";
label-font = 3;
};
"module/memory" = {
type = "internal/memory";
interval = 2;
format = "<label>";
format-prefix = " ";
format-foreground = base00;
format-background = base0C;
format-padding = 1;
format-font = 2;
label = "%gb_used%";
label-font = 3;
};
"module/pulseaudio" = {
type = "internal/pulseaudio";
format-volume = "<ramp-volume> <label-volume>";
label-volume = "%percentage%%";
format-volume-foreground = base00;
format-volume-background = base04;
format-volume-padding = 1;
format-volume-font = 2;
label-muted = "%{F${base08}} %{F${base00}}muted";
format-muted-foreground = base00;
format-muted-background = base04;
format-muted-padding = 1;
format-muted-font = 2;
ramp-volume-0 = "";
ramp-volume-1 = "";
ramp-volume-2 = "奔";
ramp-volume-3 = "";
ramp-volume-4 = "";
click-middle = "${pkgs.pavucontrol}/bin/pavucontrol";
};
"module/network" = {
type = "internal/network";
interface =
builtins.head (builtins.attrNames config.networking.interfaces);
interval = 3;
format-connected = "<label-connected>";
label-connected = "%{T2}%{T3} %upspeed% %{T2}%{T3} %downspeed%";
format-connected-foreground = base00;
format-connected-background = base0E;
format-connected-padding = 1;
format-connected-font = 3;
};
};
};
};
};
}

View File

@ -1,31 +0,0 @@
{ config, lib, pkgs, ... }:
let cfg = config.modules.desktop;
in {
imports = [ ./apps ./bspwm ./gtk.nix ./xmonad ./sway ];
options.modules.desktop = {
name = lib.mkOption {
default = "bspwm";
type = lib.types.enum [ "bspwm" "xmonad" "sway" ];
};
};
config = {
home-manager.users.moritz = {
services.unclutter.enable = true;
xdg = {
enable = true;
configFile = {
"wallpapers/" = {
source = ./wallpapers;
recursive = true;
};
};
};
};
# Remap capslock to esc and shift + capslock to capslock
services.xserver.xkbOptions =
"terminate:ctrl_alt_bksp,caps:escape_shifted_capslock";
};
}

View File

@ -1,14 +0,0 @@
{ config, lib, pkgs, ... }:
{
home-manager.users.moritz = {
gtk = {
enable = true;
theme = {
package = pkgs.dracula-theme;
name = "Dracula";
};
};
};
programs.dconf.enable = true;
}

View File

@ -1,40 +0,0 @@
{ config, lib, pkgs, ... }:
let cfg = config.modules.desktop;
in {
config = lib.mkIf (cfg.name == "xmonad") {
services = {
xserver = {
enable = true;
layout = "de";
displayManager = {
defaultSession = "none+xmonad";
autoLogin = {
enable = true;
user = "moritz";
};
lightdm.enable = true;
};
windowManager.xmonad.enable = true;
};
};
console.keyMap = "de";
home-manager.users.moritz = let
xmonadPackages = haskellPackages: [
haskellPackages.xmonad-contrib
haskellPackages.xmonad-extras
haskellPackages.xmonad
haskellPackages.xmobar
];
in {
xsession.windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
config = ./xmonad.hs;
# extraPackages = xmonadPackages;
};
programs.xmobar.enable = true;
};
};
}

View File

@ -1,5 +0,0 @@
{ config, lib, pkgs, ... }:
{
imports = [ ./emacs.nix ./idea.nix ./vim.nix ./code.nix ];
}

View File

@ -1,18 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.modules.editors;
in {
options.modules.editors = {
idea = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = mkIf cfg.idea {
home-manager.users.moritz = {
home.packages = with pkgs; [ jdk jetbrains.idea-ultimate ];
};
};
}

View File

@ -1,27 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.modules.editors;
in {
options.modules.editors = {
vim = mkOption {
default = true;
type = types.bool;
example = false;
};
};
config = mkIf cfg.vim {
home-manager.users.moritz.programs.neovim = {
enable = true;
vimAlias = true;
vimdiffAlias = true;
plugins = with pkgs.vimPlugins; [
(nvim-treesitter.withPlugins (p: pkgs.tree-sitter.allGrammars))
coc-nvim
dracula-vim
];
withNodeJs = true;
withPython3 = true;
};
};
}

View File

@ -1,19 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.modules.gaming;
in {
options.modules.gaming = mkOption {
default = false;
type = types.bool;
example = true;
};
config = mkIf cfg {
programs.steam.enable = true;
home-manager.users.moritz.home.packages = with pkgs; [
lutris
legendary-gl
];
};
}

View File

@ -1,8 +0,0 @@
{ config, lib, pkgs, ... }:
{
virtualisation.podman = {
enable = true;
dockerCompat = true;
};
}

128
modules/profiles/base.nix Normal file
View File

@ -0,0 +1,128 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
{
users.users.moritz = {
isNormalUser = true;
home = "/home/moritz";
extraGroups = [ "wheel" ]; # "networkmanager" "video" "dialout"
initialPassword = "password"; # CHANGE ME PLEASE
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGoAqa2m7hIzZ2LS96Z+RCIlRvhBM/j7h27tMBCwMT+a" # Moritz
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDhtwHDGAZshiQWKkCcPWV9tC83b+bKBgjDcjP/N2CKO" # Laptop
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKl8gMhwSf1NsP5gp14xbbyjqQLZzcHLb/XKRMoHdXgI" # Desktop
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDHlemuKagHwz2T5rEwgJNlVUdUdOXyPtCEzD73CrwY2zmpR4AMj7y9u3Rm7HwHUDjLap1ZFwg+53bAsVP6HFZccCXoIfO/8BL0WDGQJrfgb+A+UiRhSqSvyZ77bGJkadbBkadguz3qR3PHcb41DOlhuqVcHxsY8ceHMxAuyb0pLJVJLeytMD+CHS/r7hoj2hckTNAZ+VhCXBtdZfZ7uPUBxLfluYRNNMmdwCglsg3RUS242nJUzy3A84+CXIGeWmNG9Fu45IDkwMthxSW9klyU9R38R9DBDcugkyb6vz+JKSuRVAa47qh/kmtsYekfL3ul9D2JN32P8S+6ZoXx+gXupGJ0ltwJWAFkhLJ+yeXj9kCOv/mIUmCB14jMGsvKiSwV25O/twyjqe2LEkMVgimgrjEYoHu+ZTyp0iFtUvSrFo4tsAhfWPV9yj4F/hUksW7xKIwq5Niyx7he5M/XddudtnAximyiBDGCdJm1Ejl0UaGa6ZQv7y6VZdx0PyZuraT7l9ub8so6JlE4cVgSSU9vE0IS2QqBuHhsIjh8RVksoTR2NQbeDdGaGpGnq2C8y0rDXwE/EJA4LK45khX/GPn73n8F0kBG8dBrWgRDAEODpmebScO7d5mCeM0z3lPcRmh+3e3DPnVVOl+uR7udlc7NauLzl7q913UtxZaF1PlD7Q==" # GPG
];
};
time.timeZone = "Europe/Berlin";
my = {
shell = {
abbreviations = {
us = "systemctl --user";
rs = "doas systemctl";
};
aliases = {
ls = "exa -lh --icons --git";
cat = "bat";
grep = "rg";
rm = "rm -i";
mv = "mv -i";
nix-switch = "doas nixos-rebuild switch --flake ~/.dotfiles";
nix-boot = "doas nixos-rebuild boot --flake ~/.dotfiles";
nix-lock = "pushd ~/.dotfiles && nix flake update && popd";
nixpkgs-review = "nixpkgs-review-checks";
latexwatch = ''find -type f -name "*.tex" | entr -c latexmk -pdf -silent'';
};
variables = { EDITOR = "vim"; };
};
};
console.keyMap = "de";
environment.systemPackages = with pkgs; [
# archives
p7zip
unzip
zip
# file management
ranger
trash-cli
# monitoring
htop
bottom
# nix
comma
nix-index
nixpkgs-fmt
statix
# other
arduino
bat
cht-sh
du-dust
duf
entr
exa
gparted
hub
neofetch
tmux
ttyper
up
viu
wget
];
fonts.fonts = with pkgs; [
(nerdfonts.override {
fonts = [ "FiraCode" "DroidSansMono" "JetBrainsMono" ];
})
];
programs = {
mtr.enable = true;
command-not-found.enable = true;
};
services = {
sshd.enable = true; # for agenix
btrfs.autoScrub.enable =
lib.mkDefault
(builtins.any (filesystem: filesystem.fsType == "btrfs")
(builtins.attrValues config.fileSystems));
};
home-manager.users.moritz = {
programs = {
# Let Home Manager install and manage itself.
home-manager.enable = true;
fzf.enable = true;
starship.enable = true;
};
home = {
username = "moritz";
homeDirectory = "/home/moritz";
language = {
base = "en_US.UTF-8";
time = "de_DE.UTF-8";
numeric = "de_DE.UTF-8";
paper = "de_DE.UTF-8";
};
stateVersion = "21.05";
};
xdg.userDirs.enable = true;
};
}

View File

@ -0,0 +1,133 @@
{ config
, lib
, pkgs
, ...
}:
with lib; {
my = {
# config
yubikey.enable = true;
wallpapers.enable = true;
theming.enable = true;
shell.aliases = {
feh = "feh --auto-zoom --scale-down";
};
virtualisation = {
podman.enable = true;
libvirtd.enable = true;
};
programs = {
adb.enable = true;
bspwm.enable = true;
code.enable = true;
emacs.enable = true;
firefox = {
enable = true;
overrides = {
## arkenfox overrides
# automatic search
"keyword.enabled" = true;
"browser.search.suggest.enabled" = true;
"browser.urlbar.suggest.searches" = true;
# startup page
"browser.startup.homepage" = "https://searxng.moritzboeh.me/";
"browser.startup.page" = 1;
# drm
"media.eme.enabled" = true;
# sanitisation
"privacy.clearOnShutdown.history" = false;
# disable letterboxing
"privacy.resistFingerprinting.letterboxing" = false;
## OTHER
# Dont show warning when accessing about:config
"browser.aboutConfig.showWarning" = false;
# Hide bookmarks
"browser.toolbars.bookmarks.visibility" = "never";
# Smooth scrolling
"general.smoothScroll.lines.durationMaxMS" = 125;
"general.smoothScroll.lines.durationMinMS" = 125;
"general.smoothScroll.mouseWheel.durationMaxMS" = 200;
"general.smoothScroll.mouseWheel.durationMinMS" = 100;
"general.smoothScroll.msdPhysics.enabled" = true;
"general.smoothScroll.other.durationMaxMS" = 125;
"general.smoothScroll.other.durationMinMS" = 125;
"general.smoothScroll.pages.durationMaxMS" = 125;
"general.smoothScroll.pages.durationMinMS" = 125;
"mousewheel.min_line_scroll_amount" = 40;
"mousewheel.system_scroll_override_on_root_content.enabled" = true;
"mousewheel.system_scroll_override_on_root_content.horizontal.factor" = 175;
"mousewheel.system_scroll_override_on_root_content.vertical.factor" = 175;
"toolkit.scrollbox.horizontalScrollDistance" = 6;
"toolkit.scrollbox.verticalScrollDistance" = 2;
};
};
git.signing = true;
gpg.enable = true;
hub.enable = true;
kitty.enable = true;
ledger.enable = true;
rofi.enable = true;
spotify.enable = true;
thunar.enable = true;
zathura.enable = true;
};
services = {
dunst.enable = true;
kdeconnect.enable = true;
openconnect.enable = true;
openvpn.enable = true;
picom.enable = true;
printing.enable = true;
redshift.enable = true;
};
};
environment.systemPackages = with pkgs; [
# nix
nixpkgs-review-checks
# ripping
abcde
handbrake
picard
# other
tlaplusToolbox
anki
calibre
jellyfin-media-player
keepassxc
libreoffice
pavucontrol
signal-desktop
vlc
];
home-manager.users.moritz = {
services.unclutter.enable = true;
services.nextcloud-client = {
enable = true;
startInBackground = true;
};
};
services = {
gnome.gnome-keyring.enable = true;
pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
# Remap capslock to esc and shift + capslock to capslock
xserver.xkbOptions = "terminate:ctrl_alt_bksp,caps:escape_shifted_capslock";
};
}

View File

@ -0,0 +1,11 @@
{ config
, lib
, pkgs
, ...
}: {
programs.steam.enable = true;
environment.systemPackages = with pkgs; [
lutris
legendary-gl
];
}

24
modules/programs/adb.nix Normal file
View File

@ -0,0 +1,24 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.adb;
in
{
options.my.programs.adb = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = mkIf cfg.enable {
programs.adb.enable = true;
users.users.moritz.extraGroups = [ "adbusers" ];
};
}

11
modules/programs/bspwm/bspwmrc Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
mapfile -t monitors < <(bspc query -M --names | sort -r)
desktops=$(( 10 / ${#monitors[@]} ))
start=1
end=$desktops
for monitor in "${monitors[@]}"; do
bspc monitor "$monitor" -d $(seq -s ' ' $start $end)
start=$(( start + desktops ))
end=$(( end + desktops ))
done

View File

@ -0,0 +1,79 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.bspwm;
in
{
options.my.programs.bspwm = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = lib.mkIf cfg.enable {
services = {
xserver = {
enable = true;
layout = "de";
displayManager = {
defaultSession = "none+bspwm";
autoLogin = {
enable = true;
user = "moritz";
};
lightdm.enable = true;
};
windowManager.bspwm.enable = true;
};
};
home-manager.users.moritz = {
xsession.windowManager.bspwm = {
enable = true;
rules = {
"Zathura".state = "tiled";
"Emacs".state = "tiled";
"feh".state = "floating";
"Vampire_Survivors".state = "fullscreen";
};
settings = with config.scheme.withHashtag; {
border_width = 2;
window_gap = 5;
borderless_monocle = true;
gapless_monocle = true;
focus_follows_pointer = true;
};
startupPrograms = [
"${pkgs.systemd}/bin/systemctl --user start polybar.service"
"randomWallpaper"
"synology-drive"
];
extraConfig = builtins.readFile ./bspwmrc;
};
services = {
sxhkd = {
enable = true;
extraConfig = builtins.readFile ./sxhkdrc;
};
polybar = {
enable = true;
package = pkgs.polybar.override { pulseSupport = true; };
script = ''
for m in $(polybar --list-monitors | ${pkgs.coreutils}/bin/cut -d":" -f1); do
MONITOR=$m polybar --reload bottom &
done
'';
};
};
home.packages = with pkgs; [ feh playerctl pamixer brightnessctl ];
};
};
}

View File

@ -1,16 +1,22 @@
{ config, lib, pkgs, ... }:
{ config
, lib
, pkgs
, ...
}:
with lib;
let cfg = config.modules.editors;
in {
options.modules.editors = {
code = mkOption {
let
cfg = config.my.programs.code;
in
{
options.my.programs.code = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = mkIf cfg.code {
config = mkIf cfg.enable {
home-manager.users.moritz = {
programs.vscode = {
enable = true;

View File

@ -0,0 +1,30 @@
{ config
, lib
, pkgs
, ...
}:
{
imports = [
./adb.nix
./bspwm
./code.nix
./direnv.nix
./emacs.nix
./firefox.nix
./fish.nix
./git.nix
./gpg.nix
./hub.nix
./kitty.nix
./ledger
./rofi
./spotify.nix
./sway.nix
./thunar.nix
./vim.nix
./xmonad
./zathura.nix
./zsh.nix
];
}

View File

@ -0,0 +1,26 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.direnv;
in
{
options.my.programs.direnv = {
enable = mkOption {
default = true;
type = types.bool;
example = false;
};
};
config = mkIf cfg.enable {
home-manager.users.moritz.programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
};
}

View File

@ -1,20 +1,28 @@
{ config, lib, pkgs, inputs, ... }:
{ config
, lib
, pkgs
, inputs
, ...
}:
with lib;
let
myEmacs = with pkgs;
((emacsPackagesFor emacsPgtkNativeComp).emacsWithPackages
cfg = config.my.programs.emacs;
myEmacs = with pkgs; ((emacsPackagesFor emacsPgtkNativeComp).emacsWithPackages
(epkgs: [ epkgs.vterm ]));
cfg = config.modules.editors.emacs;
in {
options.modules.editors = {
emacs = mkOption {
default = true;
in
{
options.my.programs.emacs = {
enable = mkOption {
default = false;
type = types.bool;
example = false;
example = true;
};
};
config = mkIf cfg {
config = mkIf cfg.enable {
my.shell.aliases = {
emacs = "emacsclient -t -a 'emacs -t'";
};
fonts.fonts = [ pkgs.emacs-all-the-icons-fonts ];
home-manager.users.moritz = {

View File

@ -0,0 +1,47 @@
{ config
, lib
, pkgs
, inputs
, ...
}:
with lib;
let
cfg = config.my.programs.firefox;
arkenfox = builtins.readFile "${inputs.arkenfox-userjs}/user.js";
in
{
options.my.programs.firefox = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
overrides = mkOption {
default = { };
type = with types; attrsOf (oneOf [ str bool int ]);
apply = overrides: lib.concatStrings (
lib.mapAttrsToList
(
name: value: ''
user_pref("${name}", ${builtins.toJSON value});
''
)
overrides
);
};
};
config = mkIf cfg.enable {
home-manager.users.moritz.programs.firefox = {
enable = true;
profiles."default".extraConfig = ''
// Arkenfox user.js
${arkenfox}
// Overrides
${cfg.overrides}
'';
};
};
}

View File

@ -1,24 +1,40 @@
{ config, lib, pkgs, inputs, ... }:
{ config
, lib
, pkgs
, inputs
, ...
}:
with lib;
let
cfg = config.modules.cli.shell;
exportedVariables = let
cfg = config.my.programs.fish;
shellConfig = config.my.shell;
exportVariables =
lib.mapAttrsToList (n: v: ''set -x ${n} "${v}"'') cfg.variables;
in lib.concatStringsSep "\n" exportVariables;
in {
config = lib.mkIf (cfg.name == "fish") {
lib.mapAttrsToList (n: v: ''set -x ${n} "${v}"'') shellConfig.variables;
exportedVariables = lib.concatStringsSep "\n" exportVariables;
in
{
options.my.programs.fish = {
enable = mkOption {
default = true;
type = types.bool;
example = false;
};
};
config = lib.mkIf cfg.enable {
# set as default shell
users.users.moritz.shell = pkgs.fish;
# needed for nix completions
programs.fish.enable = true;
home-manager.users.moritz = {
programs = {
fish = {
enable = true;
shellAbbrs = cfg.abbreviations;
shellAbbrs = shellConfig.abbreviations;
shellAliases = cfg.aliases;
shellAliases = shellConfig.aliases;
shellInit = ''
fzf_configure_bindings --git_log=\cg
@ -54,10 +70,12 @@ in {
fish_greeting = "";
cheat = "cht.sh $argv | bat -p";
};
plugins = [{
plugins = [
{
name = "dracula";
src = inputs.dracula-fish;
}];
}
];
};
fzf.enableFishIntegration = true;
starship.enableFishIntegration = true;

57
modules/programs/git.nix Normal file
View File

@ -0,0 +1,57 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.git;
in
{
options.my.programs.git = {
enable = mkOption {
default = true;
type = types.bool;
example = false;
};
signing = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = mkIf cfg.enable {
my.shell.abbreviations = {
ga = "git add";
gb = "git branch";
gc = "git commit";
gco = "git checkout";
gd = "git diff";
gds = "git diff --staged";
gp = "git push";
gf = "git fetch";
gF = "git pull";
gs = "git status";
};
home-manager.users.moritz = {
programs.git = {
enable = true;
userName = "Moritz Böhme";
userEmail = "mail@moritzboeh.me";
extraConfig.init.defaultBranch = "main";
delta.enable = true;
signing = mkIf cfg.signing {
key = "0x970C6E89EB0547A9";
signByDefault = true;
};
lfs.enable = true;
};
};
programs.git = {
enable = true;
config.safe.directory = "/home/moritz/.dotfiles";
};
};
}

34
modules/programs/gpg.nix Normal file
View File

@ -0,0 +1,34 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.gpg;
in
{
options.my.programs.gpg = {
enable = mkOption {
default = true;
type = types.bool;
example = true;
};
};
config = mkIf cfg.enable {
home-manager.users.moritz.programs.gpg.enable = true;
environment.shellInit = ''
export GPG_TTY="$(tty)"
gpg-connect-agent /bye
export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh"
'';
programs = {
ssh.startAgent = false;
gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
};
};
}

27
modules/programs/hub.nix Normal file
View File

@ -0,0 +1,27 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.hub;
in
{
options.my.programs.hub = {
enable = mkOption {
default = true;
type = types.bool;
example = false;
};
};
config = mkIf cfg.enable {
age.secrets = {
github = {
file = ../../secrets/github.age;
owner = "1000";
};
};
};
}

View File

@ -0,0 +1,48 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.kitty;
in
{
options.my.programs.kitty = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = mkIf cfg.enable {
my.shell.aliases.ssh = "kitty +kitten ssh";
home-manager.users.moritz = {
programs.kitty = {
enable = true;
settings = {
scrollback_lines = 10000;
enable_audio_bell = false;
cursor_shape = "underline";
window_padding_width = 3;
confirm_os_window_close = 0;
};
keybindings = {
"ctrl+plus" = "change_font_size all +2.0";
"ctrl+minus" = "change_font_size all -2.0";
};
font = {
name = "FiraCode Nerd Font";
size = 10;
};
};
xdg.configFile."kitty/ssh.conf" = {
text = ''
env TERM=xterm-color
'';
};
};
};
}

View File

@ -0,0 +1,44 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.ledger;
in
{
options.my.programs.ledger = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = mkIf cfg.enable {
my.shell.aliases = {
bal = "ledger bal";
balcash = "ledger bal -R -X --current --flat ^assets:bank ^liabilities";
balnet = "ledger bal -R -X --current --depth 2 ^assets ^liabilities";
bud = ''ledger --budget --unbudgeted bal ^expenses -p "this month"'';
budr = ''ledger --budget reg -p "this month" ^expenses'';
reg = "ledger reg -R -V --tail 15";
};
home-manager.users.moritz = {
home.packages = with pkgs; [ ledger ];
xdg.configFile = {
"fish/completions/ledger.fish" = {
text = builtins.readFile ./ledger.fish;
};
"ledger/ledgerrc".text = ''
--strict
--explicit
--payee note
--file ~/Notes/ledger/main.ledger
'';
};
};
};
}

View File

@ -0,0 +1,40 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.rofi;
in
{
options.my.programs.rofi = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = mkIf cfg.enable {
home-manager.users.moritz = {
programs.rofi = {
enable = true;
package =
pkgs.rofi.override { plugins = with pkgs; [ rofi-calc rofi-emoji ]; };
extraConfig = { combi-modi = "drun,window,emoji"; };
};
home.packages = with pkgs; [
(lib.mkIf config.networking.networkmanager.enable networkmanager_dmenu)
];
xdg = {
enable = true;
configFile."networkmanager-dmenu/config.ini".text = ''
[dmenu]
dmenu_command = rofi
'';
};
};
};
}

View File

@ -0,0 +1,87 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.spotify;
in
{
options.my.programs.spotify = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = mkIf cfg.enable {
age.secrets.spotifyd = {
file = ../../secrets/spotifyd.age;
owner = "1000";
};
home-manager.users.moritz = {
home.packages = with pkgs; [ spotify-tui sptlrx ];
services.spotifyd = {
enable = true;
package = pkgs.spotifyd.override { withMpris = true; };
settings = {
global = {
# A command that gets executed and can be used to
# retrieve your username.
username_cmd = "${pkgs.coreutils}/bin/head -n 1 /run/agenix/spotifyd";
# A command that gets executed and can be used to
# retrieve your password.
password_cmd = "${pkgs.coreutils}/bin/tail -n 1 /run/agenix/spotifyd";
# The name that gets displayed under the connect tab on
# official clients. Spaces are not allowed!
device_name = "spotifyd";
# The audio bitrate. 96, 160 or 320 kbit/s
bitrate = 320;
# Volume on startup between 0 and 100
initial_volume = "71";
# The directory used to cache audio data.
cache_path = "/tmp/spotifyd-cache";
# The displayed device type in Spotify clients.
device_type = "computer";
# set backend to pulseaudio
backend = "pulseaudio";
};
};
};
xdg.configFile."spotify-tui/config.yml".text = ''
# Dracula theme
theme:
active: "139,233,253" # current playing song in list
banner: "80,250,123" # the "spotify-tui" banner on launch
error_border: "241,250,140" # error dialog border
error_text: "248,248,242" # error message text (e.g. "Spotify API
# reported error 404")
hint: "241,250,140" # hint text in errors
hovered: "255,184,108" # hovered pane border
inactive: "248,248,242" # borders of inactive panes
playbar_background: "68,71,90" # background of progress bar
playbar_progress: "248,248,242" # filled-in part of the progress bar
playbar_progress_text: "248,248,242" # song length and time played/left
# indicator in the progress bar
playbar_text: "248,248,242" # artist name in player pane
selected: "80,250,123" # a) selected pane border, b) hovered item
# in list, & c) track title in player
text: "248,248,242" # text in panes
header: "248,248,242" # header text in panes (e.g. 'Title',
# 'Artist', etc.)
behavior:
volume_increment: 5
'';
};
};
}

View File

@ -1,9 +1,23 @@
{ config, lib, pkgs, ... }:
{ config
, lib
, pkgs
, ...
}:
with lib;
let cfg = config.modules.desktop;
in {
config = mkIf (cfg.name == "sway") {
let
cfg = config.my.programs.sway;
in
{
options.my.programs.sway = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = lib.mkIf cfg.enable {
hardware.opengl = {
enable = true;
driSupport = true;
@ -26,8 +40,7 @@ in {
output = [ "eDP-1" "HDMI-A-1" ];
modules-left = [ "sway/workspaces" "sway/mode" "wlr/taskbar" ];
modules-center = [ "sway/window" "custom/hello-from-waybar" ];
modules-right =
[ "mpd" "custom/mymodule#with-css-id" "temperature" ];
modules-right = [ "mpd" "custom/mymodule#with-css-id" "temperature" ];
"sway/workspaces" = { all-outputs = true; };
};
};
@ -51,10 +64,11 @@ in {
smartBorders = "on";
};
bars = [ ];
keybindings = let
modifier =
config.home-manager.users.moritz.wayland.windowManager.sway.config.modifier;
in lib.mkOptionDefault {
keybindings = lib.mkOptionDefault {
inherit
(config.home-manager.users.moritz.wayland.windowManager.sway.config)
modifier
;
"${modifier}+f" = "firefox";
"${modifier}+e" = "emacsclient -c -a emacs";
};

View File

@ -0,0 +1,32 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.thunar;
in
{
options.my.programs.thunar = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
xfce.exo
xfce.thunar
xfce.tumbler
xfce.xfconf
];
services.gvfs = {
enable = true;
package = lib.mkForce pkgs.gnome3.gvfs;
};
};
}

29
modules/programs/vim.nix Normal file
View File

@ -0,0 +1,29 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.vim;
in
{
options.my.programs.vim = {
enable = mkOption {
default = true;
type = types.bool;
example = false;
};
};
config = mkIf cfg.enable {
home-manager.users.moritz.programs.neovim = {
enable = true;
vimAlias = true;
vimdiffAlias = true;
withNodeJs = true;
withPython3 = true;
};
};
}

View File

@ -0,0 +1,56 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.xmonad;
in
{
options.my.programs.xmonad = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = lib.mkIf cfg.enable {
services = {
xserver = {
enable = true;
layout = "de";
displayManager = {
defaultSession = "none+xmonad";
autoLogin = {
enable = true;
user = "moritz";
};
lightdm.enable = true;
};
windowManager.xmonad.enable = true;
};
};
home-manager.users.moritz =
let
xmonadPackages = haskellPackages: [
haskellPackages.xmonad-contrib
haskellPackages.xmonad-extras
haskellPackages.xmonad
haskellPackages.xmobar
];
in
{
xsession.windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
config = ./xmonad.hs;
# extraPackages = xmonadPackages;
};
programs.xmobar.enable = true;
};
};
}

View File

@ -0,0 +1,31 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.zathura;
in
{
options.my.programs.zathura = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = mkIf cfg.enable {
home-manager.users.moritz.programs.zathura = {
enable = true;
options = {
recolor = true;
adjust-open = "width";
font = "Jetbrains Mono 9";
selection-clipboard = "clipboard";
};
};
};
}

49
modules/programs/zsh.nix Normal file
View File

@ -0,0 +1,49 @@
{ config
, lib
, pkgs
, inputs
, ...
}:
with lib;
let
cfg = config.my.programs.zsh;
shellConfig = config.my.shell;
in
{
options.my.programs.zsh = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = lib.mkIf cfg.enable {
environment.pathsToLink = [ "/share/zsh" ];
users.users.moritz.shell = pkgs.zsh;
home-manager.users.moritz.programs = {
zsh = {
enable = true;
dotDir = ".config/zsh";
history.expireDuplicatesFirst = true;
localVariables = shellConfig.variables;
shellAliases = lib.trivial.mergeAttrs shellConfig.aliases shellConfig.abbreviations;
enableSyntaxHighlighting = true;
enableAutosuggestions = true;
enableCompletion = true;
initExtra = ''
function nix-which() {
readlink -f $(which $1)
}
'';
plugins = [
{
name = "forgit";
src = inputs.forgit-git;
}
];
};
};
};
}

View File

@ -1,6 +1,7 @@
{ config, lib, ... }:
{
{ config
, lib
, ...
}: {
## System security tweaks
# sets hidepid=2 on /proc (make process info visible only to owning user)
# NOTE Was removed on nixpkgs-unstable because it doesn't do anything

View File

@ -1,11 +0,0 @@
{ config, lib, pkgs, inputs, ... }:
{
services.sshd.enable = true;
age.secrets = {
nordvpn = {
file = ../../secrets/nordvpn.age;
owner = "1000";
};
};
}

View File

@ -1,39 +1,15 @@
{ config, lib, pkgs, ... }:
{
{ config
, lib
, pkgs
, ...
}: {
imports = [
./agenix.nix
./dunst.nix
./gpg.nix
./kdeconnect.nix
./keyring.nix
./openconnect.nix
./openvpn.nix
./picom.nix
./openconnect.nix
./printing.nix
./redshift.nix
];
services = {
printing = {
enable = true;
drivers = with pkgs;
[ stable.epson-escpr2 ]; # HACK to fix broken upstream package
};
avahi = lib.mkIf config.services.printing.enable {
enable = true;
nssmdns = true;
};
pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
redshift.enable = true;
btrfs.autoScrub.enable = lib.mkDefault
(builtins.any (filesystem: filesystem.fsType == "btrfs")
(builtins.attrValues config.fileSystems));
};
location = {
latitude = 52.3;
longitude = 12.4;
};
}

View File

@ -1,6 +1,23 @@
{ config, lib, pkgs, ... }:
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.services.dunst;
in
{
options.my.services.dunst = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = lib.mkIf cfg.enable {
home-manager.users.moritz = {
services.dunst = {
enable = true;
@ -267,19 +284,16 @@
mouse_right_click = "close_all";
};
urgency_low = {
background = "#282a36";
foreground = "#6272a4";
timeout = 10;
};
urgency_normal = {
background = "#282a36";
foreground = "#bd93f9";
timeout = 10;
};
urgency_critical = {
background = "#ff5555";
foreground = "#f8f8f2";
timeout = 0;
@ -287,4 +301,5 @@
};
};
};
};
}

View File

@ -1,11 +0,0 @@
{ config, lib, pkgs, ... }:
{
programs = {
ssh.startAgent = false;
gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
};
}

View File

@ -1,38 +0,0 @@
{ config, lib, pkgs, ... }:
{
# Create jupyter user
users.users.jupyter.group = "jupyter";
users.users.jupyter.isSystemUser = true;
users.groups.jupyter = { };
services.jupyter = {
enable = true;
password =
"'argon2:$argon2id$v=19$m=10240,t=10,p=8$rILNOtQ9WhacuEhV5zW2CQ$Gvbql8TEqBxPhKeMVwKZPQ'";
kernels = {
python3 =
let
env = pkgs.python3.withPackages (pythonPackages:
with pythonPackages; [
ipykernel
pandas
scikit-learn
]);
in
{
displayName = "Python 3 for machine learning";
argv = [
"${env.interpreter}"
"-m"
"ipykernel_launcher"
"-f"
"{connection_file}"
];
language = "python";
logo32 = null;
logo64 = null;
};
};
};
}

Some files were not shown because too many files have changed in this diff Show More