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) 46 du-dust 47 ; 48 in 49 { 50 g = pkgBin config.programs.git.package; 51 du = "${pkgBin du-dust}"; 52 df = "${coreBin "df"} -h"; 53 free = "${pkgs.procps}/bin/free -h"; 54 n = nixBin; 55 nb = "${nixBin} build"; 56 nf = "${nixBin} flake"; 57 nfu = "${nixBin} flake update"; 58 nfui = "${nixBin} flake update"; 59 nfs = "${nixBin} flake show"; 60 nsh = "${nixBin} shell"; 61 top = "${pkgs.bottom}/bin/btm"; 62 myip = "${pkgs.dnsutils}/bin/dig +short myip.opendns.com @208.67.222.222 2>&1"; 63 # systemd 64 ctl = "systemctl"; 65 stl = ifSudo "s systemctl"; 66 utl = "systemctl --user"; 67 jtl = "journalctl"; 68 }; 69 }; 70 system.activationScripts.diff = '' 71 if [ -z "$systemConfig" ]; then 72 ${config.nix.package}/bin/nix store \ 73 --experimental-features 'nix-command' \ 74 diff-closures /run/current-system "$systemConfig" 75 fi 76 ''; 77 78 users.mutableUsers = false; 79 80 programs.mosh = { 81 enable = true; 82 openFirewall = false; 83 }; 84 programs.git.enable = true; 85}