Skip to content

Instantly share code, notes, and snippets.

@i-e-b
Last active July 4, 2023 16:53
Show Gist options
  • Save i-e-b/6320077 to your computer and use it in GitHub Desktop.
Save i-e-b/6320077 to your computer and use it in GitHub Desktop.
/etc/nixos/configuration.nix

My experiments with an XMonad setup in NixOS. This is my work box now, so it pretty much works.

probably needs:

# useradd -m iain
# passwd iain ...
# passwd root ...
# This is a generated file. Do not modify!
# Make changes to /etc/nixos/configuration.nix instead.
{ config, pkgs, ... }:
{
require = [
./hardware-configuration.nix
<nixos/modules/installer/scan/not-detected.nix>
<nixos/modules/programs/virtualbox.nix>
];
boot.blacklistedKernelModules = [ "snd_pcsp" ];
boot.loader.grub.device = "/dev/sdb"; # for 2-disk work machine
#boot.loader.grub.device = "/dev/sda"; # for single disk boxes
# These for Virtual box images only -- use hardware-configuration.nix for real machines
# boot.initrd.kernelModules = [ "ata_piix" "ohci_hcd" ];
# boot.kernelModules = [ ];
# boot.extraModulePackages = [ ];
environment.systemPackages = with pkgs; [
wget vimHugeX sudo
manpages
gitAndTools.gitFull
iptables nmap tcpdump
rxvt_unicode
zlib
bc
# coding junk
gcc
#gcc-wrapper
#gccmakedep
# nix package for nix-shell etc
binutils
nix
haskellPackages.haskellPlatform
#cabal2nix
#ubuntu-font-family
#vista-fonts
# X11 packages
chromium
firefoxWrapper
trayer
# Haskell packages for XMonad
haskellPackages.xmobar
haskellPackages.xmonad
haskellPackages.xmonadContrib
haskellPackages.xmonadExtras
# Font junk
xfontsel
xlsfonts
dmenu
xscreensaver
xclip
xchat
#virtualbox # This is done with the require reference at the top.
];
# nix.maxJobs = 4;
time.timeZone = "Europe/London";
services.openssh.enable = true;
networking.interfaceMonitor.enable = true;
i18n = {
consoleFont = "lat9w-16";
consoleKeyMap = "uk";
defaultLocale = "en_GB.UTF-8";
};
# User account
users.extraGroups.wheel.gid = 0;
users.extraUsers.iain = {
createHome = true;
home = "/home/iain";
description = "Iain Ballard";
extraGroups = [ "wheel" "disk" "vboxusers" "cdrom" ];
isSystemUser = false;
useDefaultShell = true;
};
security.sudo.enable = true;
services.xserver = {
enable = true;
layout = "gb";
windowManager.xmonad.enable = true;
windowManager.default = "xmonad";
desktopManager.xterm.enable = false;
desktopManager.default = "none";
startOpenSSHAgent = true;
displayManager = {
slim = {
enable = true;
defaultUser = "iain";
};
};
wacom.enable = true;
};
services.printing.enable = true;
# Show the manual on virtual console 8 :
services.nixosManual.showManual = true;
fileSystems = [
{ mountPoint = "/";
label = "nixos";
}
];
swapDevices = [
{ device = "/dev/disk/by-label/swap"; }
];
}

$ fdisk /dev/sdb (or whatever device you want to install on)

$ mkfs.ext4 -L nixos /dev/sdb1 (idem)

$ mkswap -L swap /dev/sdb2 (idem)

$ mount LABEL=nixos /mnt

$ nixos-option --install

  • For a basic install: $ nano /mnt/etc/nixos/configuration.nix (in particular, set the fileSystems and swapDevices options)
  • or, for this set of scripts: $ wget https://gist.github.com/i-e-b/6320077/raw/ecea4e02867e563406f4238a880783a161bee9ba/configuration.nix > /mnt/etc/nixos/configuration.nix

$ nixos-install

$ reboot

#!/bin/sh
sudo systemctl restart display-manager &
-- write to ~/.xmonad/xmonad.hs
import XMonad
main = xmonad defaultConfig
{ modMask = mod4Mask -- super instead of alt (usually Windows key)
, terminal = "urxvt"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment