Way too massive refactoring
This commit is contained in:
parent
113d68be68
commit
24aac9708b
49 changed files with 481 additions and 407 deletions
180
shared/base.nix
Normal file
180
shared/base.nix
Normal file
|
@ -0,0 +1,180 @@
|
|||
{ pkgs, lib, ... }:
|
||||
{
|
||||
options.custom.gua_pref = lib.mkOption {
|
||||
type = with lib.types; nullOr (strMatching "^[0-9a-zA-Z:]+$");
|
||||
default = null;
|
||||
description = "IPv6 GUA Prefix to use in other confs";
|
||||
};
|
||||
|
||||
config = {
|
||||
custom.gua_pref = "2001:14ba:a090:39";
|
||||
|
||||
######################################## Packages ###############################################
|
||||
environment.systemPackages = with pkgs; [
|
||||
tmux
|
||||
git
|
||||
vim
|
||||
p7zip
|
||||
tree
|
||||
btop
|
||||
pwgen
|
||||
ssss
|
||||
dig
|
||||
termshark
|
||||
];
|
||||
|
||||
######################################## ZSH configuration ######################################
|
||||
users.defaultUserShell = pkgs.zsh;
|
||||
environment.shells = with pkgs; [ zsh ];
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
autosuggestions.enable = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
ohMyZsh = {
|
||||
enable = true;
|
||||
plugins = [
|
||||
"history-substring-search"
|
||||
"tmux"
|
||||
];
|
||||
theme = "af-magic";
|
||||
};
|
||||
interactiveShellInit = ''
|
||||
ZSH_TMUX_AUTOSTART=false
|
||||
ZSH_TMUX_AUTOQUIT=false
|
||||
ZSH_TMUX_CONFIG=/etc/tmux.conf
|
||||
'';
|
||||
promptInit = ''
|
||||
if [ -n "$IN_NIX_SHELL" ]; then
|
||||
setopt PROMPT_SUBST
|
||||
RPROMPT+='[nix]'
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
######################################## tmux configuration #####################################
|
||||
programs.tmux.enable = true;
|
||||
programs.tmux.extraConfig = ''
|
||||
unbind C-b
|
||||
set -g prefix M-w
|
||||
bind M-w send-prefix
|
||||
|
||||
bind s split-window -v
|
||||
bind v split-window -h
|
||||
|
||||
# Smart pane switching with awareness of Vim splits.
|
||||
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq nvim && tmux send-keys C-h) || tmux select-pane -L"
|
||||
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq nvim && tmux send-keys C-j) || tmux select-pane -D"
|
||||
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq nvim && tmux send-keys C-k) || tmux select-pane -U"
|
||||
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq nvim && tmux send-keys C-l) || tmux select-pane -R"
|
||||
|
||||
bind -n C-Left select-pane -L
|
||||
bind -n C-Right select-pane -R
|
||||
bind -n C-Up select-pane -U
|
||||
bind -n C-Down select-pane -D
|
||||
|
||||
# resize panes more easily
|
||||
bind -r h resize-pane -L 10
|
||||
bind -r j resize-pane -D 10
|
||||
bind -r k resize-pane -U 10
|
||||
bind -r l resize-pane -R 10
|
||||
|
||||
bind M-c attach -c "#{pane_current_path}"
|
||||
|
||||
set -s escape-time 0
|
||||
'';
|
||||
|
||||
######################################## SSH configuration #########################
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings.PasswordAuthentication = false;
|
||||
};
|
||||
users.users.root.openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJowj9IJIgYjDwZm5mEttiwvPfu1dd4eVTHfaDnbwcOV vili-bw-ssh-ed25519-main"
|
||||
];
|
||||
|
||||
######################################## Localization ###########################################
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
i18n.extraLocaleSettings = {
|
||||
LC_ADDRESS = "fi_FI.UTF-8";
|
||||
LC_IDENTIFICATION = "fi_FI.UTF-8";
|
||||
LC_MEASUREMENT = "fi_FI.UTF-8";
|
||||
LC_MONETARY = "fi_FI.UTF-8";
|
||||
LC_NAME = "fi_FI.UTF-8";
|
||||
LC_NUMERIC = "fi_FI.UTF-8";
|
||||
LC_PAPER = "fi_FI.UTF-8";
|
||||
LC_TELEPHONE = "fi_FI.UTF-8";
|
||||
LC_TIME = "fi_FI.UTF-8";
|
||||
};
|
||||
|
||||
services.xserver.xkb = {
|
||||
layout = "us,";
|
||||
variant = "de_se_fi,";
|
||||
};
|
||||
console = lib.mkForce {
|
||||
font = "Lat2-Terminus16";
|
||||
useXkbConfig = true; # use xkbOptions in tty.
|
||||
};
|
||||
time.timeZone = "Europe/Helsinki";
|
||||
|
||||
######################################## Memory management ######################################
|
||||
zramSwap.enable = true;
|
||||
swapDevices = [
|
||||
{
|
||||
device = "/var/lib/swapfile";
|
||||
size = 8 * 1024;
|
||||
}
|
||||
];
|
||||
|
||||
######################################## Housekeeping ###########################################
|
||||
system.autoUpgrade = {
|
||||
enable = true;
|
||||
dates = "04:00";
|
||||
randomizedDelaySec = "30min";
|
||||
allowReboot = true;
|
||||
rebootWindow = {
|
||||
lower = "03:30";
|
||||
upper = "05:00";
|
||||
};
|
||||
};
|
||||
|
||||
nix = {
|
||||
settings = {
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
auto-optimise-store = true;
|
||||
tarball-ttl = 0;
|
||||
};
|
||||
gc = {
|
||||
automatic = true;
|
||||
options = "--delete-older-than 7d";
|
||||
dates = "05:00";
|
||||
randomizedDelaySec = "30min";
|
||||
};
|
||||
};
|
||||
|
||||
######################################## Misc. ##################################################
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
networking = {
|
||||
# Easiest to use and most distros use this by default.
|
||||
networkmanager = {
|
||||
enable = true;
|
||||
# Use EUI-64 addresses by default, so that addresses are predictable
|
||||
settings."connection"."ipv6.addr-gen-mode" = 0;
|
||||
};
|
||||
# IPv6 privacy addresses for outgoing traffic
|
||||
tempAddresses = "default";
|
||||
};
|
||||
|
||||
users.mutableUsers = false; # Force all user management to happen throught nix-files
|
||||
|
||||
boot.loader = {
|
||||
systemd-boot.enable = lib.mkDefault true;
|
||||
efi.canTouchEfiVariables = lib.mkDefault true;
|
||||
timeout = lib.mkDefault 0;
|
||||
};
|
||||
};
|
||||
}
|
17
shared/hardware/nvidia.nix
Normal file
17
shared/hardware/nvidia.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
hardware = {
|
||||
nvidia = {
|
||||
open = true; # Set to false to use the proprietary kernel module
|
||||
forceFullCompositionPipeline = true;
|
||||
};
|
||||
|
||||
graphics = {
|
||||
enable = true;
|
||||
extraPackages = with pkgs; [ nvidia-vaapi-driver ];
|
||||
};
|
||||
};
|
||||
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
boot.kernelPackages = pkgs.linuxPackages_xanmod_latest;
|
||||
}
|
44
shared/impermanence.nix
Normal file
44
shared/impermanence.nix
Normal file
|
@ -0,0 +1,44 @@
|
|||
{ ... }:
|
||||
let
|
||||
impermanence = builtins.fetchTarball {
|
||||
url = "https://github.com/nix-community/impermanence/archive/master.tar.gz";
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [ "${impermanence}/nixos.nix" ];
|
||||
|
||||
environment.persistence."/persist" = {
|
||||
enable = true; # NB: Defaults to true, not needed
|
||||
hideMounts = true;
|
||||
directories = [
|
||||
# "/etc/NetworkManager/system-connections"
|
||||
# {
|
||||
# directory = "/var/lib/colord";
|
||||
# user = "colord";
|
||||
# group = "colord";
|
||||
# mode = "u=rwx,g=rx,o=";
|
||||
# }
|
||||
];
|
||||
files = [
|
||||
# "/etc/machine-id"
|
||||
# {
|
||||
# file = "/var/keys/secret_file";
|
||||
# parentDirectory = {
|
||||
# mode = "u=rwx,g=,o=";
|
||||
# };
|
||||
# }
|
||||
];
|
||||
users.vili = {
|
||||
# directories = [
|
||||
# "VirtualBox VMs"
|
||||
# {
|
||||
# directory = ".gnupg";
|
||||
# mode = "0700";
|
||||
# }
|
||||
# ];
|
||||
# files = [
|
||||
# ".screenrc"
|
||||
# ];
|
||||
};
|
||||
};
|
||||
}
|
18
shared/users/vili.nix
Normal file
18
shared/users/vili.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
users.users.vili = {
|
||||
isNormalUser = true;
|
||||
home = "/home/vili";
|
||||
description = "Vili Sinervä";
|
||||
uid = 1000;
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"networkmanager"
|
||||
"audio"
|
||||
];
|
||||
openssh.authorizedKeys.keys = config.users.users.root.openssh.authorizedKeys.keys;
|
||||
hashedPasswordFile = "/persist/secrets/hashed-passwords/vili";
|
||||
};
|
||||
|
||||
users.groups.vili.gid = 1000;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue