NixOS Xfce on VMware Workstation 12 Pro

インストールに使用しましたISOファイルは、nixos-graphical-17.03.1298.5bafc71b61-x86_64-linux.isoです。

仮想マシンをパワーオンします。

[root@nixos:~] # loadkeys jp106

fdisk -l
fdisk /dev/sda
o
n, p, 1, 2048, +38G
n, p, 2, Enter, Enter
w

mkfs.ext4 -L nixos /dev/sda1
mkswap -L swap /dev/sda2
swapon /dev/sda2
mount /dev/disk/by-label/nixos /mnt
nixos-generate-config --root /mnt

nano /mnt/etc/nixos/configuration.nix
下記のとおり編集・追記しました。

# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  # Use the GRUB 2 boot loader.
  boot.loader.grub.enable = true;
  boot.loader.grub.version = 2;
  # boot.loader.grub.efiSupport = true;
  # boot.loader.grub.efiInstallAsRemovable = true;
  # boot.loader.efi.efiSysMountPoint = "/boot/efi";
  # Define on which hard drive you want to install Grub.
  boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only

  networking.hostName = "nixos"; # Define your hostname.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Select internationalisation properties.
  i18n = {
    consoleFont = "Lat2-Terminus16";
    consoleKeyMap = "jp106";
    defaultLocale = "ja_JP.UTF-8";
  };

  # Set your time zone.
  time.timeZone = "Asia/Tokyo";

  # List packages installed in system profile. To search by name, run:
  # $ nix-env -qaP | grep wget
  environment.systemPackages = with pkgs; [
    wget
  ];

  # List services that you want to enable:

  # Enable the OpenSSH daemon.
  services.openssh.enable = true;

  # Open ports in the firewall.
  # networking.firewall.allowedTCPPorts = [ ... ];
  # networking.firewall.allowedUDPPorts = [ ... ];
  # Or disable the firewall altogether.
  # networking.firewall.enable = false;

  # Enable CUPS to print documents.
  services.printing.enable = true;

  # Enable the X11 windowing system.
  services.xserver.enable = true;
  services.xserver.layout = "jp";
  # services.xserver.xkbOptions = "eurosign:e";

  # Enable the KDE Desktop Environment.
  # services.xserver.displayManager.sddm.enable = true;
  # services.xserver.desktopManager.plasma5.enable = true;

  # Enable the Xfce Desktop Enviroment.
  services.xserver.displayManager.slim.enable = true;
  services.xserver.desktopManager.xfce.enable = true;

  # Define a user account. Don't forget to set a password with ‘passwd’.
  # users.extraUsers.guest = {
  #   isNormalUser = true;
  #   uid = 1000;
  # };

  # The NixOS release to be compatible with for stateful data such as databases.
  system.stateVersion = "17.03";
}

nixos-install

poweroff

Userの追加について
root # useradd -c ‘Real Name’ -m user_name
root # passwd user_name
root # usermod -G wheel user_name

Applicationsのインストールについて
user $ sudo nix-env -i wget unzip gnupg pcmanfm chromium firefox mutt thunderbird leafpad vim gparted

user $ sudo nano /etc/nixos/configuration.nix
下記のとおり編集・追記しました。

# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  # Use the GRUB 2 boot loader.
  boot.loader.grub.enable = true;
  boot.loader.grub.version = 2;
  # boot.loader.grub.efiSupport = true;
  # boot.loader.grub.efiInstallAsRemovable = true;
  # boot.loader.efi.efiSysMountPoint = "/boot/efi";
  # Define on which hard drive you want to install Grub.
  boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only

  networking.hostName = "nixos"; # Define your hostname.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Select internationalisation properties.
  i18n = {
    consoleFont = "Lat2-Terminus16";
    consoleKeyMap = "jp106";
    defaultLocale = "ja_JP.UTF-8";
  };

  # Set your time zone.
  time.timeZone = "Asia/Tokyo";

  # List packages installed in system profile. To search by name, run:
  # $ nix-env -qaP | grep wget
  environment.systemPackages = with pkgs; [
    wget
    unzip
    gnupg
    pcmanfm
    chromium
    firefox
    mutt
    thunderbird
    leafpad
    vim
    gparted
  ];

  # List services that you want to enable:

  # Enable the OpenSSH daemon.
  services.openssh.enable = true;

  # Enable VMware Tools.
  services.vmwareGuest.enable = true;

  # Open ports in the firewall.
  # networking.firewall.allowedTCPPorts = [ ... ];
  # networking.firewall.allowedUDPPorts = [ ... ];
  # Or disable the firewall altogether.
  # networking.firewall.enable = false;

  # Enable CUPS to print documents.
  services.printing.enable = true;

  # Enable the X11 windowing system.
  services.xserver.enable = true;
  services.xserver.layout = "jp";
  # services.xserver.xkbOptions = "eurosign:e";

  # Enable the KDE Desktop Environment.
  # services.xserver.displayManager.sddm.enable = true;
  # services.xserver.desktopManager.plasma5.enable = true;

  # Enable the Xfce Desktop Enviroment.
  services.xserver.displayManager.slim.enable = true;
  services.xserver.desktopManager.xfce.enable = true;

  # Define a user account. Don't forget to set a password with ‘passwd’.
  # users.extraUsers.guest = {
  #   isNormalUser = true;
  #   uid = 1000;
  # };

  # The NixOS release to be compatible with for stateful data such as databases.
  system.stateVersion = "17.03";

  i18n.inputMethod.enabled = "fcitx";
  i18n.inputMethod.fcitx.engines = with pkgs.fcitx-engines; [ mozc ];

  # i18n.inputMethod.enabled = "ibus";
  # i18n.inputMethod.ibus.engines = with pkgs.ibus-engines; [ anthy mozc ];

  nixpkgs.config.allowUnfree = true;
  system.autoUpgrade.enable = true;

  fonts = {
    fonts = with pkgs; [
      ipafont
      powerline-fonts
      baekmuk-ttf
      kochi-substitute
      carlito
    ];

    fontconfig = {
      defaultFonts = {
        monospace = [
          "DejaVu Sans Mono for Powerline"
          "IPAGothic"
          "Baekmuk Dotum"
        ];
        serif = [
          "DejaVu Serif"
          "IPAPMincho"
          "Baekmuk Batang"
        ];
        sansSerif = [
          "DejaVu Sans"
          "IPAPGothic"
          "Baekmuk Dotum"
        ];
      };
    };
  };

}

こちらを見させていただきました。
https://github.com/Tokyo-NixOS/Tokyo-NixOS-Meetup-Wiki/wiki/configuration.nix

configuration.nixファイルを変更したときには、nixos-rebuild switchを実行する必要があります。

user $ sudo nixos-rebuild switch

muttの設定について

user $ sudo mkdir -p ~/.mutt/cache/headers
user $ sudo mkdir ~/.mutt/cache/bodies
user $ sudo touch ~/.mutt/certificates
user $ sudo touch ~/.mutt/muttrc

user $ sudo nano ~/.mutt/muttrc

set ssl_starttls = yes
set ssl_force_tls = yes
set imap_user = ’user_name@gmail.com
set imap_pass = ’password’
set from = ’user_name@gmail.com
set realname = ’Full Name’
set folder = ’imaps://imap.gmail.com/’
set spoolfile = ’imaps://imap.gmail.com/INBOX’
set postponed = ’imaps://imap.gmail.com/[Gmail]/Drafts’
set header_cache = ’~/.mutt/cache/headers’
set message_cachedir = ’~/.mutt/cache/bodies’
set certificate_file = ’~/.mutt/certificates’
set smtp_url = ’smtps://user_name@gmail.com@smtp.gmail.com:465/’
set smtp_pass = ’password’
set move = no
set imap_keepalive = 900

muttのエディタの変更(nano → vim)について

user $ sudo nano ~/.bashrc
export EDITOR=vim

then enter this command
user $ source ~/.bashrc

user $ sudo nano ~/.mutt/muttrc
以下のとおり追記します。
set editor = ’vim

Vimの起動時の設定について
https://github.com/tomasr/molokai.gitからmolokai-master.zipをダウンロードして、展開します。
https://github.com/NewProggie/NewProggie-Color-Scheme.gitからNewProggie-Color-Scheme-master.zipをダウンロードして、展開します。
user $ sudo mkdir -p /home/pure/.vim/colors/
user $ sudo mv /home/pure/ダウンロード/molokai-master/colors/molokai.vim /home/pure/.vim/colors/
user $ sudo mv /home/pure/ダウンロード/NewProggie-Color-Scheme-master/colors/newproggie.vim /home/pure/.vim/colors/

user $ sudo nano ~/.vimrc
set guifont=Monospace\ 14
colorscheme newproggie
 set t_Co=256
 syntax on

デフォルトの壁紙の場所です。
/nix/store/jhvvijwk9g8y25lq5kagcxawm7p4i824-xfdesktop-4.12.3/share/backgrounds/xfce/

NixOS Xfceのスクリーンショットです。

https://cdn.scrot.moe/images/2017/06/13/2017-06-13_16h52_14.png