From 0cc3e1fc298d8a722d70fd69f4f17bec787057c3 Mon Sep 17 00:00:00 2001 From: langedev Date: Sun, 19 Nov 2023 19:31:04 -0800 Subject: [PATCH] Initial commit lol --- configuration.nix | 43 +++++ flake.lock | 154 ++++++++++++++++++ flake.nix | 17 ++ hardware-configuration.nix | 41 +++++ modules/audio/pipewire/default.nix | 12 ++ modules/graphics/nvidia/default.nix | 7 + modules/login/greetd/default.nix | 17 ++ modules/network/bluetooth/default.nix | 7 + .../network/browsers/librewolf/default.nix | 6 + modules/network/networking/default.nix | 41 +++++ modules/network/syncthing/default.nix | 9 + modules/shell/fish/default.nix | 11 ++ modules/system/default.nix | 36 ++++ modules/themeing/default.nix | 7 + modules/user/default.nix | 8 + 15 files changed, 416 insertions(+) create mode 100644 configuration.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hardware-configuration.nix create mode 100644 modules/audio/pipewire/default.nix create mode 100644 modules/graphics/nvidia/default.nix create mode 100644 modules/login/greetd/default.nix create mode 100644 modules/network/bluetooth/default.nix create mode 100644 modules/network/browsers/librewolf/default.nix create mode 100644 modules/network/networking/default.nix create mode 100644 modules/network/syncthing/default.nix create mode 100644 modules/shell/fish/default.nix create mode 100644 modules/system/default.nix create mode 100644 modules/themeing/default.nix create mode 100644 modules/user/default.nix diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..0f448f4 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,43 @@ +# 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, ... }: + +{ + nix.package = pkgs.nixUnstable; + imports = + [ + # Hardware Settings (hardware scan) + ./hardware-configuration.nix + + # System essentials (boot, lang, hostname, ...) + ./modules/system + + ./modules/user + + ./modules/themeing + + ./modules/audio/pipewire + + ./modules/shell/fish # This enables fish as the default shell + + ./modules/network/browsers/librewolf + ./modules/network/networking + ./modules/network/syncthing + ./modules/network/bluetooth + + ./modules/login/greetd + + # ./modules/graphics/nvidia + ]; + + nixpkgs.config.allowUnfree = true; + nix.settings = { + substituters = [ "https://hyprland.cachix.org" ]; + trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ]; + experimental-features = [ "nix-command" "flakes" ]; + }; + + system.stateVersion = "23.05"; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..79f4514 --- /dev/null +++ b/flake.lock @@ -0,0 +1,154 @@ +{ + "nodes": { + "hyprland": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "nixpkgs": "nixpkgs", + "systems": "systems", + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1699808562, + "narHash": "sha256-wTU1ivhWAAGWO6Fzx4RYFruW8HrIh5X7fjy5NJPaqOc=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "0ba2e6870478bcf1af1b6508677b46a3484fb21f", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1691753796, + "narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1698134075, + "narHash": "sha256-foCD+nuKzfh49bIoiCBur4+Fx1nozo+4C/6k8BYk4sg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "8efd5d1e283604f75a808a20e6cde0ef313d07d4", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1699825797, + "narHash": "sha256-W2m42mVt4/O6CJFbECPfLApmi8bO+qscbmSeEKrSHEg=", + "owner": "langedev", + "repo": "nixpkgs", + "rev": "a69768a1c385042d46ff57396c49d26df5ac035c", + "type": "github" + }, + "original": { + "owner": "langedev", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "hyprland": "hyprland", + "nixpkgs": "nixpkgs_2" + } + }, + "systems": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "wlroots": { + "flake": false, + "locked": { + "host": "gitlab.freedesktop.org", + "lastModified": 1699292815, + "narHash": "sha256-HXu98PyBMKEWLqiTb8viuLDznud/SdkdJsx5A5CWx7I=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "5de9e1a99d6642c2d09d589aa37ff0a8945dcee1", + "type": "gitlab" + }, + "original": { + "host": "gitlab.freedesktop.org", + "owner": "wlroots", + "repo": "wlroots", + "rev": "5de9e1a99d6642c2d09d589aa37ff0a8945dcee1", + "type": "gitlab" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1697981233, + "narHash": "sha256-y8q4XUwx+gVK7i2eLjfR32lVo7TYvEslyzrmzYEaPZU=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "22e7a65ff9633e1dedfa5317fdffc49f68de2ff2", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..84f22c0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,17 @@ +{ + inputs = { + nixpkgs.url = "github:langedev/nixpkgs/nixos-unstable"; + hyprland.url = "github:hyprwm/Hyprland"; + }; + + outputs = { nixpkgs, hyprland, ... }: { + nixosConfigurations.jibril = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./configuration.nix + hyprland.nixosModules.default + { programs.hyprland.enable = true; } + ]; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..0e7a3d9 --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,41 @@ +# 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 = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/168fb358-6783-4b66-8eed-374769a14c88"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/2A27-6F56"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/db71f8e9-74e6-40f8-b5c3-1dcf74510f3b"; } + ]; + + # 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.wlp2s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + # high-resolution display +} diff --git a/modules/audio/pipewire/default.nix b/modules/audio/pipewire/default.nix new file mode 100644 index 0000000..c3ebfe8 --- /dev/null +++ b/modules/audio/pipewire/default.nix @@ -0,0 +1,12 @@ +{ config, pkgs, lib, ... }: + +{ + security.rtkit.enable = true; + + services.pipewire = { + enable = true; + alsa.enable = false; + alsa.support32Bit = false; + pulse.enable = true; + }; +} diff --git a/modules/graphics/nvidia/default.nix b/modules/graphics/nvidia/default.nix new file mode 100644 index 0000000..6d39712 --- /dev/null +++ b/modules/graphics/nvidia/default.nix @@ -0,0 +1,7 @@ +{ config, pkgs, lib, ... }: + +{ + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.opengl.enable = true; + hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable; +} diff --git a/modules/login/greetd/default.nix b/modules/login/greetd/default.nix new file mode 100644 index 0000000..23620f8 --- /dev/null +++ b/modules/login/greetd/default.nix @@ -0,0 +1,17 @@ +{ config, pkgs, lib, ... }: + +{ + services.greetd = { + enable = true; + package = pkgs.greetd.tuigreet; + settings = { + terminal = { + vt = 2; + }; + default_session = { + command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland"; + user = "pan"; + }; + }; + }; +} diff --git a/modules/network/bluetooth/default.nix b/modules/network/bluetooth/default.nix new file mode 100644 index 0000000..1e76c8f --- /dev/null +++ b/modules/network/bluetooth/default.nix @@ -0,0 +1,7 @@ +{ config, pkgs, lib, ... }: + +{ + hardware.bluetooth.enable = true; + hardware.bluetooth.powerOnBoot = true; + services.blueman.enable = true; +} diff --git a/modules/network/browsers/librewolf/default.nix b/modules/network/browsers/librewolf/default.nix new file mode 100644 index 0000000..034c5eb --- /dev/null +++ b/modules/network/browsers/librewolf/default.nix @@ -0,0 +1,6 @@ +{ config, pkgs, lib, ... }: + +{ + environment.variables.WEBBROWSER = "librewolf"; + environment.systemPackages = with pkgs; [ librewolf ]; +} diff --git a/modules/network/networking/default.nix b/modules/network/networking/default.nix new file mode 100644 index 0000000..57fae54 --- /dev/null +++ b/modules/network/networking/default.nix @@ -0,0 +1,41 @@ +{ config, pkgs, lib, ... }: + +{ + networking.wireless = { + enable = true; + userControlled = { + enable = true; + group = "network"; + }; + networks = { + "The Kabal 2.4" = { + pskRaw = "56302c1b1c7499f4a4f0e01cefe14b4393c5092420ebf71c68336cd084acd357"; + priority = 1; + }; + "WWUwireless-Secure" = { + auth = '' + key_mgmt=WPA-EAP + eap=PEAP + identity="langed@wwu.edu" + password="Slashed-Tidy4-Cubbyhole" + ''; + priority = 1; + }; + "Yellowsticky" = { + pskRaw = "8984d7e1e2f5bd9c3ccf92e429886bc64d40d42d4771ed5946556227afa4abf0"; + priority = 1; + }; + "Lange" = { + pskRaw = "bbbbf63e23747bc0ff36aed4c20dcee0221a6ccb2d2db07e4c64058e645e5f1e"; + priority = 1; + }; + "Homura" = { + pskRaw = "dd77456e1df3f2c17bccc917a0e609684fa6d2ccb6a2e0fb122d50d243e0c87e"; + priority = 0; + }; + }; + }; + + + networking.enableIPv6 = false; +} diff --git a/modules/network/syncthing/default.nix b/modules/network/syncthing/default.nix new file mode 100644 index 0000000..3397cd1 --- /dev/null +++ b/modules/network/syncthing/default.nix @@ -0,0 +1,9 @@ +{ config, pkgs, lib, ... }: + +{ + services.syncthing.enable = true; + services.syncthing.user = "pan"; + services.syncthing.dataDir = "/home/pan/dox"; + services.syncthing.overrideFolders = false; + services.syncthing.overrideDevices = false; +} diff --git a/modules/shell/fish/default.nix b/modules/shell/fish/default.nix new file mode 100644 index 0000000..37eef00 --- /dev/null +++ b/modules/shell/fish/default.nix @@ -0,0 +1,11 @@ +{ config, pkgs, lib, ... }: + +{ + programs.fish.enable = true; + + users.defaultUserShell = pkgs.fish; + + environment.shells = with pkgs; [ fish ]; + + # environment.variables.NIX_BUILD_SHELL = "fish"; +} diff --git a/modules/system/default.nix b/modules/system/default.nix new file mode 100644 index 0000000..81eaf8b --- /dev/null +++ b/modules/system/default.nix @@ -0,0 +1,36 @@ +{ config, pkgs, lib, ... }: + +{ + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "jibril"; + + time.timeZone = "America/Los_Angeles"; + + i18n.defaultLocale = "en_US.UTF-8"; + + # "Essential" Packages + environment.systemPackages = with pkgs; [ + git + neovim + nnn + xdg-user-dirs + blueman + ]; + + # XDG Compliance + environment.sessionVariables = rec { + XDG_CONFIG_HOME = "\${HOME}/.config"; + XDG_CACHE_HOME = "\${HOME}/.cache"; + XDG_STATE_HOME = "\${HOME}/.local/state"; + XDG_DATA_HOME = "\${HOME}/.local/share"; + XDG_BIN_HOME = "\${HOME}/.local/bin"; + }; + + users.groups = { + wheel = { }; + network = { }; + }; +} diff --git a/modules/themeing/default.nix b/modules/themeing/default.nix new file mode 100644 index 0000000..13e7abe --- /dev/null +++ b/modules/themeing/default.nix @@ -0,0 +1,7 @@ +{ config, pkgs, lib, ... }: + +{ + fonts.packages = with pkgs; [ + cascadia-code + ]; +} diff --git a/modules/user/default.nix b/modules/user/default.nix new file mode 100644 index 0000000..58a4426 --- /dev/null +++ b/modules/user/default.nix @@ -0,0 +1,8 @@ +{ config, pkgs, lib, ... }: + +{ + users.users.pan = { + isNormalUser = true; + extraGroups = [ "wheel" "network" ]; + }; +}