From 30013dfc5e4c9701590df4ea7c318160ab8f7834 Mon Sep 17 00:00:00 2001
From: coolneng <akasroua@gmail.com>
Date: Mon, 2 May 2022 01:55:43 +0200
Subject: [PATCH] Refactor configuration.nix using with pkgs

---
 configuration.nix | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/configuration.nix b/configuration.nix
index efb524c..e21f5ad 100644
--- a/configuration.nix
+++ b/configuration.nix
@@ -1,9 +1,13 @@
-{ config, pkgs, lib, ... }: {
+{ config, pkgs, lib, ... }:
+
+with pkgs;
+
+{
   # NixOS wants to enable GRUB by default
   boot.loader.grub.enable = false;
 
   # A bunch of boot parameters needed for optimal runtime on RPi 4B
-  boot.kernelPackages = pkgs.linuxPackages_rpi4;
+  boot.kernelPackages = linuxPackages_rpi4;
   boot.kernelParams = [
     "zfs.zfs_arc_max=134217728"
     "console=TTYAMA0,115200"
@@ -17,9 +21,9 @@
     version = 4;
   };
 
-  environment.systemPackages = with pkgs; [ libraspberrypi htop vim ];
+  environment.systemPackages = [ libraspberrypi htop vim ];
 
-  # !!! Adding a swap file is optional, but strongly recommended!
+  # Add a swap file
   swapDevices = [{
     device = "/swapfile";
     size = 4096;
@@ -42,7 +46,7 @@
     openssh.authorizedKeys.keys = [
       "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFRqINHR7/zc+c3/PuR+NeSsBHXXzBiEtFWSK6QaxQTW coolneng@panacea"
     ];
-    shell = "${pkgs.fish}/bin/fish";
+    shell = "${fish}/bin/fish";
   };
 
   # Set vim as default editor
@@ -87,7 +91,7 @@
   # Configure fish shell
   programs.fish.enable = true;
   users.users.root = {
-    shell = "${pkgs.fish}/bin/fish";
+    shell = "${fish}/bin/fish";
     openssh.authorizedKeys.keys = [
       "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFRqINHR7/zc+c3/PuR+NeSsBHXXzBiEtFWSK6QaxQTW coolneng@panacea"
     ];