Konfigurasi Nixos (Pantheon + BSPWM) Thinkpad X220

mrfdn author

Rafi

mrfdn.com - Sebenarnya sudah lama sekali saya ingin menggunakan Pantheon Desktop milik ElementaryOS. Alasannya karena simple dan minimalis juga rasanya lebih dekat ke MacOs terutama pada file managernya.

Untungnya Nixos sudah menyertakan Pantheon Desktop pada pilihan saat instalasi Nixos .

Lalu saya juga masih ingin menggunakan WM only pada system, jadi saya juga ingin menjalankan BSPWM sebagai window manager. (dan sekarang lebih betah pakai window manager)

Begini setup yang saya lakukan.

  1. Install Nixos + Pantheon Desktop
  2. Melakukan konfigurasi pada file configuration.nix untuk mengaktifkan BSPWM secara otomatis.

Karena desktop ini menggunakan BSPWM maka saya juga menambahkan Polybar untuk menampilkan barnya.

Tercatat saat menulis artikel ini saya sudah melakukan 40 kali rebuild system nixos.

Konfigurasi terakhir saya sudah simpan sehingga menjadi seperti ini :

# 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
      <nixos-hardware/lenovo/thinkpad/x220>
    ];

  # Bootloader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.loader.efi.efiSysMountPoint = "/boot/efi";

  # Enable NTFS support
  boot.supportedFilesystems = [ "ntfs" ];

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

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Enable networking
  networking.networkmanager.enable = true;

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

  # Select internationalisation properties.
  i18n.defaultLocale = "en_US.utf8";

  i18n.extraLocaleSettings = {
    LC_ADDRESS = "id_ID.utf8";
    LC_IDENTIFICATION = "id_ID.utf8";
    LC_MEASUREMENT = "id_ID.utf8";
    LC_MONETARY = "id_ID.utf8";
    LC_NAME = "id_ID.utf8";
    LC_NUMERIC = "id_ID.utf8";
    LC_PAPER = "id_ID.utf8";
    LC_TELEPHONE = "id_ID.utf8";
    LC_TIME = "id_ID.utf8";
  };

  # Enable the X11 windowing system.
  services.xserver.enable = true;
  services.xserver.displayManager.startx.enable = true;

  # BSPWM
  services.xserver.windowManager.bspwm.enable = true;

  # Enable the Pantheon Desktop Environment.
  services.xserver.displayManager.lightdm.enable = true;
  services.xserver.displayManager.defaultSession = "none+bspwm";
  services.xserver.desktopManager.pantheon.enable = true;

  
  #zsh
    programs.zsh.enable = true;
    programs.zsh.autosuggestions.enable = true;
    programs.bash.enableCompletion = true;

  # Configure keymap in X11
  services.xserver = {
    layout = "us";
    xkbVariant = "";
  };


  # Enable pactl for volume thinkpad x220
  #hardware.pulseaudio.package.pkgs = [ "pulseaudioFull" ];

  # Enable Backlight Thinkpad
   programs.light.enable = true;


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

  # Enable sound with pipewire.
  sound.enable = true;
  hardware.pulseaudio.enable = false;
  security.rtkit.enable = true;
  security.polkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
    # If you want to use JACK applications, uncomment this
    #jack.enable = true;

    # use the example session manager (no others are packaged yet so this is enabled by default,
    # no need to redefine it in your config for now)
    #media-session.enable = true;
  };

  # Enable touchpad support (enabled default in most desktopManager).
  services.xserver.libinput.enable = true;

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.nix = {
    isNormalUser = true;
    description = "nix";
    extraGroups = [ 
	"wheel" 
    	"networkmanager" 
	"video" 
	"input"
	"storage"
	];
  };


  users.extraUsers.nix = {
 	shell = pkgs.zsh;
   };

  # Enable automatic login for the user.
  services.xserver.displayManager.autoLogin.enable = false;
  services.xserver.displayManager.autoLogin.user = "nix";

  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
  #  vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
    wget
    firefox
    neovim
    pfetch
    git
    feh
    picom
    sxhkd
    kitty
    zsh
    polybar
    rofi
    w3m
    scrot
    killall
    xclip
    obs-studio
    ffmpeg
    mpv
    gimp
    nodejs
    nodePackages.npm
    ntfs3g
    pasystray
    qogir-icon-theme
    qogir-theme
    lxappearance
    kdenlive
    youtube-dl
    vscodium
    unzip
    luajit
    lf
    hugo
    pulseaudio
    pulseaudio-ctl
    rclone
    rclone-browser
    scrot
    sxiv
    tdesktop
    xorg.xev
    zsh-autosuggestions
    font-awesome
  ];

#fonts.fonts = [ ];

   fonts.fonts = with pkgs; [
      (nerdfonts.override { fonts = [ "Iosevka" "FiraCode" "Hack" ]; })
   ];

   # Mount drive
   security.pam.mount.enable = true;
   security.pam.mount.createMountPoints = true;
   

nix = {
    # Hard link identical files in the store automatically
    autoOptimiseStore = true;
    # automatically trigger garbage collection
    gc.automatic = true;
    gc.dates = "weekly";
    gc.options = "--delete-older-than 30d";
  };


  # Some programs need SUID wrappers, can be configured further or are
  # started in user sessions.
  # programs.mtr.enable = true;
  # programs.gnupg.agent = {
  #   enable = true;
  #   enableSSHSupport = true;
  # };

  # 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;

  # This value determines the NixOS release from which the default
  # settings for stateful data, like file locations and database versions
  # on your system were taken. It‘s perfectly fine and recommended to leavecatenate(variables, "bootdev", bootdev)
  # this value at the release version of the first install of this system.
  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  system.stateVersion = "22.05"; # Did you read the comment?

}

Untuk menggunakan konfigurasi ini, seperti biasa anda hanya perlu mengedit file /etc/nixos/configuration.nix

Kemudian melakukan rebuild sudo nixos-rebuild switch

Tunggu sampai selesai, kemudian restart komputer anda.

Konfigurasi di atas dibuat khusus untuk dijalankan pada laptop Thinkpad X220.

Akhir kata

Konfigurasi ini masih jauh dari sempurna. Masih terdapat beberapa fitur yang tidak saya harapkan ada pada system saat ini.

Meski demikian menggunakan Nixos system memang terasa sangat imutable.

mrfdn author

Rafi

  • 15 year+ of Linux user.
  • 5 years+ blogger and web developer.

Jika artikel yang dibuatnya ternyata bermanfaat, support dengan cara

Baca juga