52 Commits

Author SHA1 Message Date
materus b7086ad070 waffentrager: update 2026-06-27 15:16:35 +02:00
materus 506c6844a8 materusPC: updates 2026-06-27 15:16:23 +02:00
materus 80f1b5e177 common: update config 2026-06-27 15:15:59 +02:00
materus 9fcfab613d flake: update lock 2026-06-27 15:15:37 +02:00
materus fb653eb0f4 waffentrager: init 2026-06-24 00:06:21 +02:00
materus 29adb6e6b0 valkyrie: some changes 2026-06-23 16:42:16 +02:00
materus 0c8f567a7e valkyrie: init 2026-06-23 12:13:21 +02:00
materus f89ff639c7 oldie: add samba 2026-06-21 14:51:00 +02:00
materus 1aa560a248 common: zprofile load home-manager profile.d 2026-06-21 09:04:13 +02:00
materus 9b7da5e109 oldie: add data folder 2026-06-20 23:18:25 +02:00
materus 1035825618 oldie: test searxng 2026-06-20 18:19:19 +02:00
materus f40403e725 oldie/materusPC: add waypipe and tmux 2026-06-19 14:53:27 +02:00
materus 481bfdde77 oldie/materusPC: KDE config 2026-06-19 13:30:34 +02:00
materus ac43221eec common: restructure config, update tmux and wezterm 2026-06-18 17:29:42 +02:00
materus a485b83e49 materusPC: More wezterm things 2026-06-16 22:07:39 +02:00
materus 6197a64c4a common: tmux config 2026-06-16 21:54:12 +02:00
materus 38afb1aa4f materusPC: Add wezterm to home-manager 2026-06-16 21:53:59 +02:00
materus 5a7e4a5020 materusPC: Update inputMethod
common: override path in default.nix
2026-06-15 22:49:36 +02:00
materus e37d2bb716 materusPC: replace sddm with plasma-login 2026-06-15 22:05:43 +02:00
materus 76b54b8800 common: init wezterm 2026-06-14 13:02:33 +02:00
materus 33dcdb8c61 common: zsh alias for eza 2026-06-14 11:14:57 +02:00
materus 640907f9e1 common: zsh changes 2026-06-14 10:39:13 +02:00
materus 5440b8aaf2 oldie: tmux 2026-06-14 09:38:07 +02:00
materus 65f9c1bb9d oldie: more updates 2026-06-14 09:07:33 +02:00
materus 71710a3aa0 oldie: init secrets, connect to wireguard 2026-06-13 23:14:06 +02:00
materus 0c4725063c oldie: add vivaldi to home 2026-06-13 22:57:46 +02:00
materus 1401ddc71c Init oldie PC (Old-materusPC previously) 2026-06-13 22:45:05 +02:00
materus bc3fa6788b User vim.plug instead of lazy 2026-06-13 14:00:56 +02:00
materus 9afcf62bf3 Zsh - Move MSYS to zshrc 2026-06-10 11:40:00 +02:00
materus c159b6dfdd Zsh completions changes 2026-06-10 11:36:26 +02:00
materus 5f753f2050 Update to 26.05 2026-06-09 17:40:53 +02:00
materus 791e88e8a5 Update flake.lock 2026-06-09 00:00:41 +02:00
materus 9cc357c618 Update VSCodium config 2026-06-09 00:00:26 +02:00
materus 4d38367fdb materusPC: Use nftables 2026-05-15 17:06:12 +02:00
materus 8f3b2266d3 Update flake, add flake registry, fix xhost, others 2026-04-11 19:33:39 +02:00
materus 9292f61a3f Neovim: Fix treesitter on non-nix 2026-04-04 07:55:24 +02:00
materus 3afafba3ce wake on lan udev, SSH initrd, flake lock update, TODO nix settings 2026-04-03 23:16:53 +02:00
materus d51b13294c VSCodium settings update 2026-04-02 14:02:23 +02:00
materus 32e6adb6e3 Use dracula theme 2026-04-01 18:27:42 +02:00
materus e916b8ca78 Add theia to .gitignore. VSCodium config. neovim theme change 2026-04-01 17:43:05 +02:00
materus 7a2647d5ae Add more neovim plugins 2026-03-25 21:18:58 +01:00
materus ec3cac1c98 Add neovim plugins 2026-03-25 21:03:57 +01:00
materus 8eb8d54d93 Update system. Changes in neovim config 2026-03-25 20:16:21 +01:00
materus bf522e0b25 Neovim: Add suda 2026-03-21 23:01:29 +01:00
materus 6db3e9995c Neovim: Treesitter, indent config 2026-03-21 20:46:29 +01:00
materus a0af6e0844 Change tab size and tab to spaces in nvim 2026-03-21 19:52:35 +01:00
materus 7111005253 Add nvim aliases to zsh 2026-03-21 10:36:26 +01:00
materus 1cecb465c2 Use system clipboard in neovim 2026-03-20 12:02:20 +01:00
materus 8b9b884bc3 Move neovide out of nvim nix 2026-03-20 08:39:34 +01:00
materus 576b955023 Neovim init config. Formatting. Updates. 2026-03-20 08:35:04 +01:00
materus bd10321f19 materusPC: Init new config 2026-02-08 10:52:41 +01:00
materus e31a724c4b Add 1 git-crypt collaborator
New collaborators:

    090B38BD59460ADC381FB1221542894AB75B790D
        Mateusz "materus" Słodkowicz (materus.pl) <materus@podkos.pl>
2026-02-08 10:51:05 +01:00
82 changed files with 9701 additions and 111 deletions
+4
View File
@@ -0,0 +1,4 @@
# Do not edit this file. To specify the files to encrypt, create your own
# .gitattributes file in the directory where your files are.
* !filter !diff
*.gpg binary
+2
View File
@@ -0,0 +1,2 @@
**/private/** filter=git-crypt diff=git-crypt
encrypted-test filter=git-crypt diff=git-crypt
+3
View File
@@ -0,0 +1,3 @@
\#*\#
.vscode
.theia
+2
View File
@@ -0,0 +1,2 @@
MATERUS = {}
require("materus")
+32
View File
@@ -0,0 +1,32 @@
vim.opt.number = true
vim.opt.expandtab = true
vim.opt.cursorline = true
vim.opt.shiftwidth = 2
vim.opt.softtabstop = 2
vim.opt.tabstop = 2
vim.opt.clipboard:append { 'unnamed', 'unnamedplus' }
--vim.g.cord_defer_startup = true
vim.pack.add({
"https://github.com/nvim-lua/plenary.nvim",
"https://github.com/muniftanjim/nui.nvim",
"https://github.com/nvim-tree/nvim-web-devicons",
"https://github.com/lewis6991/gitsigns.nvim",
"https://github.com/mofiqul/dracula.nvim",
"https://github.com/hrsh7th/nvim-cmp",
"https://github.com/neovim/nvim-lspconfig",
"https://github.com/stevearc/oil.nvim",
"https://github.com/nvim-mini/mini.icons",
"https://github.com/nvim-neo-tree/neo-tree.nvim",
"https://github.com/romgrk/barbar.nvim",
"https://github.com/nvim-telescope/telescope.nvim",
"https://github.com/lambdalisue/vim-suda",
"https://github.com/dstein64/nvim-scrollview",
"https://github.com/vyfor/cord.nvim"
})
vim.cmd.colorscheme("dracula")
if vim.fn.executable("tree-sitter") == 1 and MATERUS.NIXOS ~= 1 then
end
+6
View File
@@ -0,0 +1,6 @@
__HOME_ZPROFILE_SOURCED=1
[[ -f "$ZSH_DATA_DIR/nix_profile.sh" ]] && source "$ZSH_DATA_DIR/nix_profile.sh"
[[ -f "/etc/profile" ]] && emulate sh -c "source /etc/profile"
[[ -f "~/.profile" ]] && emulate sh -c "source ~/.profile"
+141
View File
@@ -0,0 +1,141 @@
__HOME_ZSHRC_SOURCED=1
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
bindkey -e
if [ -n "$EAT_SHELL_INTEGRATION_DIR" ]; then
source "$EAT_SHELL_INTEGRATION_DIR/zsh";
fi
#Check if terminal is fullcolor
if zmodload zsh/terminfo && (( "$terminfo[colors]" >= "256" )); then
__MATERUS_ZSH_256COLORS="${__MATERUS_ZSH_256COLORS:-1}"; else
__MATERUS_ZSH_256COLORS="${__MATERUS_ZSH_256COLORS:-0}";
fi
#MSYS
if [[ "$(uname -s)" =~ ^MSYS_NT.* ]]; then
#Use windows symlink instead copy
MSYS=winsymlinks:nativestrict
fi
#region Plugins
# Clone plugins if not exists
[ -d $ZSH_DATA_DIR/plugins/powerlevel10k ] || git clone https://github.com/romkatv/powerlevel10k $ZSH_DATA_DIR/plugins/powerlevel10k
[ -d $ZSH_DATA_DIR/plugins/zsh-syntax-highlighting ] || git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_DATA_DIR/plugins/zsh-syntax-highlighting
[ -d $ZSH_DATA_DIR/plugins/zsh-history-substring-search ] || git clone https://github.com/zsh-users/zsh-history-substring-search.git $ZSH_DATA_DIR/plugins/zsh-history-substring-search
[ -d $ZSH_DATA_DIR/plugins/zsh-autosuggestions ] || git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_DATA_DIR/plugins/zsh-autosuggestions
source ${ZSH_DATA_DIR}/plugins/powerlevel10k/powerlevel10k.zsh-theme
source ${ZSH_DATA_DIR}/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source ${ZSH_DATA_DIR}/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
source ${ZSH_DATA_DIR}/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
#endregion
#region SUBSTRING SEARCH
history-substring-search-up-prefixed(){
HISTORY_SUBSTRING_SEARCH_PREFIXED=1 history-substring-search-up
}
history-substring-search-down-prefixed(){
HISTORY_SUBSTRING_SEARCH_PREFIXED=1 history-substring-search-down
}
zle -N history-substring-search-up-prefixed
zle -N history-substring-search-down-prefixed
#endregion
#region Init Variables
export SAVEHIST=100000
export HISTSIZE=$SAVEHIST
export ZSH_PRIVATE=${ZSH_PRIVATE:-0}
mkdir -p $ZSH_DATA_DIR
mkdir -p $ZSH_DATA_DIR/plugins
# Load config generated by nix
[[ -f "$ZSH_DATA_DIR/nix.sh" ]] && source "$ZSH_DATA_DIR/nix.sh"
setopt HIST_SAVE_NO_DUPS
setopt HIST_IGNORE_SPACE
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt EXTENDED_HISTORY
# Private history mode
if [[ $ZSH_PRIVATE == 1 ]] then
export HISTFILE="/dev/null";
unsetopt SHARE_HISTORY;
else
export HISTFILE="$ZSH_DATA_DIR/zsh_history";
setopt SHARE_HISTORY;
fi
#endregion
#region Bindings
source ${ZSH_CONFIG_DIR}/extra/zinputrc
bindkey -r "^["
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
bindkey "^[[1;5A" history-substring-search-up-prefixed
bindkey "^[[1;5B" history-substring-search-down-prefixed
bindkey "$key[Up]" history-substring-search-up
bindkey "$key[Down]" history-substring-search-down
bindkey '^[[3~' delete-char
bindkey '^[[3;2~' delete-word
#endregion
#region Completions
ZSH_COMPDIR="${ZSH_COMPDIR:-${XDG_CACHE_HOME:-${HOME}/.cache}/zsh}"
ZSH_COMPDUMP="${ZSH_COMPDUMP:-${ZSH_COMPDIR}/.zcompdump-${HOST}-${ZSH_VERSION}}"
if [[ ! -d ${ZSH_COMPDIR} ]]; then
command mkdir -p "${ZSH_COMPDIR}"
fi
autoload -U compinit && compinit -d $ZSH_COMPDUMP
source ${ZSH_CONFIG_DIR}/extra/zshcompletion.zsh
#endregion
#region Functions
zsh-private() {
ZSH_PRIVATE=1 zsh
}
myip() {
wget -qO- https://wtfismyip.com/text
}
speedtest() {
curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python3
}
#endregion
#region Aliases
if [[ "$TERM" = "xterm-kitty" ]]; then
alias ssh="kitty +kitten ssh"
fi
if [[ $(whence -p "nvim") ]]; then
EDITOR="${EDITOR:-nvim}"
alias vim="nvim"
alias vi="nvim"
alias vimdiff="nvim -d"
fi
if [[ $(whence -p "eza") ]]; then
alias l="eza -lahg --color=auto --hyperlink"
alias ll="eza -alF --color=auto --hyperlink"
alias ls="eza --color=auto"
else
alias l="ls -lah --color=auto"
alias ll="ls -alF --color=auto"
alias ls="ls --color=auto"
fi
#endregion
if [[ "$__MATERUS_ZSH_256COLORS" = "1" ]] ; then [[ ! -f ${ZSH_CONFIG_DIR}/p10kcfg/fullcolor.zsh ]] || source ${ZSH_CONFIG_DIR}/p10kcfg/fullcolor.zsh;
else [[ ! -f ${ZSH_CONFIG_DIR}/p10kcfg/compatibility.zsh ]] || source ${ZSH_CONFIG_DIR}/p10kcfg/compatibility.zsh;
fi
+45
View File
@@ -0,0 +1,45 @@
# Stolen from ArchWiki
# create a zkbd compatible hash;
# to add other keys to this hash, see: man 5 terminfo
typeset -A key
key[Home]=${terminfo[khome]}
key[End]=${terminfo[kend]}
key[Insert]=${terminfo[kich1]}
key[Delete]=${terminfo[kdch1]}
key[Up]=${terminfo[kcuu1]}
key[Down]=${terminfo[kcud1]}
key[Left]=${terminfo[kcub1]}
key[Right]=${terminfo[kcuf1]}
key[PageUp]=${terminfo[kpp]}
key[PageDown]=${terminfo[knp]}
# setup key accordingly
[[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
[[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
[[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode
[[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-history
[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-history
[[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
[[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
[[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" beginning-of-buffer-or-history
[[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" end-of-buffer-or-history
# Finally, make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
function zle-line-init () {
printf '%s' "${terminfo[smkx]}"
}
function zle-line-finish () {
printf '%s' "${terminfo[rmkx]}"
}
zle -N zle-line-init
zle -N zle-line-finish
fi
+189
View File
@@ -0,0 +1,189 @@
#Stolen from grml zsh config
function __zsh_compl () {
# TODO: This could use some additional information
# Make sure the completion system is initialised
(( ${+_comps} )) || return 1
# allow one error for every three characters typed in approximate completer
zstyle ':completion:*:approximate:' max-errors 'reply=( $((($#PREFIX+$#SUFFIX)/3 )) numeric )'
# don't complete backup files as executables
zstyle ':completion:*:complete:-command-::commands' ignored-patterns '(aptitude-*|*\~)'
# start menu completion only if it could find no unambiguous initial string
zstyle ':completion:*:correct:*' insert-unambiguous true
zstyle ':completion:*:corrections' format $'%{\e[0;31m%}%d (errors: %e)%{\e[0m%}'
zstyle ':completion:*:correct:*' original true
# activate color-completion
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
# format on completion
zstyle ':completion:*:descriptions' format $'%{\e[0;31m%}completing %B%d%b%{\e[0m%}'
# automatically complete 'cd -<tab>' and 'cd -<ctrl-d>' with menu
# zstyle ':completion:*:*:cd:*:directory-stack' menu yes select
# insert all expansions for expand completer
zstyle ':completion:*:expand:*' tag-order all-expansions
zstyle ':completion:*:history-words' list false
# activate menu
zstyle ':completion:*:history-words' menu yes
# ignore duplicate entries
zstyle ':completion:*:history-words' remove-all-dups yes
zstyle ':completion:*:history-words' stop yes
# match uppercase from lowercase
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# separate matches into groups
zstyle ':completion:*:matches' group 'yes'
zstyle ':completion:*' group-name ''
if [[ "$NOMENU" -eq 0 ]] ; then
# if there are more than 5 options allow selecting from a menu
zstyle ':completion:*' menu select=5
else
# don't use any menus at all
setopt no_auto_menu
fi
zstyle ':completion:*:messages' format '%d'
zstyle ':completion:*:options' auto-description '%d'
# describe options in full
zstyle ':completion:*:options' description 'yes'
# on processes completion complete all user processes
zstyle ':completion:*:processes' command 'ps -au$USER'
# offer indexes before parameters in subscripts
zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
# provide verbose completion information
zstyle ':completion:*' verbose true
# recent (as of Dec 2007) zsh versions are able to provide descriptions
# for commands (read: 1st word in the line) that it will list for the user
# to choose from. The following disables that, because it's not exactly fast.
zstyle ':completion:*:-command-:*:' verbose false
# set format for warnings
zstyle ':completion:*:warnings' format $'%{\e[0;31m%}No matches for:%{\e[0m%} %d'
# define files to ignore for zcompile
zstyle ':completion:*:*:zcompile:*' ignored-patterns '(*~|*.zwc)'
zstyle ':completion:correct:' prompt 'correct to: %e'
# Ignore completion functions for commands you don't have:
zstyle ':completion::(^approximate*):*:functions' ignored-patterns '_*'
# Provide more processes in completion of programs like killall:
zstyle ':completion:*:processes-names' command 'ps c -u ${USER} -o command | uniq'
# complete manual by their section
zstyle ':completion:*:manuals' separate-sections true
zstyle ':completion:*:manuals.*' insert-sections true
zstyle ':completion:*:man:*' menu yes select
# Search path for sudo completion
zstyle ':completion:*:sudo:*' command-path /usr/local/sbin \
/usr/local/bin \
/usr/sbin \
/usr/bin \
/sbin \
/bin \
/usr/X11R6/bin \
/run/current-system/sw/bin \
/run/current-system/sw/sbin
# provide .. as a completion
zstyle ':completion:*' special-dirs ..
# run rehash on completion so new installed program are found automatically:
function _force_rehash () {
(( CURRENT == 1 )) && rehash
return 1
}
## correction
# some people don't like the automatic correction - so run 'NOCOR=1 zsh' to deactivate it
if [[ "$NOCOR" -gt 0 ]] ; then
zstyle ':completion:*' completer _oldlist _expand _force_rehash _complete _files _ignored
setopt nocorrect
else
# try to be smart about when to use what completer...
setopt correct
zstyle -e ':completion:*' completer '
if [[ $_last_try != "$HISTNO$BUFFER$CURSOR" ]] ; then
_last_try="$HISTNO$BUFFER$CURSOR"
reply=(_complete _match _ignored _prefix _files)
else
if [[ $words[1] == (rm|mv) ]] ; then
reply=(_complete _files)
else
reply=(_oldlist _expand _force_rehash _complete _ignored _correct _approximate _files)
fi
fi'
fi
# command for process lists, the local web server details and host completion
zstyle ':completion:*:urls' local 'www' '/var/www/' 'public_html'
# Some functions, like _apt and _dpkg, are very slow. We can use a cache in
# order to speed things up
if [[ ${__COMP_CACHING:-yes} == yes ]]; then
if [[ ! -d ${ZSH_COMPDIR} ]]; then
command mkdir -p "${ZSH_COMPDIR}"
fi
zstyle ':completion:*' use-cache yes
zstyle ':completion:*:complete:*' cache-path "${ZSH_COMPDIR}"
fi
# host completion
_etc_hosts=()
_ssh_config_hosts=()
_ssh_hosts=()
if [[ -r ~/.ssh/config ]] ; then
_ssh_config_hosts=(${${(s: :)${(ps:\t:)${${(@M)${(f)"$(<$HOME/.ssh/config)"}:#Host *}#Host }}}:#*[*?]*})
fi
if [[ -r ~/.ssh/known_hosts ]] ; then
_ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*})
fi
if [[ -r /etc/hosts ]] && [[ "$NOETCHOSTS" -eq 0 ]] ; then
: ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(grep -v '^0\.0\.0\.0\|^127\.0\.0\.1\|^::1 ' /etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}}
fi
local localname
localname="$(uname -n)"
hosts=(
"${localname}"
"$_ssh_config_hosts[@]"
"$_ssh_hosts[@]"
"$_etc_hosts[@]"
localhost
)
zstyle ':completion:*:hosts' hosts $hosts
# TODO: so, why is this here?
# zstyle '*' hosts $hosts
# use generic completion system for programs not yet defined; (_gnu_generic works
# with commands that provide a --help option with "standard" gnu-like output.)
for compcom in cp deborphan df feh fetchipac gpasswd head hnb ipacsum mv \
pal stow uname ; do
[[ -z ${_comps[$compcom]} ]] && compdef _gnu_generic ${compcom}
done; unset compcom
# see upgrade function in this file
compdef _hosts upgrade
}
__zsh_compl
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+6
View File
@@ -0,0 +1,6 @@
#TODO: Set ZDOTDIR based on MKK_CONFIG_PATH
__HOME_ZSHENV_SOURCED=1
ZDOTDIR=${XDG_CONFIG_HOME:-"$HOME/.config"}/zsh/cfg
ZSH_DATA_DIR="${XDG_CONFIG_HOME:-"$HOME/.config"}/zsh/data"
ZSH_CONFIG_DIR="${XDG_CONFIG_HOME:-"$HOME/.config"}/zsh/cfg"
setopt no_global_rcs
+9
View File
@@ -0,0 +1,9 @@
local wezterm = require 'wezterm'
local config = wezterm.config_builder()
-- config.color_scheme = 'Duotone Dark'
config.enable_scroll_bar = true
config.scrollback_lines = 50000
return config
+12
View File
@@ -0,0 +1,12 @@
set -g history-limit 50000
set -g display-time 4000
set -g status-interval 5
set -g default-terminal "screen-256color"
set -g status-keys emacs
set -g focus-events on
setw -g aggressive-resize on
setw -g mouse on
setw -g clock-mode-style 24
set -ga terminal-overrides ',xterm*:smcup@:rmcup@'
set -g allow-passthrough on
+22
View File
@@ -0,0 +1,22 @@
let
flake-compatish = import (
builtins.fetchTree {
type = "github";
owner = "lillecarl";
repo = "flake-compatish";
ref = "main";
}
);
flake = flake-compatish {
source = ./.;
overrides = {
self = ./.;
materus-inputs = ./nix-config/subflake;
materus-inputs-unstable = ./nix-config/subflake;
};
};
in
flake.impure
# sudo -i nixos-rebuild switch --file . --attr nixosConfigurations.${HOSTNAME}
+18
View File
@@ -0,0 +1,18 @@
diff --git a/bubblewrap.c b/bubblewrap.c
index f606257..4ccb199 100644
--- a/bubblewrap.c
+++ b/bubblewrap.c
@@ -876,13 +876,6 @@ acquire_privs (void)
/* Keep only the required capabilities for setup */
set_required_caps ();
}
- else if (real_uid != 0 && has_caps ())
- {
- /* We have some capabilities in the non-setuid case, which should not happen.
- Probably caused by the binary being setcap instead of setuid which we
- don't support anymore */
- die ("Unexpected capabilities but not setuid, old file caps config?");
- }
else if (real_uid == 0)
{
/* If our uid is 0, default to inheriting all caps; the caller
+1
View File
@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPEDY+H8Hc/RSLE064AAh8IojvqxPd8BE5gec2aOfYMh materus@podkos.pl
+1
View File
@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFrSFfoYf7J35GrjrNWgD140kv/p7qzlSI8Xrp+A16jc root@nixos
Generated
+992
View File
@@ -0,0 +1,992 @@
{
"nodes": {
"base16": {
"inputs": {
"fromYaml": "fromYaml"
},
"locked": {
"lastModified": 1755819240,
"narHash": "sha256-qcMhnL7aGAuFuutH4rq9fvAhCpJWVHLcHVZLtPctPlo=",
"owner": "SenchoPens",
"repo": "base16.nix",
"rev": "75ed5e5e3fce37df22e49125181fa37899c3ccd6",
"type": "github"
},
"original": {
"owner": "SenchoPens",
"ref": "main",
"repo": "base16.nix",
"type": "github"
}
},
"base16_2": {
"inputs": {
"fromYaml": "fromYaml_2"
},
"locked": {
"lastModified": 1755819240,
"narHash": "sha256-qcMhnL7aGAuFuutH4rq9fvAhCpJWVHLcHVZLtPctPlo=",
"owner": "SenchoPens",
"repo": "base16.nix",
"rev": "75ed5e5e3fce37df22e49125181fa37899c3ccd6",
"type": "github"
},
"original": {
"owner": "SenchoPens",
"ref": "main",
"repo": "base16.nix",
"type": "github"
}
},
"devshell": {
"inputs": {
"nixpkgs": [
"materus-inputs",
"nixpkgs"
]
},
"locked": {
"lastModified": 1768818222,
"narHash": "sha256-460jc0+CZfyaO8+w8JNtlClB2n4ui1RbHfPTLkpwhU8=",
"owner": "numtide",
"repo": "devshell",
"rev": "255a2b1725a20d060f566e4755dbf571bbbb5f76",
"type": "github"
},
"original": {
"owner": "numtide",
"ref": "main",
"repo": "devshell",
"type": "github"
}
},
"devshell_2": {
"inputs": {
"nixpkgs": [
"materus-inputs-unstable",
"nixpkgs"
]
},
"locked": {
"lastModified": 1768818222,
"narHash": "sha256-460jc0+CZfyaO8+w8JNtlClB2n4ui1RbHfPTLkpwhU8=",
"owner": "numtide",
"repo": "devshell",
"rev": "255a2b1725a20d060f566e4755dbf571bbbb5f76",
"type": "github"
},
"original": {
"owner": "numtide",
"ref": "main",
"repo": "devshell",
"type": "github"
}
},
"emacs-overlay": {
"inputs": {
"nixpkgs": [
"materus-inputs",
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1782557170,
"narHash": "sha256-9E7D3SRCOkdFcPJMyNrgR8AhymNLYdhjmp6r6IE9BFw=",
"owner": "nix-community",
"repo": "emacs-overlay",
"rev": "9f9cc155c00a8cfd5680dabf408816eaad4851d7",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "master",
"repo": "emacs-overlay",
"type": "github"
}
},
"emacs-overlay_2": {
"inputs": {
"nixpkgs": [
"materus-inputs-unstable",
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1782557170,
"narHash": "sha256-9E7D3SRCOkdFcPJMyNrgR8AhymNLYdhjmp6r6IE9BFw=",
"owner": "nix-community",
"repo": "emacs-overlay",
"rev": "9f9cc155c00a8cfd5680dabf408816eaad4851d7",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "master",
"repo": "emacs-overlay",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"materus-inputs",
"nixerus",
"nur",
"nixpkgs"
]
},
"locked": {
"lastModified": 1733312601,
"narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"materus-inputs",
"nur",
"nixpkgs"
]
},
"locked": {
"lastModified": 1733312601,
"narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_3": {
"inputs": {
"nixpkgs-lib": [
"materus-inputs-unstable",
"nixerus",
"nur",
"nixpkgs"
]
},
"locked": {
"lastModified": 1733312601,
"narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_4": {
"inputs": {
"nixpkgs-lib": [
"materus-inputs-unstable",
"nur",
"nixpkgs"
]
},
"locked": {
"lastModified": 1733312601,
"narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"ref": "main",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"ref": "main",
"repo": "flake-utils",
"type": "github"
}
},
"fromYaml": {
"flake": false,
"locked": {
"lastModified": 1731966426,
"narHash": "sha256-lq95WydhbUTWig/JpqiB7oViTcHFP8Lv41IGtayokA8=",
"owner": "SenchoPens",
"repo": "fromYaml",
"rev": "106af9e2f715e2d828df706c386a685698f3223b",
"type": "github"
},
"original": {
"owner": "SenchoPens",
"repo": "fromYaml",
"type": "github"
}
},
"fromYaml_2": {
"flake": false,
"locked": {
"lastModified": 1731966426,
"narHash": "sha256-lq95WydhbUTWig/JpqiB7oViTcHFP8Lv41IGtayokA8=",
"owner": "SenchoPens",
"repo": "fromYaml",
"rev": "106af9e2f715e2d828df706c386a685698f3223b",
"type": "github"
},
"original": {
"owner": "SenchoPens",
"repo": "fromYaml",
"type": "github"
}
},
"git-agecrypt": {
"inputs": {
"flake-utils": [
"materus-inputs",
"flake-utils"
],
"nixpkgs": [
"materus-inputs",
"nixpkgs"
]
},
"locked": {
"lastModified": 1710176518,
"narHash": "sha256-cmnBW/691mmLHq8tWpD3+zwCf7Wph5fcVdSxQGxqd1k=",
"owner": "vlaci",
"repo": "git-agecrypt",
"rev": "126be86c515466c5878a60561f754a9ab4af6ee8",
"type": "github"
},
"original": {
"owner": "vlaci",
"ref": "main",
"repo": "git-agecrypt",
"type": "github"
}
},
"git-agecrypt_2": {
"inputs": {
"flake-utils": [
"materus-inputs-unstable",
"flake-utils"
],
"nixpkgs": [
"materus-inputs-unstable",
"nixpkgs"
]
},
"locked": {
"lastModified": 1710176518,
"narHash": "sha256-cmnBW/691mmLHq8tWpD3+zwCf7Wph5fcVdSxQGxqd1k=",
"owner": "vlaci",
"repo": "git-agecrypt",
"rev": "126be86c515466c5878a60561f754a9ab4af6ee8",
"type": "github"
},
"original": {
"owner": "vlaci",
"ref": "main",
"repo": "git-agecrypt",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"materus-inputs",
"nixpkgs"
]
},
"locked": {
"lastModified": 1781981105,
"narHash": "sha256-/1nNBbA7PrSQpTc9Qazkhl4kIPg+TNl0CjxS3UQJKlw=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "7bfff44b465909f69a442701293bc0badcf476dc",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-26.05",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_2": {
"inputs": {
"nixpkgs": [
"materus-inputs-unstable",
"nixpkgs"
]
},
"locked": {
"lastModified": 1782522538,
"narHash": "sha256-CvOaUvJ+mXlxU3m2cPWKcOAhtKETsPUYhq+Xa5ewBp4=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "8d8a6cc50ddc60748791a14ee1163c865ec57635",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "master",
"repo": "home-manager",
"type": "github"
}
},
"materus-inputs": {
"inputs": {
"base16": "base16",
"devshell": "devshell",
"emacs-overlay": "emacs-overlay",
"flake-utils": "flake-utils",
"git-agecrypt": "git-agecrypt",
"home-manager": "home-manager",
"nix-vscode-extensions": "nix-vscode-extensions",
"nixerus": "nixerus",
"nixos-hardware": "nixos-hardware",
"nixpkgs": [
"nixpkgs"
],
"nur": "nur_2",
"plasma-manager": "plasma-manager",
"sops-nix": "sops-nix"
},
"locked": {
"path": "./nix-config/subflake",
"type": "path"
},
"original": {
"path": "./nix-config/subflake",
"type": "path"
},
"parent": []
},
"materus-inputs-unstable": {
"inputs": {
"base16": "base16_2",
"devshell": "devshell_2",
"emacs-overlay": "emacs-overlay_2",
"flake-utils": "flake-utils_2",
"git-agecrypt": "git-agecrypt_2",
"home-manager": "home-manager_2",
"nix-vscode-extensions": "nix-vscode-extensions_2",
"nixerus": "nixerus_2",
"nixos-hardware": "nixos-hardware_2",
"nixpkgs": [
"nixpkgs-unstable"
],
"nur": "nur_4",
"plasma-manager": "plasma-manager_2",
"sops-nix": "sops-nix_2"
},
"locked": {
"path": "./nix-config/subflake",
"type": "path"
},
"original": {
"path": "./nix-config/subflake",
"type": "path"
},
"parent": []
},
"nix-vscode-extensions": {
"inputs": {
"nixpkgs": [
"materus-inputs",
"nixpkgs"
]
},
"locked": {
"lastModified": 1782532666,
"narHash": "sha256-UWJ9jcV/Vpwwx13850hE35rht7y/5YImnFdRIXD2aw4=",
"owner": "nix-community",
"repo": "nix-vscode-extensions",
"rev": "fbc9c3086bbd1ec1ea7e4b8318ad446e853ccf79",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "master",
"repo": "nix-vscode-extensions",
"type": "github"
}
},
"nix-vscode-extensions_2": {
"inputs": {
"nixpkgs": [
"materus-inputs-unstable",
"nixpkgs"
]
},
"locked": {
"lastModified": 1782532666,
"narHash": "sha256-UWJ9jcV/Vpwwx13850hE35rht7y/5YImnFdRIXD2aw4=",
"owner": "nix-community",
"repo": "nix-vscode-extensions",
"rev": "fbc9c3086bbd1ec1ea7e4b8318ad446e853ccf79",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "master",
"repo": "nix-vscode-extensions",
"type": "github"
}
},
"nixerus": {
"inputs": {
"home-manager": [
"materus-inputs",
"home-manager"
],
"nixpkgs": [
"materus-inputs",
"nixpkgs"
],
"nur": "nur"
},
"locked": {
"lastModified": 1781796426,
"narHash": "sha256-QEWeBiAJcPS4rBdEUoatYKFtMxRNobZyPS68xVZ8c60=",
"owner": "materusPL",
"repo": "Nixerus",
"rev": "b8eb02bb22b15d60fd9634f039a6b2075cf5cd1e",
"type": "github"
},
"original": {
"owner": "materusPL",
"ref": "master",
"repo": "Nixerus",
"type": "github"
}
},
"nixerus_2": {
"inputs": {
"home-manager": [
"materus-inputs-unstable",
"home-manager"
],
"nixpkgs": [
"materus-inputs-unstable",
"nixpkgs"
],
"nur": "nur_3"
},
"locked": {
"lastModified": 1781796426,
"narHash": "sha256-QEWeBiAJcPS4rBdEUoatYKFtMxRNobZyPS68xVZ8c60=",
"owner": "materusPL",
"repo": "Nixerus",
"rev": "b8eb02bb22b15d60fd9634f039a6b2075cf5cd1e",
"type": "github"
},
"original": {
"owner": "materusPL",
"ref": "master",
"repo": "Nixerus",
"type": "github"
}
},
"nixos-hardware": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1782379505,
"narHash": "sha256-zPvPiU+a7pqtH47xrtZLNRABJKpOjfZQclDbcvNtH+I=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "603d3afd1b6145bd66e97ae38a34d91c95df70cf",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "master",
"repo": "nixos-hardware",
"type": "github"
}
},
"nixos-hardware_2": {
"inputs": {
"nixpkgs": "nixpkgs_5"
},
"locked": {
"lastModified": 1782379505,
"narHash": "sha256-zPvPiU+a7pqtH47xrtZLNRABJKpOjfZQclDbcvNtH+I=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "603d3afd1b6145bd66e97ae38a34d91c95df70cf",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "master",
"repo": "nixos-hardware",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1781577229,
"narHash": "sha256-lrp67w8AulE9Ks53n27I45ADSzbOCn4H+CNW1Ck8B+8=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "567a49d1913ce81ac6e9582e3553dd90a955875f",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1782375420,
"narHash": "sha256-wiPYmEuHbJvleW489n6+lamL7JSJg3pcKUYwURU9CkI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4062d36ebeae843c750011eef6b61ec9a9dbc9a9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-26.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable_2": {
"locked": {
"lastModified": 1782375420,
"narHash": "sha256-wiPYmEuHbJvleW489n6+lamL7JSJg3pcKUYwURU9CkI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4062d36ebeae843c750011eef6b61ec9a9dbc9a9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-26.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1782467914,
"narHash": "sha256-pGvFkM8N0xEkIIXDe5YYfbEAvHrk4IxBrjB/x8OomhE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e73de5be04e0eff4190a1432b946d469c794e7b4",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1767892417,
"narHash": "sha256-8bW3q88CEg2u4hSP66Vf4lpbLonHz7hqDNBMcCY7E9U=",
"rev": "3497aa5c9457a9d88d71fa93a4a8368816fbeeba",
"type": "tarball",
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.05pre924538.3497aa5c9457/nixexprs.tar.xz"
},
"original": {
"type": "tarball",
"url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1741173522,
"narHash": "sha256-k7VSqvv0r1r53nUI/IfPHCppkUAddeXn843YlAC5DR0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d69ab0d71b22fa1ce3dbeff666e6deb4917db049",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1781577229,
"narHash": "sha256-lrp67w8AulE9Ks53n27I45ADSzbOCn4H+CNW1Ck8B+8=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "567a49d1913ce81ac6e9582e3553dd90a955875f",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_5": {
"locked": {
"lastModified": 1767892417,
"narHash": "sha256-8bW3q88CEg2u4hSP66Vf4lpbLonHz7hqDNBMcCY7E9U=",
"rev": "3497aa5c9457a9d88d71fa93a4a8368816fbeeba",
"type": "tarball",
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.05pre924538.3497aa5c9457/nixexprs.tar.xz"
},
"original": {
"type": "tarball",
"url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"
}
},
"nixpkgs_6": {
"locked": {
"lastModified": 1741173522,
"narHash": "sha256-k7VSqvv0r1r53nUI/IfPHCppkUAddeXn843YlAC5DR0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d69ab0d71b22fa1ce3dbeff666e6deb4917db049",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_7": {
"locked": {
"lastModified": 1782375420,
"narHash": "sha256-wiPYmEuHbJvleW489n6+lamL7JSJg3pcKUYwURU9CkI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4062d36ebeae843c750011eef6b61ec9a9dbc9a9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-26.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nur": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1781794604,
"narHash": "sha256-+A52qDscDCQelWn+aSZA7iSv500HXRPmsO8KRR3mivg=",
"owner": "nix-community",
"repo": "NUR",
"rev": "8661c872ba8979434bf38bd2eb814d4f73578b38",
"type": "github"
},
"original": {
"id": "nur",
"type": "indirect"
}
},
"nur_2": {
"inputs": {
"flake-parts": "flake-parts_2",
"nixpkgs": "nixpkgs_3",
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1769756556,
"narHash": "sha256-gvLoC2HohFNtIAVEvBWSMacBH3sZdvhIPiF75hR2cO4=",
"owner": "nix-community",
"repo": "NUR",
"rev": "7f4366be821b64f130c08dd47cbc22cad3003d97",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "master",
"repo": "NUR",
"type": "github"
}
},
"nur_3": {
"inputs": {
"flake-parts": "flake-parts_3",
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1781794604,
"narHash": "sha256-+A52qDscDCQelWn+aSZA7iSv500HXRPmsO8KRR3mivg=",
"owner": "nix-community",
"repo": "NUR",
"rev": "8661c872ba8979434bf38bd2eb814d4f73578b38",
"type": "github"
},
"original": {
"id": "nur",
"type": "indirect"
}
},
"nur_4": {
"inputs": {
"flake-parts": "flake-parts_4",
"nixpkgs": "nixpkgs_6",
"treefmt-nix": "treefmt-nix_2"
},
"locked": {
"lastModified": 1769756556,
"narHash": "sha256-gvLoC2HohFNtIAVEvBWSMacBH3sZdvhIPiF75hR2cO4=",
"owner": "nix-community",
"repo": "NUR",
"rev": "7f4366be821b64f130c08dd47cbc22cad3003d97",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "master",
"repo": "NUR",
"type": "github"
}
},
"plasma-manager": {
"inputs": {
"home-manager": [
"materus-inputs",
"home-manager"
],
"nixpkgs": [
"materus-inputs",
"nixpkgs"
]
},
"locked": {
"lastModified": 1775856943,
"narHash": "sha256-b7Mp7P+q2Md5AGt4rjHfMcBykzMumFTen10ST++AuTU=",
"owner": "nix-community",
"repo": "plasma-manager",
"rev": "a524a6160e6df89f7673ba293cf7d78b559eb1a5",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "trunk",
"repo": "plasma-manager",
"type": "github"
}
},
"plasma-manager_2": {
"inputs": {
"home-manager": [
"materus-inputs-unstable",
"home-manager"
],
"nixpkgs": [
"materus-inputs-unstable",
"nixpkgs"
]
},
"locked": {
"lastModified": 1775856943,
"narHash": "sha256-b7Mp7P+q2Md5AGt4rjHfMcBykzMumFTen10ST++AuTU=",
"owner": "nix-community",
"repo": "plasma-manager",
"rev": "a524a6160e6df89f7673ba293cf7d78b559eb1a5",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "trunk",
"repo": "plasma-manager",
"type": "github"
}
},
"root": {
"inputs": {
"materus-inputs": "materus-inputs",
"materus-inputs-unstable": "materus-inputs-unstable",
"nixpkgs": "nixpkgs_7",
"nixpkgs-unstable": "nixpkgs-unstable"
}
},
"sops-nix": {
"inputs": {
"nixpkgs": [
"materus-inputs",
"nixpkgs"
]
},
"locked": {
"lastModified": 1782165805,
"narHash": "sha256-478kKQBvK6SYTOdN2h9jhKJv94nbXRbFMfuL1WshErg=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "56b24064fdcaedca53553b1a6d607fd23b613a24",
"type": "github"
},
"original": {
"owner": "Mic92",
"ref": "master",
"repo": "sops-nix",
"type": "github"
}
},
"sops-nix_2": {
"inputs": {
"nixpkgs": [
"materus-inputs-unstable",
"nixpkgs"
]
},
"locked": {
"lastModified": 1782165805,
"narHash": "sha256-478kKQBvK6SYTOdN2h9jhKJv94nbXRbFMfuL1WshErg=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "56b24064fdcaedca53553b1a6d607fd23b613a24",
"type": "github"
},
"original": {
"owner": "Mic92",
"ref": "master",
"repo": "sops-nix",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"materus-inputs",
"nur",
"nixpkgs"
]
},
"locked": {
"lastModified": 1733222881,
"narHash": "sha256-JIPcz1PrpXUCbaccEnrcUS8jjEb/1vJbZz5KkobyFdM=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "49717b5af6f80172275d47a418c9719a31a78b53",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"treefmt-nix_2": {
"inputs": {
"nixpkgs": [
"materus-inputs-unstable",
"nur",
"nixpkgs"
]
},
"locked": {
"lastModified": 1733222881,
"narHash": "sha256-JIPcz1PrpXUCbaccEnrcUS8jjEb/1vJbZz5KkobyFdM=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "49717b5af6f80172275d47a418c9719a31a78b53",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}
},
"root": "root",
"version": 7
}
+151 -102
View File
@@ -1,128 +1,177 @@
{
description = "Materus hosts and user config";
#region Inputs
inputs = {
nixpkgs = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
ref = "nixos-26.05";
};
nixpkgs-unstable = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
ref = "nixos-unstable";
};
flake-utils = {
type = "github";
owner = "numtide";
repo = "flake-utils";
ref = "main";
materus-inputs = {
url = "path:./nix-config/subflake";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.url = "github:nix-community/home-manager/release-26.05";
};
materus-inputs-unstable = {
url = "path:./nix-config/subflake";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
base16 = {
type = "github";
owner = "SenchoPens";
repo = "base16.nix";
ref = "main";
};
#endregion
outputs =
inputs@{
self,
nixpkgs,
nixpkgs-unstable,
materus-inputs,
materus-inputs-unstable,
}:
let
#region Variables
path = toString ./.;
files = {
ssh-keys = {
materus = ./extra-files/ssh/materus.pub;
waffentrager = ./extra-files/ssh/waffentrager.pub;
};
patches = {
bwrap = ./extra-files/patches/bubblewrap.patch;
};
};
#endregion
#region System make helper
makeSystem =
{
host,
arch ? "x86_64-linux",
stable ? true,
extraArgs ? { },
}:
let
inp = if stable then materus-inputs else materus-inputs-unstable;
sys-nixpkgs = if stable then nixpkgs else nixpkgs-unstable;
materusArgs = {
inherit files;
inherit arch;
inherit self;
inputs = inp;
flake-path = path;
host-path = path + "/nix-config/host/${host}";
};
in
(sys-nixpkgs.lib.nixosSystem {
system = arch;
specialArgs = extraArgs // {
inherit materusArgs;
};
modules = [
./nix-config/host/${host}
(import ./nix-config/shared false)
];
devshell = {
type = "github";
owner = "numtide";
repo = "devshell";
ref = "main";
inputs = {
nixpkgs.follows = "nixpkgs";
});
#endregion
#region Home make helper
makeHome =
{
user,
arch ? "x86_64-linux",
stable ? true,
extraArgs ? { },
host ? null,
}:
let
inp = if stable then materus-inputs else materus-inputs-unstable;
home-nixpkgs = if stable then nixpkgs else nixpkgs-unstable;
pkgs = import home-nixpkgs {
system = arch;
config.allowUnfree = true;
overlays = [
inp.nix-vscode-extensions.overlays.default
];
};
materusArgs = {
inherit files;
inherit arch;
inherit self;
inputs = inp;
flake-path = path;
home-path = path + "/nix-config/home/${user}";
};
in
inp.home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules =
let
host-path = ./. + "/nix-config/host/${host}/home-manager/${user}.nix";
in
[
./nix-config/home/${user}
(import ./nix-config/shared true)
]
++ (if (host != null && builtins.pathExists host-path) then [ host-path ] else [ ]);
extraSpecialArgs = extraArgs // {
inherit materusArgs;
};
};
#endregion
in
rec {
nixosConfigurations = {
materusPC = makeSystem {
host = "materusPC";
stable = true;
};
oldie = makeSystem {
host = "oldie";
stable = true;
};
valkyrie = makeSystem {
host = "valkyrie";
stable = true;
};
waffentrager = makeSystem {
host = "waffentrager";
stable = true;
arch = "aarch64-linux";
};
};
home-manager = {
type = "github";
owner = "nix-community";
repo = "home-manager";
ref = "master";
inputs = {
nixpkgs.follows = "nixpkgs";
homeConfigurations = {
"materus@materusPC" = makeHome {
user = "materus";
host = "materusPC";
stable = true;
};
"materus@oldie" = makeHome {
user = "materus";
host = "oldie";
stable = true;
};
"materus@valkyrie" = makeHome {
user = "materus";
host = "valkyrie";
stable = true;
};
emacs-overlay = {
type = "github";
owner = "nix-community";
repo = "emacs-overlay";
ref = "master";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
"materus@waffentrager" = makeHome {
user = "materus";
host = "waffentrager";
arch = "aarch64-linux";
stable = true;
};
};
nixos-hardware = {
type = "github";
owner = "NixOS";
repo = "nixos-hardware";
ref = "master";
};
nixerus = {
type = "github";
owner = "materusPL";
repo = "Nixerus";
ref = "master";
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
};
};
nix-vscode-extensions = {
type = "github";
owner = "nix-community";
repo = "nix-vscode-extensions";
ref = "master";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
sops-nix = {
type = "github";
owner = "Mic92";
repo = "sops-nix";
ref = "master";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
git-agecrypt = {
type = "github";
owner = "vlaci";
repo = "git-agecrypt";
ref = "main";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
plasma-manager = {
type = "github";
owner = "nix-community";
repo = "plasma-manager";
ref = "trunk";
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
};
};
nur = {
type = "github";
owner = "nix-community";
repo = "NUR";
ref = "master";
};
};
outputs = inputs: inputs;
}
+73
View File
@@ -0,0 +1,73 @@
{
config,
pkgs,
lib,
...
}:
{
home.username = lib.mkDefault "materus";
home.homeDirectory = lib.mkDefault "/home/materus";
home.file = {
".zshenv".source = "${config.xdg.configFile."zsh/cfg".source}/zshenv";
".tmux.conf".source = "${config.mkk.dir}/config/tmux/tmux.conf";
};
xdg.enable = true;
xdg.configFile."wezterm".source = "${config.mkk.dir}/config/terminal/wezterm";
xdg.configFile."zsh/cfg".source =
"${config.mkk.dir}/config/shell/zsh";
xdg.configFile."zsh/data/plugins/powerlevel10k".source =
"${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k";
xdg.configFile."zsh/data/plugins/zsh-history-substring-search".source =
"${pkgs.zsh-history-substring-search}/share/zsh-history-substring-search";
xdg.configFile."zsh/data/plugins/zsh-syntax-highlighting".source =
"${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting";
xdg.configFile."zsh/data/plugins/zsh-autosuggestions".source =
"${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions";
xdg.configFile."zsh/data/nix.sh".text = ''
source ${pkgs.vte}/etc/profile.d/vte.sh
'';
xdg.configFile."zsh/data/nix_profile.sh".text = ''
[[ -e ~/.nix-profile/etc/profile.d/hm-session-vars.sh ]] && emulate sh -c "source ~/.nix-profile/etc/profile.d/hm-session-vars.sh"
[[ -e ~/.nix-profile/etc/profile.d/command-not-found.sh ]] && emulate sh -c "source ~/.nix-profile/etc/profile.d/command-not-found.sh"
[[ -e ~/.nix-profile/etc/profile.d/wezterm.sh ]] && emulate sh -c "source ~/.nix-profile/etc/profile.d/wezterm.sh"
__HOME_ZPROFILE_NIX_SOURCED=1
'';
xdg.userDirs.enable = lib.mkDefault true;
xdg.userDirs.createDirectories = lib.mkDefault config.xdg.userDirs.enable;
xdg.userDirs.desktop = lib.mkDefault "${config.home.homeDirectory}/Pulpit";
xdg.userDirs.documents = lib.mkDefault "${config.home.homeDirectory}/Dokumenty";
xdg.userDirs.download = lib.mkDefault "${config.home.homeDirectory}/Pobrane";
xdg.userDirs.music = lib.mkDefault "${config.xdg.userDirs.extraConfig.AUDIO}/Muzyka";
xdg.userDirs.pictures = lib.mkDefault "${config.home.homeDirectory}/Obrazy";
xdg.userDirs.publicShare = lib.mkDefault "${config.home.homeDirectory}/Publiczny";
xdg.userDirs.templates = lib.mkDefault "${config.home.homeDirectory}/Szablony";
xdg.userDirs.videos = lib.mkDefault "${config.home.homeDirectory}/Wideo";
xdg.userDirs.extraConfig = {
MISC = lib.mkDefault "${config.home.homeDirectory}/Inne";
PIC_SCREENSHOTS = lib.mkDefault "${config.xdg.userDirs.pictures}/Zrzuty ekranu";
PIC_MEMES = lib.mkDefault "${config.xdg.userDirs.pictures}/Memy";
PIC_MISC = lib.mkDefault "${config.xdg.userDirs.pictures}/Inne";
PIC_PHOTOS = lib.mkDefault "${config.xdg.userDirs.pictures}/Zdjęcia";
PIC_AVATARS = "${config.xdg.userDirs.pictures}/Avatar";
AUDIO = lib.mkDefault "${config.home.homeDirectory}/Audio";
KEYS = lib.mkDefault "${config.xdg.userDirs.documents}/Klucze";
};
xdg.userDirs.setSessionVariables = true;
home.sessionVariables = {
};
programs.home-manager.enable = true;
}
+57
View File
@@ -0,0 +1,57 @@
{ pkgs, lib, ... }:
{
security.rtkit.enable = true;
services.pipewire = {
enable = true;
audio.enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
systemWide = true;
jack.enable = true;
};
environment.sessionVariables =
let
makePluginPath =
format:
"$HOME/.${format}:"
+ (lib.makeSearchPath format [
"$HOME/.nix-profile/lib"
"/run/current-system/sw/lib"
"/etc/profiles/per-user/$USER/lib"
]);
in
{
ALSOFT_DRIVERS = "pulse";
DSSI_PATH = makePluginPath "dssi";
LADSPA_PATH = makePluginPath "ladspa";
LV2_PATH = makePluginPath "lv2";
LXVST_PATH = makePluginPath "lxvst";
VST_PATH = makePluginPath "vst";
VST3_PATH = makePluginPath "vst3";
};
environment.systemPackages = with pkgs; [
openal
pulseaudio
reaper
yabridge
yabridgectl
vital
odin2
fire
lsp-plugins
];
services.udev.extraRules = ''
KERNEL=="rtc0", GROUP="audio"
KERNEL=="hpet", GROUP="audio"
DEVPATH=="/devices/virtual/misc/cpu_dma_latency", OWNER="root", GROUP="audio", MODE="0660"
'';
}
+93
View File
@@ -0,0 +1,93 @@
{
pkgs,
lib,
mkk,
...
}:
{
boot.supportedFilesystems = [
"ntfs"
"btrfs"
"vfat"
"exfat"
"ext4"
];
boot.tmp.useTmpfs = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot/efi";
boot.loader.grub = {
enable = true;
efiSupport = true;
device = "nodev";
gfxmodeEfi = pkgs.lib.mkDefault "1920x1080@240";
gfxmodeBios = pkgs.lib.mkDefault "1920x1080@240";
useOSProber = true;
memtest86.enable = true;
};
boot.plymouth.enable = true;
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
boot.kernelParams = [ "ip=${mkk.local}" ];
# Use latest kernel.
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_zen;
boot.initrd = {
availableKernelModules = [
"r8169"
"wireguard"
];
luks.devices."ROOT_1".device = "/dev/disk/by-label/CRYPT_ROOT_1";
luks.devices."ROOT_2".device = "/dev/disk/by-label/CRYPT_ROOT_2";
secrets."/etc/secrets/30-wg-initrd.key" = "/mkk/keys/wireguard";
systemd = {
enable = true;
network = {
netdevs."30-wg-initrd" = {
netdevConfig = {
Kind = "wireguard";
Name = "wg-initrd";
};
wireguardConfig = {
PrivateKeyFile = "/etc/secrets/30-wg-initrd.key";
};
wireguardPeers = [
{
AllowedIPs = [
"${mkk.wireguard.ip-masks.main}"
"${mkk.wireguard.peers.valkyrie.ip}/32"
];
PublicKey = "${mkk.wireguard.peers.valkyrie.pubKey}";
Endpoint = "${mkk.network.valkyrie.ip}:${mkk.wireguard.peers.valkyrie.port}";
PersistentKeepalive = 25;
}
];
};
networks."30-wg-initrd" = {
name = "wg-initrd";
addresses = [ { Address = "${mkk.wireguard.peers.materusPC.ip}/32"; } ];
};
networks."10-lan" = {
matchConfig.Name = "eno1";
networkConfig.DHCP = "yes";
};
};
};
network = {
enable = true;
flushBeforeStage2 = true;
ssh = {
enable = true;
port = 22;
authorizedKeyFiles = [ mkk.files.ssh-keys.materus ];
hostKeys = [
"/mkk/keys/ssh_host_ed25519_key"
"/mkk/keys/ssh_host_rsa_key"
];
};
};
};
}
+304
View File
@@ -0,0 +1,304 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{
config,
lib,
pkgs,
mkk,
...
}:
let
patchedBwrap = pkgs.bubblewrap.overrideAttrs (o: {
patches = (o.patches or [ ]) ++ [
mkk.files.patches.bwrap
];
});
in
{
# Set your time zone.
time.timeZone = "Europe/Warsaw";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
i18n.defaultLocale = "pl_PL.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "pl";
useXkbConfig = false; # use xkb.options in tty.
};
hardware.graphics = {
enable = true;
extraPackages = with pkgs; [
];
};
programs.java.enable = true;
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true;
extraPackages = with pkgs; [
vlc
libva
libva-utils
libva-vdpau-driver
mesa
mesa-demos
libvdpau-va-gl
nss
mkk.nixerus.pkgs.polymc
];
extraCompatPackages = [
pkgs.proton-ge-bin
];
package = pkgs.steam.override {
extraEnv = {
PRESSURE_VESSEL_FILESYSTEMS_RW="\${XDG_RUNTIME_DIR}/wivrn/comp_ipc";
#PRESSURE_VESSEL_IMPORT_OPENXR_1_RUNTIMES="1";
};
extraLibraries =
p: with p; [
];
};
};
programs.git = {
enable = true;
lfs.enable = true;
};
programs.gnupg.agent = {
enable = true;
enableSSHSupport = false;
enableBrowserSocket = true;
};
programs.gamescope.enable = true;
programs.gamescope.capSysNice = true;
hardware.uinput.enable = true;
hardware.steam-hardware.enable = true;
programs.gamemode.enable = true;
programs.corectrl.enable = true;
programs.fish.enable = true;
programs.command-not-found.enable = false;
programs.dconf.enable = true;
environment.systemPackages = with pkgs; [
tmux
waypipe
wezterm
kdePackages.ark
kdePackages.kcalc
vim
nano
obsidian
git-crypt
telegram-desktop
discord
thunderbird-latest
floorp-bin
brave
keepassxc
spotify
remmina
mesa-demos
vulkan-tools
pciutils
schroot
vlc
fastfetch
];
environment.variables = {
};
environment.sessionVariables = {
STEAM_EXTRA_COMPAT_TOOLS_PATHS = "\${STEAM_EXTRA_COMPAT_TOOLS_PATHS}\${STEAM_EXTRA_COMPAT_TOOLS_PATHS:+:}\${HOME}/.steam/root/compatibilitytools.d";
XDG_CACHE_HOME = "\${HOME}/.cache";
XDG_CONFIG_HOME = "\${HOME}/.config";
XDG_BIN_HOME = "\${HOME}/.local/bin";
XDG_DATA_HOME = "\${HOME}/.local/share";
QT_XKB_CONFIG_ROOT = "\${XKB_CONFIG_ROOT}";
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
SDL_IM_MODULE = "fcitx";
MOZ_USE_XINPUT2 = "1";
PATH = [ "\${XDG_BIN_HOME}" ];
};
environment.shellInit = ''
if ! [ -z "$DISPLAY" ]; then ${pkgs.xhost}/bin/xhost +si:localuser:root &> /dev/null; fi;
if ! [ -z "$DISPLAY" ]; then ${pkgs.xhost}/bin/xhost +si:localuser:$USER &> /dev/null; fi;
'';
i18n.inputMethod.enable = true;
i18n.inputMethod.type = "fcitx5";
i18n.inputMethod.fcitx5.addons = [
pkgs.kdePackages.fcitx5-configtool
pkgs.fcitx5-lua
pkgs.fcitx5-mozc
pkgs.fcitx5-gtk
pkgs.kdePackages.fcitx5-qt
];
environment.enableAllTerminfo = true;
environment.pathsToLink = [
"/share/zsh"
"/share/bash-completion"
"/share/fish"
];
environment.shells = with pkgs; [
zsh
bashInteractive
fish
nushell
];
# Configure keymap in X11
# services.xserver.xkb.layout = "us";
# services.xserver.xkb.options = "eurosign:e,caps:escape";
# Define a user account. Don't forget to set a password with passwd.
users.users.materus = {
isNormalUser = true;
extraGroups = [
"audio"
"video"
"render"
"pipewire"
"wheel"
"networkmanager"
"input"
"kvm"
"libvirt-qemu"
"libvirt"
"libvirtd"
"podman"
"scanner"
"lp"
];
#shell = pkgs.zsh;
description = "Mateusz Słodkowicz";
#openssh.authorizedKeys.keyFiles = [ ("${materusArg.cfg.path}" + "/extraFiles/keys/ssh/materus.pub") ];
#hashedPasswordFile = config.sops.secrets."users/materus".path;
};
programs.firefox.enable = true;
fonts.packages = [
pkgs.dejavu_fonts
pkgs.freefont_ttf
pkgs.gyre-fonts
pkgs.liberation_ttf
pkgs.unifont
pkgs.noto-fonts
pkgs.noto-fonts-color-emoji
pkgs.noto-fonts-cjk-sans
pkgs.noto-fonts-cjk-serif
pkgs.wqy_zenhei
pkgs.corefonts
pkgs.hack-font
pkgs.nerd-fonts.hack
pkgs.ubuntu-classic
pkgs.monocraft
pkgs.nerd-fonts.droid-sans-mono
pkgs.nerd-fonts.meslo-lg
pkgs.nerd-fonts.profont
pkgs.nerd-fonts.fira-code
];
fonts.enableDefaultPackages = lib.mkDefault true;
fonts.fontconfig.enable = lib.mkDefault true;
fonts.fontconfig.cache32Bit = lib.mkDefault true;
fonts.fontconfig.defaultFonts.sansSerif = [
"Noto Sans"
"DejaVu Sans"
"WenQuanYi Zen Hei"
"Noto Color Emoji"
];
fonts.fontconfig.defaultFonts.serif = [
"Noto Serif"
"DejaVu Serif"
"WenQuanYi Zen Hei"
"Noto Color Emoji"
];
fonts.fontconfig.defaultFonts.emoji = [
"Noto Color Emoji"
"OpenMoji Color"
];
fonts.fontconfig.defaultFonts.monospace = [
"Hack Nerd Font"
"Noto Sans Mono"
"WenQuanYi Zen Hei Mono"
];
fonts.fontDir.enable = lib.mkDefault true;
nixpkgs.config.allowUnfree = true;
nix.settings = {
experimental-features = lib.mkMerge [
[
"nix-command"
"flakes"
]
];
auto-optimise-store = true;
trusted-users = [
"root"
"@wheel"
];
substituters = [
"https://nix-community.cachix.org"
"https://cache.nixos.org/"
"https://nixerus.cachix.org/"
];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"nixerus.cachix.org-1:2x7sIG7y1vAoxc8BNRJwsfapZsiX4hIl4aTi9V5ZDdE="
];
};
users.defaultUserShell = pkgs.zsh;
programs.zsh = {
enable = true;
enableGlobalCompInit = false;
interactiveShellInit = ''
if [[ ''${__HOME_ZSHRC_SOURCED:-0} == 0 ]]; then
source ${pkgs.grml-zsh-config}/etc/zsh/zshrc
fi
'';
promptInit = '''';
};
systemd.sleep.settings.Sleep = {
AllowSuspend="yes";
AllowHibernation="no";
AllowHybridSleep="no";
AllowSuspendThenHibernate="no";
};
system.stateVersion = "25.11";
}
+18
View File
@@ -0,0 +1,18 @@
{ ... }:
{
imports = [
./configuration.nix
./audio.nix
./network.nix
./services.nix
./boot.nix
./virtualization/libvirt.nix
./virtualization/vfio.nix
./virtualization/containers.nix
./hardware-configuration.nix
./private
];
}
@@ -0,0 +1,180 @@
# 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,
...
}:
let
video = [
"video=HDMI-A-3:1920x1080@144"
"video=DP-3:1920x1080@240"
];
vmCores = "8-15,24-31";
in
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [
"pci-stub"
"amdgpu"
"i2c_dev"
"kvm_amd"
"vfio"
"vfio_iommu_type1"
"vfio-pci"
"kvmfr"
];
boot.extraModprobeConfig = ''
options kvm_amd nested=1 avic=1 npt=1 sev=0
options vfio_iommu_type1 allow_unsafe_interrupts=1
options kvmfr static_size_mb=64
'';
boot.kernel.sysctl = {
"vm.max_map_count" = 1000000;
"vm.swappiness" = 10;
"net.ipv4.ip_forward" = 1;
};
boot.extraModulePackages = with config.boot.kernelPackages; [
v4l2loopback
kvmfr
];
boot.kernelParams = [
"rcu_nocbs=${vmCores}"
"nohz_full=${vmCores}"
"vfio_iommu_type1.allow_unsafe_interrupts=1"
"pcie_acs_override=downstream,multifunction"
#''vfio-pci.ids="1002:744c"''
"nox2apic"
"nvme_core.default_ps_max_latency_us=0"
"nvme_core.io_timeout=255"
"nvme_core.max_retries=10"
"nvme_core.shutdown_timeout=10"
"amd_iommu=on"
"amdgpu.ppfeaturemask=0xffffffff"
#"amdgpu.runpm=0"
"iommu=pt"
"psi=1"
"i915.force_probe=!56a6"
"xe.force_probe=56a6"
]
++ video;
fileSystems."/" = {
device = "/dev/disk/by-label/materusPC_ROOT";
fsType = "btrfs";
options = [
"subvol=@"
"noatime"
"compress=zstd"
"ssd"
"space_cache=v2"
];
};
fileSystems."/home" = {
device = "/dev/disk/by-label/materusPC_ROOT";
fsType = "btrfs";
options = [
"subvol=@home"
"noatime"
"compress=zstd"
"ssd"
"space_cache=v2"
];
};
fileSystems."/nix" = {
device = "/dev/disk/by-label/materusPC_ROOT";
fsType = "btrfs";
options = [
"subvol=@nix"
"noatime"
"compress=zstd"
"ssd"
"space_cache=v2"
];
};
fileSystems."/var/log" = {
device = "/dev/disk/by-label/materusPC_ROOT";
fsType = "btrfs";
options = [
"subvol=@log"
"noatime"
"compress=zstd"
"ssd"
"space_cache=v2"
];
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/materusPC_BOOT";
fsType = "ext4";
};
fileSystems."/boot/efi" = {
device = "/dev/disk/by-label/EFI";
fsType = "vfat";
options = [
"fmask=0022"
"dmask=0022"
];
};
fileSystems."/etc/nixos" = {
device = "/mkk/config";
fsType = "none";
options = [ "bind" ];
depends = [ "/" ];
};
swapDevices = [
{ label = "materusPC_SWAP"; }
];
zramSwap = {
enable = true;
memoryPercent = 50;
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
services.udev.extraRules = ''
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x1002", ATTR{device}=="0x744c", ATTR{power/control}="on"
'';
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
hardware.sane.enable = true;
hardware.sane.extraBackends = [ pkgs.hplipWithPlugin ];
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
settings = {
General = {
Experimental = true;
FastConnectable = true;
};
Policy = {
AutoEnable = true;
};
};
};
}
@@ -0,0 +1,200 @@
{
pkgs,
config,
lib,
mkk,
...
}:
let
jsonFormat = pkgs.formats.json { };
in
{
home.stateVersion = "25.11";
mkk.neovim.enable = true;
programs.nix-index.enable = true;
mkk.dir = config.lib.file.mkOutOfStoreSymlink "/mkk/config";
programs.git = {
enable = true;
lfs.enable = true;
settings = {
user.email = "materus@podkos.pl";
user.name = "materus";
commit.gpgsign = true;
gpg.format = "ssh";
};
signing.signByDefault = true;
signing.key = "/mkk/config/extra-files/ssh/materus.pub";
};
home.packages = with pkgs; [
eza
wezterm
mkk.nixerus.pkgs.polymc
neovide
curl
wget
python3
packwiz
ani-cli
mpv
kitty
libreoffice-qt6-fresh
direnv
jsonnet
jsonnet-language-server
];
programs.vscodium = {
enable = true;
mutableExtensionsDir = true;
profiles.default.enableExtensionUpdateCheck = true;
profiles.default.extensions = with pkgs.nix-vscode-extensions.vscode-marketplace; [
# VSCode
kerrickstaley.layered-settings
mkhl.direnv
betterthantomorrow.joyride
dracula-theme.theme-dracula
leonardssh.vscord
ms-vscode.hexeditor
pkief.material-icon-theme
pkief.material-product-icons
# Python
#ms-python.vscode-pylance
ms-python.python
ms-python.debugpy
ms-python.vscode-python-envs
# Git
eamodio.gitlens
donjayamanne.githistory
waderyan.gitblame
codezombiech.gitignore
# Lua
sumneko.lua
# Jsonnet
grafana.vscode-jsonnet
# Nix
jnoortheen.nix-ide
# C++
twxs.cmake
llvm-vs-code-extensions.vscode-clangd
ms-vscode.cmake-tools
cs128.cs128-clang-tidy
xaver.clang-format
# Other
redhat.vscode-yaml
redhat.vscode-xml
webfreak.debug
];
package = (
pkgs.vscodium.fhsWithPackages (
ps: with ps; [
nixfmt
nixd
direnv
jsonnet
jsonnet-language-server
clang-tools
clang
]
)
);
};
xdg.configFile."VSCodium/User/settings.nix.jsonnet".enable = false;
xdg.configFile."VSCodium/User/settings_generated.json".enable = false;
home.activation.VSCodiumSetup =
let
source = jsonFormat.generate "settings.nix" {
# VSCode
"window.dialogStyle" = "custom";
"window.titleBarStyle" = "custom";
"workbench.colorTheme" = "Dracula Theme";
"workbench.iconTheme" = "material-icon-theme";
"editor.fontFamily" = "'Hack Nerd Font', 'monospace', monospace";
"direnv.path.executable" = "${pkgs.direnv}/bin/direnv";
"vscord.app.name" = "VSCodium";
# Typescript
"typescript.tsserver.maxTsServerMemory" = 1024 * 8;
"typescript.tsserver.nodePath" = "${pkgs.nodejs}/bin/node";
# Nix
"[nix]" = {
"editor.defaultFormatter" = "jnoortheen.nix-ide";
};
"nix.enableLanguageServer" = true;
"nix.formatterPath" = "${pkgs.nixfmt}/bin/nixfmt";
"nix.serverPath" = "${pkgs.nixd}/bin/nixd";
"nix.serverSettings" = {
"nixd" = {
"nixpkgs" = {
"expr" = "import (builtins.getFlake \"/mkk/config\").inputs.nixpkgs { }";
};
"formatting" = {
"command" = [
"nixfmt"
];
};
"options" = {
"nixos" = {
"expr" =
"(builtins.getFlake (builtins.toString \"/mkk/config\" )).nixosConfigurations.materusPC.options";
};
"home-manager" = {
"expr" =
"(builtins.getFlake (builtins.toString \"/mkk/config\")).homeConfigurations.materus.options";
};
};
};
};
# C++
"C_Cpp.clang_format_path" = "${pkgs.clang-tools}/bin/clang-format";
"C_Cpp.clang_format_fallbackStyle" = "Microsoft";
"clang-tidy.executable" = "${pkgs.clang-tools}/bin/clang-tidy";
"[cpp]" = {
"editor.defaultFormatter" = "xaver.clang-format";
};
"[c]" = {
"editor.defaultFormatter" = "xaver.clang-format";
};
"cmake.showOptionsMovedNotification" = false;
"cmake.pinnedCommands" = [
"workbench.action.tasks.configureTaskRunner"
"workbench.action.tasks.runTask"
];
"clang-format.fallbackStyle" = "Microsoft";
};
target = config.xdg.configFile."VSCodium/User/settings.nix.jsonnet".target;
command = ''
echo "Kill codium"
run ${pkgs.procps}/bin/pkill -9 codium || true
echo "Copying mutable VSCodium files"
verboseEcho "${source} -> ${target}"
run cp --remove-destination --no-preserve=mode ${source} ${target}
echo "Remove old settings_generated.json"
if [ -f '${config.xdg.configFile."VSCodium/User/settings_generated.json".target}' ]; then
run rm -f ${config.xdg.configFile."VSCodium/User/settings_generated.json".target}
fi
'';
in
(lib.hm.dag.entryAfter [ "linkGeneration" "writeBoundary" ] command);
xdg.dataFile."java-runtimes/graalvm-oracle-17".source = pkgs.graalvmPackages.graalvm-oracle_17;
xdg.dataFile."java-runtimes/graalvm-oracle-latest".source = pkgs.graalvmPackages.graalvm-oracle;
xdg.dataFile."java-runtimes/openjdk21".source = pkgs.jdk21;
}
+52
View File
@@ -0,0 +1,52 @@
{
config,
pkgs,
lib,
mkk,
...
}:
{
sops.templates."networkmanager.env".content = ''
WIREGUARD_PRIVATEKEY="${config.sops.placeholder.wireguard}"
'';
networking.nftables.enable = true;
networking.hostName = "materusPC";
#networking.wireless.iwd.enable = true;
networking.networkmanager.enable = true;
networking.firewall.enable = false;
networking.networkmanager.ensureProfiles.environmentFiles = [
config.sops.templates."networkmanager.env".path
];
networking.networkmanager.ensureProfiles.profiles = {
wg0 = {
connection = {
id = "PodKos";
type = "wireguard";
interface-name = "wg-podkos";
};
wireguard = {
private-key = "$WIREGUARD_PRIVATEKEY";
};
"wireguard-peer.${mkk.wireguard.peers.valkyrie.pubKey}" = {
endpoint = "${mkk.network.valkyrie.ip}:${mkk.wireguard.peers.valkyrie.port}";
allowed-ips = "${mkk.wireguard.ip-masks.main};${mkk.wireguard.ip-masks.guest};${mkk.wireguard.ip-masks.asia};${mkk.wireguard.peers.valkyrie.ip}/32;";
persistent-keepalive = "20";
};
ipv4 = {
address1 = "${mkk.wireguard.peers.materusPC.ip}/32";
dns = "${mkk.wireguard.peers.valkyrie.ip};";
method = "manual";
never-default = "true";
};
ipv6 = {
addr-gen-mode = "stable-privacy";
method = "disabled";
};
proxy = { };
};
};
services.udev.extraRules = ''
ACTION=="add", SUBSYSTEM=="net", NAME=="en*", RUN+="${pkgs.ethtool}/bin/ethtool -s $name wol g"
'';
}
Binary file not shown.
Binary file not shown.
+171
View File
@@ -0,0 +1,171 @@
{ pkgs, mkk, ... }:
{
imports = [
#region Suspend/sleep
{
systemd.services.pre-suspend = {
description = "Service description here";
wantedBy = [ "suspend.target" "sleep.target" ];
before = [
"suspend.target"
"sleep.target"
];
script = ''
if [ $(systemctl is-active systemd-nspawn@archlinux) = "active" ]; then
systemctl stop systemd-nspawn@archlinux;
sleep 1s;
while [ $(systemctl is-active systemd-nspawn@archlinux) = "active" ]; do sleep 1s; done;
fi
if [ $(systemctl is-active windows-share-mount.service) = "active" ]; then
systemctl stop windows-share-mount.service
fi
'';
serviceConfig.Type = "oneshot";
};
systemd.services.post-suspend = {
description = "Service description here";
wantedBy = [ "suspend.target" "sleep.target" ];
after = [
"suspend.target"
"sleep.target"
];
script = ''
systemctl start windows-share-mount.service
'';
serviceConfig.Type = "oneshot";
};
}
#endregion
#region KDE
{
services.displayManager = {
autoLogin.enable = true;
autoLogin.user = "materus";
plasma-login-manager.enable = true;
};
services.desktopManager.plasma6.enable = true;
services.desktopManager.plasma6.enableQt5Integration = true;
environment.variables = {
#Fix for amdgpu crashes
KWIN_DRM_USE_MODIFIERS = "0";
KWIN_DRM_NO_DIRECT_SCANOUT = "1";
QT_PLUGIN_PATH = [
"${pkgs.qt6.qtimageformats}/${pkgs.qt6.qtbase.qtPluginPrefix}"
"${pkgs.kdePackages.ffmpegthumbs}/${pkgs.qt6.qtbase.qtPluginPrefix}"
];
XCURSOR_THEME = "breeze_cursors";
};
environment.systemPackages = with pkgs.kdePackages; [
kolourpaint
kcolorchooser
kcolorpicker
ark
bluedevil
bluez-qt
kcalc
kcron
];
xdg.portal.enable = true;
xdg.portal.wlr.enable = true;
xdg.portal.xdgOpenUsePortal = true;
xdg.portal.extraPortals = [ pkgs.kdePackages.xdg-desktop-portal-kde ];
environment.plasma6.excludePackages = with pkgs.kdePackages; [
kwallet
kwalletmanager
kwallet-pam
];
}
#endregion
];
#region Printing
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
services.printing = {
enable = true;
drivers = with pkgs; [
cups-filters
cups-browsed
hplipWithPlugin
];
};
#endregion
programs.kdeconnect.enable = true;
services.libinput.enable = true;
services.dbus.enable = true;
services.dbus.packages = [ pkgs.gcr ];
services.flatpak.enable = true;
services.gvfs.enable = true;
services.davfs2.enable = true;
programs.ssh.startAgent = true;
programs.ssh.forwardX11 = true;
services.openssh.enable = true;
services.openssh.openFirewall = true;
#region Sunshine
services.sunshine = {
enable = true;
capSysAdmin = true;
openFirewall = true;
autoStart = false;
package = mkk.nixerus.pkgs.sunshine;
};
#endregion
#region Syncthing
services.syncthing = {
enable = true;
user = "materus";
dataDir = "/home/materus";
};
#endregion
#region Samba
services.samba-wsdd.enable = true;
services.samba-wsdd.openFirewall = true;
services.samba = {
enable = true;
package = pkgs.sambaFull;
openFirewall = true;
settings = {
global = {
"workgroup" = "WORKGROUP";
"server string" = "smbmaterus";
"netbios name " = "smbmaterus";
"security" = "user";
"hosts allow" = "192.168.122. 127.0.0.1 localhost";
"hosts deny" = "0.0.0.0/0";
"guest account" = "nobody";
"map to guest" = "bad user";
"allow insecure wide links" = "yes";
};
windows = {
"path" = "/mkk/data/share/vm_share/";
"browseable" = "yes";
"read only" = "no";
"guest ok" = "no";
"create mask" = "0644";
"directory mask" = "0755";
"force user" = "materus";
"force group" = "users";
"follow symlinks" = "yes";
"wide links" = "yes";
};
};
};
#endregion
#region WiVRn
services.wivrn = {
enable = true;
openFirewall = true;
};
#endregion
}
@@ -0,0 +1,16 @@
{ ... }:
{
imports = [
./nspawn/arch.nix
];
virtualisation.lxc.enable = true;
virtualisation.lxc.lxcfs.enable = true;
virtualisation.waydroid.enable = true;
virtualisation.podman = {
enable = true;
dockerCompat = true;
dockerSocket.enable = true;
};
}
@@ -0,0 +1,111 @@
{ pkgs, config, ... }:
{
virtualisation.libvirtd = {
enable = true;
onBoot = "ignore";
onShutdown = "shutdown";
qemu.runAsRoot = true;
qemu.swtpm.enable = true;
qemu.package = pkgs.qemu_full;
};
virtualisation.spiceUSBRedirection.enable = true;
environment.systemPackages = with pkgs; [
virtiofsd
config.virtualisation.libvirtd.qemu.package
looking-glass-client
virt-manager
libguestfs-with-appliance
];
# Packages for QEMU hooks
systemd.services.libvirtd = {
path =
let
env = pkgs.buildEnv {
name = "qemu-hook-env";
paths = with pkgs; [
bash
libvirt
kmod
systemd
ripgrep
sd
coreutils
sudo
su
killall
procps
util-linux
bindfs
qemu-utils
psmisc
procps
];
};
in
[ env ];
};
# Shared qcow drive
systemd.services.windows-share-mount = {
wantedBy = [ "multi-user.target" ];
path = [
config.virtualisation.libvirtd.qemu.package
pkgs.util-linux
pkgs.kmod
pkgs.coreutils
];
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = true;
unitConfig.ConditionPathExists = "/mkk/data/vm/data.qcow2";
script = ''
modprobe nbd max_part=10
sleep 1
qemu-nbd -c /dev/nbd10 /mkk/data/vm/data.qcow2 --discard=unmap
sleep 1
mount /dev/nbd10p1 /mkk/data/mounts/windows -o uid=1000,gid=100
'';
preStop = ''
umount -r /dev/nbd10p1
qemu-nbd -d /dev/nbd10
'';
};
#Hugepages
systemd.mounts = [
{
where = "/dev/hugepages";
enable = false;
}
{
where = "/dev/hugepages/hugepages-2048kB";
enable = true;
what = "hugetlbfs";
type = "hugetlbfs";
options = "pagesize=2M";
requiredBy = [ "basic.target" ];
}
{
where = "/dev/hugepages/hugepages-1048576kB";
enable = true;
what = "hugetlbfs";
type = "hugetlbfs";
options = "pagesize=1G";
requiredBy = [ "basic.target" ];
}
];
virtualisation.libvirtd.qemu.verbatimConfig = ''
cgroup_device_acl = [
"/dev/null", "/dev/full", "/dev/zero",
"/dev/random", "/dev/urandom",
"/dev/ptmx", "/dev/kvm", "/dev/kqemu",
"/dev/rtc","/dev/hpet", "/dev/vfio/vfio",
"/dev/kvmfr0"
]
'';
}
@@ -0,0 +1,146 @@
{
config,
pkgs,
lib,
...
}:
let
mainMirror = "https://ftp.icm.edu.pl/pub/Linux/dist/archlinux";
extraMirrors = [ ];
getty = [
8
9
];
ttys = [
8
9
] ++ getty;
startPkgs = lib.strings.concatStringsSep " " [
"base"
"base-devel"
"dbus"
"less"
"nano"
"bash-completion"
];
scripts = {
preStart = pkgs.writeShellScript "arch-pre-start" ''
if [ ! -d "/var/lib/machines/archlinux" ]; then
export PATH=''${PATH:+''${PATH}:}${
lib.strings.makeBinPath (
with pkgs;
[
wget
coreutils-full
gnutar
zstd
]
)
}
ARCH_IMAGE=$(mktemp)
trap 'rm $ARCH_IMAGE' EXIT
wget "${mainMirror}/iso/latest/archlinux-bootstrap-x86_64.tar.zst" -O $ARCH_IMAGE
mkdir -p /var/lib/machines/archlinux
trap 'rm -rf /var/lib/machines/archlinux' ERR
tar -xaf $ARCH_IMAGE -C "/var/lib/machines/archlinux" --strip-components=1 --numeric-owner
printf 'Server = %s/$repo/os/$arch\n' "${mainMirror}" > /var/lib/machines/archlinux/etc/pacman.d/mirrorlist
rm "/var/lib/machines/archlinux/etc/resolv.conf"
[ -f "/var/lib/machines/archlinux/etc/securetty" ] && \
printf 'pts/%d\n' $(seq 0 10) >>"/var/lib/machines/archlinux/etc/securetty"
systemd-machine-id-setup --root="/var/lib/machines/archlinux"
systemd-nspawn -q --settings=false --system-call-filter=@sandbox -D "/var/lib/machines/archlinux" /bin/sh -c "
export PATH=/bin
touch /etc/systemd/do-not-udevadm-trigger-on-update
pacman-key --init && pacman-key --populate
pacman -Rs --noconfirm arch-install-scripts
pacman -Sy --noconfirm --needed ${startPkgs}
pacman -Syu --noconfirm
systemctl disable getty@tty1.service
${
lib.strings.concatStringsSep "\n" (
lib.lists.forEach getty (x: "systemctl enable getty@tty${builtins.toString x}.service")
)
}
"
fi
'';
};
in
{
systemd.nspawn."archlinux" = {
enable = true;
execConfig = {
Boot = true;
SystemCallFilter = [ "@known" ];
Timezone = "symlink";
Capability = "all";
PrivateUsers = "no";
ResolvConf = "copy-host";
};
filesConfig = {
BindReadOnly = [
"/nix"
"/run/current-system"
"/run/booted-system"
"/run/opengl-driver"
"/run/opengl-driver-32"
];
Bind = [
"/:/run/host-root"
"/run/udev"
"/run/pipewire"
"/run/pulse"
"/sys/class"
"/sys/devices"
"/dev/fuse"
"/dev/snd"
"/dev/input"
"/dev/uinput"
"/dev/shm"
"/dev/kfd"
"/dev/dri"
"/dev/tty"
"/dev/tty0"
"/var/lib/flatpak"
"/var/lib/containers"
"/tmp/.X11-unix"
/mkk
] ++ lib.lists.forEach ttys (x: "/dev/tty${builtins.toString x}");
};
networkConfig = {
Bridge = "br0";
};
};
systemd.services."systemd-nspawn@archlinux" = {
enable = true;
preStart = "${scripts.preStart}";
overrideStrategy = "asDropin";
serviceConfig = {
DeviceAllow = [
"char-* rwm"
"block-* rwm"
"/dev/shm rwm"
];
};
};
}
@@ -0,0 +1,178 @@
{ config, pkgs, ... }:
let
bar0_guest = "15";
bar2_guest = "8";
bar0_host = "15";
bar2_host = "8";
allCores = "0-31";
allCoresMask = "ffffffff";
hostCores = "0-7,16-23";
hostCoresMask = "00ff00ff";
vmCores = "8-15,24-31";
vmCoresMask = "ff00ff00";
VM_UUID = "ad2632db-0da0-4204-98b3-0592a185ebd0";
startedHook = ''
# Renice QEMU process and threads
QEMU_PID=$(ps aux | grep qemu-system-x86_64 | grep "${VM_UUID}" | tr -s ' ' | cut -d " " -f 2)
for pid in $(ls /proc/$QEMU_PID/task); do
renice -n "-15" -p "$pid";
done
renice -n "-10" -p "$QEMU_PID";
'';
startHook =
/*
''
# Debugging
exec 19>/home/materus/startlogfile
BASH_XTRACEFD=19
set -x
exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3
exec 1>/home/materus/startlogfile.out 2>&1
''
+
*/
''
# Service for my shared qcow2 drive, it's mounted to host when VM not running
systemctl stop windows-share-mount.service
# Stop arch container, script doesnt kill things in container so gpu will be in broken state without it
if [ $(systemctl is-active systemd-nspawn@archlinux) = "active" ]; then
systemctl stop systemd-nspawn@archlinux;
sleep 5s;
while [ $(systemctl is-active systemd-nspawn@archlinux) = "active" ];do sleep 2s; done;
fi
# Remember non symlink path to card and render, symlink might get deleted
DRI_RENDER=$(readlink -f /dev/dri/by-path/pci-$VIRSH_GPU_VIDEO-render)
DRI_CARD=$(readlink -f /dev/dri/by-path/pci-$VIRSH_GPU_VIDEO-card)
# Send "remove" event so wayland compositors can release gpu, sleep because it doesnt work instantly
echo remove > /sys/bus/pci/devices/$VIRSH_GPU_VIDEO/drm/card*/uevent
sleep 3s
# Remove all permissions from DRI nodes so no new processes will attach to it, kill all processes currently using it
chmod 0 $DRI_RENDER
chmod 0 $DRI_CARD
fuser -k $DRI_RENDER
fuser -k $DRI_CARD
# Seems to fix reset bug for 7900 XTX
echo "0" > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/d3cold_allowed"
# Unbind GPU from drivers
echo ''$VIRSH_GPU_VIDEO > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/driver/unbind"
echo ''$VIRSH_GPU_AUDIO > "/sys/bus/pci/devices/''${VIRSH_GPU_AUDIO}/driver/unbind"
# Optionally resize bars, it's pointless for me since it's full size here but keeping just in case
echo "${bar0_guest}" > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/resource0_resize"
echo "${bar2_guest}" > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/resource2_resize"
# Compact memory if possible to make continuous space for transparent huge pages
sync
echo "3" > /proc/sys/vm/drop_caches
sync
echo "1" > /proc/sys/vm/compact_memory
# Set host cgroups and workqueue to use defined cpu cores (I'm using first half of cpu on host, second half on guest)
systemctl set-property --runtime -- user.slice AllowedCPUs=${hostCores}
systemctl set-property --runtime -- system.slice AllowedCPUs=${hostCores}
systemctl set-property --runtime -- init.scope AllowedCPUs=${hostCores}
echo "${hostCoresMask}" > /sys/bus/workqueue/devices/writeback/cpumask
# Set performance governor if not set
echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# Reduce interval of memory statistics to 120s from default 1s
sysctl vm.stat_interval=120
'';
stopHook = ''
# Debugging
# exec 19>/home/materus/stoplogfile
# BASH_XTRACEFD=19
# set -x
# exec 3>&1 4>&2
# trap 'exec 2>&4 1>&3' 0 1 2 3
# exec 1>/home/materus/stoplogfile.out 2>&1
# echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# Stop arch container, sometimes gpu doesnt return properly if it's active
if [ $(systemctl is-active systemd-nspawn@archlinux) = "active" ]; then
systemctl stop systemd-nspawn@archlinux;
sleep 5s;
while [ $(systemctl is-active systemd-nspawn@archlinux) = "active" ]; do sleep 2s; done;
fi
sysctl vm.stat_interval=1
sleep 1s
echo ''$VIRSH_GPU_VIDEO > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/driver/unbind"
echo ''$VIRSH_GPU_AUDIO > "/sys/bus/pci/devices/''${VIRSH_GPU_AUDIO}/driver/unbind"
echo "${bar0_host}" > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/resource0_resize"
echo "${bar2_host}" > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/resource2_resize"
echo "1" > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/d3cold_allowed"
echo ''$VIRSH_GPU_VIDEO > /sys/bus/pci/drivers/amdgpu/bind
echo ''$VIRSH_GPU_AUDIO > /sys/bus/pci/drivers/snd_hda_intel/bind
systemctl start windows-share-mount.service
systemctl set-property --runtime -- user.slice AllowedCPUs=${allCores}
systemctl set-property --runtime -- system.slice AllowedCPUs=${allCores}
systemctl set-property --runtime -- init.scope AllowedCPUs=${allCores}
echo "${allCoresMask}" > /sys/bus/workqueue/devices/writeback/cpumask
'';
in
{
services.udev.extraRules = ''
SUBSYSTEM=="kvmfr", OWNER="root", GROUP="kvm", MODE="0660"
'';
virtualisation.libvirtd.hooks.qemu = {
"windows-vfio" = pkgs.writeShellScript "windows.sh" ''
VIRSH_GPU_VIDEO="0000:03:00.0"
VIRSH_GPU_AUDIO="0000:03:00.1"
VIRSH_USB1="0000:10:00.0"
if [ ''$1 = "windows-vfio" ]; then
if [ ''$2 = "prepare" ] && [ ''$3 = "begin" ]; then
${startHook}
fi
#if [ ''$2 = "started" ] && [ ''$3 = "begin" ]; then
${startedHook}
#fi
if [ ''$2 = "release" ] && [ ''$3 = "end" ]; then
${stopHook}
fi
fi
'';
};
}
+578
View File
@@ -0,0 +1,578 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{
config,
lib,
pkgs,
mkk,
...
}:
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
{
services.displayManager = {
autoLogin.enable = true;
autoLogin.user = "materus";
plasma-login-manager.enable = true;
};
services.desktopManager.plasma6.enable = true;
services.desktopManager.plasma6.enableQt5Integration = true;
xdg.portal.enable = true;
xdg.portal.wlr.enable = true;
xdg.portal.xdgOpenUsePortal = true;
xdg.portal.extraPortals = [ pkgs.kdePackages.xdg-desktop-portal-kde ];
environment.plasma6.excludePackages = with pkgs.kdePackages; [
kwallet
kwalletmanager
kwallet-pam
];
environment.variables = {
QT_PLUGIN_PATH = [
"${pkgs.qt6.qtimageformats}/${pkgs.qt6.qtbase.qtPluginPrefix}"
"${pkgs.kdePackages.ffmpegthumbs}/${pkgs.qt6.qtbase.qtPluginPrefix}"
];
XCURSOR_THEME = "breeze_cursors";
};
environment.systemPackages = with pkgs.kdePackages; [
kolourpaint
kcolorchooser
kcolorpicker
ark
bluedevil
bluez-qt
kcalc
kcron
];
}
{
services.searx = {
enable = false;
settings = {
server.port = 7080;
server.secret_key = mkk.searx-key;
ui = {
static_use_hash = true;
default_locale = "pl";
query_in_title = true;
infinite_scroll = true;
center_alignment = true;
default_theme = "simple";
theme_args.simple_style = "auto";
search_on_category_select = false;
#hotkeys = "vim";
};
enabled_plugins = [
"Basic Calculator"
"Hash plugin"
"Tor check plugin"
"Open Access DOI rewrite"
"Hostnames plugin"
"Unit converter plugin"
"Tracker URL remover"
];
search = {
safe_search = 2;
autocomplete_min = 2;
autocomplete = "duckduckgo";
ban_time_on_fail = 5;
max_ban_time_on_fail = 120;
favicon_resolver = "duckduckgo";
};
outgoing = {
request_timeout = 1.0;
max_request_timeout = 15.0;
pool_connections = 100;
pool_maxsize = 15;
enable_http2 = true;
};
};
faviconsSettings = {
favicons = {
cfg_schema = 1;
cache = {
db_url = "/var/cache/searxng/faviconcache.db";
HOLD_TIME = 5184000;
LIMIT_TOTAL_BYTES = 536870912;
BLOB_MAX_BYTES = 40960;
MAINTENANCE_MODE = "auto";
MAINTENANCE_PERIOD = 600;
};
};
};
};
}
{
services.samba-wsdd.enable = true;
services.samba-wsdd.openFirewall = true;
services.samba = {
enable = true;
package = pkgs.sambaFull;
openFirewall = true;
settings = {
global = {
"workgroup" = "WORKGROUP";
"server string" = "smbmaterus";
"netbios name " = "smbmaterus";
"security" = "user";
"hosts allow" = "192.168.0. 192.168.122. 127.0.0.1 localhost";
"hosts deny" = "0.0.0.0/0";
"guest account" = "nobody";
"map to guest" = "bad user";
"allow insecure wide links" = "yes";
};
shared = {
"path" = "/mkk/mnt/data/share";
"browseable" = "yes";
"read only" = "no";
"guest ok" = "no";
"create mask" = "0644";
"directory mask" = "0755";
"force user" = "materus";
"force group" = "users";
"follow symlinks" = "yes";
"wide links" = "yes";
};
};
};
}
];
# Use the systemd-boot EFI boot loader.
boot.tmp.useTmpfs = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot/efi";
boot.loader.grub = {
enable = true;
efiSupport = true;
gfxmodeEfi = "1920x1080";
gfxmodeBios = "1920x1080";
device = "nodev";
useOSProber = true;
memtest86.enable = true;
};
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = true;
open = true;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
hardware.graphics = {
enable = true;
extraPackages = with pkgs; [
libva-vdpau-driver
nvidia-vaapi-driver
libvdpau-va-gl
];
extraPackages32 = with pkgs; [
libva-vdpau-driver
nvidia-vaapi-driver
libvdpau-va-gl
];
};
# Use latest kernel.
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_zen;
networking.hostName = "oldie"; # Define your hostname.
environment.systemPackages = with pkgs; [
tmux
waypipe
neovim
nano
fastfetch
brave
];
environment.enableAllTerminfo = true;
environment.pathsToLink = [
"/share/zsh"
"/share/bash-completion"
"/share/fish"
];
# Configure network connections interactively with nmcli or nmtui.
networking.networkmanager.enable = true;
programs.firefox.enable = true;
programs.java.enable = true;
services.flatpak.enable = true;
hardware.bluetooth.enable = true;
services.gvfs.enable = true;
programs.kdeconnect.enable = true;
services.fstrim = {
enable = true;
interval = "weekly";
};
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true;
extraPackages = with pkgs; [
vlc
libva
libva-utils
libva-vdpau-driver
mesa
mesa-demos
libvdpau-va-gl
nss
mkk.nixerus.pkgs.polymc
];
extraCompatPackages = [
pkgs.proton-ge-bin
];
package = pkgs.steam.override {
extraEnv = {
PRESSURE_VESSEL_FILESYSTEMS_RW = "\${XDG_RUNTIME_DIR}/wivrn/comp_ipc";
#PRESSURE_VESSEL_IMPORT_OPENXR_1_RUNTIMES="1";
};
extraLibraries =
p: with p; [
];
};
};
fonts.packages = [
pkgs.dejavu_fonts
pkgs.freefont_ttf
pkgs.gyre-fonts
pkgs.liberation_ttf
pkgs.unifont
pkgs.noto-fonts
pkgs.noto-fonts-color-emoji
pkgs.noto-fonts-cjk-sans
pkgs.noto-fonts-cjk-serif
pkgs.wqy_zenhei
pkgs.corefonts
pkgs.hack-font
pkgs.nerd-fonts.hack
pkgs.ubuntu-classic
pkgs.monocraft
pkgs.nerd-fonts.droid-sans-mono
pkgs.nerd-fonts.meslo-lg
pkgs.nerd-fonts.profont
pkgs.nerd-fonts.fira-code
];
fonts.enableDefaultPackages = lib.mkDefault true;
fonts.fontconfig.enable = lib.mkDefault true;
fonts.fontconfig.cache32Bit = lib.mkDefault true;
fonts.fontconfig.defaultFonts.sansSerif = [
"Noto Sans"
"DejaVu Sans"
"WenQuanYi Zen Hei"
"Noto Color Emoji"
];
fonts.fontconfig.defaultFonts.serif = [
"Noto Serif"
"DejaVu Serif"
"WenQuanYi Zen Hei"
"Noto Color Emoji"
];
fonts.fontconfig.defaultFonts.emoji = [
"Noto Color Emoji"
"OpenMoji Color"
];
fonts.fontconfig.defaultFonts.monospace = [
"Hack Nerd Font"
"Noto Sans Mono"
"WenQuanYi Zen Hei Mono"
];
fonts.fontDir.enable = lib.mkDefault true;
nixpkgs.config.allowUnfree = true;
nix.settings = {
experimental-features = lib.mkMerge [
[
"nix-command"
"flakes"
]
];
auto-optimise-store = true;
trusted-users = [
"root"
"@wheel"
];
substituters = [
"https://nix-community.cachix.org"
"https://cache.nixos.org/"
"https://nixerus.cachix.org/"
];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"nixerus.cachix.org-1:2x7sIG7y1vAoxc8BNRJwsfapZsiX4hIl4aTi9V5ZDdE="
];
};
# Set your time zone.
time.timeZone = "Europe/Warsaw";
users.users.materus = {
isNormalUser = true;
extraGroups = [
"audio"
"video"
"render"
"pipewire"
"wheel"
"networkmanager"
"input"
"kvm"
"libvirt-qemu"
"libvirt"
"libvirtd"
"podman"
"scanner"
"lp"
];
#shell = pkgs.zsh;
description = "Mateusz Słodkowicz";
#openssh.authorizedKeys.keyFiles = [ ("${materusArg.cfg.path}" + "/extraFiles/keys/ssh/materus.pub") ];
#hashedPasswordFile = config.sops.secrets."users/materus".path;
};
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
users.defaultUserShell = pkgs.zsh;
programs.zsh = {
enable = true;
enableGlobalCompInit = false;
interactiveShellInit = ''
if [[ ''${__MATERUS_HM_ZSH:-0} == 0 ]]; then
source ${pkgs.grml-zsh-config}/etc/zsh/zshrc
fi
'';
promptInit = "";
};
# Select internationalisation properties.
i18n.defaultLocale = "pl_PL.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "pl";
useXkbConfig = false; # use xkb.options in tty.
};
programs.git = {
enable = true;
lfs.enable = true;
};
programs.gnupg.agent = {
enable = true;
enableSSHSupport = false;
enableBrowserSocket = true;
};
# Enable the X11 windowing system.
services.xserver.enable = false;
programs.ssh.startAgent = true;
services.syncthing = {
enable = true;
user = "materus";
dataDir = "/home/materus";
};
# Configure keymap in X11
# services.xserver.xkb.layout = "us";
# services.xserver.xkb.options = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# services.pulseaudio.enable = true;
# OR
security.rtkit.enable = true;
services.pipewire = {
enable = true;
audio.enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
systemWide = true;
jack.enable = true;
};
virtualisation.podman = {
enable = true;
dockerCompat = true;
dockerSocket.enable = true;
};
virtualisation.libvirtd = {
enable = true;
onBoot = "ignore";
onShutdown = "shutdown";
qemu.runAsRoot = true;
qemu.swtpm.enable = true;
qemu.package = pkgs.qemu_full;
};
environment.sessionVariables = rec {
XDG_CACHE_HOME = "\${HOME}/.cache";
XDG_CONFIG_HOME = "\${HOME}/.config";
XDG_BIN_HOME = "\${HOME}/.local/bin";
XDG_DATA_HOME = "\${HOME}/.local/share";
#SSH_ASKPASS_REQUIRE = "prefer";
STEAM_EXTRA_COMPAT_TOOLS_PATHS = "\${HOME}/.steam/root/compatibilitytools.d";
MOZ_USE_XINPUT2 = "1";
PATH = [ "\${XDG_BIN_HOME}" ];
};
environment.shellInit = ''
if ! [ -z "$DISPLAY" ]; then ${pkgs.xhost}/bin/xhost +si:localuser:root &> /dev/null; fi;
if ! [ -z "$DISPLAY" ]; then ${pkgs.xhost}/bin/xhost +si:localuser:$USER &> /dev/null; fi;
'';
security.sudo = {
enable = true;
extraConfig = ''
Defaults pwfeedback
'';
};
i18n.inputMethod.enable = true;
i18n.inputMethod.type = "fcitx5";
i18n.inputMethod.fcitx5.addons = [
pkgs.qt6Packages.fcitx5-configtool
pkgs.fcitx5-lua
pkgs.fcitx5-mozc
pkgs.kdePackages.fcitx5-qt
];
# Enable touchpad support (enabled default in most desktopManager).
services.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
# users.users.alice = {
# isNormalUser = true;
# extraGroups = [ "wheel" ]; # Enable sudo for the user.
# packages = with pkgs; [
# tree
# ];
# };
# programs.firefox.enable = true;
# List packages installed in system profile.
# You can use https://search.nixos.org/ to find more packages (and options).
# environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
# ];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [
24800
5900
5357
4656
#region Syncthing
22000
config.services.syncthing.relay.statusPort
config.services.syncthing.relay.port
#endregion
];
networking.firewall.allowedUDPPorts = [
24800
5900
3702
4656
#region Syncthing
22000
21027
#endregion
];
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
# to actually do that.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
hardware.uinput.enable = true;
hardware.steam-hardware.enable = true;
sops.templates."networkmanager.env".content = ''
WIREGUARD_PRIVATEKEY="${config.sops.placeholder.wg-key}"
'';
networking.networkmanager.ensureProfiles.environmentFiles = [
config.sops.templates."networkmanager.env".path
];
networking.networkmanager.ensureProfiles.profiles = {
wg0 = {
connection = {
id = "PodKos";
type = "wireguard";
interface-name = "wg-podkos";
};
wireguard = {
private-key = "$WIREGUARD_PRIVATEKEY";
};
"wireguard-peer.${mkk.wireguard.peers.valkyrie.pubKey}" = {
endpoint = "${mkk.network.valkyrie.ip}:${mkk.wireguard.peers.valkyrie.port}";
allowed-ips = "${mkk.wireguard.ip-masks.main};${mkk.wireguard.ip-masks.guest};${mkk.wireguard.ip-masks.asia};${mkk.wireguard.peers.valkyrie.ip}/32;";
persistent-keepalive = "20";
};
ipv4 = {
address1 = "${mkk.wireguard.peers.oldie.ip}/32";
dns = "${mkk.wireguard.peers.valkyrie.ip};";
method = "manual";
never-default = "true";
};
ipv6 = {
addr-gen-mode = "stable-privacy";
method = "disabled";
};
proxy = { };
};
};
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "26.05"; # Did you read the comment?
}
+8
View File
@@ -0,0 +1,8 @@
{ ... }:
{
imports = [
./configuration.nix
./private
];
}
@@ -0,0 +1,113 @@
# 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,
...
}:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [
"xhci_pci"
"ehci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.supportedFilesystems = [ "ntfs" ];
boot.initrd.systemd.enable = true;
boot.initrd.luks.devices."DECRYPTED_ROOT".device =
"/dev/disk/by-uuid/5e23b356-3494-4640-8f20-6aad670ee77c";
boot.initrd.luks.devices."DECRYPTED_DATA" = {
device = "/dev/disk/by-uuid/793e74af-381e-434c-b2b6-01206cf6edfd";
keyFile = "/root/password:/dev/mapper/DECRYPTED_ROOT";
};
fileSystems."/" = {
device = "/dev/mapper/DECRYPTED_ROOT";
fsType = "btrfs";
options = [
"subvol=@"
"ssd"
"compress=zstd"
"space_cache=v2"
];
};
fileSystems."/var/log" = {
device = "/dev/mapper/DECRYPTED_ROOT";
fsType = "btrfs";
options = [
"subvol=@log"
"ssd"
"compress=zstd"
"space_cache=v2"
];
};
fileSystems."/home" = {
device = "/dev/mapper/DECRYPTED_DATA";
fsType = "btrfs";
options = [
"subvol=@home"
"nossd"
"compress=zstd"
"space_cache=v2"
];
};
fileSystems."/mkk/mnt/data" = {
device = "/dev/mapper/DECRYPTED_DATA";
fsType = "btrfs";
options = [
"subvol=@data"
"nossd"
"compress=zstd"
"space_cache=v2"
];
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/535d8814-8541-4ac2-9cfb-ed0bf3852b0c";
fsType = "ext4";
};
fileSystems."/boot/efi" = {
device = "/dev/disk/by-uuid/93EE-5783";
fsType = "vfat";
options = [
"fmask=0022"
"dmask=0022"
];
};
fileSystems."/etc/nixos" = {
device = "/mkk/config";
fsType = "none";
options = [ "bind" ];
depends = [ "/" ];
};
swapDevices = [
{ device = "/dev/disk/by-uuid/9a5795a9-8ddb-4be0-b8f7-e59270ba8db9"; }
];
zramSwap = {
enable = true;
memoryPercent = 50;
priority = 10;
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
@@ -0,0 +1,78 @@
{ pkgs, config, ... }:
{
home.stateVersion = "26.05";
mkk.dir = config.lib.file.mkOutOfStoreSymlink "/mkk/config";
mkk.neovim.enable = true;
home.packages = with pkgs; [
neovide
obsidian
git-crypt
tmux
telegram-desktop
discord
spotify
remmina
mesa-demos
vulkan-tools
nixfmt
nixd
eza
curl
wget
python3
packwiz
ani-cli
kitty
keepassxc
moonlight-qt
wezterm
(vivaldi.override { proprietaryCodecs = true; })
];
programs.mpv = {
enable = true;
config = {
ytdl-format = "bestvideo+bestaudio";
slang = "pl,pol,Polish,Polski,en,eng,English";
alang = "ja,jp,jpn,Japanese,pl,pol,Polski,en,eng,English";
demuxer-max-bytes = "500MiB";
demuxer-max-back-bytes = "150MiB";
cache = "yes";
cache-pause-wait = "10";
cache-pause-initial = "yes";
keep-open = "yes";
};
};
programs.vscode = {
enable = true;
mutableExtensionsDir = true;
};
programs.git = {
enable = true;
lfs.enable = true;
settings = {
user.email = "materus@podkos.pl";
user.name = "materus";
commit.gpgsign = true;
gpg.format = "ssh";
};
signing.signByDefault = true;
signing.key = "/mkk/config/extra-files/ssh/materus.pub";
};
programs.delta = {
enable = true;
enableGitIntegration = true;
};
programs.gitui.enable = true;
programs.yt-dlp.enable = true;
}
Binary file not shown.
Binary file not shown.
+180
View File
@@ -0,0 +1,180 @@
# 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, pkgs, mkk, materusArgs, config, ... }:
{
imports =
[
# Include the results of the hardware scan.
./hardware-configuration.nix
./services
./private
];
programs.zsh.enable = true;
environment.etc."current-flake".source = materusArgs.self;
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
# boot.loader.grub.efiSupport = true;
# boot.loader.grub.efiInstallAsRemovable = true;
# boot.loader.efi.efiSysMountPoint = "/boot/efi";
# Define on which hard drive you want to install Grub.
boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
networking.hostName = "valkyrie"; # Define your hostname.
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.networkmanager.enable = false;
# Set your time zone.
time.timeZone = "Europe/Warsaw";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
i18n.defaultLocale = "pl_PL.UTF-8";
console = {
font = "lat2-16";
keyMap = "pl";
useXkbConfig = false; # use xkbOptions in tty.
};
# Enable the X11 windowing system.
# services.xserver.enable = true;
# Configure keymap in X11
# services.xserver.layout = "us";
# services.xserver.xkbOptions = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# sound.enable = true;
# hardware.pulseaudio.enable = true;
# Enable touchpad support (enabled default in most desktopManager).
services.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.materus = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable sudo for the user.
packages = [
];
openssh.authorizedKeys.keyFiles = [ "${mkk.files.ssh-keys.materus}" ];
shell = pkgs.zsh;
};
users.users.acme.openssh.authorizedKeys.keyFiles = [ "${mkk.files.ssh-keys.waffentrager}" ];
users.users.acme.shell = pkgs.scponly;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
wget
nano
git
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.openssh.openFirewall = false;
services.openssh.settings.PermitRootLogin = "no";
services.openssh.settings.PasswordAuthentication = false;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
networking.firewall.enable = true;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# 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 = "23.05"; # Did you read the comment?
services.nginx = {
enable = true;
package = pkgs.tengine;
recommendedTlsSettings = true;
recommendedOptimisation = true;
recommendedGzipSettings = true;
};
virtualisation.podman.autoPrune.enable = true;
virtualisation.podman.autoPrune.dates = "daily";
virtualisation.oci-containers.backend = "podman";
nix.settings = {
experimental-features = lib.mkMerge [
[
"nix-command"
"flakes"
]
];
auto-optimise-store = true;
trusted-users = [
"root"
"@wheel"
];
substituters = [
"https://nix-community.cachix.org"
"https://cache.nixos.org/"
"https://nixerus.cachix.org/"
];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"nixerus.cachix.org-1:2x7sIG7y1vAoxc8BNRJwsfapZsiX4hIl4aTi9V5ZDdE="
];
};
security.acme.acceptTerms = true;
security.acme.defaults.email = "materus+acme@podkos.pl";
security.acme.defaults.credentialFiles.OVH_FILE = config.sops.secrets.certs.path;
security.acme.defaults.dnsResolver = "9.9.9.9:53";
security.acme.certs."materus.pl" = {
domain = "materus.pl";
group = "nginx";
extraDomainNames = [ "*.materus.pl" ];
dnsProvider = "ovh";
};
security.acme.certs."podkos.pl" = {
domain = "podkos.pl";
group = "nginx";
extraDomainNames = [ "*.podkos.pl" ];
dnsProvider = "ovh";
};
}
@@ -0,0 +1,40 @@
# 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.
{ lib, modulesPath, ... }:
{
imports =
[
(modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "virtio_pci" "floppy" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ ];
boot.kernel.sysctl = { "net.ipv4.ip_forward" = 1; "net.ipv6.conf.all.forwarding" = 1; };
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
boot.tmp.useTmpfs = true;
fileSystems."/" =
{
device = "/dev/disk/by-uuid/924b1a69-2256-444f-baf6-d2d9405e451d";
fsType = "ext4";
};
swapDevices = [
{
device = "/swapfile";
size = 4 * 1024;
}
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = false;
networking.nameservers = [ "9.9.9.9" "1.1.1.1" "8.8.8.8" ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}
@@ -0,0 +1,5 @@
{ ... }:
{
home.stateVersion = "23.05";
home.homeDirectory = "/home/materus";
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,37 @@
{
config,
lib,
mkk,
...
}:
{
options.valkyrieService.dcbot.enable = mkk.lib.mkBoolOpt false "Enable muse bot";
config =
let
cfg = config.valkyrieService.dcbot;
in
lib.mkIf cfg.enable {
sops.templates."muse.env".content = ''
CACHE_LIMIT=512MB
BOT_STATUS=online
BOT_ACTIVITY_TYPE=LISTENING
BOT_ACTIVITY=Coś
DISCORD_TOKEN=${config.sops.placeholder.discord-token}
YOUTUBE_API_KEY=${config.sops.placeholder.youtube-api}
SPOTIFY_CLIENT_ID=${config.sops.placeholder.spotify-client-id}
SPOTIFY_CLIENT_SECRET=${config.sops.placeholder.spotify-client-secret}
'';
systemd.tmpfiles.rules = [
"d /var/lib/muse 0776 root root -"
];
virtualisation.oci-containers.containers.dcbot = {
image = "sl33ping/muse:pr-1195";
volumes = [ "/var/lib/muse:/data" ];
environmentFiles = [ config.sops.templates."muse.env".path ];
};
};
}
@@ -0,0 +1,17 @@
{ config, pkgs, ... }:
{
imports =
[
./pleroma.nix
./pihole.nix
./dcbot.nix
./secureyoursoul.nix
];
services.adguardhome.enable = true;
valkyrieService.pihole.enable = false;
valkyrieService.pleroma.enable = false;
valkyrieService.dcbot.enable = true;
valkyrieService.secureyoursoul.enable = true;
}
@@ -0,0 +1,56 @@
{ config, pkgs, lib, mkk, ... }:
{
options.valkyrieService.pihole.enable = mkk.lib.mkBoolOpt false "Enable pihole";
options.valkyrieService.pihole.dnsIP = lib.mkOption { default = "127.0.0.1"; };
options.valkyrieService.pihole.webIP = lib.mkOption { default = "127.0.0.1"; };
config =
let
cfg = config.valkyrieService.pihole;
dnsmasqConf = pkgs.writeText "02-dnsmasq-custom.conf" ''
no-hosts
'';
in
lib.mkIf config.valkyrieService.pihole.enable {
systemd.tmpfiles.rules = [
"d /var/lib/dnsmasq.d 0776 root root -"
"d /var/lib/pihole 0776 root root -"
"L+ /var/lib/dnsmasq.d/02-dnsmasq-custom.conf 0776 root root - ${dnsmasqConf}"
];
virtualisation.oci-containers.containers.pihole = {
image = "pihole/pihole:latest";
ports =
[
"${cfg.dnsIP}:53:53/tcp"
"${cfg.dnsIP}:53:53/udp"
"${cfg.webIP}:3000:80"
];
environment = {
TZ = "Europe/Warsaw";
FTLCONF_LOCAL_IPV4 = "127.0.0.1";
DNSMASQ_USER = "root";
VIRTUAL_HOST = "pi.hole";
PROXY_LOCATION = "pi.hole";
};
volumes = [
"/var/lib/pihole/:/etc/pihole/"
"/var/lib/dnsmasq.d:/etc/dnsmasq.d/"
"/nix/store:/nix/store"
];
extraOptions =
[
"--cap-add=NET_ADMIN"
"--dns=127.0.0.1"
"--dns=9.9.9.9"
"--hostname=pi.hole"
];
};
};
}
@@ -0,0 +1,149 @@
{ config, pkgs, lib, mkk, ... }:
let
socketPath = "/run/pleroma/http.sock";
socketChmod = with pkgs; with lib; pkgs.writers.writeBashBin "pleroma-socket"
''
coproc {
${inotify-tools}/bin/inotifywait -q -m -e create ${escapeShellArg (dirOf socketPath)}
}
trap 'kill "$COPROC_PID"' EXIT TERM
until ${pkgs.coreutils}/bin/test -S ${escapeShellArg socketPath}
do read -r -u "''${COPROC[0]}"
done
${pkgs.coreutils}/bin/chmod 0666 ${socketPath}
'';
soapbox = pkgs.stdenv.mkDerivation rec {
pname = "soapbox";
version = "v3.2.0";
dontBuild = true;
dontConfigure = true;
src = pkgs.fetchurl {
name = "soapbox";
url = "https://gitlab.com/soapbox-pub/soapbox/-/jobs/artifacts/${version}/download?job=build-production";
sha256 = "sha256-AdW6JK7JkIKLZ8X+N9STeOHqmGNUdhcXyC9jsQPTa9o=";
};
nativeBuildInputs = [ pkgs.unzip ];
unpackPhase = ''
unzip $src -d .
'';
installPhase = ''
mv ./static $out
'';
};
in
{
options.valkyrieService.pleroma.enable = mkk.lib.mkBoolOpt false "Enable pleroma";
config = lib.mkIf config.valkyrieService.pleroma.enable {
systemd.tmpfiles.rules = [
"d /var/lib/pleroma 0766 pleroma pleroma -"
"d /var/lib/pleroma/static 0766 pleroma pleroma -"
"d /var/lib/pleroma/uploads 0766 pleroma pleroma -"
"L+ /var/lib/pleroma/static/frontends/soapbox/${soapbox.version} 0766 pleroma pleroma - ${soapbox}"
];
services.nginx.virtualHosts."podkos.xyz" = {
http2 = true;
useACMEHost = "podkos.xyz";
forceSSL = true;
locations."/" = {
proxyPass = "http://unix:${socketPath}";
extraConfig = ''
etag on;
gzip on;
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'POST, PUT, DELETE, GET, PATCH, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, Idempotency-Key' always;
add_header 'Access-Control-Expose-Headers' 'Link, X-RateLimit-Reset, X-RateLimit-Limit, X-RateLimit-Remaining, X-Request-Id' always;
if ($request_method = OPTIONS) {
return 204;
}
add_header X-XSS-Protection "1; mode=block";
add_header X-Permitted-Cross-Domain-Policies none;
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
add_header Referrer-Policy same-origin;
add_header X-Download-Options noopen;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
client_max_body_size 8m;
'';
};
};
systemd.services.pleroma.serviceConfig = {
RuntimeDirectory = "pleroma";
RuntimeDirectoryPreserve = true;
ExecStartPost = "${socketChmod}/bin/pleroma-socket";
ExecStopPost = ''${pkgs.coreutils}/bin/rm -f ${socketPath}'';
};
services.pleroma = {
enable = true;
secretConfigFile = "/var/lib/pleroma/secrets.exs";
configs = [
''
import Config
config :pleroma, Pleroma.Web.Endpoint,
url: [host: "podkos.xyz", scheme: "https", port: 443],
http: [ip: {:local, "${socketPath}"}, port: 0]
config :pleroma, :instance,
name: "Podziemia Kosmosu",
email: "admin@podkos.xyz",
notify_email: "noreply@podkos.xyz",
limit: 5000,
registrations_open: false
config :pleroma, :media_proxy,
enabled: false,
redirect_on_failure: true
config :pleroma, Pleroma.Repo,
adapter: Ecto.Adapters.Postgres,
socket: "/run/postgresql/.s.PGSQL.5432",
username: "pleroma",
database: "pleroma"
# Configure web push notifications
config :web_push_encryption, :vapid_details,
subject: "mailto:admin@podkos.x yz"
config :pleroma, :frontends,
primary: %{
"name" => "soapbox",
"ref" => "${soapbox.version}"
}
config :pleroma, :database, rum_enabled: false
config :pleroma, :instance, static_dir: "/var/lib/pleroma/static"
config :pleroma, Pleroma.Uploaders.Local, uploads: "/var/lib/pleroma/uploads"
config :pleroma, configurable_from_database: true
config :pleroma, Pleroma.Upload, filters: [Pleroma.Upload.Filter.AnonymizeFilename]
''
];
};
};
}
@@ -0,0 +1,141 @@
{ config, pkgs, lib, mkk, ... }:
{
options.valkyrieService.secureyoursoul.enable = mkk.lib.mkBoolOpt false "Enable secureyoursoul, web archive";
config =
let
cfg = config.valkyrieService.secureyoursoul;
in
lib.mkIf cfg.enable {
systemd.timers.secureyoursoul-steam = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "*-*-1,7,14,21 3:00:00";
Persistent = true;
Unit = "secureyoursoul-steam.service";
};
};
systemd.timers.secureyoursoul-p1 = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "*-*-3,9,16,23 3:00:00";
Persistent = true;
Unit = "secureyoursoul-p1.service";
};
};
systemd.timers.secureyoursoul-p2 = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "*-*-5,11,18,25 3:00:00";
Persistent = true;
Unit = "secureyoursoul-p2.service";
};
};
systemd.services.secureyoursoul-steam = {
description = "Make curl requests to archive steam related things";
path = [ pkgs.coreutils pkgs.util-linux pkgs.curl ];
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = false;
script = ''
STEAM_IDS=( ${ builtins.foldl' (x: y: x +"\""+ y + "\" ") "" mkk.to_save.steamids })
EXTRA_LINKS=( ${ builtins.foldl' (x: y: x +"\""+ y + "\" ") "" mkk.to_save.extraLinks-steam })
steamladder() {
for id in ''${STEAM_IDS[@]}; do
curl -X POST -H "Authorization: Token ''$(cat ${config.sops.secrets.steamladder-api.path})" \
"https://steamladder.com/api/v1/profile/$id/"
done;
}
webarchive(){
for id in ''${STEAM_IDS[@]}; do
curl -X POST -H "Accept: application/json" \
-H "Authorization: LOW ''$(cat ${config.sops.secrets.webarchive-accesskey.path}):''$(cat ${config.sops.secrets.webarchive-secretkey.path})" \
-d"url=https://steamcommunity.com/profiles/$id" \
-d"capture_outlinks=1" \
-d"capture_screenshot=on" \
-d"capture_all=on" \
"https://web.archive.org/save";
sleep 180;
done;
for link in ''${EXTRA_LINKS[@]}; do
curl -X POST -H "Accept: application/json" \
-H "Authorization: LOW ''$(cat ${config.sops.secrets.webarchive-accesskey.path}):''$(cat ${config.sops.secrets.webarchive-secretkey.path})" \
-d"url=$link" \
-d"capture_outlinks=1" \
-d"capture_screenshot=on" \
-d"capture_all=on" \
"https://web.archive.org/save";
sleep 180;
done;
}
steamladder &
webarchive
wait
'';
};
systemd.services.secureyoursoul-p1 = {
description = "Make curl requests to archive related things";
path = [ pkgs.coreutils pkgs.util-linux pkgs.curl ];
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = false;
script = ''
EXTRA_LINKS=( ${ builtins.foldl' (x: y: x +"\""+ y + "\" ") "" mkk.to_save.extraLinks1 })
webarchive(){
for link in ''${EXTRA_LINKS[@]}; do
curl -X POST -H "Accept: application/json" \
-H "Authorization: LOW ''$(cat ${config.sops.secrets.webarchive-accesskey.path}):''$(cat ${config.sops.secrets.webarchive-secretkey.path})" \
-d"url=$link" \
-d"capture_outlinks=1" \
-d"capture_screenshot=on" \
-d"capture_all=on" \
"https://web.archive.org/save";
sleep 180;
done;
}
webarchive
'';
};
systemd.services.secureyoursoul-p2 = {
description = "Make curl requests to archive related things - part 2";
path = [ pkgs.coreutils pkgs.util-linux pkgs.curl ];
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = false;
script = ''
EXTRA_LINKS=( ${ builtins.foldl' (x: y: x +"\""+ y + "\" ") "" mkk.to_save.extraLinks2 })
webarchive(){
for link in ''${EXTRA_LINKS[@]}; do
curl -X POST -H "Accept: application/json" \
-H "Authorization: LOW ''$(cat ${config.sops.secrets.webarchive-accesskey.path}):''$(cat ${config.sops.secrets.webarchive-secretkey.path})" \
-d"url=$link" \
-d"capture_outlinks=1" \
-d"capture_screenshot=on" \
-d"capture_all=on" \
"https://web.archive.org/save";
sleep 180;
done;
}
webarchive
'';
};
};
}
@@ -0,0 +1,168 @@
# 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, mkk, lib, materusArgs, ... }:
{
imports =
[
# Include the results of the hardware scan.
./hardware-configuration.nix
];
networking.firewall.allowedTCPPorts = [ 1900 ];
networking.firewall.allowedUDPPorts = [ 1900 7359];
environment.etc."current-flake".source = materusArgs.self;
nix.settings = {
experimental-features = lib.mkMerge [
[
"nix-command"
"flakes"
]
];
auto-optimise-store = true;
trusted-users = [
"root"
"@wheel"
];
substituters = [
"https://nix-community.cachix.org"
"https://cache.nixos.org/"
"https://nixerus.cachix.org/"
];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"nixerus.cachix.org-1:2x7sIG7y1vAoxc8BNRJwsfapZsiX4hIl4aTi9V5ZDdE="
];
};
environment.systemPackages = with pkgs; [
libraspberrypi
raspberrypi-eeprom
git
p7zip
unrar
bzip2
unzip
zstd
xz
zip
gzip
];
boot.tmp.useTmpfs = true;
services.xserver.enable = false;
networking.hostName = "waffentrager";
services.openssh.enable = true;
services.openssh.settings.PermitRootLogin = "no";
users.users.materus = {
isNormalUser = true;
extraGroups = [ "wheel" ];
openssh.authorizedKeys.keyFiles = [ mkk.files.ssh-keys.materus ];
hashedPasswordFile = config.sops.secrets."users/materus".path;
shell = pkgs.zsh;
};
# Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
boot.loader.grub.enable = false;
# Enables the generation of /boot/extlinux/extlinux.conf
boot.loader.generic-extlinux-compatible.enable = true;
# networking.hostName = "nixos"; # Define your hostname.
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Set your time zone.
# time.timeZone = "Europe/Amsterdam";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# useXkbConfig = true; # use xkbOptions in tty.
# };
# Enable the X11 windowing system.
# services.xserver.enable = true;
# Configure keymap in X11
# services.xserver.layout = "us";
# services.xserver.xkbOptions = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# sound.enable = true;
# hardware.pulseaudio.enable = true;
# Enable touchpad support (enabled default in most desktopManager).
services.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
# users.users.alice = {
# isNormalUser = true;
# extraGroups = [ "wheel" ]; # Enable sudo for the user.
# packages = with pkgs; [
# firefox
# tree
# ];
# };
# List packages installed in system profile. To search, run:
# $ nix search wget
# environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
# ];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
nixpkgs.config.allowUnfree = true;
programs.zsh.enable = true;
system.stateVersion = "23.11"; # Did you read the comment?
}
+18
View File
@@ -0,0 +1,18 @@
{ config, pkgs, ... }:
{
imports = [
./configuration.nix
./private
./services
];
virtualisation.podman.autoPrune.enable = true;
virtualisation.podman.autoPrune.dates = "daily";
virtualisation.podman.defaultNetwork.settings = {
default_subnet = "10.88.0.0/16";
};
virtualisation.oci-containers.backend = "podman";
}
@@ -0,0 +1,52 @@
# 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, materusArgs, ... }:
let
crossPkgs = import pkgs.path {
localSystem = "x86_64-linux";
crossSystem = pkgs.stdenv.hostPlatform.system;
};
rpi4-kernel =
crossPkgs.callPackage (materusArgs.inputs.nixos-hardware.outPath + "/raspberry-pi/common/kernel.nix")
{
rpiVersion = 4;
};
in
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
materusArgs.inputs.nixos-hardware.nixosModules.raspberry-pi-4
];
#boot.kernelPackages = pkgs.linuxPackagesFor materusArgs.inputs.nixos-hardware.packages.aarch64-linux.rpi4-kernel;
boot.kernelPackages = crossPkgs.linuxPackagesFor rpi4-kernel;
boot.initrd.availableKernelModules = [ "xhci_pci" "usb_storage" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
boot.kernel.sysctl = {
"vm.swappiness" = 10;
};
fileSystems."/" =
{
device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888";
fsType = "ext4";
};
swapDevices = [{
device = "/var/.swapfile";
size = 8 * 1024;
}];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.end0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlan0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = "aarch64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
}
@@ -0,0 +1,5 @@
{ config, pkgs, lib, ... }:
{
home.stateVersion = "23.11";
home.homeDirectory = "/home/materus";
}
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,80 @@
{ config, pkgs, lib, mkk, ... }:
{
options.waffentragerService.auth.authelia.enable = mkk.lib.mkBoolOpt false "Enable authelia";
config =
let
cfg = config.waffentragerService.auth.authelia;
port = 9091;
in
lib.mkIf cfg.enable {
sops.secrets."authelia-storagekey" = { owner = "authelia"; };
sops.secrets."authelia-database" = { owner = "authelia"; };
sops.secrets."ldap-master" = { owner = "authelia"; };
users.users.authelia = {
group = "lldap";
isSystemUser = true;
};
services.authelia.instances.main = {
enable = true;
user = "authelia";
environmentVariables = {
AUTHELIA_AUTHENTICATION_BACKEND_LDAP_PASSWORD_FILE = config.sops.secrets."ldap-master".path;
AUTHELIA_STORAGE_POSTGRES_PASSWORD_FILE = config.sops.secrets."authelia-database".path;
};
secrets = {
jwtSecretFile = config.sops.secrets.jwt.path;
storageEncryptionKeyFile = config.sops.secrets."authelia-storagekey".path;
};
settings = {
access_control = {
default_policy = "one_factor";
};
authentication_backend = {
ldap.url = "ldap://127.0.0.1:3890";
ldap.implementation = "custom";
ldap.base_dn = config.services.lldap.settings.ldap_base_dn;
ldap.user = "CN=master,ou=people,DC=podkos,DC=pl";
ldap.additional_users_dn = "OU=people";
ldap.users_filter = "(&({username_attribute}={input})(objectClass=person))";
ldap.additional_groups_dn = "OU=groups";
ldap.groups_filter = "(&(member={dn})(objectClass=groupOfNames))";
};
storage = {
postgres.host = "/var/run/postgresql";
postgres.port = "5432";
postgres.database = "authelia";
postgres.username = "authelia";
};
notifier = {
disable_startup_check = false;
filesystem.filename = "/tmp/test_notification.txt";
};
session = {
name = "materus-session";
domain = "materus.pl";
};
default_redirection_url = "https://materus.pl";
server.port = port;
};
};
services.nginx.virtualHosts."gatekeeper.materus.pl" = {
forceSSL = true;
http3 = true;
sslTrustedCertificate = "/var/lib/mnt_acme/materus.pl/chain.pem";
sslCertificateKey = "/var/lib/mnt_acme/materus.pl/key.pem";
sslCertificate = "/var/lib/mnt_acme/materus.pl/fullchain.pem";
locations."/" = {
proxyPass = "http://127.0.0.1:${builtins.toString port}";
extraConfig = ''
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
'';
};
};
};
}
@@ -0,0 +1,13 @@
{ config, lib, pkgs, ... }:
{
imports =
[
./lldap.nix
./authelia.nix
];
config =
{
waffentragerService.auth.lldap.enable = true;
waffentragerService.auth.authelia.enable = true;
};
}
@@ -0,0 +1,87 @@
{
config,
pkgs,
lib,
mkk,
...
}:
{
options.waffentragerService.auth.lldap.enable = mkk.lib.mkBoolOpt false "Enable lldap";
config =
let
cfg = config.waffentragerService.auth.lldap;
in
lib.mkIf cfg.enable {
waffentragerService.elements.enable = true;
waffentragerService.nginx.enable = true;
services.nginx.virtualHosts."mamba.podkos.pl" = {
forceSSL = true;
http3 = true;
sslTrustedCertificate = "/var/lib/mnt_acme/mamba.podkos.pl/chain.pem";
sslCertificateKey = "/var/lib/mnt_acme/mamba.podkos.pl/key.pem";
sslCertificate = "/var/lib/mnt_acme/mamba.podkos.pl/fullchain.pem";
locations."/" = {
proxyPass = "http://127.0.0.1:17170";
extraConfig = ''
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
allow ${mkk.wireguard.ip-masks.main};
allow 192.168.100.0/24;
deny all;
'';
};
};
systemd.services.lldap = {
requires = [ "elements-mount.service" ];
after = [ "elements-mount.service" ];
serviceConfig = {
DynamicUser = lib.mkForce false;
WorkingDirectory = lib.mkForce config.waffentragerService.elements.lldapDir;
};
};
users.groups.lldap = { };
users.users.lldap = {
group = "lldap";
isSystemUser = true;
};
sops.secrets.jwt = {
owner = "lldap";
group = "lldap";
mode = "0440";
};
sops.secrets."lldap-database" = {
owner = "lldap";
group = "lldap";
};
services.lldap.enable = true;
services.lldap.environmentFile = config.sops.templates."lldap.env".path;
sops.templates."lldap.env" = {
content = ''
LLDAP_JWT_SECRET_FILE="${config.sops.secrets.jwt.path}"
LLDAP_DATABASE_URL="postgres://lldap:${
config.sops.placeholder."lldap-database"
}@%2Fvar%2Frun%2Fpostgresql/lldap"
'';
owner = "lldap";
group = "lldap";
};
services.lldap.silenceForceUserPassResetWarning = true;
services.lldap.settings = {
ldap_base_dn = "dc=podkos,dc=pl";
ldap_host = "127.0.0.1";
http_url = "https://mamba.podkos.pl";
ldap_user_dn = "master";
ldap_user_email = "materus@podkos.pl";
ldap_port = 3890;
key_seed = mkk.waffentrager.lldap.seed;
ldap_user_pass_file = config.sops.secrets.LLDAP_LDAP_USER_PASS_FILE.path;
};
};
}
@@ -0,0 +1,30 @@
{ ... }:
{
imports =
[
./storage/elements.nix
./storage/mount-acme.nix
./storage/gitea.nix
./storage/nextcloud.nix
./storage/samba.nix
./storage/syncthing.nix
./multimedia/jellyfin.nix
./multimedia/scrobbling.nix
./monitoring.nix
./nginx.nix
./postgresql.nix
./auth
];
waffentragerService.elements.enable = true;
waffentragerService.postgresql.enable = true;
waffentragerService.mount-acme.enable = true;
waffentragerService.gitea.enable = true;
waffentragerService.nginx.enable = true;
waffentragerService.nextcloud.enable = true;
waffentragerService.samba.enable = true;
waffentragerService.jellyfin.enable = true;
waffentragerService.scrobbling.enable = true;
waffentragerService.syncthing.enable = true;
waffentragerService.monitoring.enable = false;
}
@@ -0,0 +1,57 @@
{ config, lib, mkk, ... }:
{
options.waffentragerService.monitoring.enable = mkk.lib.mkBoolOpt false "Enable monitoring";
config =
let
cfg = config.waffentragerService.monitoring;
in
lib.mkIf cfg.enable {
services.grafana = {
dataDir = "${config.waffentragerService.elements.path}/services/grafana";
enable = true;
settings = {
server = {
http_addr = "127.0.0.1";
http_port = 3232;
domain = "watchman.materus.pl";
serve_from_sub_path = true;
};
};
};
services.prometheus = {
enable = true;
port = 3233;
globalConfig.scrape_interval = "30s";
stateDir = "elements/services/prometheus";
scrapeConfigs = [
{
job_name = "node";
static_configs = [{
targets = [ "localhost:${toString config.services.prometheus.exporters.node.port}" ];
}];
}
];
};
services.prometheus.exporters.node = {
enable = true;
port = 3234;
enabledCollectors = [ "systemd" ];
extraFlags = [ "--collector.ethtool" "--collector.softirqs" "--collector.tcpstat" "--collector.wifi" ];
};
services.nginx.virtualHosts."watchman.materus.pl" = {
addSSL = true;
sslTrustedCertificate = "/var/lib/mnt_acme/materus.pl/chain.pem";
sslCertificateKey = "/var/lib/mnt_acme/materus.pl/key.pem";
sslCertificate = "/var/lib/mnt_acme/materus.pl/fullchain.pem";
http2 = false;
http3 = true;
locations."/" = {
proxyPass = "http://${toString config.services.grafana.settings.server.http_addr}:${toString config.services.grafana.settings.server.http_port}";
proxyWebsockets = true;
recommendedProxySettings = true;
};
};
};
}
@@ -0,0 +1,150 @@
{ lib, config, mkk, ... }:
{
options.waffentragerService.jellyfin.enable = mkk.lib.mkBoolOpt false "Enable jellyfin";
config =
let
cfg = config.waffentragerService.jellyfin;
in
lib.mkIf cfg.enable {
services.jellyfin = rec {
enable = true;
openFirewall = true;
user = "materus";
group = "nextcloud";
dataDir = config.waffentragerService.elements.jellyfinDir;
cacheDir = "${dataDir}/cache";
};
/*
services.jellyseerr = {
enable = true;
openFirewall = true;
};*/
services.nginx = {
appendHttpConfig = ''
map $request_uri $h264Level { ~(h264-level=)(.+?)& $2; }
map $request_uri $h264Profile { ~(h264-profile=)(.+?)& $2; }
'';
proxyCachePath."jellyfin" = {
enable = true;
maxSize = "1g";
levels = "1:2";
keysZoneName = "jellyfin";
keysZoneSize = "100m";
inactive = "1d";
useTempPath = false;
};
virtualHosts = {
"noot.materus.pl" = {
extraConfig = ''
client_max_body_size 20M;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "0"; # Do NOT enable. This is obsolete/dangerous
add_header X-Content-Type-Options "nosniff";
add_header Permissions-Policy "accelerometer=(), ambient-light-sensor=(), battery=(), bluetooth=(), camera=(), clipboard-read=(), display-capture=(), document-domain=(), encrypted-media=(), gamepad=(), geolocation=(), gyroscope=(), hid=(), idle-detection=(), interest-cohort=(), keyboard-map=(), local-fonts=(), magnetometer=(), microphone=(), payment=(), publickey-credentials-get=(), serial=(), sync-xhr=(), usb=(), xr-spatial-tracking=()" always;
'';
sslTrustedCertificate = "/var/lib/mnt_acme/materus.pl/chain.pem";
sslCertificateKey = "/var/lib/mnt_acme/materus.pl/key.pem";
sslCertificate = "/var/lib/mnt_acme/materus.pl/fullchain.pem";
addSSL = true;
http2 = false;
http3 = true;
locations."~ /Items/(.*)/Images" = {
proxyPass = "http://127.0.0.1:8096";
extraConfig = ''
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_cache jellyfin;
proxy_cache_revalidate on;
proxy_cache_lock on;
'';
};
locations."~ ^/web/htmlVideoPlayer-plugin.[0-9a-z]+.chunk.js$" = {
proxyPass = "http://127.0.0.1:8096";
extraConfig = ''
proxy_set_header Accept-Encoding "";
sub_filter_types *;
sub_filter 'return u=30' 'return u=600';
sub_filter 'return u=6' 'return u=60';
sub_filter 'maxBufferLength:u' 'maxBufferLength:u,maxBufferSize:180000000';
sub_filter_once on;
'';
};
locations."~* ^/Videos/(.*)/(?!live)" = {
proxyPass = "http://127.0.0.1:8096";
extraConfig = ''
# Set size of a slice (this amount will be always requested from the backend by nginx)
# Higher value means more latency, lower more overhead
# This size is independent of the size clients/browsers can request
slice 2m;
proxy_cache jellyfin;
proxy_cache_valid 200 206 301 302 30d;
proxy_ignore_headers Expires Cache-Control Set-Cookie X-Accel-Expires;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
proxy_connect_timeout 15s;
proxy_http_version 1.1;
proxy_set_header Connection "";
# Transmit slice range to the backend
proxy_set_header Range $slice_range;
# This saves bandwidth between the proxy and jellyfin, as a file is only downloaded one time instead of multiple times when multiple clients want to at the same time
# The first client will trigger the download, the other clients will have to wait until the slice is cached
# Esp. practical during SyncPlay
proxy_cache_lock on;
proxy_cache_lock_age 60s;
proxy_cache_key "jellyvideo$uri?MediaSourceId=$arg_MediaSourceId&VideoCodec=$arg_VideoCodec&AudioCodec=$arg_AudioCodec&AudioStreamIndex=$arg_AudioStreamIndex&VideoBitrate=$arg_VideoBitrate&AudioBitrate=$arg_AudioBitrate&SubtitleMethod=$arg_SubtitleMethod&TranscodingMaxAudioChannels=$arg_TranscodingMaxAudioChannels&RequireAvc=$arg_RequireAvc&SegmentContainer=$arg_SegmentContainer&MinSegments=$arg_MinSegments&BreakOnNonKeyFrames=$arg_BreakOnNonKeyFrames&h264-profile=$h264Profile&h264-level=$h264Level&slicerange=$slice_range";
'';
};
locations."/" = {
proxyPass = "http://127.0.0.1:8096";
extraConfig = ''
proxy_pass_request_headers on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
'';
};
locations."/socket" = {
proxyPass = "http://127.0.0.1:8096";
extraConfig = ''
proxy_pass_request_headers on;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
'';
};
};
};
};
};
}
@@ -0,0 +1,240 @@
{ config, pkgs, lib, mkk, ... }:
{
options.waffentragerService.scrobbling.enable = mkk.lib.mkBoolOpt false "Enable scrobbling";
config =
let
cfg = config.waffentragerService.scrobbling;
in
#### MALOJA --------------------------------------------------------------------
lib.mkIf cfg.enable {
sops.templates."maloja.env".content = ''
MALOJA_DATA_DIRECTORY=/data
MALOJA_DIRECTORY_STATE=/data/state
MALOJA_DIRECTORY_CACHE=/data/cache
MALOJA_SKIP_SETUP=yes
MALOJA_FORCE_PASSWORD=${config.sops.placeholder.maloja}
MALOJA_SPOTIFY_API_ID=${config.sops.placeholder.spotify-client-id}
MALOJA_SPOTIFY_API_SECRET=${config.sops.placeholder.spotify-client-secret}
MALOJA_NAME=Melody
MALOJA_WEEK_OFFSET=1
PUID=${builtins.toString config.users.users.scrobbler.uid}
PGID=${builtins.toString config.users.groups.scrobbler.gid}
TC=Europe/Warsaw
TIMEZONE=Europe/Warsaw
'';
services.nginx.virtualHosts = {
"melody.materus.pl" = {
sslTrustedCertificate = "/var/lib/mnt_acme/materus.pl/chain.pem";
sslCertificateKey = "/var/lib/mnt_acme/materus.pl/key.pem";
sslCertificate = "/var/lib/mnt_acme/materus.pl/fullchain.pem";
addSSL = true;
http2 = false;
http3 = true;
locations."/" = {
proxyPass = "http://127.0.0.1:42010";
extraConfig = ''
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
'';
};
};
};
virtualisation.oci-containers.containers.maloja =
{
image = "krateng/maloja:latest";
ports = [
"42010:42010"
];
volumes = [
"${config.waffentragerService.elements.malojaDir}:/data"
];
environmentFiles = [
config.sops.templates."maloja.env".path
];
};
systemd.services."${config.virtualisation.oci-containers.backend}-maloja" =
let
malojaCfg = pkgs.writeText "settings.ini" ''[MALOJA]
directory_config = /data
lastfm_api_key = False
audiodb_api_key = False
spotify_api_id = False
spotify_api_secret = False
delimiters_feat = ["ft.","ft","feat.","feat","featuring","Ft.","Ft","Feat.","Feat","Featuring"]
delimiters_informal = ["vs.","vs","&","with"]
delimiters_formal = ["; ",";"]
metadata_providers = ["spotify","deezer","lastfm","audiodb","musicbrainz"]
'';
in
{
requires = [ "elements-mount.service" ];
after = [ "elements-mount.service" ];
preStart = ''cp --update=none ${malojaCfg} ${config.waffentragerService.elements.malojaDir}/settings.ini'';
};
#### MULTI SCROBBLER --------------------------------------------------------------------
users.groups.scrobbler = { gid = 3000; };
users.users.scrobbler = {
group = "scrobbler";
uid = 3000;
isSystemUser = true;
};
sops.templates."multi-scrobbler.env".content = ''
TC=Europe/Warsaw
CONFIG_DIR=/config
PUID=${builtins.toString config.users.users.scrobbler.uid}
PGID=${builtins.toString config.users.groups.scrobbler.gid}
'';
sops.templates."multi-scrobbler.json".owner = "scrobbler";
sops.templates."multi-scrobbler.json".group = "scrobbler";
sops.templates."multi-scrobbler.json".content = builtins.toJSON {
baseUrl = "https://scrobbler.materus.pl";
disableWeb = false;
debugMode = false;
sources = [
{
name = "materus-spotify";
enable = true;
clients = [ "maloja" ];
data = {
clientId = "${config.sops.placeholder.spotify-client-id}";
clientSecret = "${config.sops.placeholder.spotify-client-secret}";
redirectUri = "https://scrobbler.materus.pl/callback";
interval = 30;
};
type = "spotify";
}
{
name = "materus-jellyfin";
enable = true;
clients = [ "maloja" ];
data = {
users = [
"materus"
];
servers = [
"waffentrager"
];
};
options = {
logPayload = false;
logFilterFailure = "warn";
};
type = "jellyfin";
}
];
clients = [
{
name = "maloja";
enable = true;
data = {
url = "https://melody.materus.pl/";
apiKey = "${config.sops.placeholder.maloja-api}";
};
type = "maloja";
}
{
name = "materus-brainz";
enable = true;
configureAs = "client";
data = {
token = "${config.sops.placeholder.listenbrainz-api}";
username = "materus";
};
type = "listenbrainz";
}
{
name = "materus-lastfm";
enable = true;
configureAs = "client";
data = {
apiKey = "${config.sops.placeholder.lastfm-api}";
secret = "${config.sops.placeholder.lastfm-secret}";
redirectUri = "https://scrobbler.materus.pl/lastfm/callback";
};
type = "lastfm";
}
];
};
services.nginx.virtualHosts = {
"scrobbler.materus.pl" = {
sslTrustedCertificate = "/var/lib/mnt_acme/materus.pl/chain.pem";
sslCertificateKey = "/var/lib/mnt_acme/materus.pl/key.pem";
sslCertificate = "/var/lib/mnt_acme/materus.pl/fullchain.pem";
addSSL = true;
http2 = false;
http3 = true;
locations."/" = {
proxyPass = "http://127.0.0.1:42011";
extraConfig = ''
allow ${mkk.wireguard.ip-masks.main};
allow 192.168.100.0/24;
deny all;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
'';
};
};
};
systemd.services."${config.virtualisation.oci-containers.backend}-multi-scrobbler" =
{
preStart = ''cp -f ${config.sops.templates."multi-scrobbler.json".path} ${config.waffentragerService.elements.malojaDir}/multi-scrobbler/config.json'';
requires = [ "elements-mount.service" ];
after = [ "elements-mount.service" ];
};
virtualisation.oci-containers.containers.multi-scrobbler = {
image = "foxxmd/multi-scrobbler:latest";
ports = [
"127.0.0.1:42011:9078"
];
volumes = [
"${config.waffentragerService.elements.malojaDir}/multi-scrobbler:/config"
];
environmentFiles = [
config.sops.templates."multi-scrobbler.env".path
];
};
};
}
@@ -0,0 +1,39 @@
{ config, lib, pkgs, mkk, ... }:
{
options.waffentragerService.nginx.enable = mkk.lib.mkBoolOpt false "Enable nginx";
config =
let
cfg = config.waffentragerService.nginx;
in
lib.mkIf cfg.enable {
networking.firewall.allowedTCPPorts = [ 80 443 ];
services.nginx = {
enable = true;
recommendedTlsSettings = true;
recommendedOptimisation = true;
recommendedGzipSettings = true;
package = pkgs.tengine;
virtualHosts."default" = {
sslTrustedCertificate = "/var/lib/mnt_acme/materus.pl/chain.pem";
sslCertificateKey = "/var/lib/mnt_acme/materus.pl/key.pem";
sslCertificate = "/var/lib/mnt_acme/materus.pl/fullchain.pem";
forceSSL = true;
http2 = false;
default = true;
locations."/" = { extraConfig = ''deny all;''; };
};
};
systemd.services.nginx = {
requires = [ "var-lib-mnt_acme.mount" ];
after = [ "var-lib-mnt_acme.mount" ];
serviceConfig = {
restart = "always";
restartSec = 60;
};
};
};
}
@@ -0,0 +1,27 @@
{ config, lib, pkgs, mkk, ... }:
{
options.waffentragerService.postgresql.enable = mkk.lib.mkBoolOpt false "Enable postgresql";
options.waffentragerService.postgresql.version = lib.mkOption { default = "16"; };
config =
let
cfg = config.waffentragerService.postgresql;
in
lib.mkIf cfg.enable {
waffentragerService.elements.enable = true;
services.postgresql.enable = true;
services.postgresql.package = pkgs."postgresql_${cfg.version}";
services.postgresql.dataDir = "${config.waffentragerService.elements.postgresqlDir}/${cfg.version}";
services.postgresql.enableJIT = true;
services.postgresql.authentication = pkgs.lib.mkOverride 10 ''
local all all trust
host all all 127.0.0.1/32 scram-sha-256
host all all ::1/128 scram-sha-256
'';
systemd.services.postgresql = {
requires = [ "elements-mount.service" ];
after = [ "elements-mount.service" ];
};
};
}
@@ -0,0 +1,65 @@
{ mkk, config, lib, pkgs, ... }:
{
options.waffentragerService.elements.enable = mkk.lib.mkBoolOpt false "Enable elements drive";
options.waffentragerService.elements.path = lib.mkOption { default = "/var/lib/elements"; };
options.waffentragerService.elements.uuid = lib.mkOption { default = "e32039c6-e98d-44b0-8e7d-120994bf7be1"; };
options.waffentragerService.elements.postgresqlDir = lib.mkOption { default = "${config.waffentragerService.elements.path}/services/postgresql"; };
options.waffentragerService.elements.nextcloudDir = lib.mkOption { default = "${config.waffentragerService.elements.path}/services/nextcloud"; };
options.waffentragerService.elements.lldapDir = lib.mkOption { default = "${config.waffentragerService.elements.path}/services/lldap"; };
options.waffentragerService.elements.jellyfinDir = lib.mkOption { default = "${config.waffentragerService.elements.path}/services/jellyfin"; };
options.waffentragerService.elements.malojaDir = lib.mkOption { default = "${config.waffentragerService.elements.path}/services/maloja"; };
config =
let
cfg = config.waffentragerService.elements;
in
lib.mkIf cfg.enable {
systemd.services.elements-mount = {
description = "Decrypt and mount elements drive";
wantedBy = [ "multi-user.target" ];
path = [ pkgs.cryptsetup pkgs.coreutils pkgs.util-linux ];
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = true;
script = ''
mkdir -p ${cfg.path}
cryptsetup luksOpen /dev/disk/by-uuid/${cfg.uuid} elements -d ${config.sops.secrets.elements.path}
mount /dev/mapper/elements ${cfg.path}
''
;
preStop = ''
umount ${cfg.path}
cryptsetup luksClose elements
'';
};
systemd.services.elements-dirmake = {
description = "Create dirs in elements drive";
path = [ pkgs.cryptsetup pkgs.coreutils pkgs.util-linux ];
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = false;
script = lib.optionalString config.waffentragerService.postgresql.enable ''
mkdir -p ${cfg.postgresqlDir}/${config.waffentragerService.postgresql.version}
chown -R postgres:postgres ${cfg.postgresqlDir}
'' + lib.optionalString config.waffentragerService.nextcloud.enable ''
mkdir -p ${cfg.nextcloudDir}
chown -R nextcloud:nextcloud ${cfg.nextcloudDir}
'' + lib.optionalString config.waffentragerService.auth.lldap.enable ''
mkdir -p ${cfg.lldapDir}
chown -R lldap:lldap ${cfg.lldapDir}
'' + lib.optionalString config.waffentragerService.jellyfin.enable ''
mkdir -p ${cfg.jellyfinDir}
chown -R materus:nextcloud ${cfg.jellyfinDir}
'' + lib.optionalString config.waffentragerService.scrobbling.enable ''
mkdir -p ${cfg.malojaDir}/multi-scrobbler
chown -R scrobbler:scrobbler ${cfg.malojaDir}
''
;
};
};
}
@@ -0,0 +1,62 @@
{ config, lib, mkk, ... }:
{
options.waffentragerService.gitea.enable = mkk.lib.mkBoolOpt false "Enable gitea";
config =
let
cfg = config.waffentragerService.gitea;
in
lib.mkMerge
[
(lib.mkIf cfg.enable {
waffentragerService.postgresql.enable = true;
waffentragerService.elements.enable = true;
services.gitea.enable = true;
services.gitea.lfs.enable = true;
services.gitea.stateDir = "${config.waffentragerService.elements.path}/services/gitea";
services.gitea.settings.service.DISABLE_REGISTRATION = true;
services.gitea.settings.server.DOMAIN = "baka.materus.pl";
services.gitea.settings.server.ROOT_URL = lib.mkForce "https://baka.materus.pl/";
services.gitea.settings.server.PROTOCOL = "fcgi+unix";
services.gitea.settings.cors = {
ENABLED = true;
X_FRAME_OPTIONS = "ALLOW-FROM https://*.materus.pl/";
};
services.gitea.database.type = "postgres";
services.gitea.database.socket = "/var/run/postgresql/";
})
(lib.mkIf (cfg.enable && config.waffentragerService.nginx.enable) {
services.nginx.virtualHosts = {
"baka.materus.pl" = {
sslTrustedCertificate = "/var/lib/mnt_acme/materus.pl/chain.pem";
sslCertificateKey = "/var/lib/mnt_acme/materus.pl/key.pem";
sslCertificate = "/var/lib/mnt_acme/materus.pl/fullchain.pem";
addSSL = true;
http2 = false;
locations."/" = {
extraConfig = ''
client_max_body_size 2G;
include ${config.services.nginx.package}/conf/fastcgi.conf;
include ${config.services.nginx.package}/conf/fastcgi_params;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
fastcgi_pass unix:/var/run/gitea/gitea.sock;
'';
};
};
};
}
)
];
}
@@ -0,0 +1,29 @@
{
config,
lib,
pkgs,
mkk,
...
}:
{
options.waffentragerService.mount-acme.enable = mkk.lib.mkBoolOpt false "Enable mount-acme";
config =
let
cfg = config.waffentragerService.mount-acme;
in
lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [ sshfs ];
systemd.mounts = [
{
description = "Mount remote acme dir from valkyrie";
what = "acme@valkyrie:/var/lib/acme";
where = "/var/lib/mnt_acme";
type = "fuse.sshfs";
options = "reconnect,gid=${toString config.ids.gids.nginx},_netdev,rw,nosuid,allow_other,default_permissions,follow_symlinks,idmap=user,compression=yes,identityfile=/materus/root/ssh_host_ed25519_key";
wantedBy = [ "multi-user.target" ];
after = [ "wg-quick-wg0.service" ];
}
];
};
}
@@ -0,0 +1,122 @@
{
config,
lib,
pkgs,
mkk,
...
}:
{
options.waffentragerService.nextcloud.enable = mkk.lib.mkBoolOpt false "Enable nextcloud";
config =
let
cfg = config.waffentragerService.nextcloud;
in
lib.mkIf cfg.enable {
waffentragerService.elements.enable = true;
waffentragerService.postgresql.enable = true;
waffentragerService.nginx.enable = true;
environment.systemPackages = [
pkgs.samba
pkgs.exiftool
pkgs.ffmpeg-headless
];
sops.secrets.nextcloud-adminpass.owner = config.users.users.nextcloud.name;
sops.secrets.nextcloud-adminpass.group = config.users.users.nextcloud.group;
services.postgresql.ensureDatabases = [ "nextcloud" ];
services.postgresql.ensureUsers = [
{
name = "nextcloud";
ensureDBOwnership = true;
}
];
services.nextcloud = {
enable = true;
package = pkgs.nextcloud33;
hostName = "waffentrager.materus.pl";
home = config.waffentragerService.elements.nextcloudDir;
config.adminuser = "nextcloud-master";
config.adminpassFile = config.sops.secrets.nextcloud-adminpass.path;
config.dbtype = "pgsql";
extraAppsEnable = true;
maxUploadSize = "8G";
https = true;
enableImagemagick = true;
configureRedis = true;
webfinger = true;
appstoreEnable = true;
database.createLocally = true;
extraApps = with pkgs.nextcloud33Packages.apps; {
inherit notify_push previewgenerator;
};
settings = {
log_type = "file";
"profile.enabled" = true;
default_phone_region = "PL";
trusted_proxies = [
mkk.network.valkyrie.ip
mkk.wireguard.peers.valkyrie.ip
mkk.wireguard.peers.waffentrager.ip
];
mail_smtpmode = "sendmail";
mail_sendmailmode = "pipe";
enable_previews = true;
preview_format = "webp";
enabledPreviewProviders = [
''OC\Preview\Movie''
''OC\Preview\PNG''
''OC\Preview\JPEG''
''OC\Preview\GIF''
''OC\Preview\BMP''
''OC\Preview\XBitmap''
''OC\Preview\MP3''
''OC\Preview\OGG''
''OC\Preview\OPUS''
''OC\Preview\MP4''
''OC\Preview\TXT''
''OC\Preview\MarkDown''
''OC\Preview\PDF''
''OC\Preview\WebP''
''OC\Preview\OpenDocument''
''OC\Preview\Krita''
''OC\Preview\AVIF''
];
"overwrite.cli.url" = "https://${config.services.nextcloud.hostName}";
};
phpOptions = {
"opcache.memory_consumption" = "512";
"opcache.interned_strings_buffer" = "64";
"opcache.max_accelerated_files" = "50000";
"opcache.jit" = "1255";
"opcache.jit_buffer_size" = "128M";
"opcache.validate_timestamps" = "0";
"opcache.revalidate_freq" = "0";
"opcache.fast_shutdown" = "1";
"opcache.save_comments" = "1";
};
phpExtraExtensions = ex: [
ex.zip
ex.zlib
ex.tidy
ex.smbclient
ex.sodium
];
};
services.nginx.virtualHosts.${config.services.nextcloud.hostName} = {
forceSSL = true;
http3 = true;
sslTrustedCertificate = "/var/lib/mnt_acme/materus.pl/chain.pem";
sslCertificateKey = "/var/lib/mnt_acme/materus.pl/key.pem";
sslCertificate = "/var/lib/mnt_acme/materus.pl/fullchain.pem";
extraConfig = ''
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
create_full_put_path on;
dav_access user:rw group:rw all:r;
'';
};
};
}
@@ -0,0 +1,57 @@
{ lib, pkgs, config, mkk, ... }:
{
options.waffentragerService.samba.enable = mkk.lib.mkBoolOpt false "Enable samba";
config =
let
cfg = config.waffentragerService.samba;
in
lib.mkIf cfg.enable {
waffentragerService.elements.enable = true;
systemd.services.samba-nmbd = {
requires = [ "elements-mount.service" ];
after = [ "elements-mount.service" ];
};
systemd.services.samba-wsdd = {
requires = [ "elements-mount.service" ];
after = [ "elements-mount.service" ];
};
services.samba-wsdd.enable = true;
services.samba-wsdd.openFirewall = true;
services.samba = {
enable = true;
package = pkgs.sambaFull;
securityType = "user";
openFirewall = true;
settings =
{
global = {
"workgroup" = "WORKGROUP";
"server string" = "smbwaffentrager";
"netbios name" = "smbwaffentrager";
"security" = "user";
"hosts allow" = "${mkk.wireguard.sambaIp} 192.168.100. 127.0.0.1 localhost";
"hosts deny" = "0.0.0.0/0";
"guest account" = "nobody";
"map to guest" = "bad user";
"mangled names" = "no";
"dos charset" = "CP850";
"unix charset" = "UTF-8";
"display charset" = "UTF-8";
"catia:mappings" = "0x22:0xa8,0x2a:0xa4,0x2f:0xf8,0x3a:0xf7,0x3c:0xab,0x3e:0xbb,0x3f:0xbf,0x5c:0xff,0x7c:0xa6";
};
materus = {
"path" = "${config.waffentragerService.elements.path}/storage/materus";
"browseable" = "yes";
"read only" = "no";
"guest ok" = "no";
"create mask" = "0770";
"directory mask" = "0770";
"force user" = "materus";
"force group" = "nextcloud";
};
};
};
};
}
@@ -0,0 +1,26 @@
{ lib, config, mkk, ... }:
{
options.waffentragerService.syncthing.enable = mkk.lib.mkBoolOpt false "Enable syncthing";
config =
let
cfg = config.waffentragerService.syncthing;
in
lib.mkIf cfg.enable {
waffentragerService.elements.enable = true; networking.firewall.allowedTCPPorts = [ 22000 config.services.syncthing.relay.statusPort config.services.syncthing.relay.port];
networking.firewall.allowedUDPPorts = [ 22000 21027 ];
systemd.services.syncthing = {
requires = [ "elements-mount.service" ];
after = [ "elements-mount.service" ];
};
services = {
syncthing = {
enable = true;
user = "materus";
group = "nextcloud";
dataDir = "${config.waffentragerService.elements.path}/storage/materus";
configDir = "${config.waffentragerService.elements.path}/storage/materus/Inne/Config/Syncthing/waffentrager/";
};
};
};
}
+33
View File
@@ -0,0 +1,33 @@
isHm:
{
lib,
materusArgs,
config,
...
}:
{
options.mkk.dir = lib.mkOption {
default = "${materusArgs.flake-path}";
type = lib.types.path;
};
options.mkk.var = lib.mkOption {
default = { };
type = lib.types.attrs;
};
imports = [
./nix.nix
]
++ lib.optionals isHm [ ./hm ]
++ lib.optionals (!isHm) [ ./os ];
config.mkk.var = import ./private/variables.nix {};
config._module.args.mkk = rec {
nixerus.pkgs = materusArgs.inputs.nixerus.packages."${materusArgs.arch}";
lib = nixerus.pkgs.lib;
files = materusArgs.files;
args = materusArgs;
} // config.mkk.var;
}
+4
View File
@@ -0,0 +1,4 @@
{ ... }:
{
imports = [ ./nvim.nix ];
}
+39
View File
@@ -0,0 +1,39 @@
{
config,
lib,
pkgs,
...
}:
{
options.mkk.neovim = {
enable = lib.mkOption {
default = false;
type = lib.types.bool;
};
};
config =
# Home Manager
lib.mkIf config.mkk.neovim.enable {
xdg.configFile."nvim/lua/materus".source = "${config.mkk.dir}/config/editor/neovim/lua/materus";
programs.neovim = {
enable = true;
withRuby = true;
withPython3 = true;
plugins = [
pkgs.vimPlugins.nvim-treesitter.withAllGrammars
];
initLua = lib.mkAfter ''
MATERUS = {
NIXOS = 1
}
require("materus")
'';
};
home.packages = [
pkgs.fd
pkgs.ripgrep
pkgs.tree-sitter
];
};
}
+130
View File
@@ -0,0 +1,130 @@
{
materusArgs,
lib,
pkgs,
...
}:
{
config.nix.package = lib.mkDefault pkgs.nixVersions.latest;
config.nix.registry = {
nixpkgs-stable = {
from = {
type = "indirect";
id = "nixpkgs-stable";
};
flake = materusArgs.self.inputs.nixpkgs;
};
nixpkgs-unstable = {
from = {
type = "indirect";
id = "nixpkgs-unstable";
};
flake = materusArgs.self.inputs.nixpkgs-unstable;
};
nixpkgs = {
from = {
type = "indirect";
id = "nixpkgs";
};
flake = materusArgs.inputs.nixpkgs;
};
emacs-overlay = {
from = {
type = "indirect";
id = "emacs-overlay";
};
flake = materusArgs.inputs.emacs-overlay;
};
flake-utils = {
from = {
type = "indirect";
id = "flake-utils";
};
flake = materusArgs.inputs.flake-utils;
};
nixos-hardware = {
from = {
type = "indirect";
id = "nixos-hardware";
};
flake = materusArgs.inputs.nixos-hardware;
};
nixerus = {
from = {
type = "indirect";
id = "nixerus";
};
flake = materusArgs.inputs.nixerus;
};
devshell = {
from = {
type = "indirect";
id = "devshell";
};
flake = materusArgs.inputs.devshell;
};
home-manager = {
from = {
type = "indirect";
id = "home-manager";
};
flake = materusArgs.inputs.home-manager;
};
sops-nix = {
from = {
type = "indirect";
id = "sops-nix";
};
flake = materusArgs.inputs.sops-nix;
};
base16 = {
from = {
type = "indirect";
id = "base16";
};
flake = materusArgs.inputs.base16;
};
git-agecrypt = {
from = {
type = "indirect";
id = "git-agecrypt";
};
flake = materusArgs.inputs.git-agecrypt;
};
plasma-manager = {
from = {
type = "indirect";
id = "plasma-manager";
};
flake = materusArgs.inputs.plasma-manager;
};
nur = {
from = {
type = "indirect";
id = "nur";
};
flake = materusArgs.inputs.nur;
};
nix-vscode-extensions = {
from = {
type = "indirect";
id = "nix-vscode-extensions";
};
flake = materusArgs.inputs.nix-vscode-extensions;
};
};
}
+4
View File
@@ -0,0 +1,4 @@
{ ... }:
{
imports = [ ];
}
Binary file not shown.
+125
View File
@@ -0,0 +1,125 @@
{
description = "All the flakes";
inputs = {
nixpkgs = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
ref = "nixos-unstable";
};
nixerus = {
type = "github";
owner = "materusPL";
repo = "Nixerus";
ref = "master";
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
};
};
nur = {
type = "github";
owner = "nix-community";
repo = "NUR";
ref = "master";
};
flake-utils = {
type = "github";
owner = "numtide";
repo = "flake-utils";
ref = "main";
};
git-agecrypt = {
type = "github";
owner = "vlaci";
repo = "git-agecrypt";
ref = "main";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
plasma-manager = {
type = "github";
owner = "nix-community";
repo = "plasma-manager";
ref = "trunk";
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
};
};
home-manager = {
type = "github";
owner = "nix-community";
repo = "home-manager";
ref = "master";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
sops-nix = {
type = "github";
owner = "Mic92";
repo = "sops-nix";
ref = "master";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
nix-vscode-extensions = {
type = "github";
owner = "nix-community";
repo = "nix-vscode-extensions";
ref = "master";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
devshell = {
type = "github";
owner = "numtide";
repo = "devshell";
ref = "main";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
emacs-overlay = {
type = "github";
owner = "nix-community";
repo = "emacs-overlay";
ref = "master";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
nixos-hardware = {
type = "github";
owner = "NixOS";
repo = "nixos-hardware";
ref = "master";
};
base16 = {
type = "github";
owner = "SenchoPens";
repo = "base16.nix";
ref = "main";
};
};
outputs = inputs: inputs;
}