Skip to content

Instantly share code, notes, and snippets.

@mdedetrich
Created October 31, 2019 19:28
Show Gist options
  • Select an option

  • Save mdedetrich/f8ddf227c403eff75c082a73ef15e378 to your computer and use it in GitHub Desktop.

Select an option

Save mdedetrich/f8ddf227c403eff75c082a73ef15e378 to your computer and use it in GitHub Desktop.

Revisions

  1. mdedetrich created this gist Oct 31, 2019.
    215 changes: 215 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,215 @@
    # 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, ... }:

    with pkgs;
    let
    # Import unstable channel.
    # sudo nix-channel --add http://nixos.org/channels/nixpkgs-unstable nixpkgs-unstable
    # sudo nix-channel --update nixpkgs-unstable
    # unstable = import <nixpkgs-unstable> {};

    my-python-packages = python-packages: with python-packages; [
    virtualenvwrapper
    # other python packages you want
    ];
    python-with-my-packages = python37.withPackages my-python-packages;
    in

    {
    imports =
    [ # Include the results of the hardware scan.
    ./hardware-configuration.nix
    ];

    # Use the systemd-boot EFI boot loader.
    boot.loader.systemd-boot.enable = true;
    boot.loader.efi.canTouchEfiVariables = true;
    boot.resumeDevice = "/dev/disk/by-label/swap";

    # This is to make resume from sleep work (otherwise you will get a blank screen), see
    # https://www.reddit.com/r/thinkpad/comments/djihpo/amd_thinkpads_keep_getting_better_53_kernel/f45il67?utm_source=share&utm_medium=web2x
    boot.kernelParams = ["iommu=soft"];
    boot.plymouth.enable = true;

    # Use the latest kernel
    boot.kernelPackages = pkgs.linuxPackages_latest;
    swapDevices = [{
    label = "swap";
    }];

    nixpkgs.config = {
    allowUnfree = true;
    };

    networking.hostName = "mdedetrich"; # Define your hostname.
    # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
    networking.networkmanager.enable = true;

    virtualisation.docker.enable = true;

    # 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 = {
    consoleFont = "Lat2-Terminus16";
    consoleKeyMap = "us";
    defaultLocale = "en_US.UTF-8";
    };

    # Set your time zone.
    time.timeZone = "Europe/Berlin";

    nixpkgs.config.pulseaudio = true;

    # List packages installed in system profile. To search, run:
    # $ nix search wget
    environment.systemPackages = with pkgs; [
    wget vim neovim awesome dunst numix-gtk-theme openvpn yakuake bash bluedevil okular python-with-my-packages
    ];

    fonts.fonts = with pkgs; [
    fira-code
    fira-code-symbols
    ];

    # 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.java.enable = true;
    programs.java.package = pkgs.openjdk11;

    # List services that you want to enable:

    # Enable the OpenSSH daemon.
    services.openssh.enable = true;

    # Set neovim as default editor
    environment.variables.EDITOR = "nvim";

    programs.slock.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;

    # Required for battery events
    services.upower.enable = true;

    programs.dconf.enable = true;
    services.dbus.packages = [ pkgs.gnome3.dconf ];

    # services.autorandr.enable = true;
    # services.autorandr.defaultTarget = "default";

    # Enable sound.
    sound.enable = true;
    sound.mediaKeys = {
    enable = true;
    volumeStep = "5%";
    };

    hardware.pulseaudio = {
    enable = true;
    support32Bit = true;
    extraModules = [ pkgs.pulseaudio-modules-bt ];
    package = pkgs.pulseaudioFull;
    tcp = {
    enable = true;
    anonymousClients.allowedIpRanges = ["127.0.0.1"];
    };
    };

    hardware.bluetooth = {
    enable = true;
    };

    hardware.brightnessctl.enable = true;



    # Enable the KDE Desktop Environment.
    # services.xserver.displayManager.sddm.enable = true;
    # services.xserver.desktopManager.plasma5.enable = true;

    # Define a user account. Don't forget to set a password with ‘passwd’.

    # Enable the i3 Tiling wm Environment
    #

    services.xserver = {
    enable = true;
    layout = "us";
    xkbOptions = "eurosign:e";
    libinput.enable = true;
    displayManager.sddm = {
    enable = true;
    };
    desktopManager.plasma5 = {
    enable = true;
    };
    # displayManager.lightdm = {
    # enable = true;
    # greeters.gtk.iconTheme = {
    # package = pkgs.numix-gtk-theme;
    # name = "Numix";
    # };
    # };
    # desktopManager = {
    # default = "none";
    # xterm.enable = false;
    # };
    deviceSection = ''
    Option "AccelMethod" "sna"
    Option "TearFree" "true"
    '';
    # windowManager.awesome = {
    # enable = true;
    # };
    };

    services.mopidy = {
    enable = true;
    extensionPackages = [ pkgs.mopidy-spotify ];
    configuration = ''
    [spotify]
    enabled = true
    username = 1230945725
    password = uoFdq4eTq84gdPTng8WL

    client_id = bc6f3df8-2aff-4399-a795-1ee291389b01
    client_secret = s_7ncCjQ7LdGq9sFwnP5ur07yck5I8DMG4DNMir--7g=

    bitrate = 320

    [audio]
    output = pulsesink server=127.0.0.1
    '';
    };

    users.users.mdedetrich = {
    isNormalUser = true;
    home = "/home/mdedetrich";
    description = "Matthew de Detrich";
    extraGroups = [ "wheel" "networkmanager" "sound" "pulse" "audio" "docker" "video" "bluetooth"];
    shell = pkgs.fish;
    };

    # 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?
    }