I think we can post our configuration.nix and home.nix (for those who use home-manager) using this thread, so that it is easy to publish and allows others to search.
Many parts of this have been copied from the Internet
Hats off to the original authors!
my configuration.nix (slightly modified for publication)
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "nixos"; # Define your hostname.
networking.interfaces.enp4s0.ipv4.addresses = [ { address = "10.11.12.122"; prefixLength = 24; } ];
networking.defaultGateway = "10.11.12.1";
networking.nameservers = [ "10.11.12.1" ];
time.timeZone = "Japan";
virtualisation.virtualbox.host.enable = true;
#audio
hardware.bluetooth = {
enable = true;
config = {
General = {
Enable = "Source,Sink,Media,Socket";
};
};
};
services.blueman.enable = true;
sound.enable = true;
hardware.pulseaudio = {
enable = true;
extraModules = [ pkgs.pulseaudio-modules-bt ];
package = pkgs.pulseaudioFull;
support32Bit = true; # Steam
extraConfig = ''
load-module module-bluetooth-policy auto_switch=2
'';
};
services.cron.enable = true;
services.cron.systemCronJobs = ["@reboot root ${pkgs.ethtool}/sbin/ethtool -s enp4s0 wol g"];
services.openssh.enable = true;
services.openssh.passwordAuthentication = false;
services.openssh.challengeResponseAuthentication= false;
services.openssh.extraConfig = "UseDNS yes";
programs.mosh.enable = true;
systemd.targets.sleep.enable = false;
systemd.targets.suspend.enable = false;
systemd.targets.hibernate.enable = false;
systemd.targets.hybrid-sleep.enable = false;
services.vsftpd.enable = true;
services.vsftpd.localUsers = true;
services.vsftpd.writeEnable= true;
services.vsftpd.extraConfig = ''
pasv_enable=YES
connect_from_port_20=YES
pasv_min_port=4242
pasv_max_port=4243
'';
services.apcupsd.enable=true;
services.apcupsd.configText= ''
UPSCABLE smart
UPSTYPE apcsmart
DEVICE /dev/ttyS0
'';
services.postfix = {
enable = true;
setSendmail = true;
};
services.xserver.enable = true;
services.xserver.layout = "us";
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome3.enable = true;
users.extraUsers.yasu = {
home="/home/yasu";
isNormalUser = true;
uid = 1000;
extraGroups = ["wheel"];
};
nixpkgs.config.allowUnfree = true;
services.xserver.videoDrivers = [ "nvidia" ];
powerManagement.enable = true;
hardware.opengl.driSupport32Bit = true;
services.fail2ban.enable = true;
services.netdata.enable = true;
programs.gnupg.agent.enable = true;
services.xrdp.enable = true;
networking.firewall.allowedTCPPorts = [ 3389 ];
services.xrdp.defaultWindowManager = "${pkgs.icewm}/bin/icewm";
services.vnstat.enable = true;
i18n.inputMethod = {
enabled = "ibus";
ibus.engines = with pkgs.ibus-engines; [ /* any engine you want, for example */ mozc ];
};
fonts.fonts = with pkgs; [
carlito
dejavu_fonts
ipafont
kochi-substitute
source-code-pro
ttf_bitstream_vera
];
fonts.fontconfig.defaultFonts = {
monospace = [
"DejaVu Sans Mono"
"IPAGothic"
];
sansSerif = [
"DejaVu Sans"
"IPAPGothic"
];
serif = [
"DejaVu Serif"
"IPAPMincho"
];
};
}
my home.nix (slightly modified for publication)
{ config, pkgs, ... }:
rec {
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = "yasu";
home.homeDirectory = "/home/yasu";
home.packages = with pkgs; [
google-chrome
chromium
xclip
nmap
gnupg
pass
weechat
telnet
remmina
file
vnstat
iperf
nethogs
bind
iftop
bmon
iptraf-ng
];
programs.git = {
enable = true;
userName = "Yasuaki Kudo";
userEmail = "yasu@yasuaki.com";
};
programs.neovim = {
enable = true;
plugins = [
pkgs.vimPlugins.vim-airline
pkgs.vimPlugins.vim-nix
];
#settings = { ignorecase = true; };
extraConfig = ''
set mouse=a
set ignorecase
set pastetoggle=<F2>
set clipboard+=unnamedplus
'';
};
xdg.mimeApps.defaultApplications = { "text/html" = ["chromium-browser.desktop"];};
programs.tmux.enable = true;
programs.tmux.keyMode = "vi";
programs.tmux.sensibleOnTop = true;
programs.tmux.shortcut = "a";
programs.tmux.terminal = "screen-256color";
programs.tmux.secureSocket = false;
programs.tmux.extraConfig = ''
# Make mouse useful in copy mode
setw -g mouse on
set-option -s set-clipboard off
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -se c -i"
'';
programs.bash.enable = true;
programs.bash.initExtra = ''
set -o vi
alias grep="grep --color=auto"
# https://github.com/rycee/home-manager/pull/797#issuecomment-538464993
source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
'';
home.sessionVariables = { EDITOR = "nvim"; };
programs.neomutt.enable = true;
programs.astroid.enable = true;
programs.mbsync.enable = true;
#services.mbsync.enable = true;
#services.mbsync.frequency = "*:0/1";
programs.msmtp.enable = true;
programs.notmuch = {
enable = true;
hooks = {
preNew = "mbsync --all";
};
};
accounts.email.accounts.yasu.notmuch.enable = true;
accounts.email.accounts.yasu.mbsync.enable = true;
accounts.email.accounts.yasu.mbsync.create = "both";
accounts.email.accounts.yasu.msmtp.enable = true;
accounts.email.accounts.yasu.neomutt.enable = true;
accounts.email.accounts.yasu.astroid.enable = true;
accounts.email.accounts.yasu.primary = true;
accounts.email.accounts.yasu.userName= "yasu@yasuaki.com";
accounts.email.accounts.yasu.realName= "Yasuaki Kudo";
accounts.email.accounts.yasu.address = "yasu@yasuaki.com";
accounts.email.accounts.yasu.imap.host = "yasu.mailserver.com";
accounts.email.accounts.yasu.smtp.host = accounts.email.accounts.yasu.imap.host;
accounts.email.accounts.yasu.passwordCommand = "${pkgs.pass}/bin/pass email";
}