diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-06-17 19:09:27 +0200 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-06-17 19:09:27 +0200 |
commit | ad58b57df7b298bc3e25c578f590d44da3ce36c9 (patch) | |
tree | 28be43da790fa014e13a7284e5a5979537a8721a /hosts | |
download | nixos-config-ad58b57df7b298bc3e25c578f590d44da3ce36c9.tar.gz nixos-config-ad58b57df7b298bc3e25c578f590d44da3ce36c9.tar.bz2 nixos-config-ad58b57df7b298bc3e25c578f590d44da3ce36c9.zip |
Initial commit
Diffstat (limited to 'hosts')
-rw-r--r-- | hosts/configuration.nix | 152 | ||||
-rw-r--r-- | hosts/default.nix | 40 | ||||
-rw-r--r-- | hosts/home.nix | 173 | ||||
-rw-r--r-- | hosts/phobos/default.nix | 29 | ||||
-rw-r--r-- | hosts/phobos/hardware.nix | 40 | ||||
-rw-r--r-- | hosts/phobos/home.nix | 9 |
6 files changed, 443 insertions, 0 deletions
diff --git a/hosts/configuration.nix b/hosts/configuration.nix new file mode 100644 index 0000000..4b85fda --- /dev/null +++ b/hosts/configuration.nix @@ -0,0 +1,152 @@ +{ secrets, lib, pkgs, config, hostname, inputs, user, ... }: { + + imports = [ + ../modules/doas + ../modules/pipewire + ../modules/xorg + ../modules/fonts + ../modules/virtualisation + ]; + + # Use the GRUB 2 boot loader. + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + # boot.loader.grub.efiSupport = true; + # boot.loader.grub.efiInstallAsRemovable = true; + # boot.loader.efi.efiSysMountPoint = "/boot/efi"; + boot.loader.timeout = 0; + + # Set your time zone. + time.timeZone = "Europe/Madrid"; + + networking.hostName = hostname; # Define your hostname. + networking.extraHosts = builtins.readFile ../dotfiles/hosts; + networking.nameservers = [ "9.9.9.9" ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s3.useDHCP = lib.mkDefault true; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + # Enable CUPS to print documents. + # services.printing.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.baitinq = { + isNormalUser = true; + extraGroups = [ "wheel" "audio" "video" ]; # Enable ‘sudo’ for the user. + }; + + #nixpkgs.config.allowUnfree = true; + + environment.variables = { + TERMINAL = "st"; + EDITOR = "nvim"; + VISUAL = "nvim"; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + lm_sensors + pulseaudio # used for tools + python + killall + wget + nano + git + fzf + htop + pfetch + unzip + yt-dlp + lf + usbutils + pciutils + gnupg + git-crypt + ]; + + programs.neovim = { + enable = true; + viAlias = true; + vimAlias = true; + # plugins = with pkgs.vimPlugins; [vim-addon-nix youcompleteme]; + }; + + # 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; #look at this + }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + services.openssh.listenAddresses = [{ + addr = "0.0.0.0"; + port = 2222; + }]; + programs.ssh.askPassword = ""; + programs.ssh.startAgent = true; + programs.ssh.extraConfig = '' + AddKeysToAgent yes + ''; + + programs.firejail.enable = true; + programs.firejail.wrappedBinaries = { + discord-wrapped = { + executable = "${lib.getBin pkgs.discord}/bin/discord"; + profile = "${pkgs.firejail}/etc/firejail/discord.profile"; + }; + }; + + nix = { + settings.auto-optimise-store = true; + gc = { + automatic = true; + dates = "daily"; + options = "-d"; + }; + }; + + # Open ports in the firewall. + networking.firewall.allowedTCPPorts = [ 2222 ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + networking.firewall.enable = true; + + # Copy the NixOS configuration file and link it from the resulting system + # (/run/current-system/configuration.nix). This is useful in case you + # accidentally delete configuration.nix. + #system.copySystemConfiguration = true; + + nix = { + package = pkgs.nixFlakes; + extraOptions = "experimental-features = nix-command flakes"; + maxJobs = "auto"; + buildCores = 0; + }; + + lib.formatter.x86_64-linux = pkgs.nixpkgs-fmt; + + hardware.enableRedistributableFirmware = true; + hardware.cpu.intel.updateMicrocode = true; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "22.05"; # Did you read the comment? +} + diff --git a/hosts/default.nix b/hosts/default.nix new file mode 100644 index 0000000..f6814c5 --- /dev/null +++ b/hosts/default.nix @@ -0,0 +1,40 @@ +{ user, lib, nixpkgs, nur, inputs, home-manager, ... }: +let + system = "x86_64-linux"; # System architecture + + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; # Allow proprietary software + overlays = [ + nur.overlay + (import ../packages) + (import ../overlays/base.nix) + ]; + }; + + inherit (nixpkgs.lib); + + secrets = import ../secrets; +in +{ + phobos = + let hostname = "phobos"; + in + lib.nixosSystem { + inherit system; + specialArgs = { inherit pkgs inputs user secrets hostname; }; + modules = [ + ./configuration.nix + ./phobos + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { inherit pkgs user secrets hostname inputs; }; + home-manager.users.${user} = { + imports = [ ./home.nix ] ++ [ (import ./phobos/home.nix) ]; + }; + } + ]; + }; +} diff --git a/hosts/home.nix b/hosts/home.nix new file mode 100644 index 0000000..fa1438b --- /dev/null +++ b/hosts/home.nix @@ -0,0 +1,173 @@ +{ config, lib, pkgs, inputs, user, hostname, secrets, ... }: +let + dotfiles = ../dotfiles; +in +{ + home.username = "${user}"; + home.homeDirectory = "/home/${user}"; + + home.packages = with pkgs; [ + scrot + qemu + redshift + custom.xwinwrapr + discord + mpv + sxiv + dwm + st + dmenu + unclutter + clipmenu + dunst + sxhkd + feh + custom.smart-wallpaper + custom.dwmbar + numlockx + surf + pavucontrol + light + polkit_gnome + progress + qbittorrent + vscode + xorg.xev + statix + ]; + + programs = { + git = { + enable = true; + userName = "Baitinq"; + userEmail = "manuelpalenzuelamerino@gmail.com"; + }; + + firefox = { + enable = true; + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + ublock-origin + darkreader + https-everywhere + bypass-paywalls-clean + ]; + profiles.default = { + id = 0; + name = "Default"; + isDefault = true; + settings = { + "general.autoScroll" = true; + }; + }; + }; + + obs-studio = { enable = true; }; + + neovim = { + enable = true; + viAlias = true; + vimAlias = true; + withPython3 = true; + plugins = with pkgs.vimPlugins; [ + vim-addon-nix + YouCompleteMe + nerdtree + rainbow_parentheses + base16-vim + vim-orgmode + ]; + }; + + zsh = { + enable = true; + zplug = { + enable = true; + plugins = [ + { + name = "zsh-users/zsh-autosuggestions"; + } # Simple plugin installation + { + name = "zsh-users/zsh-syntax-highlighting"; + } # Simple plugin installation + { name = "chrissicool/zsh-256color"; } # Simple plugin installation + { + name = "fsegouin/oh-my-zsh-agnoster-mod-theme"; + tags = [ "as:theme" "depth:1" ]; + } # Installations with additional options. For the list of options, please refer to Zplug README. + ]; + }; + shellAliases = { + ls = "ls --color"; + l = "ls -l"; + ll = "ls -la"; + weather = "(){ curl -s v2.wttr.in/$1 }"; + vim = "nvim"; + q = "exit"; + c = "clear"; + extract = '' + () { + if [ -f $1 ] ; then + case $1 in + *.tar.bz2) tar xvjf $1 ;; + *.tar.gz) tar xvzf $1 ;; + *.tar.xz) tar Jxvf $1 ;; + *.bz2) bunzip2 $1 ;; + *.rar) rar x $1 ;; + *.gz) gunzip $1 ;; + *.tar) tar xvf $1 ;; + *.tbz2) tar xvjf $1 ;; + *.tgz) tar xvzf $1 ;; + *.zip) unzip -d `echo $1 | sed 's/\(.*\)\.zip/\1/'` $1;; + *.Z) uncompress $1 ;; + *.7z) 7z x $1 ;; + *) echo "don't know how to extract '$1'" ;; + esac + else + echo "'$1' is not a valid file!" + fi + }''; + }; + + initExtra = '' + #when going up go up only beggining of curr word history + bindkey '\e[A' history-search-backward + bindkey '\e[B' history-search-forward + #ctrl + arrow forward/backward word + bindkey "^[[1;5C" forward-word + bindkey "^[[1;5D" backward-word + #alt + arrow forward/backward word + bindkey "^[[1;3C" forward-word + bindkey "^[[1;3D" backward-word + #ctrl + delete delete whole word + bindkey '^H' backward-kill-word + #alt + delete delete whole word + bindkey "\e\x7f" backward-kill-word + ''; + }; + + }; + + home.file = { + ".bash_profile".source = dotfiles + "/.bash_profile"; + ".xinitrc".source = dotfiles + "/.xinitrc"; + ".Xresources".source = dotfiles + "//.Xresources/"; + ".bashrc".source = dotfiles + "/.bashrc"; + ".config/zathura/zathurarc".source = dotfiles + "/zathurarc"; + ".config/sxhkd/".source = dotfiles + "/sxhkd"; + ".config/dunst/dunstrc".source = dotfiles + "/dunstrc"; + ".config/dwmbar".source = dotfiles + "/dwmbar/"; + + ".scripts/".source = dotfiles + "/scripts/"; + }; + + home.file = { + "./Images/Wallpapers".source = pkgs.fetchFromGitHub { + owner = "Baitinq"; + repo = "Wallpapers"; + rev = "291f9a4cf78a6ad862da151139ea026ea72968e5"; + sha256 = "sha256-YKpIno5QSJM/GGp5DwQeuhKmTU5S96+IhLr0O0V8PDI="; + }; + }; + + xsession.enable = true; +} diff --git a/hosts/phobos/default.nix b/hosts/phobos/default.nix new file mode 100644 index 0000000..cbefcba --- /dev/null +++ b/hosts/phobos/default.nix @@ -0,0 +1,29 @@ +# 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, lib, secrets, hostname, inputs, user, ... }: { + + imports = [ + # Include the results of the hardware scan. + ./hardware.nix + ]; + + # Define on which hard drive you want to install Grub. + boot.loader.grub.device = "/dev/sdb"; # or "nodev" for efi only + + # Pick only one of the below networking options. + networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + networking.wireless.networks = secrets.wifi; + # networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + environment.systemPackages = with pkgs; + [ + + ]; +} + diff --git a/hosts/phobos/hardware.nix b/hosts/phobos/hardware.nix new file mode 100644 index 0000000..6194c2d --- /dev/null +++ b/hosts/phobos/hardware.nix @@ -0,0 +1,40 @@ +{ config, lib, pkgs, modulesPath, ... }: +let + powerMode = "performance"; +in +{ + imports = [ ]; + + boot.initrd.availableKernelModules = + [ "xhci_pci" "ahci" "usbhid" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm_intel" ]; + boot.extraModulePackages = [ ]; + boot.kernelParams = [ "net.ifnames=0" "biosdevname=0" "iomem=relaxed" ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/2a0ba6f5-a4ec-4614-9bd2-11b4a66d5d82"; + fsType = "ext4"; + }; + + swapDevices = [ ]; + + powerManagement.cpuFreqGovernor = powerMode; + + services.xserver.videoDrivers = [ "intel" ]; + # hardware.nvidia.modesetting.enable = true; + hardware.opengl.enable = true; + hardware.opengl.driSupport = true; + #services.xserver.videoDrivers = [ "nvidia" ]; + + /* hardware.nvidia.prime = { + sync.enable = true; + + # Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA + nvidiaBusId = "PCI:1:0:0"; + + # Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA + intelBusId = "PCI:0:2:0"; + }; + */ +} diff --git a/hosts/phobos/home.nix b/hosts/phobos/home.nix new file mode 100644 index 0000000..2cb65eb --- /dev/null +++ b/hosts/phobos/home.nix @@ -0,0 +1,9 @@ +{ config, lib, pkgs, inputs, user, hostname, secrets, ... }: +{ + home.packages = with pkgs; [ + (minecraft.override { jre = pkgs.jdk8; }) + jetbrains.idea-community + calibre + qtcreator + ]; +} |