[NixOS] Add nixOS machine configuration and base configuration
This commit is contained in:
		
							
								
								
									
										201
									
								
								nixos/configuration.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										201
									
								
								nixos/configuration.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,201 @@
 | 
				
			|||||||
 | 
					{ config, pkgs, ... }:
 | 
				
			||||||
 | 
					let
 | 
				
			||||||
 | 
					  my-python-packages = python-packages: with python-packages; [
 | 
				
			||||||
 | 
					    appdirs
 | 
				
			||||||
 | 
					    requests
 | 
				
			||||||
 | 
					    virtualenv
 | 
				
			||||||
 | 
					    ipython
 | 
				
			||||||
 | 
					    ipdb
 | 
				
			||||||
 | 
					    virtualenvwrapper
 | 
				
			||||||
 | 
					    pip
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					  python-with-my-packages = pkgs.python3.withPackages my-python-packages;
 | 
				
			||||||
 | 
					in
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  boot.loader.systemd-boot.enable = true;
 | 
				
			||||||
 | 
					  nixpkgs.config.allowUnfree = true;
 | 
				
			||||||
 | 
					  security.sudo.wheelNeedsPassword = false;
 | 
				
			||||||
 | 
					  networking.networkmanager.enable = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  i18n = {
 | 
				
			||||||
 | 
					    consoleKeyMap = "us";
 | 
				
			||||||
 | 
					    defaultLocale = "en_US.UTF-8";
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Set your time zone.
 | 
				
			||||||
 | 
					  # TODO: this should be set dynamically
 | 
				
			||||||
 | 
					  time.timeZone = "America/Los_Angeles";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  fonts = {
 | 
				
			||||||
 | 
					    fonts = with pkgs; [
 | 
				
			||||||
 | 
					      fira-mono
 | 
				
			||||||
 | 
					      dejavu_fonts
 | 
				
			||||||
 | 
					      noto-fonts-emoji
 | 
				
			||||||
 | 
					      emojione
 | 
				
			||||||
 | 
					      twemoji-color-font
 | 
				
			||||||
 | 
					      source-code-pro
 | 
				
			||||||
 | 
					      roboto
 | 
				
			||||||
 | 
					      source-sans-pro
 | 
				
			||||||
 | 
					      source-serif-pro
 | 
				
			||||||
 | 
					    ];
 | 
				
			||||||
 | 
					    fontconfig = {
 | 
				
			||||||
 | 
					      defaultFonts = {
 | 
				
			||||||
 | 
					        monospace = [ "Source Code Pro" ];
 | 
				
			||||||
 | 
					        sansSerif = [ "Roboto" ];
 | 
				
			||||||
 | 
					        serif     = [ "Source Serif Pro" ];
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					      ultimate = {
 | 
				
			||||||
 | 
					        enable = false;
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # List packages installed in system profile. To search, run:
 | 
				
			||||||
 | 
					  # $ nix search wget
 | 
				
			||||||
 | 
					  environment.systemPackages = with pkgs; [
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Applications
 | 
				
			||||||
 | 
					    google-chrome
 | 
				
			||||||
 | 
					    firefox
 | 
				
			||||||
 | 
					    hexchat
 | 
				
			||||||
 | 
					    kodi
 | 
				
			||||||
 | 
					    vlc
 | 
				
			||||||
 | 
					    xfce.thunar
 | 
				
			||||||
 | 
					    spotify
 | 
				
			||||||
 | 
					    termite
 | 
				
			||||||
 | 
					    rxvt_unicode
 | 
				
			||||||
 | 
					    emacs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Appearance
 | 
				
			||||||
 | 
					    numix-icon-theme-circle
 | 
				
			||||||
 | 
					    gnome3.adwaita-icon-theme
 | 
				
			||||||
 | 
					    hicolor-icon-theme
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Desktop
 | 
				
			||||||
 | 
					    autorandr
 | 
				
			||||||
 | 
					    clipit
 | 
				
			||||||
 | 
					    compton
 | 
				
			||||||
 | 
					    feh
 | 
				
			||||||
 | 
					    sddm-kcm
 | 
				
			||||||
 | 
					    networkmanagerapplet
 | 
				
			||||||
 | 
					    pinentry
 | 
				
			||||||
 | 
					    pommed_light
 | 
				
			||||||
 | 
					    rofi
 | 
				
			||||||
 | 
					    rofi-pass
 | 
				
			||||||
 | 
					    volnoti
 | 
				
			||||||
 | 
					    xclip
 | 
				
			||||||
 | 
					    xdotool
 | 
				
			||||||
 | 
					    xorg.xkbcomp
 | 
				
			||||||
 | 
					    xsettingsd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Audio
 | 
				
			||||||
 | 
					    pulsemixer
 | 
				
			||||||
 | 
					    pavucontrol
 | 
				
			||||||
 | 
					    playerctl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Haskell
 | 
				
			||||||
 | 
					    cabal-install
 | 
				
			||||||
 | 
					    cabal2nix
 | 
				
			||||||
 | 
					    ghc
 | 
				
			||||||
 | 
					    stack2nix
 | 
				
			||||||
 | 
					    stack
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Tools
 | 
				
			||||||
 | 
					    binutils
 | 
				
			||||||
 | 
					    gcc
 | 
				
			||||||
 | 
					    gitFull
 | 
				
			||||||
 | 
					    gnumake
 | 
				
			||||||
 | 
					    gnupg
 | 
				
			||||||
 | 
					    htop
 | 
				
			||||||
 | 
					    ncdu
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					    python-with-my-packages
 | 
				
			||||||
 | 
					    rcm
 | 
				
			||||||
 | 
					    silver-searcher
 | 
				
			||||||
 | 
					    stow
 | 
				
			||||||
 | 
					    tmux
 | 
				
			||||||
 | 
					    wget
 | 
				
			||||||
 | 
					    zsh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Miscellaneous
 | 
				
			||||||
 | 
					    librsvg
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # 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 = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  environment.loginShellInit = ". ~/.lib/nix_login.sh";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  services.xserver = {
 | 
				
			||||||
 | 
					    exportConfiguration = true;
 | 
				
			||||||
 | 
					    enable = true;
 | 
				
			||||||
 | 
					    layout = "us";
 | 
				
			||||||
 | 
					    videoDrivers = [ "nvidia" ];
 | 
				
			||||||
 | 
					    desktopManager = {
 | 
				
			||||||
 | 
					      gnome3.enable = true;
 | 
				
			||||||
 | 
					      default = "none";
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    windowManager = {
 | 
				
			||||||
 | 
					      default = "xmonad";
 | 
				
			||||||
 | 
					      i3.enable = true;
 | 
				
			||||||
 | 
					      session = [{
 | 
				
			||||||
 | 
					        name = "xmonad";
 | 
				
			||||||
 | 
					        start = ''
 | 
				
			||||||
 | 
					          /usr/bin/env imalison-xmonad &
 | 
				
			||||||
 | 
					          waitPID=$!
 | 
				
			||||||
 | 
					        '';
 | 
				
			||||||
 | 
					      }];
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    displayManager = {
 | 
				
			||||||
 | 
					      # lightdm = {
 | 
				
			||||||
 | 
					      #   enable = true;
 | 
				
			||||||
 | 
					      #   extraSeatDefaults=''
 | 
				
			||||||
 | 
					      #     greeter-hide-users=false
 | 
				
			||||||
 | 
					      #   '';
 | 
				
			||||||
 | 
					      # };
 | 
				
			||||||
 | 
					      sddm = {
 | 
				
			||||||
 | 
					        enable = true;
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  hardware.opengl.driSupport32Bit = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Define a user account. Don't forget to set a password with ‘passwd’.
 | 
				
			||||||
 | 
					  users.extraUsers.imalison = {
 | 
				
			||||||
 | 
					    name = "imalison";
 | 
				
			||||||
 | 
					    group = "users";
 | 
				
			||||||
 | 
					    isNormalUser = true;
 | 
				
			||||||
 | 
					    extraGroups = [
 | 
				
			||||||
 | 
					      "wheel" "disk" "audio" "video"
 | 
				
			||||||
 | 
					      "networkmanager" "systemd-journal"
 | 
				
			||||||
 | 
					    ];
 | 
				
			||||||
 | 
					    createHome = true;
 | 
				
			||||||
 | 
					    uid = 1000;
 | 
				
			||||||
 | 
					    home = "/home/imalison";
 | 
				
			||||||
 | 
					    shell = pkgs.zsh;
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  system.stateVersion = "18.03"; # Did you read the comment?
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										60
									
								
								nixos/machines/imalison-home.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								nixos/machines/imalison-home.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,60 @@
 | 
				
			|||||||
 | 
					{ config, lib, pkgs, ... }:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  imports = [
 | 
				
			||||||
 | 
					    <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
 | 
				
			||||||
 | 
					    ../configuration.nix
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ];
 | 
				
			||||||
 | 
					  boot.kernelModules = [ "kvm-intel" ];
 | 
				
			||||||
 | 
					  boot.extraModulePackages = [ ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  fileSystems."/" = {
 | 
				
			||||||
 | 
					    device = "/dev/disk/by-uuid/110e3bf8-19b7-4a39-8e2a-b4c3c0d59d0e";
 | 
				
			||||||
 | 
					    fsType = "ext4";
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  fileSystems."/boot" = {
 | 
				
			||||||
 | 
					    device = "/dev/disk/by-uuid/B2DA-CD21";
 | 
				
			||||||
 | 
					    fsType = "vfat";
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  fileSystems."/arch-linux-root" = {
 | 
				
			||||||
 | 
					    device = "/dev/disk/by-uuid/9095e51e-33f9-440d-a272-46e129800f81";
 | 
				
			||||||
 | 
					    fsType = "ext4";
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  swapDevices =
 | 
				
			||||||
 | 
					    [ { device = "/dev/disk/by-uuid/a6933b22-c7f4-4c57-b330-1450f313922e"; }
 | 
				
			||||||
 | 
					      { device = "/dev/disk/by-uuid/dbd49a76-4b3e-4b5c-9a88-68a9e61f6210"; }
 | 
				
			||||||
 | 
					    ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  nix.maxJobs = lib.mkDefault 4;
 | 
				
			||||||
 | 
					  powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  boot.initrd.luks.devices = [
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      name = "root";
 | 
				
			||||||
 | 
					      device = "/dev/sda3";
 | 
				
			||||||
 | 
					      preLVM = true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  boot.loader.grub.device = "/dev/sda";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  networking.hostName = "imalison-home";
 | 
				
			||||||
 | 
					  boot.loader.efi.canTouchEfiVariables = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  services.xserver.screenSection = ''
 | 
				
			||||||
 | 
					    DefaultDepth 24
 | 
				
			||||||
 | 
					    Option "RegistryDwords" "PerfLevelSrc=0x3322; PowerMizerDefaultAC=0x1"
 | 
				
			||||||
 | 
					    Option "TripleBuffer" "True"
 | 
				
			||||||
 | 
					    Option "Stereo" "0"
 | 
				
			||||||
 | 
					    Option "nvidiaXineramaInfoOrder" "DFP-0"
 | 
				
			||||||
 | 
					    Option "metamodes" "DVI-D-0: nvidia-auto-select +0+2160 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}, HDMI-0: nvidia-auto-select +640+0 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}, HDMI-1: nvidia-auto-select +2560+2160 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}"
 | 
				
			||||||
 | 
					    Option "SLI" "Off"
 | 
				
			||||||
 | 
					    Option "MultiGPU" "Off"
 | 
				
			||||||
 | 
					    Option "BaseMosaic" "off"
 | 
				
			||||||
 | 
					  '';
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user