ark/profiles/core/default.nix

165 lines
3.9 KiB
Nix
Raw Normal View History

2021-05-03 07:48:31 +03:00
{ self, config, pkgs, ... }:
let
lib = pkgs.lib;
inherit (lib) fileContents mkIf;
pkgBin = lib.dev.pkgBinNoDep pkgs;
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
2019-12-26 10:17:44 +03:00
gotop
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
];
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";
grep = "${pkgs.ripgrep}/bin/rg";
cat = "${pkgBin "bat"} -pp --theme=base16";
c = "${pkgBin "bat"} -pp --theme=base16";
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";
2019-12-26 10:17:44 +03:00
# top
top = "gotop";
# 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"
'';
nix = {
autoOptimiseStore = true;
gc.automatic = true;
optimise.automatic = true;
useSandbox = true;
allowedUsers = [ "@wheel" ];
trustedUsers = [ "root" "@wheel" ];
extraOptions = ''
2020-07-17 00:16:27 +03:00
min-free = 536870912
keep-outputs = true
keep-derivations = true
fallback = true
'';
};
2021-05-03 07:48:31 +03:00
programs.command-not-found.enable = false;
home-manager.useGlobalPkgs = true;
users.mutableUsers = false;
2020-07-27 07:24:28 +03:00
services.earlyoom.enable = true;
}