2021-05-28 19:37:09 +03:00
|
|
|
{ self, inputs, config, pkgs, lib, ourLib, ... }:
|
2021-05-03 07:48:31 +03:00
|
|
|
let
|
|
|
|
inherit (lib) fileContents mkIf;
|
2021-05-14 22:17:10 +03:00
|
|
|
pkgBin = 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
|
2021-06-30 17:50:07 +03:00
|
|
|
bottom
|
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
|
2021-06-05 09:13:41 +03:00
|
|
|
mosh
|
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";
|
|
|
|
|
|
|
|
# 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
|
|
|
|
2021-05-28 19:37:09 +03:00
|
|
|
nix =
|
|
|
|
let
|
|
|
|
registry =
|
|
|
|
builtins.mapAttrs
|
|
|
|
(_: v: { flake = v; })
|
|
|
|
(lib.filterAttrs (_: v: v ? outputs) inputs);
|
|
|
|
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;
|
|
|
|
};
|
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;
|
2021-07-24 16:51:53 +03:00
|
|
|
|
2021-05-13 21:04:15 +03:00
|
|
|
# For rage encryption, all hosts need a ssh key pair
|
|
|
|
services.openssh = {
|
|
|
|
enable = true;
|
|
|
|
openFirewall = lib.mkDefault false;
|
|
|
|
};
|
|
|
|
|
2019-12-05 08:36:36 +03:00
|
|
|
services.earlyoom.enable = true;
|
|
|
|
}
|