2021-05-10 14:19:05 +03:00
|
|
|
{ self, config, pkgs, lib, ... }:
|
2021-05-03 07:48:31 +03:00
|
|
|
let
|
|
|
|
inherit (lib) fileContents mkIf;
|
2021-05-10 14:19:05 +03:00
|
|
|
pkgBin = pkgs.ourlib.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 ];
|
2019-12-05 08:36:36 +03:00
|
|
|
|
2021-05-03 07:48:31 +03:00
|
|
|
boot = {
|
|
|
|
tmpOnTmpfs = true;
|
|
|
|
loader.systemd-boot.configurationLimit = 10;
|
|
|
|
};
|
2019-12-05 08:36:36 +03:00
|
|
|
|
2021-05-03 07:48:31 +03:00
|
|
|
console.font = "7x14";
|
2019-12-05 08:36:36 +03:00
|
|
|
|
2021-05-03 07:48:31 +03:00
|
|
|
environment = {
|
2019-12-05 08:36:36 +03:00
|
|
|
systemPackages = with pkgs; [
|
|
|
|
binutils
|
|
|
|
coreutils
|
|
|
|
curl
|
2020-08-02 22:28:41 +03:00
|
|
|
direnv
|
2019-12-05 08:36:36 +03:00
|
|
|
dnsutils
|
2020-07-07 03:25:32 +03:00
|
|
|
dosfstools
|
2019-12-05 08:36:36 +03:00
|
|
|
fd
|
|
|
|
git
|
2019-12-26 10:17:44 +03:00
|
|
|
gotop
|
2019-12-17 07:13:33 +03:00
|
|
|
gptfdisk
|
2019-12-05 08:36:36 +03:00
|
|
|
iputils
|
2020-07-21 03:04:37 +03:00
|
|
|
jq
|
2020-12-17 00:48:40 +03:00
|
|
|
manix
|
2019-12-05 08:36:36 +03:00
|
|
|
moreutils
|
2021-02-15 08:17:24 +03:00
|
|
|
nix-index
|
2020-07-07 03:25:32 +03:00
|
|
|
nmap
|
2019-12-05 08:36:36 +03:00
|
|
|
ripgrep
|
2021-03-15 06:49:35 +03:00
|
|
|
skim
|
2021-02-03 08:46:12 +03:00
|
|
|
tealdeer
|
2021-04-09 06:03:38 +03:00
|
|
|
usbutils
|
2019-12-05 08:36:36 +03:00
|
|
|
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
|
2019-12-05 08:36:36 +03:00
|
|
|
];
|
|
|
|
|
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
|
|
|
|
2021-01-19 10:51:23 +03:00
|
|
|
# fix nixos-option
|
2021-05-11 21:40:37 +03:00
|
|
|
nixos-option = "nixos-option -I nixpkgs=${self}/lib/compat";
|
2021-01-19 10:51:23 +03:00
|
|
|
|
2019-12-05 08:36:36 +03:00
|
|
|
# sudo
|
2019-12-19 21:57:49 +03:00
|
|
|
s = ifSudo "sudo -E ";
|
|
|
|
si = ifSudo "sudo -i";
|
2019-12-05 08:36:36 +03:00
|
|
|
se = ifSudo "sudoedit";
|
|
|
|
|
2019-12-26 10:17:44 +03:00
|
|
|
# top
|
|
|
|
top = "gotop";
|
|
|
|
|
2019-12-05 08:36:36 +03:00
|
|
|
# systemd
|
|
|
|
ctl = "systemctl";
|
2019-12-19 21:57:49 +03:00
|
|
|
stl = ifSudo "s systemctl";
|
2019-12-05 08:36:36 +03:00
|
|
|
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-03-02 06:11:23 +03:00
|
|
|
};
|
2019-12-05 08:36:36 +03:00
|
|
|
};
|
|
|
|
|
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"
|
|
|
|
'';
|
2019-12-05 08:36:36 +03:00
|
|
|
|
|
|
|
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
|
2020-12-26 08:09:09 +03:00
|
|
|
keep-outputs = true
|
|
|
|
keep-derivations = true
|
2021-02-17 22:54:41 +03:00
|
|
|
fallback = true
|
2019-12-05 08:36:36 +03:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
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
|
|
|
|
2019-12-05 08:36:36 +03:00
|
|
|
services.earlyoom.enable = true;
|
|
|
|
}
|