config/configuration.nix

341 lines
8.0 KiB
Nix
Raw Normal View History

2022-10-17 22:40:48 +02:00
{ config, pkgs, lib, ... }:
{
#nixpkgs.overlays = overlays;
nixpkgs.config.allowUnfreePredicate = (pkg: true);
nixpkgs.config.allowUnfree = true;
system.autoUpgrade.enable = true; # daily nixos-rebuild switch, no reboot by default
2023-02-24 21:36:30 +01:00
# TODO: can i make this non-string?
2022-10-17 22:40:48 +02:00
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
2023-02-24 21:36:30 +01:00
# TODO: move to pbsds home
programs.ssh.extraConfig = ''
Host *.ntnu.no *.pvv.org
User pederbs
'';
2022-10-17 22:40:48 +02:00
# deduplicate with hardlinks, expensive. Alternative: nix-store --optimise
nix.settings.auto-optimise-store = true;
#nix.optimize.automatic = true; # periodic optimization
2023-02-24 21:36:30 +01:00
nix.gc.automatic = true;
nix.gc.dates = "weekly";
nix.gc.options = "--delete-older-than 30d";
2022-10-17 22:40:48 +02:00
imports = [
2023-02-24 21:36:30 +01:00
./cachix.nix
2023-02-25 01:29:13 +01:00
(if builtins.pathExists ./hardware-configuration.nix
then ./hardware-configuration.nix # results of hardware scan
else {}
)
2023-02-24 21:36:30 +01:00
2023-02-25 00:03:29 +01:00
./profiles/web
./profiles/web/index
./profiles/web/cinny
./profiles/web/element
./profiles/web/flexget
./profiles/web/gitea
./profiles/web/hydra
./profiles/web/invidious
./profiles/web/jellyfin
./profiles/web/libreddit
./profiles/web/mattermost
./profiles/web/navidrome
./profiles/web/netdata
./profiles/web/nitter
./profiles/web/ntopng
./profiles/web/owncast
./profiles/web/paperless
./profiles/web/polaris
./profiles/web/resilio
./profiles/web/roundcube
./profiles/web/thelounge
./profiles/web/vaultwarden
./profiles/web/webdav-zotero
#./profiles/web/convos
#./profiles/web/cryptpad
#./profiles/web/galene
#./profiles/web/graphana
#./profiles/web/hedgedoc
#./profiles/web/home-assistant
#./profiles/web/jitsi-meet
#./profiles/web/kukkee
#./profiles/web/matrix-synapse
#./profiles/web/shlink
#./profiles/web/sourcegraph
./profiles/web/pdoc
./profiles/web/linktree-pbsds
./profiles/web/refleksjon-no
./profiles/web/roroslyd-no
2023-02-25 01:29:13 +01:00
#./profiles/web/trivial-gradios
#./profiles/web/censordodge
#./profiles/web/openspeedtest
2023-02-25 00:03:29 +01:00
2023-02-25 01:29:13 +01:00
./profiles/domeneshop-dyndns # TODO: olavtr is hardcoded...
2022-10-17 22:40:48 +02:00
./profiles/code-remote
2023-02-24 21:36:30 +01:00
./profiles/remote-builders #
2023-02-25 00:03:29 +01:00
./profiles/nfs/reidun.nix # NFS mounts
2023-02-24 21:36:30 +01:00
./profiles/autossh-reverse-tunnels
#./profiles/xrdp
2022-10-17 22:40:48 +02:00
./users
2023-02-25 01:29:13 +01:00
#./users/pbsds
./users/all.nix
2022-10-17 22:40:48 +02:00
];
2023-02-24 21:36:30 +01:00
# TODO: remove? Move to where relevant
2023-02-25 01:29:13 +01:00
nixpkgs.overlays = [
/** /
(final: prev: {
mapcrafter = prev.callPackage /home/pbsds/repos/nixpkgs-mapcrafter/pkgs/tools/games/minecraft/mapcrafter/default.nix { };
mapcrafter-world112 = prev.callPackage /home/pbsds/repos/nixpkgs-mapcrafter/pkgs/tools/games/minecraft/mapcrafter/default.nix { world="world112"; };
})
/**/
];
2022-10-17 22:40:48 +02:00
# Allow unstable packages.
nixpkgs.config.packageOverrides = pkgs: {
unstable = import <nixos-unstable> {
config = config.nixpkgs.config;
};
2023-02-24 21:36:30 +01:00
# TODO: nur
2022-10-17 22:40:48 +02:00
};
# enable opengl (headless)
hardware.opengl.enable = true;
#hardware.opengl.extraPackages = [ pkgs.mesa.drivers ];
hardware.opengl.extraPackages = with pkgs; [ mesa.drivers vaapiIntel libvdpau-va-gl vaapiVdpau intel-ocl ];
# run/build weird binaries
boot.binfmt.emulatedSystems = [
"wasm32-wasi"
2023-02-24 21:36:30 +01:00
"wasm64-wasi"
2022-10-17 22:40:48 +02:00
"x86_64-windows"
"aarch64-linux"
"riscv64-linux"
2023-02-24 21:36:30 +01:00
#"x86_64-darwin"
#"aarch64-darwin"
2022-10-17 22:40:48 +02:00
];
2023-02-24 21:36:30 +01:00
services.thermald.enable = true;
2022-10-17 22:40:48 +02:00
# Bootloader
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
boot.loader.grub.useOSProber = true;
# Virtualization
2023-02-25 01:29:13 +01:00
virtualisation.podman.enable = true;
# TODO: are these default since 22.11?
virtualisation.podman.dockerCompat = true; # alias docker to podman
virtualisation.oci-containers.backend = "podman";
2022-10-17 22:40:48 +02:00
# Networking
networking = {
# Enable networking
networkmanager.enable = true;
#wireless.enable = true; # Enables wireless support via wpa_supplicant.
2023-02-24 21:36:30 +01:00
#iwd.enable = true
2022-10-17 22:40:48 +02:00
hostName = "noximilien"; # Define your hostname.
domain = "pbsds.net";
interfaces.eno1.ipv4.addresses = [
{ address = "192.168.1.9"; prefixLength = 24; }
];
nameservers = [
"192.168.1.254"
"8.8.8.8"
];
defaultGateway = {
address = "192.168.1.254";
interface = "eno1";
};
#useDHCP = true;
};
2023-02-24 21:36:30 +01:00
# firewall
services.fail2ban.enable = true;
networking.firewall.enable = true; # default
2022-10-17 22:40:48 +02:00
#networking.firewall.allowedTCPPorts = [ ... ];
#networking.firewall.allowedUDPPorts = [ ... ];
# Time zone and internationalisation properties.
time.timeZone = "Europe/Oslo";
i18n.defaultLocale = "en_US.utf8";
2023-02-25 01:29:13 +01:00
i18n.extraLocaleSettings.LC_ADDRESS = "nb_NO.utf8";
i18n.extraLocaleSettings.LC_IDENTIFICATION = "nb_NO.utf8";
i18n.extraLocaleSettings.LC_MEASUREMENT = "nb_NO.utf8";
i18n.extraLocaleSettings.LC_MONETARY = "nb_NO.utf8";
i18n.extraLocaleSettings.LC_NAME = "nb_NO.utf8";
i18n.extraLocaleSettings.LC_NUMERIC = "nb_NO.utf8";
i18n.extraLocaleSettings.LC_PAPER = "nb_NO.utf8";
i18n.extraLocaleSettings.LC_TELEPHONE = "nb_NO.utf8";
i18n.extraLocaleSettings.LC_TIME = "nb_NO.utf8";
console.keyMap = "no";
services.xserver.layout = "no";
2023-02-24 21:36:30 +01:00
services.xserver.xkbVariant = "";
2022-10-17 22:40:48 +02:00
# Installed system packages
# $ nix search FOOBAR
2023-02-24 21:36:30 +01:00
# TODO: prune this, make home-manager deal with the majority
2022-10-17 22:40:48 +02:00
environment.systemPackages = with pkgs; [
lsof
lshw
htop
file
tmux
#parallel # already provided by moreutils
pwgen
git
nmap
rsync
bind.dnsutils
graphviz
dialog
cowsay
gnused
gnumake
coreutils-full
moreutils
binutils
diffutils
findutils
usbutils
bash-completion
curl
wget
strace
2023-02-24 21:36:30 +01:00
killall
2022-10-17 22:40:48 +02:00
zip
unrar
unzip
atool
p7zip
bzip2
gzip
atool
micro
aspell
aspellDicts.en
aspellDicts.nb
vimv
dos2unix
#rmate # TODO: add to nixpkgs
pandoc
cargo
cargo-edit
sqlite
#sshuttle
visidata
weston
cage
vimix-gtk-themes
flat-remix-icon-theme
xclip
feh
sshfs
glances
zenith
fzf
2023-02-25 01:29:13 +01:00
tealdeer # tldr
2022-10-17 22:40:48 +02:00
entr
axel aria
bat
xe # xargs alternative
sd # sed alternative
fd # find alternative
silver-searcher # `ag`
ripgrep
jq
yq
htmlq
sysz
du-dust # du alternative
2023-02-25 01:29:13 +01:00
ncdu # Disk usage analyzer with an ncurses interface
2022-10-17 22:40:48 +02:00
gh
hub
2023-02-24 21:36:30 +01:00
cachix
2022-10-17 22:40:48 +02:00
nix-output-monitor
nix-prefetch
nix-top
#nix-index
nix-tree
nixfmt
alejandra
];
2023-02-25 01:29:13 +01:00
# TODO: somehow make this root only?
# TODO: zsh
2022-10-17 22:40:48 +02:00
programs.bash.shellInit = ''
if command -v fzf-share >/dev/null; then
source "$(fzf-share)/key-bindings.bash"
source "$(fzf-share)/completion.bash"
fi
'';
# TODO: make this root only?
2023-02-24 21:36:30 +01:00
programs.bash.shellAliases."ed" = "micro"; # TODO: ${EDITOR:-micro}
2023-02-25 01:29:13 +01:00
environment.variables."EDITOR" = "micro";
2022-10-17 22:40:48 +02:00
2023-02-24 21:36:30 +01:00
# TODO: remove? Move?
2022-10-17 22:40:48 +02:00
programs.dconf.enable = true;
# System fonts
# Nice to have when X-forwading on headless machines
fonts.fonts = with pkgs; [
noto-fonts # includes Cousine
noto-fonts-cjk
noto-fonts-emoji
noto-fonts-extra
dejavu_fonts
];
# 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;
#};
# OpenSSH
services.openssh.enable = true;
services.openssh.forwardX11 = 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. Its 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).
2023-02-24 21:36:30 +01:00
system.stateVersion = "22.11"; # Did you read the comment?
2022-10-17 22:40:48 +02:00
}