ark/modules/base/default.nix

116 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-04-09 22:09:32 +03:00
pkgBin = tlib.pkgBin pkgs;
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
console.font = "7x14";
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
utillinux
whois
bat
fzf
exa
lm_sensors
mkpasswd
zoxide
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;
in {
g = pkgBin "git";
git-optimize = "${pkgBin "git"} gc --aggressive --prune=now";
cat = "${pkgBin "bat"} -pp --theme=base16";
c = "cat";
du = "${pkgs.du-dust}/bin/dust";
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";
nfu = "${nixBin} flake update";
nfui = "${nixBin} flake lock --update-input";
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
${pkgs.nixUnstable}/bin/nix store \
--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"];};
};
};
2022-04-09 22:09:32 +03:00
nixpkgs.config.allowUnfree = true;
}