nix machine / user configurations
1{ 2 inputs, 3 config, 4 pkgs, 5 lib, 6 tlib, 7 ... 8}: 9let 10 inherit (lib) fileContents mkIf; 11 12 coreBin = v: "${pkgs.coreutils}/bin/${v}"; 13 nixBin = "${config.nix.package}/bin/nix"; 14 pkgBin = tlib.pkgBin; 15in 16{ 17 imports = [ 18 ./nix.nix 19 ./hm-system-defaults.nix 20 ]; 21 22 environment = { 23 systemPackages = with pkgs; [ 24 binutils 25 coreutils 26 dnsutils 27 moreutils 28 iputils 29 curl 30 direnv 31 fd 32 nmap 33 ripgrep 34 tealdeer 35 usbutils 36 util-linux 37 bottom 38 unzip 39 unrar 40 git 41 ]; 42 shellAliases = 43 let 44 ifSudo = string: mkIf config.security.sudo.enable string; 45 inherit (pkgs) dust; 46 in 47 { 48 g = pkgBin config.programs.git.package; 49 du = "${pkgBin dust}"; 50 df = "${coreBin "df"} -h"; 51 free = "${pkgs.procps}/bin/free -h"; 52 n = nixBin; 53 nb = "${nixBin} build"; 54 nf = "${nixBin} flake"; 55 nfu = "${nixBin} flake update"; 56 nfui = "${nixBin} flake update"; 57 nfs = "${nixBin} flake show"; 58 nsh = "${nixBin} shell"; 59 top = "${pkgs.bottom}/bin/btm"; 60 myip = "${pkgs.dnsutils}/bin/dig +short myip.opendns.com @208.67.222.222 2>&1"; 61 # systemd 62 ctl = "systemctl"; 63 stl = ifSudo "s systemctl"; 64 utl = "systemctl --user"; 65 jtl = "journalctl"; 66 }; 67 }; 68 system.activationScripts.diff = '' 69 if [ -z "$systemConfig" ]; then 70 ${config.nix.package}/bin/nix store \ 71 --experimental-features 'nix-command' \ 72 diff-closures /run/current-system "$systemConfig" 73 fi 74 ''; 75 76 users.mutableUsers = false; 77 78 programs.mosh = { 79 enable = true; 80 openFirewall = false; 81 }; 82 programs.git.enable = true; 83}