feat: initial commit

This commit is contained in:
Jacob Bachmann 2023-08-30 19:14:26 +02:00
commit 7fc2437bed
38 changed files with 1528 additions and 0 deletions

12
README.md Normal file
View file

@ -0,0 +1,12 @@
# Nix los hier
:warning: WIP
## References
- https://nixos-and-flakes.thiscute.world/
- https://git.sbruder.de/simon/nixos-config
- https://neovimcraft.com/
- https://search.nixos.org/packages
- https://mipmip.github.io/home-manager-option-search/

49
flake.lock generated Normal file
View file

@ -0,0 +1,49 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1692099905,
"narHash": "sha256-/pSusGhmIdSdAaywQRFA5dVbfdIzlWQTecM+E46+cJ0=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "2a6679aa9cc3872c29ba2a57fe1b71b3e3c5649f",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-23.05",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1692447944,
"narHash": "sha256-fkJGNjEmTPvqBs215EQU4r9ivecV5Qge5cF/QDLVn3U=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d680ded26da5cf104dd2735a51e88d2d8f487b4d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

29
flake.nix Normal file
View file

@ -0,0 +1,29 @@
{
description = "Nix los hier";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager/release-23.05";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, home-manager, ... }@inputs: {
nixosConfigurations = {
W530 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = inputs;
modules = [
./hosts/W530
./modules
home-manager.nixosModules.home-manager
{
imports = [ ./users/gandalf ];
}
];
};
};
};
}

5
hosts/W530/default.nix Normal file
View file

@ -0,0 +1,5 @@
{ ... }: {
imports = [ ./hardware.nix ];
networking.hostName = "W530"; # Define your hostname.
}

89
hosts/W530/hardware.nix Normal file
View file

@ -0,0 +1,89 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "firewire_ohci" "usb_storage" "sd_mod" "sr_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
boot.kernelParams = [ "resume_offset=9364344" ];
boot.resumeDevice = "/dev/disk/by-uuid/2e6bd7f5-74f0-4047-a0ab-5679b877a9fe";
fileSystems."/" =
{
device = "/dev/disk/by-uuid/2e6bd7f5-74f0-4047-a0ab-5679b877a9fe";
fsType = "btrfs";
options = [ "subvol=@" "compress=zstd" "noatime" ];
};
boot.initrd.luks.devices."cryptlvm".device = "/dev/disk/by-uuid/d04a2c58-4116-45d6-aa6e-2002556e6d22";
fileSystems."/home" =
{
device = "/dev/disk/by-uuid/2e6bd7f5-74f0-4047-a0ab-5679b877a9fe";
fsType = "btrfs";
options = [ "subvol=@home" "compress=zstd" "noatime" ];
};
fileSystems."/root" =
{
device = "/dev/disk/by-uuid/2e6bd7f5-74f0-4047-a0ab-5679b877a9fe";
fsType = "btrfs";
options = [ "subvol=@root" "compress=zstd" "noatime" ];
};
fileSystems."/srv" =
{
device = "/dev/disk/by-uuid/2e6bd7f5-74f0-4047-a0ab-5679b877a9fe";
fsType = "btrfs";
options = [ "subvol=@srv" "compress=zstd" "noatime" ];
};
fileSystems."/var/log" =
{
device = "/dev/disk/by-uuid/2e6bd7f5-74f0-4047-a0ab-5679b877a9fe";
fsType = "btrfs";
options = [ "subvol=@log" "compress=zstd" "noatime" ];
};
fileSystems."/var/cache" =
{
device = "/dev/disk/by-uuid/2e6bd7f5-74f0-4047-a0ab-5679b877a9fe";
fsType = "btrfs";
options = [ "subvol=@cache" "compress=zstd" "noatime" ];
};
fileSystems."/tmp" =
{
device = "/dev/disk/by-uuid/2e6bd7f5-74f0-4047-a0ab-5679b877a9fe";
fsType = "btrfs";
options = [ "subvol=@tmp" "compress=zstd" "noatime" ];
};
fileSystems."/swap" =
{
device = "/dev/disk/by-uuid/2e6bd7f5-74f0-4047-a0ab-5679b877a9fe";
fsType = "btrfs";
options = [ "subvol=@swap" "noatime" ];
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/A410-7E4F";
fsType = "vfat";
};
swapDevices = [{
device = "/swap/swapfile";
}];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

16
modules/aliases.nix Normal file
View file

@ -0,0 +1,16 @@
{
ls = "lsd --color=auto";
la = "lsd -lAh --group-directories-first";
lt = "lsd -lAh --group-directories-first --tree";
llt = "unbuffer lsd -lAh --group-directories-first --tree | less -r";
gg = "cd ~/git";
gs = "git status";
gl = "git log --oneline";
glg = "git log --oneline --graph --decorate --all";
gaa = "git add --all";
gc = "git commit -m";
gp = "git push";
ta = "tmux attach";
ngc = "sudo nix-collect-garbage -d";
nec = "sudo nvim -u $HOME/.config/nvim/init.lua --cmd 'cd /etc/nixos'";
}

11
modules/audio.nix Normal file
View file

@ -0,0 +1,11 @@
{ ... }: {
# Enable pipewire - audio
services.pipewire = {
enable = true;
audio.enable = true;
alsa.enable = true;
alsa.support32Bit = true;
jack.enable = true;
pulse.enable = true;
};
}

9
modules/bluetooth.nix Normal file
View file

@ -0,0 +1,9 @@
{ ... }: {
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
};
services.blueman.enable = true;
}

5
modules/boot.nix Normal file
View file

@ -0,0 +1,5 @@
{ ... }: {
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
}

6
modules/dbus.nix Normal file
View file

@ -0,0 +1,6 @@
{ pkgs, ... }: {
services.dbus = {
enable = true;
packages = [ pkgs.gcr ]; # needed for gnome pinentry
};
}

22
modules/default.nix Normal file
View file

@ -0,0 +1,22 @@
{
imports = [
./audio.nix
./bluetooth.nix
./boot.nix
./dbus.nix
./fonts.nix
./i18n.nix
./keyd.nix
./network.nix
./nix.nix
./nvidia.nix
./opengl.nix
./power.nix
./packages.nix
./print.nix
./security.nix
./shell.nix
./unfree.nix
./xdg-portal.nix
];
}

9
modules/fonts.nix Normal file
View file

@ -0,0 +1,9 @@
{ pkgs, ... }: {
# Add fonts
fonts = {
enableDefaultPackages = true;
packages = with pkgs; [
(nerdfonts.override { fonts = [ "DejaVuSansMono" ]; })
];
};
}

11
modules/i18n.nix Normal file
View file

@ -0,0 +1,11 @@
{ ... }: {
# Set your time zone.
time.timeZone = "Europe/Berlin";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "us";
};
}

28
modules/keyd.nix Normal file
View file

@ -0,0 +1,28 @@
{ ... }: {
# Enable keyd and remap keys
services.keyd = {
enable = true;
keyboards.default.settings = {
main = {
leftalt = "layer(meta)";
leftmeta = "layer(alt)";
altgr = "layer(control)";
rightalt = "layer(control)";
capslock = "layer(nav)";
};
meta = {
capslock = "overload(nav, capslock)";
};
nav = {
h = "left";
j = "down";
k = "up";
l = "right";
"0" = "home";
"4" = "end";
u = "pageup";
d = "pagedown";
};
};
};
}

7
modules/network.nix Normal file
View file

@ -0,0 +1,7 @@
{ ... }: {
networking.networkmanager.enable = true;
systemd.services = {
NetworkManager-wait-online.enable = false;
};
}

7
modules/nix.nix Normal file
View file

@ -0,0 +1,7 @@
{ ... }: {
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
};
system.stateVersion = "23.05";
}

15
modules/nvidia.nix Normal file
View file

@ -0,0 +1,15 @@
{ ... }: {
/*
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
# Modesetting is needed for most Wayland compositors
modesetting.enable = true;
# Use the open source version of the kernel module
# Only available on driver 515.43.04+
open = false;
# Enable the nvidia settings menu
nvidiaSettings = true;
};
*/
}

7
modules/opengl.nix Normal file
View file

@ -0,0 +1,7 @@
{ ... }: {
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
}

23
modules/packages.nix Normal file
View file

@ -0,0 +1,23 @@
{ pkgs, ... }: {
environment.systemPackages = with pkgs; [
pciutils
qt6.qtwayland
xdg-utils # for opening default programs
glib # gsettings
git
mercurial # contains 'hg'
wget
neofetch
lsd
ripgrep
expect # contains 'unbuffer'
# languages
gcc13
go
openjdk17
javaPackages.openjfx17
gradle_7
python312
nodejs_20
];
}

6
modules/power.nix Normal file
View file

@ -0,0 +1,6 @@
{ ... }: {
powerManagement = {
enable = true;
powertop.enable = true;
};
}

4
modules/print.nix Normal file
View file

@ -0,0 +1,4 @@
{ ... }: {
# Enable CUPS to print documents.
services.printing.enable = true;
}

6
modules/security.nix Normal file
View file

@ -0,0 +1,6 @@
{ ... }: {
security.polkit.enable = true;
# rtkit is optional but recommended
security.rtkit.enable = true;
}

22
modules/shell.nix Normal file
View file

@ -0,0 +1,22 @@
{ pkgs, ... }:
let
aliases = import ./aliases.nix;
in
{
programs.zsh = {
enable = true;
};
users.users.gandalf = {
shell = pkgs.zsh;
};
environment = {
shellAliases = aliases;
};
programs.htop = {
enable = true;
};
}

3
modules/unfree.nix Normal file
View file

@ -0,0 +1,3 @@
{ ... }: {
nixpkgs.config.allowUnfree = true;
}

8
modules/xdg-portal.nix Normal file
View file

@ -0,0 +1,8 @@
{ pkgs, ... }: {
xdg.portal = {
enable = true;
wlr.enable = true;
# gtk portal needed to make gtk apps happy
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
};
}

36
users/gandalf/default.nix Normal file
View file

@ -0,0 +1,36 @@
{ pkgs, ... }:
let
aliases = import ../../modules/aliases.nix;
in
{
users.users.gandalf = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" ];
packages = with pkgs; [
firefox
speechd # https://support.mozilla.org/en-US/kb/speechd-setup
gopass
gopass-jsonapi
gnome.nautilus
gimp
];
};
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.gandalf = { pkgs, ... }: {
imports = [ ./modules ];
config = {
home = {
username = "gandalf";
homeDirectory = "/home/gandalf";
shellAliases = aliases;
stateVersion = "23.05";
};
};
};
# programs.home-manager.enable = true;
}

View file

@ -0,0 +1,24 @@
{ ... }:
let
common = import ./common.nix;
in
{
# alacritty - a cross-platform, GPU-accelerated terminal emulator
programs.alacritty = {
enable = true;
# custom settings
settings = {
env.TERM = "xterm-256color";
font = {
size = 12;
draw_bold_text_with_bright_colors = true;
normal = {
family = common.font;
};
};
scrolling.multiplier = 5;
selection.save_to_clipboard = true;
};
};
}

View file

@ -0,0 +1,20 @@
{
colorschemes = rec {
custom = {
black = "#000000";
white = "#ffffff";
# https://yeun.github.io/open-color/
active = "#ffdeeb"; # pink1
activeDark = "#f783ac"; # pink4
inactive = "#495057"; # gray7
inactiveDark = "#212529"; # gray9
alert = "#c92a2a"; # red9
};
default = custom;
};
font = "DejaVuSansM Nerd Font";
font-size = "14";
gtk = "Adwaita";
}

View file

@ -0,0 +1,14 @@
{
imports = [
./alacritty.nix
./fzf.nix
./gnupg.nix
./neovim.nix
./sway.nix
./tmux.nix
./vscode.nix
./waybar.nix
./wofi.nix
./zsh.nix
];
}

View file

@ -0,0 +1,7 @@
{
programs.fzf = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
};
}

View file

@ -0,0 +1,12 @@
{ ... }: {
programs.gpg = {
enable = true;
};
services.gpg-agent = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
pinentryFlavor = "gnome3";
};
}

View file

@ -0,0 +1,131 @@
{ pkgs, ... }: {
programs.neovim = {
enable = true;
defaultEditor = true;
vimAlias = true;
plugins = with pkgs.vimPlugins; [
telescope-nvim
toggleterm-nvim
nvim-tree-lua
(nvim-treesitter.withPlugins (_: pkgs.tree-sitter.allGrammars))
nvim-lspconfig
];
extraPackages = with pkgs; [
nil
nixpkgs-fmt
];
extraLuaConfig = ''
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- set termguicolors to enable highlight groups
vim.opt.termguicolors = true
local set = vim.opt
set.tabstop = 2
set.shiftwidth = 2
set.softtabstop = 2
set.expandtab = true
-- needed for toggleterm
set.hidden = true
-- nvim-tree setup
local nvimtree = require('nvim-tree')
local nvimtreeapi = require('nvim-tree.api')
local function nvimtree_on_attach(bufnr)
local api = require "nvim-tree.api"
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
-- default mappings
api.config.mappings.default_on_attach(bufnr)
-- custom mappings
vim.keymap.set('n', '<C-t>', api.tree.toggle, {})
vim.keymap.set('n', '?', api.tree.toggle_help, opts('Help'))
end
nvimtree.setup({
on_attach = nvimtree_on_attach,
})
vim.keymap.set('n', '<C-t>', nvimtreeapi.tree.toggle, {})
-- telescope setup
local telescope = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', telescope.find_files, {})
vim.keymap.set('n', '<leader>fg', telescope.live_grep, {})
vim.keymap.set('n', '<leader>fb', telescope.buffers, {})
vim.keymap.set('n', '<leader>fh', telescope.help_tags, {})
-- toggleterm setup
local toggleterm = require('toggleterm')
toggleterm.setup{
open_mapping = [[<c-\>]],
hide_numbers = false,
autochdir = true,
direction = 'float',
float_opts = {
border = 'curved',
},
}
-- nvim-treesitter
local treesitter = require('nvim-treesitter.configs')
treesitter.setup {
indent = {
enable = true
},
highlight = {
enable = true
},
}
-- nvim-lspconfig
local lspconfig = require('lspconfig')
lspconfig.nil_ls.setup {
settings = {
['nil'] = {
formatting = {
command = { "nixpkgs-fmt" },
},
},
},
}
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
-- Use LspAttach autocommand to only map the following keys
-- after the language server attaches to the current buffer
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev)
-- Enable completion triggered by <c-x><c-o>
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
-- Buffer local mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local opts = { buffer = ev.buf }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
-- vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
-- vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
-- vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
-- vim.keymap.set('n', '<space>wl', function()
-- print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
-- end, opts)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
-- vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
-- vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', '<space>f', function()
vim.lsp.buf.format { async = true }
end, opts)
end,
})
'';
};
}

View file

@ -0,0 +1,280 @@
{ config, pkgs, ... }:
let
cfg = config.wayland.windowManager.sway.config;
common = import ./common.nix;
in
{
home.packages = with pkgs; [
brightnessctl # control screen brightness
pavucontrol # control audio
networkmanagerapplet # control network
dracula-theme # gtk theme
gnome3.adwaita-icon-theme # default gnome cursors
# wdisplays # graphical output manager
# wev # wayland event monitor
wl-clipboard # cli tool to manage wayland clipboard
# wl-mirror # emulation for “mirror display” mode
# wlr-randr # output management that actually works
];
wayland.windowManager.sway = {
enable = true;
wrapperFeatures = {
base = true;
gtk = true;
};
xwayland = true;
extraSessionCommands = ''
export CLUTTER_BACKEND=wayland;
export GDK_BACKEND=wayland;
export GDK_DPI_SCALE=1;
export NIXOS_OZONE_WL=1;
export WLR_NO_HARDWARE_CURSORS=1;
export MOZ_ENABLE_WAYLAND=1;
export MOZ_USE_XINPUT2=1;
export XDG_SESSION_TYPE=wayland;
export XDG_CURRENT_DESKTOP=sway;
# SDL:
export SDL_VIDEODRIVER=wayland
# QT (needs qt5.qtwayland in systemPackages):
export QT_QPA_PLATFORM=wayland-egl
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
# Fix for some Java AWT applications (e.g. Android Studio),
# use this if they aren't displayed properly:
export _JAVA_AWT_WM_NONREPARENTING=1
export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on";
'';
config = {
modifier = "Mod4";
terminal = "${pkgs.alacritty}/bin/alacritty";
menu = "${pkgs.wofi}/bin/wofi";
startup = [
{ command = "blueman-applet"; }
{ command = "nm-applet"; }
];
input = {
"2:7:SynPS/2_Synaptics_TouchPad" = {
accel_profile = "flat";
dwt = "enabled";
dwtp = "enabled";
tap = "enabled";
natural_scroll = "enabled";
middle_emulation = "enabled";
scroll_factor = "0.3";
};
"2:10:TPPS/2_IBM_TrackPoint" = {
accel_profile = "flat";
scroll_factor = "0.5";
};
};
left = "h";
down = "j";
up = "k";
right = "l";
keybindings = {
# Basics
"${cfg.modifier}+Return" = "exec ${cfg.terminal}";
"${cfg.modifier}+q" = "kill";
"${cfg.modifier}+Space" = "exec ${cfg.menu}";
"${cfg.modifier}+Shift+c" = "reload";
"${cfg.modifier}+Shift+q" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
# Focus
"${cfg.modifier}+${cfg.left}" = "focus left";
"${cfg.modifier}+${cfg.down}" = "focus down";
"${cfg.modifier}+${cfg.up}" = "focus up";
"${cfg.modifier}+${cfg.right}" = "focus right";
"${cfg.modifier}+Left" = "focus left";
"${cfg.modifier}+Down" = "focus down";
"${cfg.modifier}+Up" = "focus up";
"${cfg.modifier}+Right" = "focus right";
# Moving
"${cfg.modifier}+Shift+${cfg.left}" = "move left";
"${cfg.modifier}+Shift+${cfg.down}" = "move down";
"${cfg.modifier}+Shift+${cfg.up}" = "move up";
"${cfg.modifier}+Shift+${cfg.right}" = "move right";
"${cfg.modifier}+Shift+Left" = "move left";
"${cfg.modifier}+Shift+Down" = "move down";
"${cfg.modifier}+Shift+Up" = "move up";
"${cfg.modifier}+Shift+Right" = "move right";
# Workspaces
"${cfg.modifier}+1" = "workspace number 1";
"${cfg.modifier}+2" = "workspace number 2";
"${cfg.modifier}+3" = "workspace number 3";
"${cfg.modifier}+4" = "workspace number 4";
"${cfg.modifier}+5" = "workspace number 5";
"${cfg.modifier}+6" = "workspace number 6";
"${cfg.modifier}+7" = "workspace number 7";
"${cfg.modifier}+8" = "workspace number 8";
"${cfg.modifier}+9" = "workspace number 9";
"${cfg.modifier}+0" = "workspace number 10";
"${cfg.modifier}+Shift+1" = "move container to workspace number 1";
"${cfg.modifier}+Shift+2" = "move container to workspace number 2";
"${cfg.modifier}+Shift+3" = "move container to workspace number 3";
"${cfg.modifier}+Shift+4" = "move container to workspace number 4";
"${cfg.modifier}+Shift+5" = "move container to workspace number 5";
"${cfg.modifier}+Shift+6" = "move container to workspace number 6";
"${cfg.modifier}+Shift+7" = "move container to workspace number 7";
"${cfg.modifier}+Shift+8" = "move container to workspace number 8";
"${cfg.modifier}+Shift+9" = "move container to workspace number 9";
"${cfg.modifier}+Shift+0" = "move container to workspace number 10";
"${cfg.modifier}+Control+${cfg.down}" = "workspace prev";
"${cfg.modifier}+Control+${cfg.up}" = "workspace next";
"${cfg.modifier}+Control+Shift+${cfg.down}" = "move workspace to output left";
"${cfg.modifier}+Control+Shift+${cfg.up}" = "move workspace to output right";
# Splits
"${cfg.modifier}+b" = "splith";
"${cfg.modifier}+v" = "splitv";
# Layouts
"${cfg.modifier}+s" = "layout stacking";
"${cfg.modifier}+w" = "layout tabbed";
"${cfg.modifier}+e" = "layout toggle split";
"${cfg.modifier}+f" = "fullscreen toggle";
"${cfg.modifier}+a" = "focus parent";
"${cfg.modifier}+d" = "floating toggle";
"${cfg.modifier}+Shift+d" = "focus mode_toggle";
# Scratchpad
"${cfg.modifier}+Shift+minus" = "move scratchpad";
"${cfg.modifier}+minus" = "scratchpad show";
# Resize mode
"${cfg.modifier}+r" = "mode resize";
# Multimedia Keys
"XF86AudioRaiseVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+";
"XF86AudioLowerVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%-";
"XF86AudioMute" = "exec ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
"XF86AudioMicMute" = "exec ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle";
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl -q set 5%-";
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl -q set 5%+";
# "XF86AudioPrev" = "exec ${pkgs.mpc_cli}/bin/mpc -q next";
# "XF86AudioNext" = "exec ${pkgs.mpc_cli}/bin/mpc -q prev";
# "XF86AudioPlay" = "exec ${pkgs.mpc_cli}/bin/mpc -q toggle";
# "XF86AudioPause" = "exec ${pkgs.mpc_cli}/bin/mpc -q toggle";
# Programs
"${cfg.modifier}+Shift+v" = "exec ${pkgs.pavucontrol}/bin/pavucontrol";
"${cfg.modifier}+Shift+b" = "exec ${pkgs.blueman}/bin/blueman-manager";
"${cfg.modifier}+Shift+n" = "exec ${pkgs.networkmanagerapplet}/bin/nm-connection-editor";
};
fonts = {
names = [ common.font ];
style = "Bold";
size = 12.0;
};
seat = {
"*" = {
xcursor_theme = common.gtk;
};
};
window = {
titlebar = false;
border = 4;
};
gaps = {
inner = 5;
};
colors = {
focused = {
border = common.colorschemes.default.active;
background = common.colorschemes.default.active;
text = common.colorschemes.default.black;
indicator = common.colorschemes.default.activeDark;
childBorder = common.colorschemes.default.active;
};
focusedInactive = {
border = common.colorschemes.default.inactive;
background = common.colorschemes.default.inactive;
text = common.colorschemes.default.white;
indicator = common.colorschemes.default.inactive;
childBorder = common.colorschemes.default.inactive;
};
unfocused = {
border = common.colorschemes.default.inactiveDark;
background = common.colorschemes.default.inactiveDark;
text = common.colorschemes.default.white;
indicator = common.colorschemes.default.inactiveDark;
childBorder = common.colorschemes.default.inactiveDark;
};
urgent = {
border = common.colorschemes.default.alert;
background = common.colorschemes.default.alert;
text = common.colorschemes.default.white;
indicator = common.colorschemes.default.black;
childBorder = common.colorschemes.default.alert;
};
placeholder = {
border = common.colorschemes.default.active;
background = common.colorschemes.default.active;
text = common.colorschemes.default.black;
indicator = common.colorschemes.default.activeDark;
childBorder = common.colorschemes.default.active;
};
};
bars = [
{
command = "${pkgs.waybar}/bin/waybar";
}
];
};
extraConfig = ''
for_window [title="Firefox Sharing Indicator"] {
floating enable
}
for_window [title="Bluetooth Devices"] {
floating enable
resize set 700px 450px
move position 100ppt 0
move left 700px
}
for_window [title="Volume Control"] {
floating enable
resize set 700px 450px
move position 100ppt 0
move left 700px
}
for_window [app_id="nm-connection-editor" title="Network Connections"] {
floating enable
resize set 700px 450px
move position 100ppt 0
move left 700px
}
for_window [app_id="thunderbird" title="Reminder"] {
floating enable
resize set 700px 450px
move position 100ppt 0
move left 700px
}
set $ddterm-id dropdown-terminal
set $ddterm ${cfg.terminal} --class $ddterm-id
set $ddterm-resize resize set 100ppt 40ppt, move position 0 0
# resize/move new dropdown terminal windows
for_window [app_id="$ddterm-id"] {
floating enable
$ddterm-resize
move to scratchpad
scratchpad show
}
# show existing or start new dropdown terminal
bindsym ${cfg.modifier}+grave exec swaymsg '[app_id="$ddterm-id"] scratchpad show' || $ddterm && sleep .1 && swaymsg '[app_id="$ddterm-id"] $ddterm-resize'
# ^-- resize again, case moving to different output
'';
};
}

View file

@ -0,0 +1,14 @@
{
programs.tmux = {
enable = true;
newSession = true;
terminal = "screen-256color";
clock24 = true;
escapeTime = 0;
historyLimit = 10000;
mouse = true;
keyMode = "vi";
};
}

View file

@ -0,0 +1,147 @@
{ pkgs, ... }:
let
common = import ./common.nix;
in
{
programs.vscode = {
enable = true;
enableExtensionUpdateCheck = true;
enableUpdateCheck = false;
extensions = with pkgs.vscode-extensions; [
vscodevim.vim
editorconfig.editorconfig
dbaeumer.vscode-eslint
waderyan.gitblame
bierner.markdown-mermaid
pkief.material-icon-theme
christian-kohler.path-intellisense
johnpapa.vscode-peacock
esbenp.prettier-vscode
bradlc.vscode-tailwindcss
jnoortheen.nix-ide
];
userSettings = {
"window.menuBarVisibility" = "toggle";
"workbench.iconTheme" = "material-icon-theme";
"explorer.confirmDragAndDrop" = false;
"explorer.confirmDelete" = false;
"editor.renderControlCharacters" = true;
"editor.renderWhitespace" = "all";
"editor.renderFinalNewline" = "on";
"editor.tabSize" = 4;
"editor.cursorStyle" = "line";
"editor.insertSpaces" = false;
"editor.lineNumbers" = "on";
"editor.wordSeparators" = "/\\()\"':,.;<>~!@#$%^&*|+=[]{}`?-";
"editor.wordWrap" = "on";
"editor.suggestSelection" = "first";
"editor.fontFamily" = common.font;
"editor.fontSize" = 16;
"editor.bracketPairColorization.enabled" = true;
"editor.guides.bracketPairs" = "active";
"editor.quickSuggestions" = {
strings = "on";
};
"editor.codeActionsOnSave" = {
".source.organizeImports" = true;
};
"terminal.integrated.fontFamily" = common.font;
"files.exclude" = {
"**/.classpath" = true;
"**/.project" = true;
"**/.settings" = true;
"**/.factorypath" = true;
"**/__pycache__" = true;
};
"[html]" = {
"editor.tabSize" = 2;
"editor.insertSpaces" = true;
"editor.defaultFormatter" = "esbenp.prettier-vscode";
};
"[javascript]" = {
"editor.tabSize" = 2;
"editor.insertSpaces" = true;
"editor.defaultFormatter" = "esbenp.prettier-vscode";
};
"[typescript]" = {
"editor.tabSize" = 2;
"editor.insertSpaces" = true;
"editor.defaultFormatter" = "esbenp.prettier-vscode";
};
"[typescriptreact]" = {
"editor.tabSize" = 2;
"editor.insertSpaces" = true;
"editor.defaultFormatter" = "esbenp.prettier-vscode";
};
"[python]" = {
"editor.tabSize" = 4;
"editor.insertSpaces" = true;
"editor.formatOnType" = true;
};
"[yaml]" = {
"editor.insertSpaces" = true;
"editor.tabSize" = 2;
"editor.autoIndent" = "advanced";
};
"[json]" = {
"editor.defaultFormatter" = "vscode.json-language-features";
};
"[jsonc]" = {
"editor.defaultFormatter" = "esbenp.prettier-vscode";
};
"[java]" = {
"editor.defaultFormatter" = "redhat.java";
};
"[markdown]" = {
"editor.defaultFormatter" = "esbenp.prettier-vscode";
};
"[css]" = {
"editor.defaultFormatter" = "esbenp.prettier-vscode";
};
"[nix]" = {
"editor.defaultFormatter" = "jnoortheen.nix-ide";
};
"git.autofetch" = true;
"json.schemaDownload.enable" = true;
"javascript.updateImportsOnFileMove.enabled" = "always";
"typescript.updateImportsOnFileMove.enabled" = "always";
"nix.enableLanguageServer" = true;
"nix.serverPath" = "${pkgs.nil}/bin/nil";
"nix.formatterPath" = "${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt";
};
keybindings = [
{
key = "ctrl+tab";
command = "workbench.action.nextEditor";
}
{
key = "ctrl+shift+tab";
command = "workbench.action.previousEditor";
}
{
key = "alt+left";
command = "workbench.action.navigateBack";
}
{
key = "alt+right";
command = "workbench.action.navigateForward";
}
{
key = "ctrl+f";
command = "editor.action.formatDocument";
when = "editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly && !inCompositeEditor";
}
];
};
}

View file

@ -0,0 +1,338 @@
{ pkgs, ... }: {
programs.waybar = {
enable = true;
settings.mainBar = {
layer = "top";
margin = "5 5 5 5";
modules-left = [ "sway/workspaces" "sway/window" "sway/mode" ];
modules-center = [ "clock" ];
modules-right = [ "tray" "network" "pulseaudio" "custom/mem" "temperature" "backlight" "battery" ];
"sway/workspaces" = {
disable-scroll = true;
persistent_workspaces = {
"1" = [ ];
"2" = [ ];
"3" = [ ];
"4" = [ ];
};
};
"sway/window" = {
format = "{title}";
max-length = 43;
};
"sway/mode" = {
format = "<span style=\"italic\">{}</span>";
};
clock = {
timezones = [ "Europe/Berlin" ];
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
format = "{:%a, %d %b, %H:%M}";
actions = {
on-click = "tz_up";
};
};
network = {
interval = 1;
format = "{ifname}";
format-wifi = "{signalStrength}% ";
format-ethernet = "eth 󰈁";
format-disconnected = "󰈂"; # An empty format will hide the module.
tooltip-format = "{ifname} via {gwaddr} 󰈁";
tooltip-format-wifi = "{essid} ({signalStrength}%) ";
tooltip-format-ethernet = "{ifname} ";
tooltip-format-disconnected = "Disconnected";
};
pulseaudio = {
reverse-scrolling = 1;
format = "{volume}% {icon} {format_source}";
format-bluetooth = "{volume}% {icon} {format_source}";
format-bluetooth-muted = "󰖁 {icon} {format_source}";
format-muted = "󰖁 {format_source}";
format-source = "{volume}% ";
format-source-muted = "";
format-icons = {
headphone = "";
hands-free = "󰋎";
headset = "󰋎";
phone = "";
portable = "";
car = "";
default = [
"󰕿"
"󰖀"
"󰕾"
];
};
on-click = "${pkgs.pavucontrol}/bin/pavucontrol";
min-length = 13;
};
"custom/mem" = {
format = "{} 󰍛";
interval = 3;
exec = "free -h | awk '/Mem:/{printf $3}'";
tooltip = false;
};
temperature = {
critical-threshold = 80;
format = "{temperatureC}°C {icon}";
format-icons = [
""
""
""
""
""
];
tooltip = false;
};
backlight = {
device = "intel_backlight";
format = "{percent}% {icon}";
format-icons = [
"󰌶"
"󱩎"
"󱩏"
"󱩐"
"󱩑"
"󱩒"
"󱩓"
"󱩔"
"󱩕"
"󱩖"
"󰛨"
];
};
battery = {
states = {
warning = 30;
critical = 15;
};
format = "{capacity}% {icon}";
format-charging = "{capacity}% 󰂄";
format-plugged = "{capacity}% ";
format-alt = "{time} {icon}";
format-icons = [
"󰂃"
"󰁺"
"󰁻"
"󰁼"
"󰁽"
"󰁾"
"󰁿"
"󰂀"
"󰂁"
"󰂂"
"󰁹"
];
on-update = pkgs.writeShellScript "check-battery" ''
bat=/sys/class/power_supply/BAT0
CRIT=''${1:-15}
FILE=~/.config/waybar/.notified.target
stat=$(cat $bat/status)
perc=$(cat $bat/capacity)
if [[ $perc -le $CRIT ]] && [[ $stat == "Discharging" ]]; then
if [[ ! -f "$FILE" ]]; then
notify-send --urgency=critical --icon=dialog-warning "Battery Low" "Current charge: $perc%"
touch $FILE
fi
elif [[ -f "$FILE" ]]; then
rm $FILE
fi
'';
};
tray = {
icon-size = 16;
spacing = 0;
};
};
style = ''
@define-color bg-color #212529;
* {
border: none;
border-radius: 0;
font-family: DejaVuSansM Nerd Font;
min-height: 20px;
}
window#waybar {
background: transparent;
}
window#waybar.hidden {
opacity: 0.2;
}
#workspaces {
padding-left: 8px;
padding-right: 8px;
margin-right: 8px;
border-radius: 10px;
transition: none;
background: @bg-color;
}
#workspaces button {
transition: none;
color: #7c818c;
background: transparent;
padding: 5px;
font-size: 18px;
}
#workspaces button.persistent {
color: #7c818c;
font-size: 12px;
}
#workspaces button:hover {
transition: none;
box-shadow: inherit;
text-shadow: inherit;
border-radius: inherit;
color: @bg-color;
background: #7c818c;
}
#workspaces button.focused {
color: white;
}
#window {
padding-left: 16px;
padding-right: 16px;
margin-right: 8px;
border-radius: 10px 10px 10px 10px;
transition: none;
color: #ffffff;
background: @bg-color;
}
#mode {
padding-left: 16px;
padding-right: 16px;
border-radius: 10px;
transition: none;
color: #ffffff;
background: @bg-color;
}
#clock {
padding-left: 16px;
padding-right: 16px;
border-radius: 10px 10px 10px 10px;
transition: none;
color: #ffffff;
background: @bg-color;
}
#network {
margin-right: 8px;
padding-left: 16px;
padding-right: 16px;
border-radius: 10px;
transition: none;
color: #ffffff;
background: @bg-color;
}
#pulseaudio {
margin-right: 8px;
padding-left: 16px;
padding-right: 16px;
border-radius: 10px;
transition: none;
color: #ffffff;
background: @bg-color;
}
#pulseaudio.muted {
background-color: #90b1b1;
color: #2a5c45;
}
#custom-mem {
margin-right: 8px;
padding-left: 16px;
padding-right: 16px;
border-radius: 10px;
transition: none;
color: #ffffff;
background: @bg-color;
}
#temperature {
margin-right: 8px;
padding-left: 16px;
padding-right: 16px;
border-radius: 10px;
transition: none;
color: #ffffff;
background: @bg-color;
}
#temperature.critical {
background-color: #eb4d4b;
}
#backlight {
margin-right: 8px;
padding-left: 16px;
padding-right: 16px;
border-radius: 10px;
transition: none;
color: #ffffff;
background: @bg-color;
}
#battery {
padding-left: 16px;
padding-right: 16px;
border-radius: 10px;
transition: none;
color: #ffffff;
background: @bg-color;
}
#battery.charging {
color: #ffffff;
background-color: #26A65B;
}
#battery.warning:not(.charging) {
background-color: #ffbe61;
color: black;
}
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#tray {
margin-right: 8px;
padding-left: 16px;
padding-right: 16px;
border-radius: 10px;
transition: none;
color: #ffffff;
background: @bg-color;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
'';
};
}

View file

@ -0,0 +1,66 @@
{ ... }:
let
common = import ./common.nix;
in
{
programs.wofi = {
enable = true;
settings = {
show = "drun";
allow_images = true;
image_size = 24;
no_actions = true;
};
style = ''
* {
font-family: '${common.font}', monospace;
font-size: ${common.font-size}px;
color: ${common.colorschemes.default.black};
}
window {
background-color: transparent;
}
#input {
background-color: ${common.colorschemes.default.active};
border: 5px;
border-color: ${common.colorschemes.default.activeDark};
border-radius: 0px;
padding-top: 10px;
padding-bottom: 10px;
padding-left: 20px;
padding-right: 20px;
margin-bottom: 10px;
}
#scroll {
background-color: ${common.colorschemes.default.active};
border: 5px;
border-color: ${common.colorschemes.default.activeDark};
border-radius: 0px;
padding: 10px;
}
#entry {
padding: 10px;
}
#entry #text {
margin-left: 20px;
}
#entry:selected {
background-color: ${common.colorschemes.default.activeDark};
}
#entry:selected #img {
background-color: ${common.colorschemes.default.activeDark};
}
#entry:selected #text {
background-color: ${common.colorschemes.default.activeDark};
}
'';
};
}

View file

@ -0,0 +1,30 @@
{ config, pkgs, ... }: {
programs.zsh = {
enable = true;
enableCompletion = true;
enableAutosuggestions = true;
plugins = [
{
name = "zsh-syntax-highlighting";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-syntax-highlighting";
rev = "0.7.1";
hash = "sha256-gOG0NLlaJfotJfs+SUhGgLTNOnGLjoqnUp54V9aFJg8=";
};
}
];
oh-my-zsh = {
enable = true;
theme = "terminalparty";
plugins = [
"git"
];
};
history = {
path = "${config.xdg.dataHome}/zsh/histfile";
size = 10000;
save = 10000;
};
};
}