{ lib, pkgs, ... }: { ################################################################################### # # NixOS's core configuration suitable for all my machines # ################################################################################### # for nix server, we do not need to keep too much generations boot.loader.systemd-boot.configurationLimit = lib.mkDefault 10; # boot.loader.grub.configurationLimit = 10; # do garbage collection weekly to keep disk usage low nix.gc = { automatic = lib.mkDefault true; dates = lib.mkDefault "weekly"; options = lib.mkDefault "--delete-older-than 1w"; }; # Manual optimise storage: nix-store --optimise # https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-auto-optimise-store nix.settings.auto-optimise-store = true; # enable flakes globally nix.settings.experimental-features = ["nix-command" "flakes"]; # Allow unfree packages nixpkgs.config.allowUnfree = lib.mkDefault false; # Set your time zone. time.timeZone = "Asia/Shanghai"; # Select internationalisation properties. i18n.defaultLocale = "en_US.UTF-8"; i18n.extraLocaleSettings = { LC_ADDRESS = "zh_CN.UTF-8"; LC_IDENTIFICATION = "zh_CN.UTF-8"; LC_MEASUREMENT = "zh_CN.UTF-8"; LC_MONETARY = "zh_CN.UTF-8"; LC_NAME = "zh_CN.UTF-8"; LC_NUMERIC = "zh_CN.UTF-8"; LC_PAPER = "zh_CN.UTF-8"; LC_TELEPHONE = "zh_CN.UTF-8"; LC_TIME = "zh_CN.UTF-8"; }; # networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ]; # Or disable the firewall altogether. networking.firewall.enable = lib.mkDefault false; # Enable the OpenSSH daemon. services.openssh = { enable = true; settings = { X11Forwarding = true; PermitRootLogin = "no"; # disable root login PasswordAuthentication = false; # disable password login }; openFirewall = true; }; # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. wget curl aria2 git # used by nix flakes git-lfs # used by huggingface models # create a fhs environment by command `fhs`, so we can run non-nixos packages in nixos! ( let base = pkgs.appimageTools.defaultFhsEnvArgs; in pkgs.buildFHSUserEnv (base // { name = "fhs"; targetPkgs = pkgs: (base.targetPkgs pkgs) ++ [pkgs.pkg-config]; profile = "export FHS=1"; runScript = "bash"; extraOutputsToInstall = ["dev"]; }) ) ]; # replace default editor with neovim environment.variables.EDITOR = "nvim"; virtualisation.docker = { enable = true; }; # for power management services.power-profiles-daemon = { enable = true; }; services.upower.enable = true; }