diff --git a/system/common/global/default.nix b/system/common/global/default.nix new file mode 100644 index 0000000..d17cf65 --- /dev/null +++ b/system/common/global/default.nix @@ -0,0 +1,26 @@ +{ inputs, outputs, ... }: { + imports = [ + inputs.home-manager.nixosModules.home-manager + ./nix.nix + ./fish.nix + ./locale.nix + ./security.nix + ./systemdboot.nix + ./pipewire.nix + ] ++ (builtins.attrValues outputs.nixosModules); + + home-manager.extraSpecialArgs = { inherit inputs outputs; }; + + nixpkgs = { + config = { + allowUnfree = true; + permittedInsecurePackages = [ + "openssl-1.1.1u" + ]; + }; + }; + + hardware.enableRedistibutableFirmware = true; + + + } diff --git a/system/common/global/fish.nix b/system/common/global/fish.nix new file mode 100644 index 0000000..e53f255 --- /dev/null +++ b/system/common/global/fish.nix @@ -0,0 +1,10 @@ +{ + programs.fish = { + enable = true; + vendor = { + completions.enable = true; + config.enable = true; + functions.enable = true; + }; + }; +} diff --git a/system/common/global/locale.nix b/system/common/global/locale.nix new file mode 100644 index 0000000..73c7221 --- /dev/null +++ b/system/common/global/locale.nix @@ -0,0 +1,10 @@ +{ lib, ... }: { + i18n = { + defaultLocale = lib.mkDefault "en_US.UTF-8"; + }; + supportedLocales = lib.mkDefault [ + "en_US.UTF-8/UTF-8" + ]; + }; + time.timeZone = lib.mkDefault "Pacific/Auckland"; +} diff --git a/system/common/global/nix.nix b/system/common/global/nix.nix new file mode 100644 index 0000000..7c1c861 --- /dev/null +++ b/system/common/global/nix.nix @@ -0,0 +1,26 @@ +{ inputs, lib, ... }: +{ + nix = { + settings = { + trusted-users = [ "root" "@wheel" ]; + auto-optimise-store = lib.mkDefault true; + experimental-features = [ "nix-command" "flakes" "repl-flake" ]; + warn-dirty = false; + system-features = [ "kvm" "big-parallel" "nixos-test" ]; + flake-registry = ""; + }; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 2d"; + }; + + # Add each flake input as a registry + # To make nix3 commands consistent with the flake + registry = lib.mapAttrs (_: value: { flake = value; }) inputs; + + # Add nixpkgs input to NIX_PATH + # This lets nix2 commands still use + nixPath = [ "nixpkgs=${inputs.nixpkgs.outPath}" ]; + }; +} diff --git a/system/common/global/pipewire.nix b/system/common/global/pipewire.nix new file mode 100644 index 0000000..e35a788 --- /dev/null +++ b/system/common/global/pipewire.nix @@ -0,0 +1,11 @@ +{ + security.rtkit.enable = true; + hardware.pulseaudio.enable = false; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; +} diff --git a/system/ooksx1/modules/security.nix b/system/common/global/security.nix similarity index 95% rename from system/ooksx1/modules/security.nix rename to system/common/global/security.nix index 6e0e943..a0cbe19 100644 --- a/system/ooksx1/modules/security.nix +++ b/system/common/global/security.nix @@ -12,9 +12,6 @@ }; security = { - rtkit = { - enable = true; - }; polkit = { enable = true; }; diff --git a/system/common/global/systemdboot.nix b/system/common/global/systemdboot.nix new file mode 100644 index 0000000..6ea69ef --- /dev/null +++ b/system/common/global/systemdboot.nix @@ -0,0 +1,8 @@ +{ + boot.loader = { + systemd-boot = { + enable = true; + }; + efi.canTouchEfiVariables = true; + }; +} diff --git a/system/common/user/ooks/default.nix b/system/common/user/ooks/default.nix new file mode 100644 index 0000000..66fd176 --- /dev/null +++ b/system/common/user/ooks/default.nix @@ -0,0 +1,24 @@ +{ pkgs, config, ... }: +let ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups; +in +{ + users.users.ooks = { + isNormalUser = true + shell = pkgs.fish; + extraGroups = [ + "wheel" + "video" + "audio" + ] ++ ifTheyExist [ + "git" + "network" + "libvirtd" + "deluge" + ]; + + packages = [ pkgs.home-manager ]; + }; + + home-manager.users.ooks = import ../../../../home/ooks/${config.networking.hostName} + +} diff --git a/system/ooksx1/hardware-configuration.nix b/system/ooksx1/hardware-configuration.nix index f8b7c66..1cc2b75 100644 --- a/system/ooksx1/hardware-configuration.nix +++ b/system/ooksx1/hardware-configuration.nix @@ -1,6 +1,3 @@ -# 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, ... }: { @@ -44,7 +41,11 @@ fsType = "vfat"; }; - swapDevices = [ ]; + swapDevices = [ + device = "/swap/swapfile"; + size = 8196; + ]; + # 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 diff --git a/system/ooksx1/modules/networking.nix b/system/ooksx1/modules/networking.nix deleted file mode 100644 index e69de29..0000000 diff --git a/system/ooksx1/modules/packages.nix b/system/ooksx1/modules/packages.nix deleted file mode 100644 index 131975a..0000000 --- a/system/ooksx1/modules/packages.nix +++ /dev/null @@ -1,78 +0,0 @@ - -{ pkgs, ... } -{ -# System Packages -# ------------------------------------------------------------------------------------------------- - - environment = { - binsh = with pkgs; [ fish ] - systemPackages = with pkgs; [ - # Editor - neovim - # Utility - wget - neofetch - glib - xdg-utils - killall - zip - rar - btop - p7zip - git - pciutils - gdb - dash - curl - # Programming - cargo - # Fonts - jetbrains-mono - # File browsers - ranger - joshuto - # Wayland - wayland - wayland-scanner - wayland-utils - egl-wayland - wayland-protocols - wev # Wayland window debugger - wl-clipboard # Wayland clipboard - wlr-randr - # Firmware - linux-firmware - # Audio - alsa-lib - alsa-utils - flac - pulsemixer - # Appearance - lxappearance - # Screenshot - pkgs.sway-contrib.grimshot - flameshot - grim - # Notification - dunst - libnotify - ]; - }; - -# Programs -# ------------------------------------------------------------------------------------------------- - - programs.mtr.enable = true - programs.gnupg.agent = { - enable = true; - enabeSSHSupport = true; - }; - programs.hyprland = { - enable = true; - xwayland.enable = true; - }; - programs.fish = { - enable = true - }; - - diff --git a/system/ooksx1/laptop.nix b/system/ooksx1/ooksx1.nix similarity index 66% rename from system/ooksx1/laptop.nix rename to system/ooksx1/ooksx1.nix index f71d1ab..3bd2020 100644 --- a/system/ooksx1/laptop.nix +++ b/system/ooksx1/ooksx1.nix @@ -8,9 +8,15 @@ # ------------------------------------------------------------------------------------------------- { - imports = - [ # Include the results of the hardware scan + imports = [ + inputs.hardware.nixosModules.common-pc-ssd + ./hardware-configuration.nix + + ../common/user/ooks + ../common/global/ + + ]; # Bootloader @@ -47,25 +53,15 @@ nixpkgs.system = "x86_64-linux"; -# Networking +# Hostname and networking # ------------------------------------------------------------------------------------------------- networking = { - hostName = "ooksthink"; # Define your hostname. - networkmanager.enable = true; # Easiest to use and most distros use this by default. + hostName = "ooksthink"; + networkmanager.enable = true; }; -# Time Zone -# ------------------------------------------------------------------------------------------------- - - time.timeZone = "Pacific/Auckland"; - -# Localization -# ------------------------------------------------------------------------------------------------- - - i18n.defaultLocale = "en_US.UTF-8"; - # X Server # ------------------------------------------------------------------------------------------------- @@ -90,7 +86,7 @@ # Printing # ------------------------------------------------------------------------------------------------- - # services.printing.enable = true; + services.printing.enable = true; # Sound # ------------------------------------------------------------------------------------------------- @@ -103,76 +99,23 @@ # services.xserver.libinput.enable = true; -# User +# Laptop Programs # ------------------------------------------------------------------------------------------------- - users.users = { - ooks = { - isNormalUser = true; - extraGroups = [ "wheel" ]; - shell = pkgs.fish; + powerManagement.powertop.enable = true; + programs = { + light.enable = true; + dconf.enable = true; + kdeconnect.enable = true; + }; -# User Packages -# ------------------------------------------------------------------------------------------------- +# XDG Portal +# ------------------------------------------------------------------------------------------------ - packages = with pkgs; [ - firefox - tree - hyprland - kitty - ]; - }; - }; - -# System Environment -# ------------------------------------------------------------------------------------------------- - - environment = { - binsh = "${pkgs.dash}/bin/dash"; - shells = with pkgs; [ fish ]; - systemPackages = with pkgs; [ - # Editor - # ------ - neovim - # Utility - # ------ - wget - dash - neofetch - glib - xdg-utils - pciutils - gdb - killall - jetbrains-mono - cargo - p7zip - joshuto - zip - rar - btop - git - libnotify - dunst - wl-clipboard - wlr-randr - wayland - wayland-scanner - wayland-utils - egl-wayland - wayland-protocols - wev - alsa-lib - alsa-utils - flac - pulsemixer - linux-firmware - lxappearance - pkgs.sway-contrib.grimshot - flameshot - grim - ]; - }; +xdg.portal = { + enable = true; + wlr.enable = true; +}; # Fonts # ------------------------------------------------------------------------------------------------- @@ -189,30 +132,16 @@ fonts.fonts = with pkgs; [ enable = true; enableSSHSupport = true; }; - programs.hyprland = { - enable = true; - xwayland.enable = true; - }; - programs.fish = { - enable = true; - }; # Services # ------------------------------------------------------------------------------------------------- - security.rtkit.enable = true; - services = { - pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; - wireplumber.enable = true; }; - dbus.packages = [ pkgs.gcr ]; - getty.autologinUser = "ooks"; + dbus = { + enable = true; + packages = [ pkgs.gcr ]; + }; auto-cpufreq = { enable = true; settings = { @@ -245,18 +174,6 @@ fonts.fonts = with pkgs; [ }; }; -# Security -# ------------------------------------------------------------------------------------------------- - - security.polkit.enable = true; - security.sudo = { - enable = true; - extraConfig = '' - ooks ALL=(ALL) NOPASSWD:ALL - ''; - }; - - # D-Bus # -------------------------------------------------------------------------------------------------