From 36e92d95c2baac7504692a30f5896d09a6fefb3b Mon Sep 17 00:00:00 2001 From: Felix Tenley Date: Sat, 24 Aug 2019 13:12:32 +0200 Subject: [PATCH] add initial config --- .gitignore | 1 + README.md | 8 +++ configuration.nix | 1 + home-pc.nix | 121 ++++++++++++++++++++++++++++++++++++++++++++++ home/felschr.nix | 63 ++++++++++++++++++++++++ install.sh | 24 +++++++++ 6 files changed, 218 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 120000 configuration.nix create mode 100644 home-pc.nix create mode 100644 home/felschr.nix create mode 100755 install.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8ed425a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/hardware-configuration.nix diff --git a/README.md b/README.md new file mode 100644 index 0000000..c87c20a --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# FelschR's NixOS configuration + +## Installation on new machine +To setup a new machine run the following command after completing partitioning and mounting: +``` +./install.sh +``` +This runs `nixos-generate-config`, symlinks the passed configuration to `/etc/nixos/configuration.nix`, sets up required nix channels and then runs `nixos-install`. diff --git a/configuration.nix b/configuration.nix new file mode 120000 index 0000000..c60b8ab --- /dev/null +++ b/configuration.nix @@ -0,0 +1 @@ +home-pc.nix \ No newline at end of file diff --git a/home-pc.nix b/home-pc.nix new file mode 100644 index 0000000..b458921 --- /dev/null +++ b/home-pc.nix @@ -0,0 +1,121 @@ +# Import unstable and home-manager channels: +# sudo nix-channel --add http://nixos.org/channels/nixos-unstable nixos-unstable +# sudo nix-channel --add https://github.com/rycee/home-manager/archive/release-19.03.tar.gz home-manager +# sudo nix-channel --update + +{ config, pkgs, ... }: + +let + unstable = import {}; +in +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + + ]; + + # configure unfree and unstable packages + nixpkgs.config.allowUnfree = true; + + nixpkgs.overlays = [ + (self: super: { + libu2f-host = unstable.libu2f-host; + }) + ]; + + # Use the systemd-boot EFI boot loader. + boot.initrd.luks.devices = [ + { + name = "root"; + device = "/dev/disk/by-uuid/a08f2cb3-2a6d-4dbc-b846-4a42ca137117"; + preLVM = true; + allowDiscards = true; + } + ]; + # boot.kernelPackages = pkgs.linuxPackages_latest; + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = false; + + networking.hostName = "felix-nixos"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Select internationalisation properties. + i18n = { + consoleFont = "Lat2-Terminus16"; + consoleKeyMap = "uk"; + defaultLocale = "en_GB.UTF-8"; + }; + + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + wget + curl + networkmanager + neovim + gnomeExtensions.dash-to-panel + gnomeExtensions.topicons-plus + unstable.libu2f-host + ]; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound. + sound.enable = true; + hardware.pulseaudio.enable = true; + hardware.pulseaudio.support32Bit = true; + + # NVIDIA drivers + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.opengl.driSupport32Bit = true; + + # Enable special device support + hardware.ledger.enable = true; + hardware.u2f.enable = true; + + # Enable the X11 windowing system. + services.xserver.enable = true; + services.xserver.layout = "gb"; + services.xserver.xkbOptions = "eurosign:e"; + + # Enable Gnome 3 + services.xserver.displayManager.gdm.enable = true; + services.xserver.displayManager.gdm.wayland = false; + services.xserver.desktopManager.gnome3.enable = true; + services.dbus.packages = with pkgs; [ + gnome3.dconf gnome2.GConf + ]; + environment.gnome3.excludePackages = with pkgs; [ + gnome3.gnome-weather + gnome3.gnome-calendar + gnome3.gnome-todo + # gnome3.gnome-books + gnome3.gnome-maps + gnome3.gnome-contacts + gnome3.gnome-software + gnome3.gnome-packagekit + gnome3.epiphany + gnome3.evolution + gnome3.accerciser + ]; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.felschr = { + isNormalUser = true; + extraGroups = [ "wheel" "audio" ]; # Enable ‘sudo’ for the user. + shell = pkgs.fish; + }; + home-manager.users.felschr = import ./home/felschr.nix; + + # 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.03"; # Did you read the comment? + +} diff --git a/home/felschr.nix b/home/felschr.nix new file mode 100644 index 0000000..87d060c --- /dev/null +++ b/home/felschr.nix @@ -0,0 +1,63 @@ +{ config, pkgs, ... }: + +{ + nixpkgs.config.allowUnfree = true; + + # xsession.enable = true; + + gtk.enable = true; + gtk.theme.name = "Adwaita-dark"; + gtk.gtk3.extraConfig = { + gtk-application-prefer-dark-theme = true; + }; + + services.redshift = { + enable = true; + latitude = "53.2603609"; + longitude = "10.4014691"; + }; + + programs.fish = { + enable = true; + }; + + programs.neovim = { + enable = true; + viAlias = true; + vimAlias = true; + }; + + programs.termite = { + enable = true; + }; + + programs.git = { + enable = true; + userName = "Felix Tenley"; + userEmail = "dev@felschr.com"; + }; + + programs.emacs = { + enable = true; + }; + + programs.vscode = { + enable = true; + # userSettings = {} + }; + + services.keybase.enable = true; + services.kbfs.enable = true; + + programs.chromium = { + enable = true; + }; + + home.packages = with pkgs; [ + signal-desktop + discord + keybase-gui + linux-steam-integration + # lutris + ]; +} diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..6d15534 --- /dev/null +++ b/install.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +if [ $EUID != 0 ]; then + sudo "$0" "$@" + exit $? +fi + +CONFIG=$0 + +if [ -z "$CONFIG" ] +then + echo "path to config to use as configuration.nix needs to be passed as first argument" +fi + +ln -s $CONFIG configuration.nix + +nixos-generate-config --root /mnt + +# add nixos-unstable and home-manager channels +nix-channel --add http://nixos.org/channels/nixos-unstable nixos-unstable +nix-channel --add https://github.com/rycee/home-manager/archive/release-19.03.tar.gz home-manager +nix-channel --update + +nixos-install