From 6b4f5d8e579d4e836f24276372ffdc3fbe72de4e Mon Sep 17 00:00:00 2001 From: Maddie H Date: Mon, 7 Oct 2024 14:49:14 +0100 Subject: [PATCH] feat: use modules instead of including all files in flake.nix --- flake.nix | 139 ++++++------------------------------ homes/common/default.nix | 25 +++++++ homes/desktop/default.nix | 35 +++++++++ homes/laptop/default.nix | 7 ++ systems/desktop/default.nix | 35 +++++++++ systems/laptop/default.nix | 11 +++ 6 files changed, 133 insertions(+), 119 deletions(-) create mode 100644 homes/common/default.nix create mode 100644 homes/desktop/default.nix create mode 100644 homes/laptop/default.nix create mode 100644 systems/desktop/default.nix create mode 100644 systems/laptop/default.nix diff --git a/flake.nix b/flake.nix index e2decc3..bdaa470 100644 --- a/flake.nix +++ b/flake.nix @@ -43,104 +43,30 @@ { nixosConfigurations."desktop" = nixpkgs.lib.nixosSystem { - specialArgs = { inherit username; inherit inputs; }; + specialArgs = { + inherit username; + inherit inputs; + }; pkgs = nixpkgs_x86_64_linux; system = "x86_64-linux"; modules = [ + # Home Manager Modules home-manager.nixosModules.home-manager { + home-manager.extraSpecialArgs = { + inherit username; + inherit inputs; + pkgs = nixpkgs_x86_64_linux; + }; home-manager.users.${username}.imports = [ - ./homes/common/java.nix - ./homes/common/ssh - ./homes/common/amfora.nix - ./homes/common/btop.nix - ./homes/common/eza.nix - ./homes/common/fetch.nix - ./homes/common/git.nix - ./homes/common/helix.nix - ./homes/common/htop.nix - ./homes/common/kakoune - ./homes/common/latex.nix - ./homes/common/lf - ./homes/common/media-tools.nix - ./homes/common/python.nix - ./homes/common/rust.nix - ./homes/common/shell.nix - ./homes/common/starship.nix - ./homes/common/tmux.nix - ./homes/common/wezterm.nix - ./homes/common/xdg.nix - ./homes/common/zsh.nix - ./homes/common/radicle.nix - - ./homes/desktop/alacritty.nix - ./homes/desktop/anyrun.nix - ./homes/desktop/audio.nix - ./homes/desktop/chromium.nix - ./homes/desktop/cider.nix - ./homes/desktop/cursor.nix - ./homes/desktop/discord.nix - ./homes/desktop/element.nix - ./homes/desktop/games.nix - ./homes/desktop/gtk.nix - ./homes/desktop/home.nix - ./homes/desktop/hyprland.nix - ./homes/desktop/hyprlock.nix - ./homes/desktop/hyprpaper.nix - ./homes/desktop/kdeconnect.nix - ./homes/desktop/kitty.nix - ./homes/desktop/librewolf.nix - ./homes/desktop/minecraft.nix - ./homes/desktop/mpv.nix - ./homes/desktop/ncdu.nix - ./homes/desktop/steam.nix - ./homes/desktop/syncplay.nix - ./homes/desktop/terminals.nix - ./homes/desktop/tor-browser.nix - ./homes/desktop/uxplay.nix - ./homes/desktop/waybar.nix - ./homes/desktop/wine.nix - ./homes/desktop/wlogout.nix - ./homes/desktop/xdg.nix - ./homes/desktop/xorg.nix - ./homes/desktop/zathura.nix - + ./homes/common + ./homes/desktop inputs.anyrun.homeManagerModules.default ]; - home-manager.extraSpecialArgs = { inherit username; inherit inputs; pkgs = nixpkgs_x86_64_linux; }; } - ./systems/desktop/audio.nix - ./systems/desktop/avahi.nix - ./systems/desktop/bluetooth.nix - ./systems/desktop/boot.nix - ./systems/desktop/clicks-tailscale.nix - ./systems/desktop/cpu.nix - ./systems/desktop/doas.nix - ./systems/desktop/firewall.nix - ./systems/desktop/fonts.nix - ./systems/desktop/gpg.nix - ./systems/desktop/hardware.nix - ./systems/desktop/hyprland.nix - ./systems/desktop/hyprlock.nix - ./systems/desktop/locale.nix - ./systems/desktop/ly.nix - ./systems/desktop/man.nix - ./systems/desktop/networking.nix - ./systems/desktop/nix-ld.nix - ./systems/desktop/nix.nix - ./systems/desktop/nixos.nix - ./systems/desktop/nvidia.nix - ./systems/desktop/packages.nix - ./systems/desktop/security.nix - ./systems/desktop/ssh.nix - ./systems/desktop/systemd.nix - ./systems/desktop/tailscale.nix - ./systems/desktop/users.nix - ./systems/desktop/xdg.nix - ./systems/desktop/xorg.nix - ./systems/desktop/yubikey.nix - ./systems/desktop/zsh.nix + # NixOS Modules + ./systems/desktop ]; }; @@ -160,42 +86,17 @@ pkgs = nixpkgs_aarch64_darwin; }; home-manager.users.${username}.imports = [ - ./homes/laptop/home.nix - ./homes/laptop/ssh.nix - ./homes/laptop/shell.nix - ./homes/common/ssh - ./homes/common/amfora.nix - ./homes/common/btop.nix - ./homes/common/eza.nix - ./homes/common/fetch.nix - ./homes/common/git.nix - ./homes/common/helix.nix - ./homes/common/htop.nix - ./homes/common/kakoune - ./homes/common/latex.nix - ./homes/common/lf - ./homes/common/media-tools.nix - ./homes/common/python.nix - ./homes/common/rust.nix - ./homes/common/shell.nix - ./homes/common/starship.nix - ./homes/common/tmux.nix - ./homes/common/wezterm.nix - ./homes/common/xdg.nix - ./homes/common/zsh.nix - ./homes/common/radicle.nix + ./homes/laptop + ./homes/common ]; } + # Nix Darwin Modules - ./systems/laptop/fonts.nix - ./systems/laptop/gpg.nix - ./systems/laptop/nix.nix - ./systems/laptop/packages.nix - ./systems/laptop/ssh.nix - ./systems/laptop/sudo.nix - ./systems/laptop/zsh.nix + ./systems/laptop ]; }; + formatter.aarch64-darwin = nixpkgs_aarch64_darwin.legacyPackages.aarch64-darwin.nixpkgs-fmt; + formatter.x86_64-linux = nixpkgs_x86_64_linux.legacyPackages.x86_64-linux.nixpkgs-fmt; }; } diff --git a/homes/common/default.nix b/homes/common/default.nix new file mode 100644 index 0000000..f83956b --- /dev/null +++ b/homes/common/default.nix @@ -0,0 +1,25 @@ +{ + imports = [ + ./ssh + ./amfora.nix + ./btop.nix + ./eza.nix + ./fetch.nix + ./git.nix + ./helix.nix + ./htop.nix + ./kakoune + ./latex.nix + ./lf + ./media-tools.nix + ./python.nix + ./rust.nix + ./shell.nix + ./starship.nix + ./tmux.nix + ./wezterm.nix + ./xdg.nix + ./zsh.nix + ./radicle.nix + ]; +} diff --git a/homes/desktop/default.nix b/homes/desktop/default.nix new file mode 100644 index 0000000..2159e2e --- /dev/null +++ b/homes/desktop/default.nix @@ -0,0 +1,35 @@ +{ + import = [ + ./alacritty.nix + ./anyrun.nix + ./audio.nix + ./chromium.nix + ./cider.nix + ./cursor.nix + ./discord.nix + ./element.nix + ./games.nix + ./gtk.nix + ./home.nix + ./hyprland.nix + ./hyprlock.nix + ./hyprpaper.nix + ./kdeconnect.nix + ./kitty.nix + ./librewolf.nix + ./minecraft.nix + ./mpv.nix + ./ncdu.nix + ./steam.nix + ./syncplay.nix + ./terminals.nix + ./tor-browser.nix + ./uxplay.nix + ./waybar.nix + ./wine.nix + ./wlogout.nix + ./xdg.nix + ./xorg.nix + ./zathura.nix + ]; +} diff --git a/homes/laptop/default.nix b/homes/laptop/default.nix new file mode 100644 index 0000000..af5d4a1 --- /dev/null +++ b/homes/laptop/default.nix @@ -0,0 +1,7 @@ +{ + imports = [ + ./home.nix + ./shell.nix + ./ssh.nix + ]; +} diff --git a/systems/desktop/default.nix b/systems/desktop/default.nix new file mode 100644 index 0000000..1fa9c17 --- /dev/null +++ b/systems/desktop/default.nix @@ -0,0 +1,35 @@ +{ + imports = [ + ./audio.nix + ./avahi.nix + ./bluetooth.nix + ./boot.nix + ./clicks-tailscale.nix + ./cpu.nix + ./doas.nix + ./firewall.nix + ./fonts.nix + ./gpg.nix + ./hardware.nix + ./hyprland.nix + ./hyprlock.nix + ./locale.nix + ./ly.nix + ./man.nix + ./networking.nix + ./nix-ld.nix + ./nix.nix + ./nixos.nix + ./nvidia.nix + ./packages.nix + ./security.nix + ./ssh.nix + ./systemd.nix + ./tailscale.nix + ./users.nix + ./xdg.nix + ./xorg.nix + ./yubikey.nix + ./zsh.nix + ]; +} diff --git a/systems/laptop/default.nix b/systems/laptop/default.nix new file mode 100644 index 0000000..0d682e4 --- /dev/null +++ b/systems/laptop/default.nix @@ -0,0 +1,11 @@ +{ + imports = [ + ./gpg.nix + ./nix.nix + ./ssh.nix + ./zsh.nix + ./sudo.nix + ./fonts.nix + ./packages.nix + ]; +}