diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..08bc2bb --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,45 @@ +{ + // Nix settings + "nix.formatterPath": [ + "nixpkgs-fmt", + "nixfmt", + "treefmt", + "--stdin", + "{file}", + "nix", + "fmt", + "--", + "-", + ], + "nix.enableLanguageServer": true, + "nix.serverPath": "nixd", + "nix.serverSettings": { + "nixd": { + "nixpkgs": { + "expr": "(builtins.getFlake \"${workspaceFolder}/flake.nix\").inputs.nixpkgs { }" + }, + "formatting": { + "command": [ + "nix fmt" + ] + }, + "options": { + "nixos": { + "expr": "(builtins.getFlake (builtins.toString ./.)).nixosConfigurations.nixos.options" + }, + "live": { + "expr": "(builtins.getFlake (builtins.toString ./.)).nixosConfigurations.live.options" + }, + "nixosvm": { + "expr": "(builtins.getFlake (builtins.toString ./.)).nixosConfigurations.nixosvm.options" + }, + // "home-manager": { + // "expr": "(builtins.getFlake \"/absolute/path/to/flake\").homeConfigurations..options" + // }, + } + } + }, + "nixEnvSelector.useFlakes": true, + "nixEnvSelector.suggestion": true, + "nixEnvSelector.nixFile": "${workspaceFolder}/flake.nix", +} \ No newline at end of file diff --git a/flake.nix b/flake.nix index 0ed2074..ae5f217 100644 --- a/flake.nix +++ b/flake.nix @@ -18,53 +18,69 @@ }; }; - outputs = { nixpkgs, home-manager, install-system, ... } @ inputs: let - system = "x86_64-linux"; - host = "vm"; - profile = "vm"; - username = "josh"; - in { - nixosConfigurations = { - nixos = nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = { - inherit inputs; - inherit host; - inherit profile; - inherit username; + outputs = + { + nixpkgs, + home-manager, + install-system, + ... + }@inputs: + let + system = "x86_64-linux"; + host = "vm"; + profile = "vm"; + username = "josh"; + in + { + nixosConfigurations = { + nixos = nixpkgs.lib.nixosSystem { + inherit system; + specialArgs = { + inherit inputs; + inherit host; + inherit profile; + inherit username; + }; + modules = [ + ./hosts/${host} + ]; }; - modules = [ - ./hosts/${host} + + live = nixpkgs.lib.nixosSystem { + inherit system; + specialArgs = { + inherit inputs; + inherit host; + inherit profile; + inherit username; + }; + modules = [ + (nixpkgs + "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix") + { environment.systemPackages = [ install-system.packages.${system}.default ]; } + ./hosts/${host} + ]; + }; + + nixosvm = nixpkgs.lib.nixosSystem { + inherit system; + specialArgs = { + inherit inputs; + inherit host; + inherit profile; + inherit username; + }; + modules = [ + ./hosts/${host} + ]; + }; + }; + + devShell.${system} = nixpkgs.legacyPackages.${system}.pkgs.mkShell { + packages = with nixpkgs.legacyPackages.${system}.pkgs; [ + nixd ]; }; - live = nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = { - inherit inputs; - inherit host; - inherit profile; - inherit username; - }; - modules = [ - (nixpkgs + "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix") - { environment.systemPackages = [ install-system.packages.${system}.default ]; } - ./hosts/${host} - ]; - }; - - nixosvm = nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = { - inherit inputs; - inherit host; - inherit profile; - inherit username; - }; - modules = [ - ./hosts/${host} - ]; - }; + formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-tree; }; - }; -} \ No newline at end of file +} diff --git a/hosts/vm/hardware.nix b/hosts/vm/hardware.nix index 077404a..0db3279 100644 --- a/hosts/vm/hardware.nix +++ b/hosts/vm/hardware.nix @@ -1,3 +1,3 @@ { - -} \ No newline at end of file + +} diff --git a/hosts/vm/host-packages.nix b/hosts/vm/host-packages.nix index 08293c5..f7bbbf8 100644 --- a/hosts/vm/host-packages.nix +++ b/hosts/vm/host-packages.nix @@ -4,6 +4,6 @@ }: { environment.systemPackages = with pkgs; [ - + ]; -} \ No newline at end of file +} diff --git a/modules/core/boot.nix b/modules/core/boot.nix index ceb614f..9740b3e 100644 --- a/modules/core/boot.nix +++ b/modules/core/boot.nix @@ -6,4 +6,4 @@ loader.systemd-boot.enable = true; loader.efi.canTouchEfiVariables = true; }; -} \ No newline at end of file +} diff --git a/modules/core/default.nix b/modules/core/default.nix index 06c2580..a0019b6 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -20,4 +20,4 @@ ./user.nix inputs.stylix.nixosModules.stylix ]; -} \ No newline at end of file +} diff --git a/modules/core/firefox.nix b/modules/core/firefox.nix index a2f8666..8d3ec00 100644 --- a/modules/core/firefox.nix +++ b/modules/core/firefox.nix @@ -14,8 +14,13 @@ in }; # Add wayland screensharing support if PipeWire is enabled - environment.systemPackages = with pkgs; [] - ++ (if pipewireCfg.enable - then [ (wrapFirefox (firefox-unwrapped.override { pipewireSupport = true; }) {}) ] - else [ firefox ]); -} \ No newline at end of file + environment.systemPackages = + with pkgs; + [ ] + ++ ( + if pipewireCfg.enable then + [ (wrapFirefox (firefox-unwrapped.override { pipewireSupport = true; }) { }) ] + else + [ firefox ] + ); +} diff --git a/modules/core/fonts.nix b/modules/core/fonts.nix index 457623a..1bd374e 100644 --- a/modules/core/fonts.nix +++ b/modules/core/fonts.nix @@ -6,13 +6,14 @@ { fonts = { fontconfig.enable = true; - packages = with pkgs; [ - font-awesome - montserrat - nerd-fonts.jetbrains-mono - noto-fonts-emoji - ] ++ (if config.modules.zsh.enable - then [ nerd-fonts.meslo-lg ] - else []); + packages = + with pkgs; + [ + font-awesome + montserrat + nerd-fonts.jetbrains-mono + noto-fonts-emoji + ] + ++ (if config.modules.zsh.enable then [ nerd-fonts.meslo-lg ] else [ ]); }; -} \ No newline at end of file +} diff --git a/modules/core/gdm.nix b/modules/core/gdm.nix index ff6bc8d..aa7928f 100644 --- a/modules/core/gdm.nix +++ b/modules/core/gdm.nix @@ -14,4 +14,4 @@ in wayland = true; }; }; -} \ No newline at end of file +} diff --git a/modules/core/hyprland.nix b/modules/core/hyprland.nix index 48b9f97..d86f903 100644 --- a/modules/core/hyprland.nix +++ b/modules/core/hyprland.nix @@ -14,4 +14,4 @@ in withUWSM = true; }; }; -} \ No newline at end of file +} diff --git a/modules/core/network.nix b/modules/core/network.nix index 7f21f12..aff9449 100644 --- a/modules/core/network.nix +++ b/modules/core/network.nix @@ -1,5 +1,4 @@ { - config, host, pkgs, ... @@ -12,4 +11,4 @@ }; environment.systemPackages = with pkgs; [ networkmanagerapplet ]; -} \ No newline at end of file +} diff --git a/modules/core/packages.nix b/modules/core/packages.nix index f45af72..d2f4272 100644 --- a/modules/core/packages.nix +++ b/modules/core/packages.nix @@ -1,5 +1,4 @@ { - config, pkgs, ... }: @@ -14,4 +13,4 @@ tmux vim ]; -} \ No newline at end of file +} diff --git a/modules/core/pipewire.nix b/modules/core/pipewire.nix index 686d99d..7e90ffe 100644 --- a/modules/core/pipewire.nix +++ b/modules/core/pipewire.nix @@ -22,4 +22,4 @@ in # Allows Pipewire to use the realtime scheduler for increased performance security.rtkit.enable = true; }; -} \ No newline at end of file +} diff --git a/modules/core/plasma.nix b/modules/core/plasma.nix index 33ae2aa..4c48499 100644 --- a/modules/core/plasma.nix +++ b/modules/core/plasma.nix @@ -11,4 +11,4 @@ in config = mkIf cfg.enable { services.desktopManager.plasma6.enable = true; }; -} \ No newline at end of file +} diff --git a/modules/core/services.nix b/modules/core/services.nix index 1897265..d1395a7 100644 --- a/modules/core/services.nix +++ b/modules/core/services.nix @@ -5,4 +5,4 @@ services = { }; -} \ No newline at end of file +} diff --git a/modules/core/stylix.nix b/modules/core/stylix.nix index 5633e2a..ee622af 100644 --- a/modules/core/stylix.nix +++ b/modules/core/stylix.nix @@ -6,12 +6,12 @@ stylix = { enable = true; base16Scheme = "${pkgs.base16-schemes}/share/themes/blueish.yaml"; - + polarity = "dark"; fonts = { emoji = { - package = pkgs.noto-fonts-emoji; + package = pkgs.noto-fonts-emoji; name = "Noto Color Emoji"; }; monospace = { @@ -34,4 +34,4 @@ }; }; }; -} \ No newline at end of file +} diff --git a/modules/core/system.nix b/modules/core/system.nix index 9e853bf..9320f61 100644 --- a/modules/core/system.nix +++ b/modules/core/system.nix @@ -1,11 +1,9 @@ { config, - lib, ... }: -with lib; let - cfg = config.system; + cfg = config.system; in { nix = { @@ -35,4 +33,4 @@ in }; system.stateVersion = "25.05"; -} \ No newline at end of file +} diff --git a/modules/core/user.nix b/modules/core/user.nix index cfc6573..77a0e3a 100644 --- a/modules/core/user.nix +++ b/modules/core/user.nix @@ -2,13 +2,11 @@ config, host, inputs, - lib, pkgs, profile, username, ... }: -with lib; let shellCfg = config.modules.shell; in @@ -18,7 +16,14 @@ in useUserPackages = true; useGlobalPkgs = false; backupFileExtension = "backup"; - extraSpecialArgs = { inherit host inputs profile username; }; + extraSpecialArgs = { + inherit + host + inputs + profile + username + ; + }; users.${username} = { imports = [ ./../home ]; home = { @@ -42,7 +47,7 @@ in }; # Set /etc/shells so GDM will show our user when ZSH is selected - environment.shells = with pkgs; [ pkgs.${shellCfg.defaultShell} ]; + environment.shells = [ pkgs.${shellCfg.defaultShell} ]; nix.settings.allowed-users = [ "${username}" ]; -} \ No newline at end of file +} diff --git a/modules/drivers/default.nix b/modules/drivers/default.nix index 99fa3da..c9d9057 100644 --- a/modules/drivers/default.nix +++ b/modules/drivers/default.nix @@ -5,4 +5,4 @@ imports = [ ./vm-guest-services.nix ]; -} \ No newline at end of file +} diff --git a/modules/drivers/vm-guest-services.nix b/modules/drivers/vm-guest-services.nix index 7525318..6284a13 100644 --- a/modules/drivers/vm-guest-services.nix +++ b/modules/drivers/vm-guest-services.nix @@ -1,7 +1,6 @@ { config, lib, - pkgs, ... }: with lib; @@ -18,4 +17,4 @@ in services.spice-vdagentd.enable = true; services.spice-webdavd.enable = true; }; -} \ No newline at end of file +} diff --git a/modules/home/default.nix b/modules/home/default.nix index 6e708c2..5a885fa 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -1,5 +1,4 @@ { - host, ... }: { @@ -9,4 +8,4 @@ ./xdg.nix ./zsh ]; -} \ No newline at end of file +} diff --git a/modules/home/hyprland/binds.nix b/modules/home/hyprland/binds.nix index b664ce3..e4a76b0 100644 --- a/modules/home/hyprland/binds.nix +++ b/modules/home/hyprland/binds.nix @@ -1,9 +1,7 @@ { - lib, osConfig, ... }: -with lib; let cfg = osConfig.modules.hyprland; in @@ -12,7 +10,7 @@ in bind = [ # Misc "$modifier,Return,exec,${cfg.terminal}" - + # Window management "$modifier,C,killactive" "$modifier,F,fullscreen, 1" @@ -56,4 +54,4 @@ in "$modifier,mouse:273,resizewindow" ]; }; -} \ No newline at end of file +} diff --git a/modules/home/hyprland/default.nix b/modules/home/hyprland/default.nix index d1048a3..7f3d0a1 100644 --- a/modules/home/hyprland/default.nix +++ b/modules/home/hyprland/default.nix @@ -6,4 +6,4 @@ ./binds.nix ./hyprland.nix ]; -} \ No newline at end of file +} diff --git a/modules/home/hyprland/hyprland.nix b/modules/home/hyprland/hyprland.nix index 925c444..3a86e1c 100644 --- a/modules/home/hyprland/hyprland.nix +++ b/modules/home/hyprland/hyprland.nix @@ -1,5 +1,4 @@ { - host, lib, osConfig, pkgs, @@ -62,4 +61,4 @@ in }; }; }; -} \ No newline at end of file +} diff --git a/modules/home/kitty.nix b/modules/home/kitty.nix index dbb9688..6b26923 100644 --- a/modules/home/kitty.nix +++ b/modules/home/kitty.nix @@ -1,5 +1,4 @@ { - config, lib, osConfig, pkgs, @@ -29,4 +28,4 @@ in ''; }; }; -} \ No newline at end of file +} diff --git a/modules/home/xdg.nix b/modules/home/xdg.nix index f3e6aba..d2dbdc1 100644 --- a/modules/home/xdg.nix +++ b/modules/home/xdg.nix @@ -1,10 +1,8 @@ { - lib, osConfig, pkgs, ... }: -with lib; let hyprlandCfg = osConfig.modules.hyprland; pipewireCfg = osConfig.modules.pipewire; @@ -17,27 +15,31 @@ in mimeApps.enable = true; portal = { enable = true; - extraPortals = [] - ++ (if hyprlandCfg.enable - then [ pkgs.xdg-desktop-portal-hyprland ] - else []) - ++ (if pipewireCfg.enable - then [ - pkgs.xdg-desktop-portal-wlr - pkgs.xdg-desktop-portal-gtk - ] - else []) - ++ (if plasmaCfg.enable - then [ pkgs.kdePackages.xdg-desktop-portal-kde ] - else []); - configPackages = [] - ++ (if hyprlandCfg.enable - then [ pkgs.hyprland ] - else []) - ++ (if plasmaCfg.enable - # TODO: use the correct packages or config - then [ pkgs.kdePackages.kde-gtk-config ] - else []); + extraPortals = + [ ] + ++ (if hyprlandCfg.enable then [ pkgs.xdg-desktop-portal-hyprland ] else [ ]) + ++ ( + if pipewireCfg.enable then + [ + pkgs.xdg-desktop-portal-wlr + pkgs.xdg-desktop-portal-gtk + ] + else + [ ] + ) + ++ (if plasmaCfg.enable then [ pkgs.kdePackages.xdg-desktop-portal-kde ] else [ ]); + configPackages = + [ ] + ++ (if hyprlandCfg.enable then [ pkgs.hyprland ] else [ ]) + ++ ( + if + plasmaCfg.enable + # TODO: use the correct packages or config + then + [ pkgs.kdePackages.kde-gtk-config ] + else + [ ] + ); }; }; -} \ No newline at end of file +} diff --git a/modules/home/zsh/default.nix b/modules/home/zsh/default.nix index 2e08c31..0cf4c7e 100644 --- a/modules/home/zsh/default.nix +++ b/modules/home/zsh/default.nix @@ -1,12 +1,9 @@ { config, - lib, osConfig, pkgs, - profile, ... }: -with lib; let cfg = osConfig.modules.zsh; xdgCfg = config.xdg; @@ -69,4 +66,4 @@ in } ]; }; -} \ No newline at end of file +} diff --git a/modules/home/zsh/p10k.nix b/modules/home/zsh/p10k.nix index 063edd4..e06c453 100644 --- a/modules/home/zsh/p10k.nix +++ b/modules/home/zsh/p10k.nix @@ -2,7 +2,6 @@ config, lib, osConfig, - pkgs, ... }: with lib; @@ -16,4 +15,4 @@ in source = ./p10k.zsh; }; }; -} \ No newline at end of file +} diff --git a/modules/options/default.nix b/modules/options/default.nix index e97fac1..6bce156 100644 --- a/modules/options/default.nix +++ b/modules/options/default.nix @@ -11,4 +11,4 @@ ./system.nix ./zsh.nix ]; -} \ No newline at end of file +} diff --git a/modules/options/displayManager.nix b/modules/options/displayManager.nix index 85e87f8..32f689f 100644 --- a/modules/options/displayManager.nix +++ b/modules/options/displayManager.nix @@ -1,12 +1,8 @@ { - config, lib, ... }: with lib; -let - cfg = config.modules.displayManager; -in { options.modules.displayManager = { displayManager = mkOption { @@ -20,4 +16,4 @@ in ''; }; }; -} \ No newline at end of file +} diff --git a/modules/options/hyprland.nix b/modules/options/hyprland.nix index 1f8f9b1..0f637e1 100644 --- a/modules/options/hyprland.nix +++ b/modules/options/hyprland.nix @@ -1,16 +1,12 @@ { - config, lib, ... }: with lib; -let - cfg = config.modules.hyprland; -in { options.modules.hyprland = { enable = mkEnableOption { - default = false; + default = false; description = "Enable Hyprland"; }; terminal = mkOption { @@ -26,9 +22,9 @@ in monitor = mkOption { type = types.listOf types.str; default = [ ",preferred,auto,1" ]; - description = '' + description = '' Monitors to use for Hyprland. ''; }; }; -} \ No newline at end of file +} diff --git a/modules/options/pipewire.nix b/modules/options/pipewire.nix index 7d7bfe1..cc90e9b 100644 --- a/modules/options/pipewire.nix +++ b/modules/options/pipewire.nix @@ -1,12 +1,8 @@ { - config, lib, ... }: with lib; -let - cfg = config.modules.pipewire; -in { options.modules.pipewire = { enable = mkEnableOption { @@ -14,4 +10,4 @@ in description = "Enable PipeWire"; }; }; -} \ No newline at end of file +} diff --git a/modules/options/plasma.nix b/modules/options/plasma.nix index 3235593..cbf6176 100644 --- a/modules/options/plasma.nix +++ b/modules/options/plasma.nix @@ -1,12 +1,8 @@ { - config, lib, ... }: with lib; -let - cfg = config.modules.plasma; -in { options.modules.plasma = { enable = mkEnableOption { @@ -14,4 +10,4 @@ in description = "Enable Plasma"; }; }; -} \ No newline at end of file +} diff --git a/modules/options/shell.nix b/modules/options/shell.nix index ebb199f..bc58366 100644 --- a/modules/options/shell.nix +++ b/modules/options/shell.nix @@ -22,11 +22,17 @@ in }; }; - config.assertions = [] - ++ (if cfg.defaultShell == "zsh" - then [{ + config.assertions = + [ ] + ++ ( + if cfg.defaultShell == "zsh" then + [ + { assertion = zshCfg.enable; message = "You have selected zsh as the default shell, but you haven't enabled it in your configuration.\n\nPlease enable it by adding `modules.zsh.enable = true`."; - }] - else []); -} \ No newline at end of file + } + ] + else + [ ] + ); +} diff --git a/modules/options/system.nix b/modules/options/system.nix index fe5ad96..ca915e0 100644 --- a/modules/options/system.nix +++ b/modules/options/system.nix @@ -1,20 +1,16 @@ { - config, lib, ... }: with lib; -let - cfg = config.system; -in { options.system = { locale = mkOption { - type = types.str; + type = types.str; default = "en_US.UTF-8"; }; - keyMap = mkOption { + keyMap = mkOption { type = types.str; default = "us"; }; @@ -24,4 +20,4 @@ in default = "US/Eastern"; }; }; -} \ No newline at end of file +} diff --git a/modules/options/zsh.nix b/modules/options/zsh.nix index 58e926b..26a6a1d 100644 --- a/modules/options/zsh.nix +++ b/modules/options/zsh.nix @@ -1,12 +1,8 @@ { - config, lib, ... }: with lib; -let - cfg = config.modules.zsh; -in { options.modules.zsh = { enable = mkEnableOption { @@ -14,4 +10,4 @@ in default = true; }; }; -} \ No newline at end of file +} diff --git a/profiles/vm/default.nix b/profiles/vm/default.nix index 197a4ab..cb7583f 100644 --- a/profiles/vm/default.nix +++ b/profiles/vm/default.nix @@ -19,4 +19,4 @@ # drivers.nvidia-prime.enable = false; # drivers.intel.enable = false; vm.guest-services.enable = true; -} \ No newline at end of file +} diff --git a/scripts/_template/flake.nix b/scripts/_template/flake.nix index b125a85..106c0ef 100644 --- a/scripts/_template/flake.nix +++ b/scripts/_template/flake.nix @@ -2,29 +2,32 @@ description = "_template package and shell environment"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05"; }; - outputs = { self, nixpkgs, ... }: let - system = "x86_64-linux"; - pkgs = nixpkgs.legacyPackages.${system}.pkgs; - name = builtins.baseNameOf (builtins.toString ./.); - shellApplication = pkgs.writeShellApplication { - inherit name; + outputs = + { nixpkgs, ... }: + let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}.pkgs; + name = builtins.baseNameOf (builtins.toString ./.); + shellApplication = pkgs.writeShellApplication { + inherit name; - text = builtins.readFile ./${name}.sh; + text = builtins.readFile ./${name}.sh; - runtimeInputs = with pkgs; [ - coreutils - gnused - unixtools.column - ]; + runtimeInputs = with pkgs; [ + coreutils + gnused + unixtools.column + ]; + }; + in + { + packages.${system}.default = shellApplication; + + devShells.${system}.default = pkgs.mkShell { + packages = [ shellApplication ]; + }; }; - in { - packages.${system}.default = shellApplication; - - devShells.${system}.default = pkgs.mkShell { - packages = [ shellApplication ]; - }; - }; -} \ No newline at end of file +} diff --git a/scripts/install-system/flake.nix b/scripts/install-system/flake.nix index be569bd..e3d7132 100644 --- a/scripts/install-system/flake.nix +++ b/scripts/install-system/flake.nix @@ -2,28 +2,31 @@ description = "install-system package and shell environment"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05"; }; - outputs = { self, nixpkgs, ... }: let - pkgs = nixpkgs.legacyPackages.x86_64-linux.pkgs; - name = builtins.baseNameOf (builtins.toString ./.); - shellApplication = pkgs.writeShellApplication { - inherit name; + outputs = + { nixpkgs, ... }: + let + pkgs = nixpkgs.legacyPackages.x86_64-linux.pkgs; + name = builtins.baseNameOf (builtins.toString ./.); + shellApplication = pkgs.writeShellApplication { + inherit name; - text = builtins.readFile ./${name}.sh; + text = builtins.readFile ./${name}.sh; - runtimeInputs = with pkgs; [ - coreutils - gnused - unixtools.column - ]; + runtimeInputs = with pkgs; [ + coreutils + gnused + unixtools.column + ]; + }; + in + { + packages.x86_64-linux.default = shellApplication; + + devShells.x86_64-linux.default = pkgs.mkShell { + packages = [ shellApplication ]; + }; }; - in { - packages.x86_64-linux.default = shellApplication; - - devShells.x86_64-linux.default = pkgs.mkShell { - packages = [ shellApplication ]; - }; - }; -} \ No newline at end of file +}