2021-05-11 20:40:37 +02:00
|
|
|
{ self, config, lib, pkgs, ... }:
|
2020-01-04 06:06:31 +01:00
|
|
|
let inherit (lib) fileContents;
|
2020-07-31 06:17:28 +02:00
|
|
|
in
|
|
|
|
{
|
2021-12-29 23:42:51 +01:00
|
|
|
# Sets nrdxp.cachix.org binary cache which just speeds up some builds
|
2021-04-19 04:43:37 +02:00
|
|
|
imports = [ ../cachix ];
|
2019-12-05 06:36:36 +01:00
|
|
|
|
2021-12-29 23:42:51 +01:00
|
|
|
# For rage encryption, all hosts need a ssh key pair
|
|
|
|
services.openssh = {
|
|
|
|
enable = true;
|
|
|
|
openFirewall = lib.mkDefault false;
|
|
|
|
};
|
|
|
|
|
|
|
|
# This is just a representation of the nix default
|
2020-01-04 06:06:31 +01:00
|
|
|
nix.systemFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
|
2019-12-05 06:36:36 +01:00
|
|
|
|
|
|
|
environment = {
|
|
|
|
|
2021-12-29 23:42:51 +01:00
|
|
|
# Selection of sysadmin tools that can come in handy
|
2019-12-05 06:36:36 +01:00
|
|
|
systemPackages = with pkgs; [
|
|
|
|
binutils
|
|
|
|
coreutils
|
|
|
|
curl
|
2020-08-02 21:28:41 +02:00
|
|
|
direnv
|
2019-12-05 06:36:36 +01:00
|
|
|
dnsutils
|
2020-07-07 02:25:32 +02:00
|
|
|
dosfstools
|
2019-12-05 06:36:36 +01:00
|
|
|
fd
|
|
|
|
git
|
2021-06-30 16:50:07 +02:00
|
|
|
bottom
|
2019-12-17 05:13:33 +01:00
|
|
|
gptfdisk
|
2019-12-05 06:36:36 +01:00
|
|
|
iputils
|
2020-07-21 02:04:37 +02:00
|
|
|
jq
|
2020-12-16 22:48:40 +01:00
|
|
|
manix
|
2019-12-05 06:36:36 +01:00
|
|
|
moreutils
|
2021-02-15 06:17:24 +01:00
|
|
|
nix-index
|
2020-07-07 02:25:32 +02:00
|
|
|
nmap
|
2019-12-05 06:36:36 +01:00
|
|
|
ripgrep
|
2021-03-15 04:49:35 +01:00
|
|
|
skim
|
2021-02-03 06:46:12 +01:00
|
|
|
tealdeer
|
2021-04-09 05:03:38 +02:00
|
|
|
usbutils
|
2019-12-05 06:36:36 +01:00
|
|
|
utillinux
|
2020-07-07 02:25:32 +02:00
|
|
|
whois
|
2019-12-05 06:36:36 +01:00
|
|
|
];
|
|
|
|
|
2021-12-29 23:42:51 +01:00
|
|
|
# Starship is a fast and featureful shell prompt
|
|
|
|
# starship.toml has sane defaults that can be changed there
|
2020-07-27 06:24:28 +02:00
|
|
|
shellInit = ''
|
|
|
|
export STARSHIP_CONFIG=${
|
|
|
|
pkgs.writeText "starship.toml"
|
2020-08-02 22:50:05 +02:00
|
|
|
(fileContents ./starship.toml)
|
2020-07-27 06:24:28 +02:00
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
2020-01-04 06:06:31 +01:00
|
|
|
shellAliases =
|
2020-07-31 06:13:41 +02:00
|
|
|
let ifSudo = lib.mkIf config.security.sudo.enable;
|
2020-07-31 06:17:28 +02:00
|
|
|
in
|
|
|
|
{
|
2019-12-05 06:36:36 +01:00
|
|
|
# quick cd
|
|
|
|
".." = "cd ..";
|
|
|
|
"..." = "cd ../..";
|
|
|
|
"...." = "cd ../../..";
|
|
|
|
"....." = "cd ../../../..";
|
|
|
|
|
2019-12-15 09:17:42 +01:00
|
|
|
# git
|
|
|
|
g = "git";
|
|
|
|
|
2019-12-15 05:37:46 +01:00
|
|
|
# grep
|
|
|
|
grep = "rg";
|
|
|
|
gi = "grep -i";
|
|
|
|
|
2019-12-05 06:36:36 +01:00
|
|
|
# internet ip
|
|
|
|
myip = "dig +short myip.opendns.com @208.67.222.222 2>&1";
|
|
|
|
|
2019-12-16 05:29:54 +01:00
|
|
|
# nix
|
2019-12-16 06:33:52 +01:00
|
|
|
n = "nix";
|
2019-12-16 23:37:31 +01:00
|
|
|
np = "n profile";
|
|
|
|
ni = "np install";
|
|
|
|
nr = "np remove";
|
2020-07-25 04:20:24 +02:00
|
|
|
ns = "n search --no-update-lock-file";
|
2020-08-02 06:12:15 +02:00
|
|
|
nf = "n flake";
|
2021-02-14 23:50:49 +01:00
|
|
|
nepl = "n repl '<nixpkgs>'";
|
2021-03-02 04:11:23 +01:00
|
|
|
srch = "ns nixos";
|
|
|
|
orch = "ns override";
|
2019-12-16 05:29:54 +01:00
|
|
|
nrb = ifSudo "sudo nixos-rebuild";
|
2020-12-16 22:48:40 +01:00
|
|
|
mn = ''
|
|
|
|
manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | sk --preview="manix '{}'" | xargs manix
|
|
|
|
'';
|
2019-12-16 05:29:54 +01:00
|
|
|
|
2021-01-19 08:51:23 +01:00
|
|
|
# fix nixos-option
|
2021-05-11 20:40:37 +02:00
|
|
|
nixos-option = "nixos-option -I nixpkgs=${self}/lib/compat";
|
2021-01-19 08:51:23 +01:00
|
|
|
|
2019-12-05 06:36:36 +01:00
|
|
|
# sudo
|
2019-12-19 19:57:49 +01:00
|
|
|
s = ifSudo "sudo -E ";
|
|
|
|
si = ifSudo "sudo -i";
|
2019-12-05 06:36:36 +01:00
|
|
|
se = ifSudo "sudoedit";
|
|
|
|
|
2019-12-26 08:17:44 +01:00
|
|
|
# top
|
2021-06-30 16:50:07 +02:00
|
|
|
top = "btm";
|
2019-12-26 08:17:44 +01:00
|
|
|
|
2019-12-05 06:36:36 +01:00
|
|
|
# systemd
|
|
|
|
ctl = "systemctl";
|
2019-12-19 19:57:49 +01:00
|
|
|
stl = ifSudo "s systemctl";
|
2019-12-05 06:36:36 +01:00
|
|
|
utl = "systemctl --user";
|
|
|
|
ut = "systemctl --user start";
|
|
|
|
un = "systemctl --user stop";
|
2019-12-19 19:57:49 +01:00
|
|
|
up = ifSudo "s systemctl start";
|
|
|
|
dn = ifSudo "s systemctl stop";
|
|
|
|
jtl = "journalctl";
|
2019-12-05 06:36:36 +01:00
|
|
|
|
2021-03-02 04:11:23 +01:00
|
|
|
};
|
2019-12-05 06:36:36 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
fonts = {
|
2020-01-04 06:06:31 +01:00
|
|
|
fonts = with pkgs; [ powerline-fonts dejavu_fonts ];
|
2019-12-05 06:36:36 +01:00
|
|
|
|
|
|
|
fontconfig.defaultFonts = {
|
|
|
|
|
|
|
|
monospace = [ "DejaVu Sans Mono for Powerline" ];
|
|
|
|
|
|
|
|
sansSerif = [ "DejaVu Sans" ];
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
nix = {
|
|
|
|
|
2021-12-29 23:42:51 +01:00
|
|
|
# Improve nix store disk usage
|
2019-12-05 06:36:36 +01:00
|
|
|
autoOptimiseStore = true;
|
|
|
|
gc.automatic = true;
|
|
|
|
optimise.automatic = true;
|
|
|
|
|
2021-12-29 23:42:51 +01:00
|
|
|
# Prevents impurities in builds
|
2019-12-05 06:36:36 +01:00
|
|
|
useSandbox = true;
|
|
|
|
|
2021-12-29 23:42:51 +01:00
|
|
|
# give root and @wheel special privileges with nix
|
2019-12-05 06:36:36 +01:00
|
|
|
trustedUsers = [ "root" "@wheel" ];
|
|
|
|
|
2021-12-29 23:42:51 +01:00
|
|
|
# Generally useful nix option defaults
|
2019-12-05 06:36:36 +01:00
|
|
|
extraOptions = ''
|
2020-07-16 23:16:27 +02:00
|
|
|
min-free = 536870912
|
2020-12-26 06:09:09 +01:00
|
|
|
keep-outputs = true
|
|
|
|
keep-derivations = true
|
2021-02-17 20:54:41 +01:00
|
|
|
fallback = true
|
2019-12-05 06:36:36 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2020-08-02 21:28:41 +02:00
|
|
|
programs.bash = {
|
2021-12-29 23:42:51 +01:00
|
|
|
# Enable starship
|
2020-08-02 21:28:41 +02:00
|
|
|
promptInit = ''
|
|
|
|
eval "$(${pkgs.starship}/bin/starship init bash)"
|
|
|
|
'';
|
2021-12-29 23:42:51 +01:00
|
|
|
# Enable direnv, a tool for managing shell environments
|
2020-12-20 02:35:16 +01:00
|
|
|
interactiveShellInit = ''
|
2020-08-02 21:28:41 +02:00
|
|
|
eval "$(${pkgs.direnv}/bin/direnv hook bash)"
|
|
|
|
'';
|
|
|
|
};
|
2020-07-27 06:24:28 +02:00
|
|
|
|
2021-12-29 23:42:51 +01:00
|
|
|
# Service that makes Out of Memory Killer more effective
|
2019-12-05 06:36:36 +01:00
|
|
|
services.earlyoom.enable = true;
|
|
|
|
|
|
|
|
}
|