Merge branch 'main' of github.com:sajenim/dotfiles.nix

This commit is contained in:
♥ Minnie ♥ 2023-05-15 21:12:25 +08:00
commit 632a77160c
3 changed files with 93 additions and 53 deletions

View file

@ -12,8 +12,12 @@
# You can also split up your configuration and import pieces of it here: # You can also split up your configuration and import pieces of it here:
# Configurations
"${inputs.neovim-jsm}/default.nix"
# Programs # Programs
./programs/git.nix ./programs/git.nix
./programs/zsh.nix
]; ];
nixpkgs = { nixpkgs = {
@ -51,7 +55,7 @@
username = "admin"; username = "admin";
homeDirectory = "/home/admin"; homeDirectory = "/home/admin";
sessionVariables = { sessionVariables = {
EDITOR = "vim"; EDITOR = "nvim";
}; };
# Install some packages # Install some packages

View file

@ -2,48 +2,90 @@
# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) # Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
{ inputs, outputs, lib, config, pkgs, ... }: { { inputs, outputs, lib, config, pkgs, ... }: {
imports = # You can import other NixOS modules here
[ # Include the results of the hardware scan. imports = [
./hardware-configuration.nix # If you want to use modules your own flake exports (from modules/nixos):
]; # outputs.nixosModules.example
# Or modules from other flakes (such as nixos-hardware):
# inputs.hardware.nixosModules.common-cpu-amd
# inputs.hardware.nixosModules.common-ssd
# You can also split up your configuration and import pieces of it here:
# Import your generated (nixos-generate-config) hardware configuration
./hardware-configuration.nix
];
nixpkgs = { nixpkgs = {
# You can add overlays here
overlays = [ overlays = [
# Add overlays your own flake exports (from overlays and pkgs dir):
outputs.overlays.additions outputs.overlays.additions
outputs.overlays.modifications outputs.overlays.modifications
outputs.overlays.unstable-packages outputs.overlays.unstable-packages
# You can also add overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default
# Or define it inline, for example:
# (final: prev: {
# hi = final.hello.overrideAttrs (oldAttrs: {
# patches = [ ./change-hello-to-hi.patch ];
# });
# })
]; ];
# Configure your nixpkgs instance
config = { config = {
# Disable if you don't want unfree packages
allowUnfree = true; allowUnfree = true;
}; };
}; };
nix = { nix = {
autoOptimiseStore = true;
gc = { gc = {
#Automatically run the garbage collector at a specific time.
automatic = true; automatic = true;
dates = "weekly"; dates = "weekly";
options = "--delete-older-than 30d"; options = "--delete-older-than 30d";
}; };
# This will add each flake input as a registry
# To make nix commands consistent with your flake
registry = lib.mapAttrs (_: value: { flake = value; }) inputs;
# This will additionally add your inputs to the system's legacy channels
# Making legacy nix commands consistent as well, awesome!
nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry;
settings = {
# Enable flakes and new 'nix' command
experimental-features = "nix-command flakes";
# Deduplicate and optimize nix store
auto-optimise-store = true;
};
# Free up to 1GiB whenever there is less than 100MiB left. # Free up to 1GiB whenever there is less than 100MiB left.
extraOptions = '' extraOptions = ''
min-free = ${toString (100 * 1024 * 1024)} min-free = ${toString (100 * 1024 * 1024)}
max-free = ${toString (1024 * 1024 * 1024)} max-free = ${toString (1024 * 1024 * 1024)}
''; '';
registry = lib.mapAttrs (_: value: { flake = value; }) inputs;
nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry;
settings = {
experimental-features = "nix-command flakes";
auto-optimise-store = true;
};
}; };
# Select internationalisation properties
i18n.defaultLocale = "en_AU.UTF-8";
# Set timezone
time.timeZone = "Australia/Perth";
boot = { boot = {
# Kernel to install
kernelPackages = pkgs.linuxPackages_rpi4; kernelPackages = pkgs.linuxPackages_rpi4;
tmpOnTmpfs = true;
tmp.useTmpfs = true;
initrd.availableKernelModules = [ "usbhid" "usb_storage" ]; initrd.availableKernelModules = [ "usbhid" "usb_storage" ];
# ttyAMA0 is the serial consolee broken out to the GPIO
# ttyAMA0 is the serial console broken out to the GPIO
kernelParams = [ kernelParams = [
"8250.nr_uarts=1" "8250.nr_uarts=1"
"console=ttyAMA0,115200" "console=ttyAMA0,115200"
@ -51,6 +93,13 @@
# A lot of GUI programs need this, nearly all wayland applications # A lot of GUI programs need this, nearly all wayland applications
"cma=128M" "cma=128M"
]; ];
loader = {
# Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
grub.enable = false;
# Enables the generation of /boot/extlinux/extlinux.conf
generic-extlinux-compatible.enable = true;
};
}; };
# Required for the Wireless firmware # Required for the Wireless firmware
@ -63,40 +112,15 @@
}; };
}; };
# Install docker
virtualisation.docker = {
enable = true;
# Reduce container downtime due to daemon crashes
liveRestore = false;
};
# Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
boot.loader.grub.enable = false;
# Enables the generation of /boot/extlinux/extlinux.conf
boot.loader.generic-extlinux-compatible.enable = true;
# networking.hostName = "nixos"; # Define your hostname.
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Set your time zone.
# time.timeZone = "Europe/Amsterdam";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# useXkbConfig = true; # use xkbOptions in tty.
# };
# Enable the X11 windowing system.
# services.xserver.enable = true;
# Configure keymap in X11 # Configure keymap in X11
# services.xserver.layout = "us"; # services.xserver.layout = "us";
@ -116,11 +140,12 @@
# services.xserver.libinput.enable = true; # services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd. # Define a user account. Don't forget to set a password with passwd.
users.users.admin = { users.users.admin = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable sudo for the user. extraGroups = [ "docker" "wheel" ]; # Enable sudo for the user.
openssh.authorizedKeys.keyFiles = [ ../fuchsia/id_ed25519_sk.pub ]; shell = pkgs.zsh;
}; openssh.authorizedKeys.keyFiles = [ ../fuchsia/id_ed25519_sk.pub ];
};
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
# $ nix search wget # $ nix search wget
@ -129,11 +154,15 @@
wget wget
git git
home-manager home-manager
docker-compose
]; ];
environment.pathsToLink = [ "/share/zsh" ];
# Some programs need SUID wrappers, can be configured further or are # Some programs need SUID wrappers, can be configured further or are
# started in user sessions. # started in user sessions.
# programs.mtr.enable = true; # programs.mtr.enable = true;
programs.zsh.enable = true;
programs.gnupg.agent = { programs.gnupg.agent = {
enable = true; enable = true;
enableSSHSupport = true; enableSSHSupport = true;
@ -144,8 +173,10 @@
# Enable the OpenSSH daemon. # Enable the OpenSSH daemon.
services.openssh = { services.openssh = {
enable = true; enable = true;
permitRootLogin = "no"; settings = {
passwordAuthentication = false; PermitRootLogin = "no";
PasswordAuthentication = false;
};
}; };
# Open ports in the firewall. # Open ports in the firewall.

View file

@ -18,6 +18,11 @@
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/drive/HDD1" =
{ device = "/dev/disk/by-uuid/3548fbc6-6efd-4ed1-acc1-bd3ffed9d7a7";
fsType = "ext4";
};
swapDevices = [ ]; swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking