diff --git a/bootloader.nix b/bootloader.nix deleted file mode 100644 index b89b691..0000000 --- a/bootloader.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ pkgs, ... }: - -{ - boot.loader = { - efi.canTouchEfiVariables = true; - - systemd-boot = { - enable = true; - editor = false; - configurationLimit = 5; - extraInstallCommands = '' - ${pkgs.gnused}/bin/sed -i 's/^version Generation \([0-9]\+\).*$/version Generation \1/' /boot/loader/entries/nixos-generation-* - ${pkgs.gnused}/bin/sed -i 's/^default .*$/default 00-arch.conf/' /boot/loader/loader.conf - ''; - }; - }; - - boot.kernelParams = [ "quiet" "splash" ]; -} diff --git a/common/users/cameron/default.nix b/common/users/cameron/default.nix new file mode 100644 index 0000000..6819a64 --- /dev/null +++ b/common/users/cameron/default.nix @@ -0,0 +1,38 @@ +{ config, lib, pkgs, ... }: + +with lib; let + cfg = config.user.cameron; +in { + options.user.cameron = { + enable = mkEnableOption "user cameron"; + } + + config = mkIf cfg.enable { + users = { + groups.cameron.gid = 1000; + + users.cameron = { + description = "Cameron"; + isNormalUser = true; + + uid = 1000; + group = "cameron"; + extraGroups = [ "networkmanager" "wheel" ]; + + home = "/home/cameron-nix"; + createHome = true; + + shell = pkgs.zsh; + packages = (with pkgs; [ + direnv + nix-direnv + bibata-cursors + bibata-cursors-translucent + ]) ++ (with pkgs.gnomeExtensions; [ + gsconnect + dock-from-dash + ]); + }; + }; + }; +} diff --git a/users/configuration.nix b/common/users/users.nix similarity index 77% rename from users/configuration.nix rename to common/users/users.nix index 92abd5a..679ff38 100644 --- a/users/configuration.nix +++ b/common/users/users.nix @@ -6,6 +6,6 @@ }; imports = [ - ./cameron.nix + ./cameron/default.nix ]; } diff --git a/configuration.nix b/configuration.nix deleted file mode 100644 index 4b9ca61..0000000 --- a/configuration.nix +++ /dev/null @@ -1,42 +0,0 @@ -# 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, ... }: - -{ - imports = [ - # Include the results of the hardware scan. - ./hardware-configuration.nix - - ./bootloader.nix - ./filesystems.nix - ./time.nix - ./networking.nix - ./locale.nix - ./xserver.nix - ./printing.nix - ./sound.nix - ./power.nix - ./login-manager.nix - ./desktop.nix - ./packages.nix - - # User configuration - ./users/configuration.nix - ]; - - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - - - # 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 = "23.05"; # Did you read the comment? - - # system.autoUpgrade.enable = true; - # system.autoUpgrade.allowReboot = false; -} diff --git a/desktop.nix b/desktop.nix deleted file mode 100644 index 4a2c75d..0000000 --- a/desktop.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ pkgs, ... }: - -{ - programs = { - sway = { - enable = true; - - extraPackages = with pkgs; [ - swaylock - swayidle - dmenu - wmenu - i3status - brightnessctl - wob - ]; - }; - }; -} diff --git a/filesystems.nix b/filesystems.nix deleted file mode 100644 index 354534d..0000000 --- a/filesystems.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ... }: - -{ - fileSystems."/home" = { - # Disable checking /home partition with fsck - # Arch has a newer version than Nix, so it errors - noCheck = true; - }; -} diff --git a/flake.nix b/flake.nix index fcbd3ba..7e3785c 100644 --- a/flake.nix +++ b/flake.nix @@ -4,7 +4,7 @@ inputs = { - nixpkgs.url = "nixpkgs/nixos-23.11" + nixpkgs.url = "nixpkgs/nixos-23.11"; }; diff --git a/hosts/nixos/configuration.nix b/hosts/nixos/configuration.nix new file mode 100644 index 0000000..76eb5d3 --- /dev/null +++ b/hosts/nixos/configuration.nix @@ -0,0 +1,236 @@ +# 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, ... }: + +{ + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + + # User configuration + ../../common/users/users.nix + ]; + + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + + + # Disable checking /home partition with fsck + # Arch has a newer version than Nix, so it throws an error, and fails to boot + fileSystems."/home" = { + noCheck = true; + }; + + + + # Bootloader Configuration + + boot.loader = { + efi.canTouchEfiVariables = true; + + systemd-boot = { + enable = true; + editor = false; + configurationLimit = 5; + extraInstallCommands = '' + ${pkgs.gnused}/bin/sed -i 's/^version Generation \([0-9]\+\).*$/version Generation \1/' /boot/loader/entries/nixos-generation-* + ${pkgs.gnused}/bin/sed -i 's/^default .*$/default 00-arch.conf/' /boot/loader/loader.conf + ''; + }; + }; + + boot.kernelParams = [ "quiet" "splash" ]; + + + + # Power Configuration + + services.tlp = { + enable = true; + }; + + + + # Locale Configuration + + i18n = { + defaultLocale = "en_US.UTF-8"; + + extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + }; + + + + # Sound Configuration + + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + + services.pipewire = { + enable = true; + + alsa = { + enable = true; + support32Bit = true; + }; + pulse.enable = true; + # jack.enable = true + + + wireplumber.enable = true; + }; + + + + # Package Configuration + + programs = { + zsh.enable = true; + vim.defaultEditor = true; + }; + + environment.systemPackages = (with pkgs; [ + vim + neovim + git + wget + kitty + ranger + lf + firefox + + greetd.tuigreet + ]); + + environment.shells = with pkgs; [ bash zsh ]; + + xdg.portal.wlr.enable = true; + nixpkgs.config.allowUnfree = true; + + + + # Networking Configuration + + networking = { + hostName = "nixos"; + + networkmanager = { + enable = true; + }; + + firewall = { + allowedTCPPortRanges = [ + # GSConnect + #{ from = 1714; to = 1764; } + ]; + allowedUDPPortRanges = [ + # GSConnect + #{ from = 1714; to = 1764; } + ]; + }; + }; + + services.avahi = { + enable = true; + nssmdns = true; + }; + + + + # Time Configuration + + time.timeZone = "America/Denver"; + + + + # CUPS (Printing) Configuration + + services.printing = { + enable = false; + }; + + + + # X11 Configuration + + + services.xserver = { + enable = false; + + layout = "us"; + libinput = { + touchpad = { + tapping = true; + }; + }; + + excludePackages = [ pkgs.xterm ]; + }; + + + + # Login Manager Configuration + + services.greetd = { + enable = true; + settings = { + default_session = { + command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd sway"; + user = "greeter"; + }; + }; + }; + + + + # Desktop Environment Configuration + + programs = { + sway = { + enable = true; + + extraPackages = with pkgs; [ + swaylock + swayidle + dmenu + wmenu + i3status + brightnessctl + wob + ]; + }; + }; + + + + # User Configuration + + user.cameron.enable = 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 = "23.05"; # Did you read the comment? + + # system.autoUpgrade.enable = true; + # system.autoUpgrade.allowReboot = false; +} diff --git a/hosts/nixos/hardware-configuration.nix b/hosts/nixos/hardware-configuration.nix new file mode 100644 index 0000000..34ebac8 --- /dev/null +++ b/hosts/nixos/hardware-configuration.nix @@ -0,0 +1,43 @@ +# 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" "thunderbolt" "nvme" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/87af672d-688b-4e97-a9a0-cd423d0aad05"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/B0E1-ACC0"; + fsType = "vfat"; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/6ba6bd64-e18c-4827-beef-6ce82d99177b"; + fsType = "ext4"; + }; + + 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.wlp170s0.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; +} diff --git a/locale.nix b/locale.nix deleted file mode 100644 index c13b44d..0000000 --- a/locale.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ ... }: - -{ - i18n = { - defaultLocale = "en_US.UTF-8"; - - extraLocaleSettings = { - LC_ADDRESS = "en_US.UTF-8"; - LC_IDENTIFICATION = "en_US.UTF-8"; - LC_MEASUREMENT = "en_US.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NAME = "en_US.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "en_US.UTF-8"; - LC_TELEPHONE = "en_US.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - }; -} diff --git a/login-manager.nix b/login-manager.nix deleted file mode 100644 index 7e02fc0..0000000 --- a/login-manager.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ pkgs, ... }: - -{ - services.greetd = { - enable = true; - settings = { - default_session = { - command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd sway"; - user = "greeter"; - }; - }; - }; -} diff --git a/networking.nix b/networking.nix deleted file mode 100644 index 51c1750..0000000 --- a/networking.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ ... }: - -{ - networking = { - hostName = "nixos"; - - networkmanager = { - enable = true; - }; - - firewall = { - allowedTCPPortRanges = [ - # GSConnect - { from = 1714; to = 1764; } - ]; - allowedUDPPortRanges = [ - # GSConnect - { from = 1714; to = 1764; } - ]; - }; - }; - - services.avahi = { - enable = true; - nssmdns = true; - }; -} diff --git a/packages.nix b/packages.nix deleted file mode 100644 index 482fb70..0000000 --- a/packages.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ pkgs, ... }: - -{ - programs = { - zsh.enable = true; - vim.defaultEditor = true; - }; - - environment.systemPackages = (with pkgs; [ - vim - neovim - git - wget - kitty - ranger - lf - firefox - - greetd.tuigreet - ]); - - environment.shells = with pkgs; [ bash zsh ]; - - xdg.portal.wlr.enable = true; - nixpkgs.config.allowUnfree = true; -} diff --git a/power.nix b/power.nix deleted file mode 100644 index 79e3b20..0000000 --- a/power.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: - -{ - services.tlp = { - enable = true; - }; -} diff --git a/printing.nix b/printing.nix deleted file mode 100644 index 97c105e..0000000 --- a/printing.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: - -{ - services.printing = { - enable = false; - }; -} diff --git a/sound.nix b/sound.nix deleted file mode 100644 index 2f976aa..0000000 --- a/sound.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ ... }: - -{ - sound.enable = true; - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - - services.pipewire = { - enable = true; - - alsa = { - enable = true; - support32Bit = true; - }; - - pulse.enable = true; - - # jack.enable = true - - - wireplumber.enable = true; - }; -} diff --git a/time.nix b/time.nix deleted file mode 100644 index df656db..0000000 --- a/time.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ ... }: - -{ - time.timeZone = "America/Denver"; -} diff --git a/users/cameron.nix b/users/cameron.nix deleted file mode 100644 index c07369e..0000000 --- a/users/cameron.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ pkgs, ... }: - -{ - users = { - groups.cameron.gid = 1000; - - users.cameron = { - description = "Cameron"; - isNormalUser = true; - - uid = 1000; - group = "cameron"; - extraGroups = [ "networkmanager" "wheel" ]; - - home = "/home/cameron-nix"; - createHome = true; - - shell = pkgs.zsh; - packages = (with pkgs; [ - direnv - nix-direnv - bibata-cursors - bibata-cursors-translucent - ]) ++ (with pkgs.gnomeExtensions; [ - gsconnect - dock-from-dash - ]); - }; - }; -} diff --git a/xserver.nix b/xserver.nix deleted file mode 100644 index 7cacdbe..0000000 --- a/xserver.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ pkgs, ... }: - -{ - services.xserver = { - # Disable X11. Don't need it with tuigreet and sway - enable = false; - - layout = "us"; - libinput = { - touchpad = { - tapping = true; - }; - }; - - # I don't need xterm - excludePackages = [ pkgs.xterm ]; - }; -}