Skip to content

Instantly share code, notes, and snippets.

@lukego
Created March 20, 2022 16:32
Show Gist options
  • Save lukego/f2f2987fceab2a7035a295b7ff1aa989 to your computer and use it in GitHub Desktop.
Save lukego/f2f2987fceab2a7035a295b7ff1aa989 to your computer and use it in GitHub Desktop.
NixOS configuration
# 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, ... }:
let pkgs = import <nixpkgs> { overlays = [ (import "/home/luke/git/nixos-rocm") ]; }; in
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
#nix.package = pkgs.nix_2_4;
nix.nixPath = [ "nixpkgs=/home/luke/git/nixpkgs"
#"nixpkgs-overlays=/home/luke/git/nixos-rocm"
];
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
system.activationScripts.ldso = pkgs.lib.stringAfter [ "usrbinenv" ] ''
mkdir -m 0755 -p /lib64
ln -sfn ${pkgs.glibc.out}/lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2.tmp
mv -f /lib64/ld-linux-x86-64.so.2.tmp /lib64/ld-linux-x86-64.so.2 # atomically replace
'';
services.minecraft-server = {
enable = true;
eula = true;
};
hardware.spacenavd.enable = true;
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.kernelPackages = pkgs.linuxPackages_latest;
networking.enableIPv6 = false;
virtualisation.docker.enable = true;
virtualisation.docker.storageDriver = "devicemapper";
security.sudo.wheelNeedsPassword = false;
services.openssh.forwardX11 = true;
services.openssh.gatewayPorts = "yes";
services.openssh.extraConfig = ''
X11UseLocalHost yes
ListenAddress 0.0.0.0
'';
nixpkgs.config.allowUnfree = true;
services.xrdp.enable = true;
#services.xrdp.defaultWindowManager = "${pkgs.i3}/bin/i3";
programs.ssh.startAgent = true;
hardware.opengl.enable = true;
hardware.opengl.extraPackages = [ pkgs.rocm-opencl-icd ];
hardware.opengl.setLdLibraryPath = true;
# fonts.fonts = with pkgs; [
# noto-fonts
# noto-fonts-cjk
# noto-fonts-emoji
# liberation_ttf
# fira-code
# fira-code-symbols
# mplus-outline-fonts
# dina-font
# proggyfonts
# terminus
# dejavu_fonts
# ];
fonts.enableDefaultFonts = true;
services.xserver = {
enable = true;
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
# displayManager.sddm.enable = true;
# desktopManager.plasma5.enable = true;
# displayManager.autoLogin = {
# enable = true;
# user = "luke";
# };
# windowManager.i3.enable = true;
#videoDrivers = [ "amdgpu" ];
videoDrivers = [ "nvidia" ];
xrandrHeads = [ "DVI1" ];
# xkbOptions = "ctrl:nocaps, altwin:swap_alt_win";
xkbOptions = "ctrl:nocaps";
dpi = 220;
resolutions = [ { x = 3840; y = 2160; } ];
displayManager.sessionCommands = ''
${pkgs.xorg.xrdb}/bin/xrdb -merge <${pkgs.writeText "Xresources" ''
xterm*savelines: 16384
xterm*background: black
xterm*foreground: white
xterm*termName: xterm-256color
xterm*vt100.scrollBar: true
xterm*vt100.scrollbar.width: 8
xterm*faceName: Lat2-Terminus16
''}
'';
};
# services.xserver.displayManager.xserverArgs = [ "-listen tcp" ];
# services.xserver.enableTCP = true;
#services.xserver.displayManager.lightdm.extraSeatDefaults = "xserver-allow-tcp=true";
hardware.enableRedistributableFirmware = true;
hardware.bluetooth.enable = true;
services.blueman.enable = true;
networking.hostName = "snowy"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
networking.interfaces.enp4s0.useDHCP = true;
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
networking.nameservers = [ "8.8.8.8" "8.8.4.4" ];
# Select internationalisation properties.
console.font = "Lat2-Terminus16";
console.keyMap = "us";
i18n = {
defaultLocale = "en_US.UTF-8";
};
# Set your time zone.
time.timeZone = "Europe/Stockholm";
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
emacs wget vim terminus_font
];
# 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;
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
sound.enable = true;
hardware.pulseaudio.enable = false;
hardware.pulseaudio.package = pkgs.pulseaudioFull;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
services.jack = {
jackd.enable = false;
# jackd.extraOptions = [ "-dalsa" "--device" "hw:3" ];
# support ALSA only programs via ALSA JACK PCM plugin
alsa.enable = true;
# support ALSA only programs via loopback device (supports programs like Steam)
loopback = {
enable = true;
index = 3;
# buffering parameters for dmix device to work with ALSA only semi-professional sound programs
#dmixConfig = ''
# period_size 2048
#'';
};
};
# Enable touchpad support.
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.luke = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" "video" "tty" "input" "kvm" "kmem" "adm" "utmp" "users" "jackaudio" ];
};
# This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you
# should.
system.stateVersion = "19.09"; # Did you read the comment?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment