Created
July 2, 2022 17:50
-
-
Save MadMcCrow/0c85486f405a403fde5843bd863e0abd to your computer and use it in GitHub Desktop.
NixOS install configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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, ... }: | |
{ | |
nix = { | |
package = pkgs.nixUnstable; | |
extraOptions = '' | |
experimental-features = nix-command flakes | |
''; | |
}; | |
imports = | |
[ # Include the results of the hardware scan. | |
./hardware-configuration.nix | |
]; | |
# Allow proprietary software (such as the NVIDIA drivers). | |
nixpkgs.config.allowUnfree = true; | |
# Use the systemd-boot EFI boot loader. | |
boot.loader.systemd-boot.enable = true; | |
boot.loader.efi.canTouchEfiVariables = true; | |
boot.initrd.luks.devices = { | |
"nixos" = { | |
name = "nixos"; | |
device = "/dev/disk/by-uuid/79de59c8-7d77-4bd2-9531-a6312230cc18"; | |
preLVM = true; | |
}; | |
}; | |
boot.supportedFilesystems = [ "btrfs" "ext2" "ext3" "ext4" "f2fs" "fat8" "fat16" "fat32" ]; | |
networking.hostName = "nixAF"; # 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/Paris"; | |
# 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"; | |
useXkbConfig = true; # use xkbOptions in tty. | |
}; | |
# Enable Wayland and gnome | |
services.xserver = { | |
enable = true; | |
displayManager.gdm.enable = true; | |
displayManager.gdm.wayland = true; | |
displayManager.autoLogin.enable = true; | |
displayManager.autoLogin.user = "perard"; | |
desktopManager.gnome.enable = true; | |
}; | |
# Configure keymap in X11 | |
services.xserver = { | |
layout = "us"; | |
xkbVariant = "intl"; | |
xkbOptions = "eurosign:e"; | |
}; | |
# Enable CUPS to print documents. | |
services.printing.enable = true; | |
# Sound is disabled for pipewire | |
# Remove sound.enable or turn it off if you had it set previously, it seems to cause conflicts with pipewire | |
sound.enable = false; | |
hardware.pulseaudio.enable = false; | |
# rtkit is optional but recommended | |
security.rtkit.enable = true; | |
services.pipewire = { | |
enable = true; | |
alsa.enable = true; | |
alsa.support32Bit = true; | |
pulse.enable = true; | |
jack.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.perard = { | |
isNormalUser = true; | |
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. | |
packages = with pkgs; [ | |
firefox | |
]; | |
initialHashedPassword = "$6$7aX/uB.Zx8T.2UVO$RWDwkP1eVwwmz3n5lCAH3Nb7k/Q6wYZh05V8xai.NMtq1g3jjVNLvG8n.4DlOtR/vlPCjGXNSHTZSlB2sO7xW."; | |
}; | |
users.users.root.initialHashedPassword = "$6$7aX/uB.Zx8T.2UVO$RWDwkP1eVwwmz3n5lCAH3Nb7k/Q6wYZh05V8xai.NMtq1g3jjVNLvG8n.4DlOtR/vlPCjGXNSHTZSlB2sO7xW."; | |
# 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 | |
# ]; | |
# 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; | |
# Copy the NixOS configuration file and link it from the resulting system | |
# (/run/current-system/configuration.nix). This is useful in case you | |
# accidentally delete configuration.nix. | |
# system.copySystemConfiguration = true; | |
# 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 leave | |
# 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? | |
# machine-id is used by systemd for the journal, if you don't | |
# persist this file you won't be able to easily use journalctl to | |
# look at journals for previous boots. | |
environment.etc."machine-id".source | |
= "/nix/persist/etc/machine-id"; | |
# flatpak support | |
services.flatpak.enable = true; | |
xdg.portal = { | |
enable = true; | |
extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, lib, pkgs, modulesPath, ... }: | |
{ | |
imports = | |
[ (modulesPath + "/installer/scan/not-detected.nix") | |
]; | |
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; | |
boot.initrd.kernelModules = [ "dm-snapshot" ]; | |
boot.kernelModules = [ "kvm-amd" ]; | |
boot.extraModulePackages = [ ]; | |
fileSystems."/" = | |
{ device = "none"; | |
fsType = "tmpfs"; | |
options = ["defaults" "size=4G" "mode=755" ]; | |
}; | |
fileSystems."/boot" = | |
{ device = "/dev/disk/by-uuid/FDE4-18BD"; | |
fsType = "vfat"; | |
}; | |
fileSystems."/nix" = | |
{ device = "/dev/disk/by-uuid/1bb57225-ffb6-479d-85c0-8d0701894500"; | |
fsType = "f2fs"; | |
}; | |
fileSystems."/etc/nixos" = | |
{ device = "/nix/persist/etc/nixos"; | |
fsType = "none"; | |
options = [ "bind" ]; | |
}; | |
fileSystems."/var/log" = | |
{ device = "/nix/persist/var/log"; | |
fsType = "none"; | |
options = [ "bind" ]; | |
}; | |
fileSystems."/home" = { | |
device = "/dev/mapper/nixos-home"; | |
fsType = "f2fs"; | |
}; | |
swapDevices = [ { device = "/dev/mapper/nixos-swap"; }]; | |
# 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.enp4s0.useDHCP = lib.mkDefault true; | |
# networking.interfaces.wlp5s0.useDHCP = lib.mkDefault true; | |
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; | |
# high-resolution display | |
hardware.video.hidpi.enable = lib.mkDefault true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment