diff --git a/flake.nix b/flake.nix index fa75a6a..a8bec3d 100644 --- a/flake.nix +++ b/flake.nix @@ -38,59 +38,42 @@ treefmt-nix, ... }: - let - pkgs = - extraOverlays: system: - import nixpkgs { - inherit system; - overlays = extraOverlays; - config = { - allowUnfree = true; - }; - }; - in { nixosConfigurations = { - fedfer-main-laptop-nixos = nixpkgs.lib.nixosSystem rec { + fedfer-main-laptop-nixos = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; - specialArgs = { - pkgs = ( - pkgs [ - nix-vscode-extensions.overlays.default - niri.overlays.niri - ] system - ); - }; modules = [ + { + nixpkgs.overlays = [ + nix-vscode-extensions.overlays.default + niri.overlays.niri + ]; + } ./hosts/main-laptop/configuration.nix home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.users.fedfer = import ./hosts/main-laptop/home.nix; home-manager.backupFileExtension = "backup"; - home-manager.extraSpecialArgs = { - inherit inputs; - }; } stylix.nixosModules.stylix niri.nixosModules.niri ]; }; - veneficium-main-homelab-nixos = nixpkgs.lib.nixosSystem rec { + veneficium-main-homelab-nixos = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; - specialArgs = { - pkgs = (pkgs [ ] system); - inherit self; - }; + modules = [ arion.nixosModules.arion ./hosts/main-homelab/configuration.nix ]; }; }; + formatter.x86_64-linux = - (treefmt-nix.lib.evalModule (pkgs [ ] "x86_64-linux") ./treefmt.nix).config.build.wrapper; + (treefmt-nix.lib.evalModule nixpkgs.legacyPackages."x86_64-linux" ./treefmt.nix) + .config.build.wrapper; }; } diff --git a/hosts/main-homelab/configuration.nix b/hosts/main-homelab/configuration.nix index bc3d1fa..7008700 100644 --- a/hosts/main-homelab/configuration.nix +++ b/hosts/main-homelab/configuration.nix @@ -1,5 +1,4 @@ { - self, pkgs, lib, ... @@ -76,15 +75,6 @@ programs.zsh.enable = true; - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - #enable flakes - nix.settings.experimental-features = [ - "nix-command" - "flakes" - ]; - #DO NOT CHANGE THIS! IMPORTANT! DO NOT CHANGE THIS! system.stateVersion = "24.05"; # DO NOT CHANGE THIS! diff --git a/hosts/main-laptop/configuration.nix b/hosts/main-laptop/configuration.nix index 956ebd3..cc57fc2 100644 --- a/hosts/main-laptop/configuration.nix +++ b/hosts/main-laptop/configuration.nix @@ -65,6 +65,8 @@ settings = { users.fedfer.enable = lib.mkForce true; + system.boot.windows.enable = lib.mkForce true; + programs.docker.enable = lib.mkForce true; programs.tailscale.enable = lib.mkForce true; programs.gnupg.enable = lib.mkForce true; @@ -95,19 +97,6 @@ #enable wayland for electron programs environment.sessionVariables.NIXOS_OZONE_WL = "1"; - boot.kernelPackages = pkgs.linuxPackages_latest; - boot.loader.systemd-boot.enable = true; - boot.loader.systemd-boot.edk2-uefi-shell.enable = true; - boot.loader.systemd-boot.windows = { - "11" = { - title = "Windows 11 (gaming)"; - efiDeviceHandle = "FS0"; - }; - }; - boot.loader.efi.canTouchEfiVariables = true; - - boot.loader.systemd-boot.configurationLimit = 10; - #todo look further into networking options #could be pretty interesting networking.hostName = "fedfer-main-laptop-nixos"; @@ -137,9 +126,6 @@ #todo modularize! programs.xwayland.enable = true; - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - environment.systemPackages = with pkgs; [ nano lshw @@ -148,12 +134,5 @@ gcc ]; - #enable flakes - nix.settings.experimental-features = [ - "nix-command" - "flakes" - ]; - system.stateVersion = "24.05"; # DO NOT CHANGE THIS! - } diff --git a/hosts/main-laptop/hardware-configuration.nix b/hosts/main-laptop/hardware-configuration.nix index 91541f5..be1ead2 100644 --- a/hosts/main-laptop/hardware-configuration.nix +++ b/hosts/main-laptop/hardware-configuration.nix @@ -1,6 +1,3 @@ -# 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, @@ -23,25 +20,18 @@ boot.extraModulePackages = [ ]; fileSystems."/" = { - device = "/dev/disk/by-label/nixos"; + label = "nixos"; fsType = "ext4"; }; fileSystems."/boot" = { - device = "/dev/disk/by-label/BOOT"; + label = "BOOT"; fsType = "vfat"; }; - swapDevices = [ { device = "/dev/disk/by-label/swap"; } ]; + swapDevices = [ { label = "swap"; } ]; - # 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.enp2s0.useDHCP = lib.mkDefault true; - # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 80567bf..3f13ac3 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -1,7 +1,9 @@ { lib, ... }: { imports = [ - ./locale.nix + ./system/boot.nix + ./system/nix.nix + ./system/locale.nix ./users/fedfer.nix ./users/veneficium.nix @@ -34,6 +36,8 @@ ]; settings = { + system.boot.windows.enable = lib.mkDefault false; + users.fedfer.enable = lib.mkDefault false; users.veneficium.enable = lib.mkDefault false; diff --git a/modules/nixos/system/boot.nix b/modules/nixos/system/boot.nix new file mode 100644 index 0000000..3ba5510 --- /dev/null +++ b/modules/nixos/system/boot.nix @@ -0,0 +1,31 @@ +{ + pkgs, + config, + lib, + ... +}: +{ + + options.settings.system.boot = { + windows.enable = lib.mkEnableOption "Enable windows dual boot"; + }; + + config = { + boot.kernelPackages = pkgs.linuxPackages_latest; + boot.loader = { + efi.canTouchEfiVariables = true; + + systemd-boot.enable = true; + systemd-boot.edk2-uefi-shell.enable = true; + systemd-boot.configurationLimit = 10; + systemd-boot.editor = false; + + systemd-boot.windows = lib.mkIf config.settings.system.boot.windows.enable { + "11" = { + title = "Windows"; + efiDeviceHandle = "FS0"; + }; + }; + }; + }; +} diff --git a/modules/nixos/locale.nix b/modules/nixos/system/locale.nix similarity index 100% rename from modules/nixos/locale.nix rename to modules/nixos/system/locale.nix diff --git a/modules/nixos/system/nix.nix b/modules/nixos/system/nix.nix new file mode 100644 index 0000000..ad7902c --- /dev/null +++ b/modules/nixos/system/nix.nix @@ -0,0 +1,9 @@ +{ ... }: +{ + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; + + nixpkgs.config.allowUnfree = true; +}