config

NixOS config
Log | Files | Refs | README | LICENSE

default.nix (2914B) - Raw


      1 {
      2   config,
      3   lib,
      4   myData,
      5   pkgs,
      6   ...
      7 }:
      8 let
      9   cfg = config.mj;
     10 in
     11 {
     12   options.mj = with lib.types; {
     13     stateVersion = lib.mkOption {
     14       type = str;
     15       example = "22.11";
     16       description = "The NixOS state version to use for this system";
     17     };
     18 
     19     timeZone = lib.mkOption {
     20       type = str;
     21       example = "Europe/Vilnius";
     22       description = "Time zone for this system";
     23     };
     24 
     25     username = lib.mkOption { type = str; };
     26 
     27   };
     28 
     29   config = {
     30     nixpkgs.config.allowUnfree = true;
     31 
     32     time.timeZone = cfg.timeZone;
     33 
     34     nix = {
     35       gc = {
     36         automatic = true;
     37         options = "--delete-older-than 7d";
     38       };
     39       settings = {
     40         experimental-features = [
     41           "nix-command"
     42           "flakes"
     43         ];
     44         trusted-users = [ cfg.username ];
     45       };
     46     };
     47 
     48     environment = {
     49       systemPackages =
     50         with pkgs;
     51         lib.mkMerge [
     52           [
     53             extract_url
     54             tmuxbash
     55             mosh
     56             mtr
     57             bc
     58             jc # parse different formats and command outputs to json
     59             jq # parse, format and query json documents
     60             yq
     61             xz
     62             pv # pipe viewer for progressbars in pipes
     63             bat # "bat - cat with wings", cat|less with language highlight
     64             duf # nice disk usage output
     65             git
     66             lz4
     67             mmv
     68             htop
     69             file # file duh
     70             host # look up host info
     71             tree # tree duh
     72             lsof # lsof yay
     73             rage # encrypt-decrypt
     74             ncdu # disk usage navigator
     75             entr
     76             pigz
     77             zstd
     78             unrar
     79             wdiff
     80             sshfs
     81             pwgen
     82             elinks
     83             zopfli
     84             brotli
     85             bindfs
     86             spiped
     87             unison
     88             vmtouch
     89             vimv-rs
     90             ripgrep
     91             gettext
     92             exiftool
     93             usbutils
     94             pciutils
     95             parallel
     96             yamllint
     97             dos2unix
     98             rtorrent
     99             p7zip-rar
    100             moreutils
    101             smartmontools
    102             unixtools.xxd
    103             sqlite-interactive
    104 
    105             # networking
    106             wol
    107             dig
    108             nmap
    109             wget
    110             btop
    111             ngrep
    112             iftop
    113             whois
    114             iperf3
    115             jnettop
    116             openssl
    117             tcpdump
    118             testssl
    119             dnsutils
    120             curl
    121             bandwhich
    122             speedtest-cli
    123             nix-output-monitor
    124           ]
    125         ];
    126     };
    127 
    128     programs.ssh.knownHosts =
    129       let
    130         filtered = lib.filterAttrs (_key: value: lib.hasAttr "publicKey" value) myData.hosts;
    131         sshAttrs = lib.genAttrs [
    132           "extraHostNames"
    133           "publicKey"
    134         ] (_: null);
    135       in
    136       lib.mapAttrs (_name: builtins.intersectAttrs sshAttrs) filtered;
    137 
    138   };
    139 }