From a62078bbf23053a4cd40146f9fdc401e948428e7 Mon Sep 17 00:00:00 2001 From: tristan Date: Sat, 8 Apr 2023 15:18:48 +0100 Subject: [PATCH] initial commit --- system/configuration.nix | 150 ++++++++++++++++++++++++++++++ system/hardware-configuration.nix | 36 +++++++ users/tristan/home.nix | 68 ++++++++++++++ 3 files changed, 254 insertions(+) create mode 100644 system/configuration.nix create mode 100644 system/hardware-configuration.nix create mode 100644 users/tristan/home.nix diff --git a/system/configuration.nix b/system/configuration.nix new file mode 100644 index 0000000..e66889c --- /dev/null +++ b/system/configuration.nix @@ -0,0 +1,150 @@ +# 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’). + +{ lib, config, pkgs, ... }: let + flake-compat = builtins.fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz"; + + hyprland = (import flake-compat { + src = builtins.fetchTarball "https://github.com/hyprwm/Hyprland/archive/master.tar.gz"; + }).defaultNix; +in { + imports = [ + ./hardware-configuration.nix + hyprland.nixosModules.default + ]; + + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + "broadcom-sta" + ]; + + nix.settings = { + experimental-features = [ "nix-command" ]; + substituters = ["https://hyprland.cachix.org"]; + trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="]; + }; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "nixbookpro"; # Define your hostname. + # Pick only one of the below networking options. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + + # Set your time zone. + time.timeZone = "Europe/London"; + + # 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.defaultLocale = "en_GB.UTF-8"; + console = { + font = "Lat2-Terminus16"; + }; + + # use pipewire + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + + security.pam.services.swaylock = {}; + + # Configure graphical stuff + services.xserver = { + enable = true; + layout = "gb"; + xkbVariant = "dvorak"; + libinput.enable = true; + + displayManager.lightdm.enable = true; + }; + + qt5.enable = true; + qt5.platformTheme = "gtk2"; + qt5.style = "gtk2"; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # enable flatpaks + services.flatpak.enable = true; + xdg.portal.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.tristan = { + isNormalUser = true; + extraGroups = [ "wheel" "video" ]; + initialPassword = "pass"; + shell = pkgs.zsh; + }; + + users.users.guest = { + isNormalUser = true; + extraGroups = [ ]; + initialPassword = "pass"; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + gnome.gnome-software + # discover + tealdeer + alsa-utils + ]; + + services.dbus.enable = true; + programs.light.enable = true; + programs.zsh.enable = true; + programs.dconf.enable = true; + programs.hyprland = { + enable = true; + xwayland.enable = true; + }; + + # 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; + + services.tailscale.enable = true; + + # Open ports in the firewall. + networking.firewall.allowedTCPPorts = [ 8080 8081 ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # 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; + + # 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/system/hardware-configuration.nix b/system/hardware-configuration.nix new file mode 100644 index 0000000..1458694 --- /dev/null +++ b/system/hardware-configuration.nix @@ -0,0 +1,36 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "ohci_pci" "ehci_pci" "ahci" "firewire_ohci" "usb_storage" "usbhid" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" "wl" ]; + boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ]; + + fileSystems."/" = + { device = "/dev/disk/by-label/NIXROOT"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-label/NIXBOOT"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + # 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp3s0.useDHCP = lib.mkDefault true; + + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/users/tristan/home.nix b/users/tristan/home.nix new file mode 100644 index 0000000..f023f4a --- /dev/null +++ b/users/tristan/home.nix @@ -0,0 +1,68 @@ +{ config, pkgs, ... }: +let + doom-emacs = pkgs.callPackage (builtins.fetchTarball { + url = https://github.com/nix-community/nix-doom-emacs/archive/master.tar.gz; + }) { + doomPrivateDir = ./doom.d; # Directory containing your config.el, init.el + # and packages.el files + }; +in { + # Home Manager needs a bit of information about you and the + # paths it should manage. + home.username = "tristan"; + home.homeDirectory = "/home/tristan"; + + # This value determines the Home Manager release that your + # configuration is compatible with. This helps avoid breakage + # when a new Home Manager release introduces backwards + # incompatible changes. + # + # You can update Home Manager without changing this value. See + # the Home Manager release notes for a list of state version + # changes in each release. + home.stateVersion = "22.05"; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + home.packages = with pkgs; [ + brave + pcmanfm + lf + chafa + imv + mpv + mpvScripts.mpris + sway + swaylock + waybar + wofi + foot + neovim + git + neofetch + fusuma + ffmpeg + motion + trash-cli + tailscale + spotifyd + htop + mosh + tmux + doom-emacs + wget + wev + gimp + thunderbird + nextcloud-client + ]; + + gtk = { + enable = true; + theme = { + name = "Materia-dark"; + package = pkgs.materia-theme; + }; + }; +}