diff --git a/.gitignore b/.gitignore index 4bd922a..e4a6c4c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ secrets/ +flake.lock diff --git a/flake.nix b/flake.nix index bbfff52..70656c5 100644 --- a/flake.nix +++ b/flake.nix @@ -3,25 +3,51 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + + nix-colors.url = "github:misterio77/nix-colors"; + hyprland.url = "github:hyprwm/Hyprland"; }; outputs = { self, nixpkgs, home-manager, ... }@inputs: { - nixosConfigurations.alison = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { inherit inputs; }; - modules = [ - ./hosts/alison/configuration.nix - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.bckelley = import ./users/bckelley/home.nix; - } - ]; + nixosConfigurations = { + alison = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + ./hosts/alison/configuration.nix + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { inherit inputs; }; + home-manager.users.bckelley = { + imports = [ + ./users/bckelley/home.nix + ./users/bckelley/server-features.nix + ]; + }; + } + ]; + }; + + spencer = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + ./hosts/spencer/configuration.nix + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { inherit inputs; }; + home-manager.users.bckelley = import ./users/bckelley/home.nix; + } + ]; + }; }; }; } diff --git a/hosts/spencer/configuration.nix b/hosts/spencer/configuration.nix new file mode 100644 index 0000000..444f3cb --- /dev/null +++ b/hosts/spencer/configuration.nix @@ -0,0 +1,48 @@ +{ config, pkgs, inputs, ... }: + +{ + imports = + [ + ./hardware-configuration.nix + ../../modules/networking.nix + ../../modules/services.nix + ]; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "spencer"; + time.timeZone = "America/Chicago"; + + users = { + groups.bckelley = { + gid = 1000; + }; + + users.bckelley = { + isNormalUser = true; + uid = 1000; + group = "bckelley"; + extraGroups = [ "wheel" "networkmanager" ]; + }; + }; + + programs.hyprland = { + enable = true; + package = inputs.hyprland.packages.${pkgs.system}.hyprland; + }; + + environment.systemPackages = with pkgs; [ + btop + openssl + git + ]; + + 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. + system.stateVersion = "25.05"; +} diff --git a/hosts/spencer/hardware-configuration.nix b/hosts/spencer/hardware-configuration.nix new file mode 100644 index 0000000..9f1b253 --- /dev/null +++ b/hosts/spencer/hardware-configuration.nix @@ -0,0 +1,39 @@ +# 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" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/eafc409e-2d8b-4c7e-84ea-1090d62f015b"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/154B-2D54"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + 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.enp0s31f6.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/users/bckelley/home.nix b/users/bckelley/home.nix index 549f1f0..18270fd 100644 --- a/users/bckelley/home.nix +++ b/users/bckelley/home.nix @@ -1,4 +1,12 @@ -{ pkgs, ... }: { +{ pkgs, inputs, ... }: { + + imports = [ + inputs.nix-colors.homeManagerModules.default + ./programs/mako.nix + ]; + + colorScheme = inputs.nix-colors.colorSchemes.catppuccin-frappe; + home.username = "bckelley"; home.homeDirectory = "/home/bckelley"; home.stateVersion = "25.05"; @@ -10,8 +18,8 @@ programs.bash = { enable = true; shellAliases = { - rebuild = "sudo nixos-rebuild switch --flake /home/bckelley/.dotfiles#alison"; - conf = "micro /home/bckelley/.dotfiles/hosts/alison/configuration.nix"; + rebuild = "sudo nixos-rebuild switch --flake /home/bckelley/.dotfiles#$(hostname)"; + conf = "micro /home/bckelley/.dotfiles/hosts/$(hostname)/configuration.nix"; creload = "docker compose --env-file ~/HomeServer/.env -f ~/HomeServer/pihole/compose.yml exec -w /etc/caddy caddy caddy reload"; }; initExtra = '' @@ -20,18 +28,4 @@ ''; }; - systemd.user.services.ytdl-automation = { - Unit.Description = "Hourly yt-dlp list check and download"; - Service = { - Type = "oneshot"; - ExecStart = "${pkgs.nix}/bin/nix-shell /home/bckelley/HomeServer/yt-dlp/shell.nix --run 'python /home/bckelley/HomeServer/yt-dlp/main.py /home/bckelley/HomeServer/yt-dlp/list.txt 2'"; - WorkingDirectory = "/home/bckelley/HomeServer/yt-dlp"; - }; - }; - - systemd.user.timers.ytdl-automation = { - Unit.Description = "Run ytdl-automation every hour"; - Timer = { OnCalendar = "hourly"; Persistent = true; }; - Install.WantedBy = [ "timers.target" ]; - }; } diff --git a/users/bckelley/programs/mako.nix b/users/bckelley/programs/mako.nix new file mode 100644 index 0000000..570367d --- /dev/null +++ b/users/bckelley/programs/mako.nix @@ -0,0 +1,15 @@ +{ pkgs, config, ... }: + +{ + services.mako = { + enable = true; + settings = { + background-color = "#${config.colorScheme.palette.base01}"; + border-color = "#${config.colorScheme.palette.base0E}"; + border-radius = 5; + border-size = 2; + text-color = "#${config.colorScheme.palette.base04}"; + layer = "overlay"; + }; + }; +} diff --git a/users/bckelley/server-features.nix b/users/bckelley/server-features.nix new file mode 100644 index 0000000..ffb88ac --- /dev/null +++ b/users/bckelley/server-features.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: { + programs.bash.shellAliases = { + creload = "docker compose --env-file ~/HomeServer/.env -f ~/HomeServer/pihole/compose.yml exec -w /etc/caddy caddy caddy reload"; + }; + + systemd.user.services.ytdl-automation = { + Unit.Description = "Hourly yt-dlp list check and download"; + Service = { + Type = "oneshot"; + ExecStart = "${pkgs.nix}/bin/nix-shell /home/bckelley/HomeServer/yt-dlp/shell.nix --run 'python /home/bckelley/HomeServer/yt-dlp/main.py /home/bckelley/HomeServer/yt-dlp/list.txt 2'"; + WorkingDirectory = "/home/bckelley/HomeServer/yt-dlp"; + }; + }; + + systemd.user.timers.ytdl-automation = { + Unit.Description = "Run ytdl-automation every hour"; + Timer = { OnCalendar = "hourly"; Persistent = true; }; + Install.WantedBy = [ "timers.target" ]; + }; +}