From e7a35cf56f83f5062619710766d29f84e43a0371 Mon Sep 17 00:00:00 2001 From: Will Price Date: Fri, 31 May 2019 18:24:45 +0100 Subject: [PATCH 1/5] Update --- configuration.nix | 99 ++++++++++++++++++++++---------------- hardware-configuration.nix | 19 +++++--- packages.nix | 96 ++++++++++++++++++++++++++++++++++++ 3 files changed, 165 insertions(+), 49 deletions(-) create mode 100644 packages.nix diff --git a/configuration.nix b/configuration.nix index ecce47b..6a84f49 100644 --- a/configuration.nix +++ b/configuration.nix @@ -6,87 +6,104 @@ { imports = - [ # Include the results of the hardware scan. + [ ./hardware-configuration.nix + ./packages.nix ]; - # Use the GRUB 2 boot loader. - boot.loader.grub.enable = true; - boot.loader.grub.version = 2; - boot.loader.grub.efiSupport = false; - # boot.loader.grub.efiInstallAsRemovable = true; - # boot.loader.efi.efiSysMountPoint = "/boot/efi"; - # Define on which hard drive you want to install Grub. - boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.grub.device = "/dev/sda"; + boot.loader.efi.canTouchEfiVariables = true; - networking.hostName = "orchid"; # Define your hostname. - networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + # VBox only + # fsck will fail under vbox and cause a boot to hang, so turn it off + boot.initrd.checkJournalingFS = false; + # End VBox only + + networking.hostName = "nixos"; + networking.wireless.enable = true; - # Select internationalisation properties. i18n = { consoleFont = "Lat2-Terminus16"; consoleKeyMap = "uk"; defaultLocale = "en_GB.UTF-8"; }; - # Set your time zone. time.timeZone = "Europe/London"; - - # List packages installed in system profile. To search by name, run: - # $ nix-env -qaP | grep wget - environment.systemPackages = with pkgs; [ - wget - vim - firefox - git - stow - tree - fish - ]; - # Some programs need SUID wrappers, can be configured further or are # started in user sessions. - programs.bash.enableCompletion = true; # programs.mtr.enable = true; - programs.gnupg.agent = { enable = true; enableSSHSupport = true; }; + # programs.gnupg.agent = { enable = true; enableSSHSupport = true; }; - # List services that you want to enable: + programs.vim.defaultEditor = true; + #programs.nylas-mail.enable = true; + programs.npm.enable = true; + #programs.nm-applet.enable = true; + programs.less.enable = true; + #programs.iotop.enable = true; + programs.iftop.enable = true; + programs.java.enable = true; + programs.gphoto2.enable = true; + services.mpd = { + enable = true; + startWhenNeeded = true; + }; + + services.acpid.enable = true; + services.redshift = { + enable = true; + latitude = "51.4545"; + longitude = "-2.5879"; + }; - # 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 the X11 windowing system. + sound.enable = true; + hardware.pulseaudio.enable = true; + services.xserver.enable = true; services.xserver.layout = "gb"; # services.xserver.xkbOptions = "eurosign:e"; - # Enable touchpad support. - # services.xserver.libinput.enable = true; + services.xserver.libinput.enable = true; # Enable the KDE Desktop Environment. - services.xserver.displayManager.sddm.enable = true; - services.xserver.desktopManager.plasma5.enable = true; + #services.xserver.displayManager.sddm.enable = true; + #services.xserver.desktopManager.plasma5.enable = true; + services.xserver.displayManager.gdm.enable = true; + services.xserver.desktopManager.mate.enable = true; + services.xserver.windowManager.xmonad = { + enable = true; + enableContribAndExtras = true; + extraPackages = haskellPackages: [ + haskellPackages.xmonad-contrib + haskellPackages.xmonad-extras + haskellPackages.xmonad + ]; + }; - # Define a user account. Don't forget to set a password with ‘passwd’. - users.extraUsers.will = { + # Don't forget to set a password with ‘passwd’. + users.users.will = { isNormalUser = true; - uid = 1001; + home = "/home/will"; + uid = 1000; + extraGroups = [ "wheel" "networkmanager" ]; }; # 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 = "17.09"; # Did you read the comment? + system.stateVersion = "18.09"; + system.autoUpgrade.enable = true; } diff --git a/hardware-configuration.nix b/hardware-configuration.nix index 6921a89..7a35471 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -4,21 +4,24 @@ { config, lib, pkgs, ... }: { - imports = - [ - ]; + imports = [ ]; - boot.initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "ahci" "usb_storage" "sd_mod" ]; - boot.kernelModules = [ "kvm-intel" ]; + boot.initrd.availableKernelModules = [ "ata_piix" "ohci_pci" "ahci" "sd_mod" "sr_mod" ]; + boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/453e3503-1d3d-4e38-886f-149fc9e2f31f"; + { device = "/dev/disk/by-uuid/f5be4904-ef50-4105-a381-af8524f576e2"; fsType = "ext4"; }; + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/DEA2-FFC3"; + fsType = "vfat"; + }; + swapDevices = [ ]; - nix.maxJobs = lib.mkDefault 2; - powerManagement.cpuFreqGovernor = "ondemand"; + nix.maxJobs = lib.mkDefault 1; + virtualisation.virtualbox.guest.enable = true; } diff --git a/packages.nix b/packages.nix new file mode 100644 index 0000000..6c26ba8 --- /dev/null +++ b/packages.nix @@ -0,0 +1,96 @@ +{ config, pkgs, ... }: + +{ + # Allow proprietary packages + nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + wget git vim + stow + sudo + fish + ncdu + + gzip + unar + unzip + p7zip + cpio +# dd + + + # Build toolchains + autoconf + automake + gnumake + scons + cmake + gcc8 + clang + clang-analyzer + clang-manpages + clang-tools + + python27 + python37 + pipenv + + ruby + bundler + + ghc + stack + + # GUI tools + gnome3.file-roller + + + # Media + ffmpeg-full + gstreamer + gst-plugins-base + gst-plugins-bad + gst-plugins-ugly + gst-plugins-good + + # IDEs + jetbrains.clion + jetbrains.webstorm + jetbrains.idea-ultimate + jetbrains.pycharm-professional + + + # Desktop + xmonad-with-packages + dmenu + rofi + (polybar.override { + alsaSupport = true; + githubSupport = true; + mpdSupport = true; + pulseSupport = true; + }) + material-icons + xorg.xmodmap + xorg.xset + xorg.xsetroot + + terminus_font + terminus_font_ttf + dejavu_fonts + hack-font + hasklig + inriafonts + iosevka + + kdeApplications.konsole + firefox + chromium + + sway + ncmpcpp + powerline-fonts + ]; +} From 44265fad14d939ae5bd178e344d6bdda0d054137 Mon Sep 17 00:00:00 2001 From: Will Price Date: Fri, 31 May 2019 21:55:39 +0100 Subject: [PATCH 2/5] Create README.md --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..1ee11c5 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +* Download [NixOS ISO](https://nixos.org/nixos/download.html) +* Write the ISO to a USB drive using `dd` +* Boot machine from ISO + * If you're using vbox, then boot with `nomodeset` as otherwise the boot hangs. +* Install git: `nix-env -i git` +* Clone configuration: `git clone https://github.com/willprice/nixos-config.git` +* Follow the [installation guide](https://nixos.org/nixos/manual/index.html#sec-installation) up to `nixos-generate-config` + * Copy nixos configuration files to `/mnt`: `cp nixos-config/* /mnt/etc/nixos` + * Generate hardware config: `nixos-generate-config` + * Install system: `nixos-install` (set root password) From 7bd061e14e430645c7f146a8c8070c77b1e57ebe Mon Sep 17 00:00:00 2001 From: Will Price Date: Fri, 31 May 2019 21:56:31 +0100 Subject: [PATCH 3/5] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1ee11c5..52128ff 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,5 @@ * Copy nixos configuration files to `/mnt`: `cp nixos-config/* /mnt/etc/nixos` * Generate hardware config: `nixos-generate-config` * Install system: `nixos-install` (set root password) +* Reboot +* Set password for `will`: `passwd will` From f1420444630e00dd4c75ab0df9f80fb4b312e61d Mon Sep 17 00:00:00 2001 From: Will Price Date: Fri, 31 May 2019 22:51:34 +0100 Subject: [PATCH 4/5] Update README.md --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 52128ff..796a1e1 100644 --- a/README.md +++ b/README.md @@ -9,4 +9,18 @@ * Generate hardware config: `nixos-generate-config` * Install system: `nixos-install` (set root password) * Reboot +* Login as root * Set password for `will`: `passwd will` +* Log out and login as `will` setting `mate+xmonad` as desktop session + + +## Cheatsheet +### Nix + +* Install a package: `nix-env -i packageName` +* List all available packages: `nix-env -qa` (take a while to run, best of dumping this and grepping the listing) + + +### NixOS + +* Configuration file: `/etc/nixos/configuration.nix` From c985a0f08e9458a84749caf325f84995ec388d47 Mon Sep 17 00:00:00 2001 From: Will Price Date: Fri, 31 May 2019 23:54:41 +0100 Subject: [PATCH 5/5] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 796a1e1..25357e3 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,10 @@ * Login as root * Set password for `will`: `passwd will` * Log out and login as `will` setting `mate+xmonad` as desktop session +* Generate an SSH key for the new machine: `ssh-keygen` +* [Add SSH key to github profile](https://github.com/settings/ssh/new) +* Clone dotfiles: `git clone --recursive git@github.com:willprice/dotfiles.git ~/.dotfiles` +* Install dotfiles: `cd ~/.dotfiles; ./install-all.sh` ## Cheatsheet