Refactor configuration.nix using with pkgs

This commit is contained in:
coolneng 2022-05-02 01:55:43 +02:00
parent df672cd2a5
commit 30013dfc5e
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 10 additions and 6 deletions

View File

@ -1,9 +1,13 @@
{ config, pkgs, lib, ... }: { { config, pkgs, lib, ... }:
with pkgs;
{
# NixOS wants to enable GRUB by default # NixOS wants to enable GRUB by default
boot.loader.grub.enable = false; boot.loader.grub.enable = false;
# A bunch of boot parameters needed for optimal runtime on RPi 4B # A bunch of boot parameters needed for optimal runtime on RPi 4B
boot.kernelPackages = pkgs.linuxPackages_rpi4; boot.kernelPackages = linuxPackages_rpi4;
boot.kernelParams = [ boot.kernelParams = [
"zfs.zfs_arc_max=134217728" "zfs.zfs_arc_max=134217728"
"console=TTYAMA0,115200" "console=TTYAMA0,115200"
@ -17,9 +21,9 @@
version = 4; 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 = [{ swapDevices = [{
device = "/swapfile"; device = "/swapfile";
size = 4096; size = 4096;
@ -42,7 +46,7 @@
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFRqINHR7/zc+c3/PuR+NeSsBHXXzBiEtFWSK6QaxQTW coolneng@panacea" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFRqINHR7/zc+c3/PuR+NeSsBHXXzBiEtFWSK6QaxQTW coolneng@panacea"
]; ];
shell = "${pkgs.fish}/bin/fish"; shell = "${fish}/bin/fish";
}; };
# Set vim as default editor # Set vim as default editor
@ -87,7 +91,7 @@
# Configure fish shell # Configure fish shell
programs.fish.enable = true; programs.fish.enable = true;
users.users.root = { users.users.root = {
shell = "${pkgs.fish}/bin/fish"; shell = "${fish}/bin/fish";
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFRqINHR7/zc+c3/PuR+NeSsBHXXzBiEtFWSK6QaxQTW coolneng@panacea" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFRqINHR7/zc+c3/PuR+NeSsBHXXzBiEtFWSK6QaxQTW coolneng@panacea"
]; ];