ark/profiles/core/default.nix

180 lines
4.4 KiB
Nix
Raw Normal View History

2021-07-24 20:01:36 +03:00
{ self, inputs, config, pkgs, lib, ... }:
2021-05-03 07:48:31 +03:00
let
inherit (lib) fileContents mkIf;
2021-07-24 20:01:36 +03:00
pkgBin = lib.our.pkgBinNoDep pkgs;
2021-05-03 07:48:31 +03:00
coreBin = v: "${pkgs.coreutils}/bin/${v}";
nixBin = "${config.nix.package}/bin/nix";
2020-07-31 07:17:28 +03:00
in
{
2021-05-03 07:48:31 +03:00
imports = [ ../cachix ../../locale ];
2021-05-03 07:48:31 +03:00
boot = {
tmpOnTmpfs = true;
loader.systemd-boot.configurationLimit = 10;
};
2021-05-03 07:48:31 +03:00
console.font = "7x14";
2021-05-03 07:48:31 +03:00
environment = {
systemPackages = with pkgs; [
binutils
coreutils
curl
2020-08-02 22:28:41 +03:00
direnv
dnsutils
2020-07-07 03:25:32 +03:00
dosfstools
fd
git
2021-06-30 17:50:07 +03:00
bottom
2019-12-17 07:13:33 +03:00
gptfdisk
iputils
2020-07-21 03:04:37 +03:00
jq
2020-12-17 00:48:40 +03:00
manix
moreutils
nix-index
2020-07-07 03:25:32 +03:00
nmap
ripgrep
2021-03-15 06:49:35 +03:00
skim
2021-02-03 08:46:12 +03:00
tealdeer
usbutils
utillinux
2020-07-07 03:25:32 +03:00
whois
2021-05-03 07:48:31 +03:00
bat
exa
git
lm_sensors
mkpasswd
ntfs3g
zoxide
bottom
amber
unzip
unrar
grit
hydra-check
nix-index
2021-05-03 12:21:26 +03:00
du-dust
2021-06-05 09:13:41 +03:00
mosh
];
2020-01-04 08:06:31 +03:00
shellAliases =
2021-05-03 07:48:31 +03:00
let ifSudo = string: mkIf config.security.sudo.enable string;
2020-07-31 07:17:28 +03:00
in
{
2021-05-03 07:48:31 +03:00
gtw = "${pkgBin "grit"} tree wnv";
gtwa = "${pkgBin "grit"} add -p wnv";
gt = pkgBin "grit";
g = pkgBin "git";
2021-05-03 12:21:26 +03:00
git-optimize = "${pkgBin "git"} gc --aggressive --prune=now";
2021-05-03 07:48:31 +03:00
grep = "${pkgs.ripgrep}/bin/rg";
cat = "${pkgBin "bat"} -pp --theme=base16";
c = "${pkgBin "bat"} -pp --theme=base16";
2021-05-03 12:21:26 +03:00
du = "${pkgs.du-dust}/bin/dust";
2021-05-03 07:48:31 +03:00
df = "${coreBin "df"} -h";
free = "${pkgs.procps}/bin/free -h";
ls = pkgBin "exa";
l = "${pkgBin "exa"} -lhg --git";
la = "${pkgBin "exa"} -lhg --git -a";
t = "${pkgBin "exa"} -lhg --git -T";
ta = "${pkgBin "exa"} -lhg --git -a -T";
n = nixBin;
nf = "${nixBin} flake";
nfc = "${nixBin} flake check";
nfu = "${nixBin} flake update";
nfua = "${nixBin} flake update --recreate-lock-file";
nfs = "${nixBin} flake show";
np = "${nixBin} profile";
npl = "${nixBin} profile info";
npi = "${nixBin} profile install";
npr = "${nixBin} profile remove";
nsh = "${nixBin} shell";
nsr = "${nixBin} search";
nsrp = "${nixBin} search nixpkgs";
ndev = "${nixBin} develop";
nosce = "cd /etc/nixos";
nosr = ifSudo "sudo nixos-rebuild --fast";
nosrs = ifSudo "sudo nixos-rebuild switch";
nosrb = ifSudo "sudo nixos-rebuild boot";
nosrt = ifSudo "sudo nixos-rebuild test";
ncg = ifSudo "sudo nix-collect-garbage";
ncgdo = ifSudo "sudo nix-collect-garbage --delete-old";
top = "${pkgs.bottom}/bin/btm";
myip =
"${pkgs.dnsutils}/bin/dig +short myip.opendns.com @208.67.222.222 2>&1";
2020-12-17 00:48:40 +03:00
mn = ''
manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | sk --preview="manix '{}'" | xargs manix
'';
2019-12-16 07:29:54 +03:00
# fix nixos-option
nixos-option = "nixos-option -I nixpkgs=${self}/lib/compat";
# sudo
2019-12-19 21:57:49 +03:00
s = ifSudo "sudo -E ";
si = ifSudo "sudo -i";
se = ifSudo "sudoedit";
# systemd
ctl = "systemctl";
2019-12-19 21:57:49 +03:00
stl = ifSudo "s systemctl";
utl = "systemctl --user";
ut = "systemctl --user start";
un = "systemctl --user stop";
2019-12-19 21:57:49 +03:00
up = ifSudo "s systemctl start";
dn = ifSudo "s systemctl stop";
jtl = "journalctl";
};
};
2021-05-03 07:48:31 +03:00
system.activationScripts.diff = ''
${pkgs.nixUnstable}/bin/nix store \
--experimental-features 'nix-command' \
diff-closures /run/current-system "$systemConfig"
'';
2021-05-28 19:37:09 +03:00
nix =
let
registry =
2021-07-24 20:01:36 +03:00
builtins.removeAttrs
(builtins.mapAttrs
(_: v: { flake = v; })
(lib.filterAttrs (_: v: v ? outputs) inputs))
[ "bud" ];
2021-05-28 19:37:09 +03:00
in
{
autoOptimiseStore = true;
gc.automatic = true;
optimise.automatic = true;
useSandbox = true;
allowedUsers = [ "@wheel" ];
trustedUsers = [ "root" "@wheel" ];
extraOptions = ''
min-free = 536870912
keep-outputs = true
keep-derivations = true
fallback = true
'';
inherit registry;
};
2021-05-03 07:48:31 +03:00
programs.command-not-found.enable = false;
home-manager.useGlobalPkgs = true;
users.mutableUsers = false;
2021-07-24 16:51:53 +03:00
# For rage encryption, all hosts need a ssh key pair
services.openssh = {
enable = true;
openFirewall = lib.mkDefault false;
};
services.earlyoom.enable = true;
}