ark/modules/base/default.nix

115 lines
2.8 KiB
Nix
Raw Normal View History

2022-02-18 20:31:01 +03:00
{
inputs,
config,
pkgs,
2022-04-09 21:33:13 +03:00
lib,
2022-04-09 22:01:44 +03:00
tlib,
2022-02-18 20:31:01 +03:00
...
2022-03-09 23:55:02 +03:00
}: let
2022-04-09 22:01:44 +03:00
inherit (lib) fileContents mkIf;
2022-04-09 21:33:13 +03:00
2021-05-03 07:48:31 +03:00
coreBin = v: "${pkgs.coreutils}/bin/${v}";
nixBin = "${config.nix.package}/bin/nix";
2022-08-11 05:44:58 +03:00
pkgBin = tlib.pkgBin;
2022-02-18 20:31:01 +03:00
in {
2022-04-09 21:33:13 +03:00
imports = [
./nix.nix
./hm-system-defaults.nix
];
2021-05-03 07:48:31 +03:00
environment = {
2022-03-09 23:55:02 +03:00
systemPackages = with pkgs; [
binutils
coreutils
curl
direnv
dnsutils
dosfstools
fd
bottom
gptfdisk
iputils
jq
manix
moreutils
nix-index
nmap
ripgrep
skim
tealdeer
usbutils
2022-09-29 23:34:57 +03:00
util-linux
2022-03-09 23:55:02 +03:00
whois
bat
fzf
2023-09-21 21:55:07 +03:00
eza
2022-03-09 23:55:02 +03:00
lm_sensors
mkpasswd
bottom
amber
unzip
unrar
hydra-check
du-dust
mosh
2022-06-10 21:36:34 +03:00
git
git-crypt
2022-03-09 23:55:02 +03:00
];
shellAliases = let
ifSudo = string: mkIf config.security.sudo.enable string;
2023-09-21 21:55:07 +03:00
inherit (pkgs) git bat eza du-dust;
2022-03-09 23:55:02 +03:00
in {
2022-08-11 05:44:58 +03:00
g = pkgBin git;
git-optimize = "${pkgBin git} gc --aggressive --prune=now";
cat = "${pkgBin bat} -pp --theme=base16";
2022-03-09 23:55:02 +03:00
c = "cat";
2022-08-11 05:44:58 +03:00
du = "${pkgBin du-dust}";
2022-03-09 23:55:02 +03:00
df = "${coreBin "df"} -h";
free = "${pkgs.procps}/bin/free -h";
2023-09-21 21:55:07 +03:00
ls = pkgBin eza;
l = "${pkgBin eza} -lhg";
la = "${pkgBin eza} -lhg -a";
t = "${pkgBin eza} -lhg -T";
ta = "${pkgBin eza} -lhg -a -T";
2022-03-09 23:55:02 +03:00
n = nixBin;
2024-05-28 10:50:27 +03:00
nb = "${nixBin} build";
2022-03-09 23:55:02 +03:00
nf = "${nixBin} flake";
nfu = "${nixBin} flake update";
2024-05-28 10:50:27 +03:00
nfui = "${nixBin} flake update";
2022-03-09 23:55:02 +03:00
nfs = "${nixBin} flake show";
nsh = "${nixBin} shell";
2022-06-10 21:36:34 +03:00
nix-store-refs = "nix-store -qR";
2022-03-09 23:55:02 +03:00
nosrs = ifSudo "sudo nixos-rebuild --fast switch";
nosrb = ifSudo "sudo nixos-rebuild --fast boot";
nosrt = ifSudo "sudo nixos-rebuild --fast test";
ngc = ifSudo "sudo nix-collect-garbage";
ngcdo = 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";
mn = let
manix_preview = "manix '{}' | sed 's/type: /> type: /g' | bat -l Markdown --color=always --plain";
in ''manix "" | rg '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | sk --preview="${manix_preview}" | xargs manix'';
# systemd
ctl = "systemctl";
stl = ifSudo "s systemctl";
utl = "systemctl --user";
jtl = "journalctl";
};
};
2022-03-09 23:55:02 +03:00
system.activationScripts.diff = ''
2022-06-10 21:36:34 +03:00
if [ -z "$systemConfig" ]; then
2024-05-28 05:49:23 +03:00
${config.nix.package}/bin/nix store \
2022-06-10 21:36:34 +03:00
--experimental-features 'nix-command' \
diff-closures /run/current-system "$systemConfig"
fi
2022-03-09 23:55:02 +03:00
'';
2021-05-03 07:48:31 +03:00
users.mutableUsers = false;
2022-06-10 21:36:34 +03:00
programs = {
command-not-found.enable = true;
git = {
enable = true;
config = {safe.directory = ["/etc/nixos"];};
};
};
}