initial nixos-config

This commit is contained in:
2023-08-01 05:06:16 +00:00
parent 0a7012b316
commit 6cc6a1f32c
17 changed files with 366 additions and 0 deletions

13
hosts/common/stefan.nix Normal file
View File

@@ -0,0 +1,13 @@
{
users.users = {
stefan = {
isNormalUser = true;
extraGroups = [ "wheel" ];
initialPassword = "password";
openssh.authorizedKeys.keys = [
# Add your SSH public key(s) here, if you plan on using SSH to connect
];
};
};
}

View File

@@ -0,0 +1,93 @@
{ inputs, lib, config, pkgs, ... }: {
imports = [
./hardware-configuration.nix # Current system hardware config
../common/stefan.nix
# ../modules/gnome.nix
];
nixpkgs.config.allowUnfree = true; # Allow proprietary packages
nix = { # Nix package manager settings
registry = lib.mapAttrs (_: value: { flake = value; }) inputs; # Adds each flake input to make nix3 commands consistent to flake
# 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 = {
experimental-features = "nix-command flakes"; # Enable flake support
auto-optimise-store = true; # Duplicate and optimize nix store
};
gc = { # Automatic garbage collection
automatic = true;
dates = "weekly";
options = "--delete-older-than 2d";
};
};
boot = {
#kernelPackages = pkgs.linuxPackages_latest; # Latest stable kernel
loader = {
systemd-boot = {
enable = true;
configurationLimit = 5; # Limit the amount of configuration
};
efi.canTouchEfiVariables = true;
timeout = 1; # Grub autoselect time
};
};
networking = { # Network settings
hostName = "merkur";
networkmanager.enable = true;
};
security = {
rtkit.enable = true; # RealTimeKit ex. PulseAudio
polkit.enable = true;
};
i18n = { # internationalisation properties
defaultLocale = "de_DE.UTF-8";
extraLocaleSettings = {
LC_ADDRESS = "de_DE.UTF-8";
LC_IDENTIFICATION = "de_DE.UTF-8";
LC_MEASUREMENT = "de_DE.UTF-8";
LC_MONETARY = "de_DE.UTF-8";
LC_NAME = "de_DE.UTF-8";
LC_NUMERIC = "de_DE.UTF-8";
LC_PAPER = "de_DE.UTF-8";
LC_TELEPHONE = "de_DE.UTF-8";
LC_TIME = "de_DE.UTF-8";
};
};
services = {
xserver = {
layout = "de"; # X11 keymap
xkbVariant = "";
};
pipewire = { # Sound
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse.enable = true;
jack.enable = true;
};
};
environment = {
systemPackages = with pkgs; [
wget
tree
];
};
# Configure console keymap
console.keyMap = "de"; # Console keymap settings
system.stateVersion = "23.05"; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
}

View File

@@ -0,0 +1,38 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/2ffd7af0-882b-4f88-9cf9-02d9abd555b4";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/7C6D-739B";
fsType = "vfat";
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@@ -0,0 +1,14 @@
{ config, inputs, ... }:
let
inherit (config.networking) hostName; # Inherit variable
isClean = inputs.self ? rev; # Only enable if current config came from clean tree
in
{
system.autoUpgrade = { # NixOS auto upgrade
enable = isClean;
dates = "hourly";
flags = [
"--refresh"
];
};
}

17
hosts/modules/gnome.nix Normal file
View File

@@ -0,0 +1,17 @@
{ pkgs, ... }:
{
services = {
xserver = {
enable = true;
desktopManager.gnome.enable = true;
displayManager.gdm.enable = true;
};
gnome.core-utilities.enable = false;
};
environment.systemPackages = with pkgs; [
gnomeExtensions.dash-to-dock
gnomeExtensions.gsconnect
];
}