pub-solar-os/profiles/core/default.nix

163 lines
3.5 KiB
Nix
Raw Normal View History

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