ark/profiles/core/default.nix

188 lines
5.1 KiB
Nix
Raw Normal View History

2022-02-18 20:31:01 +03:00
{
self,
inputs,
config,
pkgs,
lib,
...
}:
2021-05-03 07:48:31 +03:00
let
inherit (lib) fileContents mkIf;
2021-07-24 20:01:36 +03:00
pkgBin = lib.our.pkgBinNoDep pkgs;
2021-05-03 07:48:31 +03:00
coreBin = v: "${pkgs.coreutils}/bin/${v}";
nixBin = "${config.nix.package}/bin/nix";
2022-02-18 20:31:01 +03:00
in {
imports = [../cachix ../../locale];
2021-05-03 07:48:31 +03:00
boot = {
tmpOnTmpfs = true;
loader.systemd-boot.configurationLimit = 10;
};
console.font = "7x14";
environment = {
2022-02-18 20:31:01 +03:00
systemPackages =
with pkgs; [
binutils
coreutils
curl
direnv
dnsutils
dosfstools
fd
git
bottom
gptfdisk
iputils
jq
manix
moreutils
nix-index
nmap
ripgrep
skim
tealdeer
usbutils
utillinux
whois
bat
fzf
exa
git
lm_sensors
mkpasswd
ntfs3g
zoxide
bottom
amber
unzip
unrar
grit
hydra-check
nix-index
du-dust
mosh
(
pkgs.runCommand
"0x0.sh"
{}
''
mkdir -p $out/bin
cp ${
pkgs.fetchurl
{
url = "https://raw.githubusercontent.com/Calinou/0x0/master/bin/0x0";
sha256 = "sha256-Fad+AKBuA49qtRQfnroqjaNWeuRaCekXZG9sS9JVeaM=";
}
} $out/bin/0x0
chmod +x $out/bin/0x0
''
)
];
2020-01-04 08:06:31 +03:00
shellAliases =
2022-02-18 20:31:01 +03:00
let
ifSudo = string: mkIf config.security.sudo.enable string;
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
cat = "${pkgBin "bat"} -pp --theme=base16";
2021-08-21 19:07:11 +03:00
c = "cat";
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";
2021-08-21 19:01:07 +03:00
nfui = "${nixBin} flake lock --update-input";
2021-05-03 07:48:31 +03:00
nfs = "${nixBin} flake show";
np = "${nixBin} profile";
2021-08-21 19:07:11 +03:00
nb = "${nixBin} build";
2021-05-03 07:48:31 +03:00
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";
2021-08-21 19:01:07 +03:00
nrun = "${nixBin} run";
2021-08-21 19:07:11 +03:00
nrefs = "nix-store -qR";
2021-08-21 19:01:07 +03:00
noscd = "cd /etc/nixos";
2021-08-21 19:07:11 +03:00
nosrs = ifSudo "sudo nixos-rebuild --fast switch";
nosrb = ifSudo "sudo nixos-rebuild --fast boot";
nosrt = ifSudo "sudo nixos-rebuild --fast test";
2021-08-21 19:01:07 +03:00
ngc = ifSudo "sudo nix-collect-garbage";
ngcdo = ifSudo "sudo nix-collect-garbage --delete-old";
2021-05-03 07:48:31 +03:00
top = "${pkgs.bottom}/bin/btm";
2022-02-18 20:31:01 +03:00
myip = "${pkgs.dnsutils}/bin/dig +short myip.opendns.com @208.67.222.222 2>&1";
2021-08-22 20:54:38 +03:00
mn =
2022-02-18 20:31:01 +03:00
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'';
# fix nixos-option
nixos-option = "nixos-option -I nixpkgs=${self}/lib/compat";
# sudo
2021-08-21 19:07:11 +03:00
s = ifSudo "sudo -E";
2019-12-19 21:57:49 +03:00
si = ifSudo "sudo -i";
se = ifSudo "sudoedit";
# 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";
};
};
2022-02-18 20:31:01 +03:00
system.activationScripts.diff =
''
${pkgs.nixUnstable}/bin/nix store \
--experimental-features 'nix-command' \
diff-closures /run/current-system "$systemConfig"
'';
2021-05-28 19:37:09 +03:00
nix =
let
registry =
2021-07-24 20:01:36 +03:00
builtins.removeAttrs
2022-02-18 20:31:01 +03:00
(builtins.mapAttrs (_: v: { flake = v; }) (lib.filterAttrs (_: v: v ? outputs) inputs))
["bud"];
in {
2021-10-23 12:06:42 +03:00
package = pkgs.nixUnstable;
2021-05-28 19:37:09 +03:00
gc.automatic = true;
optimise.automatic = true;
2022-02-18 20:31:01 +03:00
extraOptions =
''
min-free = 536870912
keep-outputs = true
keep-derivations = true
fallback = true
'';
2021-05-28 19:37:09 +03:00
inherit registry;
2022-02-18 20:31:01 +03:00
settings = {
sandbox = true;
allowed-users = ["@wheel"];
trusted-users = ["root" "@wheel"];
auto-optimise-store = true;
};
2021-05-28 19:37:09 +03:00
};
2021-05-03 07:48:31 +03:00
programs.command-not-found.enable = false;
home-manager.useGlobalPkgs = true;
users.mutableUsers = false;
# For rage encryption, all hosts need a ssh key pair
2022-02-18 20:31:01 +03:00
/*
services.openssh = {
enable = true;
openFirewall = lib.mkDefault false;
};
*/
services.earlyoom.enable = true;
}