From aaab14ff8cd9d8264d2f629baa680ae283309991 Mon Sep 17 00:00:00 2001 From: Zynh Ludwig Date: Fri, 28 Jun 2024 07:11:38 -0700 Subject: [PATCH] the big move --- flake.nix | 66 ++---- .../nixos/configuration.nix | 2 +- home.nix => hosts/nixos/home.nix | 2 +- hosts/snowhawk/configuration.nix | 191 ++++++++++++++++++ hosts/snowhawk/home.nix | 58 ++++++ hosts/sprite/configuration.nix | 191 ++++++++++++++++++ hosts/sprite/home.nix | 58 ++++++ 7 files changed, 522 insertions(+), 46 deletions(-) rename configuration.nix => hosts/nixos/configuration.nix (99%) rename home.nix => hosts/nixos/home.nix (97%) create mode 100644 hosts/snowhawk/configuration.nix create mode 100644 hosts/snowhawk/home.nix create mode 100644 hosts/sprite/configuration.nix create mode 100644 hosts/sprite/home.nix diff --git a/flake.nix b/flake.nix index 3a19b1a..c4231b6 100644 --- a/flake.nix +++ b/flake.nix @@ -19,49 +19,27 @@ outputs = { self, nixpkgs, ... }@inputs: { - nixosConfigurations = map - ({ hostname, system }: { - inherit system; - specialArgs = { inherit inputs; }; - modules = [ - ./hosts/${hostname}/hardware-configuration.nix - ./configuration.nix - inputs.home-manager.nixosModules.default - ]; - }) - [ - { hostname = "snowhawk"; system = "x86_64-linux"; } - { hostname = "sprite"; system = "aarch64-linux"; } - { hostname = "nixos"; system = "x86_64-linux"; } - ]; - # { - # snowhawk = nixpkgs.lib.nixosSystem { - # specialArgs = { inherit inputs; }; - # system = "x86_64-linux"; - # modules = [ - # ./hosts/snowhawk/hardware-configuration.nix - # ./configuration.nix - # inputs.home-manager.nixosModules.default - # ]; - # }; - # sprite = nixpkgs.lib.nixosSystem { - # specialArgs = { inherit inputs; }; - # system = "aarch64-linux"; - # modules = [ - # ./hosts/sprite/hardware-configuration.nix - # ./configuration.nix - # inputs.home-manager.nixosModules.default - # ]; - # }; - # nixos = nixpkgs.lib.nixosSystem { - # specialArgs = { inherit inputs; }; - # system = "x86_64-linux"; - # modules = [ - # ./hosts/nixos/hardware-configuration.nix - # ./configuration.nix - # inputs.home-manager.nixosModules.default - # ]; - # }; - # }; + nixosConfigurations = + let + cleanHostname = config: builtins.removeAttrs config [ "hostname" ]; + toNixosConfigPart = config: { name = config.hostname; value = nixpkgs.lib.nixosSystem (cleanHostname config); }; + in + builtins.listToAttrs + (map toNixosConfigPart + (map + ({ hostname, system }: { + inherit system hostname; + specialArgs = { inherit inputs; }; + modules = [ + ./hosts/${hostname}/hardware-configuration.nix + ./hosts/${hostname}/configuration.nix + inputs.home-manager.nixosModules.default + ]; + }) + [ + { hostname = "snowhawk"; system = "x86_64-linux"; } + { hostname = "sprite"; system = "aarch64-linux"; } + { hostname = "nixos"; system = "x86_64-linux"; } + ])); }; } diff --git a/configuration.nix b/hosts/nixos/configuration.nix similarity index 99% rename from configuration.nix rename to hosts/nixos/configuration.nix index f58f3a4..8e698d6 100644 --- a/configuration.nix +++ b/hosts/nixos/configuration.nix @@ -7,7 +7,7 @@ { imports = [ inputs.home-manager.nixosModules.default - ./modules + ../../modules ]; # Bootloader. diff --git a/home.nix b/hosts/nixos/home.nix similarity index 97% rename from home.nix rename to hosts/nixos/home.nix index bb3adae..cf59074 100644 --- a/home.nix +++ b/hosts/nixos/home.nix @@ -2,7 +2,7 @@ { imports = [ - ./home/modules + ../../home/modules ]; snowhawk.neovim = { diff --git a/hosts/snowhawk/configuration.nix b/hosts/snowhawk/configuration.nix new file mode 100644 index 0000000..cbe092f --- /dev/null +++ b/hosts/snowhawk/configuration.nix @@ -0,0 +1,191 @@ +# 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’). + +{ pkgs, inputs, ... }: + +{ + imports = [ + inputs.home-manager.nixosModules.default + ../../modules + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + fonts.packages = with pkgs; [ + (nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) + ]; + + # Set your time zone. + time.timeZone = "America/Los_Angeles"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.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"; + }; + + # Enable the X11 windowing system. + services.xserver.enable = true; + + snowhawk.dwm.enable = true; + + # Enable the XFCE Desktop Environment. + # services.xserver.displayManager.lightdm.enable = true; + # services.xserver.desktopManager.budgie.enable = true; + + # Configure keymap in X11 + services.xserver = { + xkb = { + layout = "us"; + variant = ""; + }; + }; + + # Enable CUPS to print documents. + services.printing.enable = true; + + services.envfs.enable = true; + + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + + # use the example session manager (no others are packaged yet so this is enabled by default, + # no need to redefine it in your config for now) + #media-session.enable = true; + }; + + nix.settings = { + experimental-features = [ "nix-command" "flakes" ]; + auto-optimise-store = true; + }; + + programs.nix-ld.enable = true; + # programs.nix-ld.libraries = with pkgs; [ + # + # ]; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.ravenshade = { + isNormalUser = true; + description = "Zynh Ludwig"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ + fish + ripgrep + lazygit + unzip + fzf + tree + libsecret + + nix-output-monitor + + gparted + arandr + flameshot + + # steam + spotify + discord + steam-run + + xivlauncher + # (xivlauncher.override { + # useSteamRun = false; + # }) + + git-credential-oauth + + xclip + + rustup + gnumake + zig + gcc + go + python3 + nodejs_22 + # dotnet-sdk_8 + ]; + }; + + # Enable automatic login for the user. + services.displayManager.autoLogin = { + enable = true; + user = "ravenshade"; + }; + + home-manager = { + extraSpecialArgs = { inherit inputs; }; + users = { "ravenshade" = import ./home.nix; }; + # backupFileExtension = "backup"; + }; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # programs.hyprland.enable = true; + # environment.sessionVariables.NIXOS_OZONE_WL = "1"; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + neovim + curl + git + killall + ]; + + # 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; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # 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.11"; # Did you read the comment? +} diff --git a/hosts/snowhawk/home.nix b/hosts/snowhawk/home.nix new file mode 100644 index 0000000..228cd01 --- /dev/null +++ b/hosts/snowhawk/home.nix @@ -0,0 +1,58 @@ +{ config, pkgs, inputs, ... }: + +{ + imports = [ + ../../home/modules + ]; + + snowhawk.neovim = { + enable = true; + package = inputs.neovim-overlay.packages.${pkgs.system}.default; + }; + snowhawk.alacritty.enable = true; + snowhawk.cursor.enable = true; + snowhawk.projects.enable = true; + + xsession.numlock.enable = true; + + services.dunst.enable = true; + services.unclutter.enable = true; + + programs.chromium = { + enable = true; + package = pkgs.google-chrome; + }; + + home.packages = with pkgs; [ + # (pkgs.writeShellScriptBin "my-hello" '' + # echo "Hello, ${config.home.username}!" + # '') + + (writeShellScriptBin "rebuild" '' + sudo nixos-rebuild switch --log-format internal-json -v |& nom --json + '') + + feh + imagemagick + brave + ]; + + home.file = { }; + + home.sessionPath = [ + "${config.home.homeDirectory}/.cargo/bin" + ]; + + nixpkgs.config.allowUnfree = true; + + # wayland.windowManager.hyprland = { + # enable = true; + # package = pkgs.hyprland; + # xwayland.enable = true; + # systemd.enable = true; + # }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + home.stateVersion = "23.11"; +} diff --git a/hosts/sprite/configuration.nix b/hosts/sprite/configuration.nix new file mode 100644 index 0000000..cbe092f --- /dev/null +++ b/hosts/sprite/configuration.nix @@ -0,0 +1,191 @@ +# 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’). + +{ pkgs, inputs, ... }: + +{ + imports = [ + inputs.home-manager.nixosModules.default + ../../modules + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + fonts.packages = with pkgs; [ + (nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) + ]; + + # Set your time zone. + time.timeZone = "America/Los_Angeles"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.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"; + }; + + # Enable the X11 windowing system. + services.xserver.enable = true; + + snowhawk.dwm.enable = true; + + # Enable the XFCE Desktop Environment. + # services.xserver.displayManager.lightdm.enable = true; + # services.xserver.desktopManager.budgie.enable = true; + + # Configure keymap in X11 + services.xserver = { + xkb = { + layout = "us"; + variant = ""; + }; + }; + + # Enable CUPS to print documents. + services.printing.enable = true; + + services.envfs.enable = true; + + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + + # use the example session manager (no others are packaged yet so this is enabled by default, + # no need to redefine it in your config for now) + #media-session.enable = true; + }; + + nix.settings = { + experimental-features = [ "nix-command" "flakes" ]; + auto-optimise-store = true; + }; + + programs.nix-ld.enable = true; + # programs.nix-ld.libraries = with pkgs; [ + # + # ]; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.ravenshade = { + isNormalUser = true; + description = "Zynh Ludwig"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ + fish + ripgrep + lazygit + unzip + fzf + tree + libsecret + + nix-output-monitor + + gparted + arandr + flameshot + + # steam + spotify + discord + steam-run + + xivlauncher + # (xivlauncher.override { + # useSteamRun = false; + # }) + + git-credential-oauth + + xclip + + rustup + gnumake + zig + gcc + go + python3 + nodejs_22 + # dotnet-sdk_8 + ]; + }; + + # Enable automatic login for the user. + services.displayManager.autoLogin = { + enable = true; + user = "ravenshade"; + }; + + home-manager = { + extraSpecialArgs = { inherit inputs; }; + users = { "ravenshade" = import ./home.nix; }; + # backupFileExtension = "backup"; + }; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # programs.hyprland.enable = true; + # environment.sessionVariables.NIXOS_OZONE_WL = "1"; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + neovim + curl + git + killall + ]; + + # 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; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # 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.11"; # Did you read the comment? +} diff --git a/hosts/sprite/home.nix b/hosts/sprite/home.nix new file mode 100644 index 0000000..228cd01 --- /dev/null +++ b/hosts/sprite/home.nix @@ -0,0 +1,58 @@ +{ config, pkgs, inputs, ... }: + +{ + imports = [ + ../../home/modules + ]; + + snowhawk.neovim = { + enable = true; + package = inputs.neovim-overlay.packages.${pkgs.system}.default; + }; + snowhawk.alacritty.enable = true; + snowhawk.cursor.enable = true; + snowhawk.projects.enable = true; + + xsession.numlock.enable = true; + + services.dunst.enable = true; + services.unclutter.enable = true; + + programs.chromium = { + enable = true; + package = pkgs.google-chrome; + }; + + home.packages = with pkgs; [ + # (pkgs.writeShellScriptBin "my-hello" '' + # echo "Hello, ${config.home.username}!" + # '') + + (writeShellScriptBin "rebuild" '' + sudo nixos-rebuild switch --log-format internal-json -v |& nom --json + '') + + feh + imagemagick + brave + ]; + + home.file = { }; + + home.sessionPath = [ + "${config.home.homeDirectory}/.cargo/bin" + ]; + + nixpkgs.config.allowUnfree = true; + + # wayland.windowManager.hyprland = { + # enable = true; + # package = pkgs.hyprland; + # xwayland.enable = true; + # systemd.enable = true; + # }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + home.stateVersion = "23.11"; +}