From cacd136ca9f652bed49237849d110df6f33e5092 Mon Sep 17 00:00:00 2001 From: smayzy Date: Fri, 8 Aug 2025 22:00:52 +0200 Subject: [PATCH] add server1 and change flatpak to make it works if not defined --- flake.nix | 9 ++++ hosts/server1/configuration.nix | 28 ++++++++++ hosts/server1/hardware-configuration.nix | 61 +++++++++++++++++++++ hosts/server1/home.nix | 7 +++ modules/nix/flatpak/flatpak.nix | 67 +++++++++++++----------- modules/nix/groups/default.nix | 1 + modules/nix/groups/server.nix | 19 +++++++ 7 files changed, 161 insertions(+), 31 deletions(-) create mode 100644 hosts/server1/configuration.nix create mode 100644 hosts/server1/hardware-configuration.nix create mode 100644 hosts/server1/home.nix create mode 100644 modules/nix/groups/server.nix diff --git a/flake.nix b/flake.nix index 3a97ae5..5c2192d 100644 --- a/flake.nix +++ b/flake.nix @@ -42,6 +42,15 @@ nvf.nixosModules.default ]; }; + server1 = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs system overlays; }; + modules = [ + ./hosts/server1/configuration.nix + nix-flatpak.nixosModules.nix-flatpak + inputs.stylix.nixosModules.stylix + nvf.nixosModules.default + ]; + }; laptop1 = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs system overlays; }; modules = [ diff --git a/hosts/server1/configuration.nix b/hosts/server1/configuration.nix new file mode 100644 index 0000000..a4da28b --- /dev/null +++ b/hosts/server1/configuration.nix @@ -0,0 +1,28 @@ +{ inputs, config, ... }: + +{ + imports = [ + ../common/common.nix + ./hardware-configuration.nix + ]; + + networking.hostName = "server1"; + + smayzy = { + server.enable = true; + }; + + home-manager = { + extraSpecialArgs = { + inherit inputs; + smayzy = config.smayzy; + }; + users = { + smayzy = import ./home.nix; + }; + backupFileExtension = "backup"; + }; + + system.stateVersion = "24.11"; + +} diff --git a/hosts/server1/hardware-configuration.nix b/hosts/server1/hardware-configuration.nix new file mode 100644 index 0000000..00b3dfe --- /dev/null +++ b/hosts/server1/hardware-configuration.nix @@ -0,0 +1,61 @@ +# 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" + "usb_storage" + "usbhid" + "sd_mod" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/05e716ac-e6a2-407d-9941-5ad95db74698"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/A238-B4BF"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" + ]; + }; + + fileSystems."/home" = { + device = "/dev/disk/by-uuid/30759de4-934a-4c89-aca5-2e4fed7fe94f"; + fsType = "ext4"; + }; + + swapDevices = [ + { device = "/dev/disk/by-uuid/5baebd62-0a58-47c0-b2de-1f5c2970fadf"; } + ]; + + # 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.enp4s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/server1/home.nix b/hosts/server1/home.nix new file mode 100644 index 0000000..e328f19 --- /dev/null +++ b/hosts/server1/home.nix @@ -0,0 +1,7 @@ +{ ... }: + +{ + imports = [ + ../common/home.nix + ]; +} diff --git a/modules/nix/flatpak/flatpak.nix b/modules/nix/flatpak/flatpak.nix index 1d25669..fa2a2f5 100644 --- a/modules/nix/flatpak/flatpak.nix +++ b/modules/nix/flatpak/flatpak.nix @@ -1,30 +1,6 @@ { lib, config, ... }: let inherit (lib) mkIf mkOption types; - - gaming = [ - "com.heroicgameslauncher.hgl" - ]; - - dev = [ - "com.google.AndroidStudio" - ]; - - utils = [ - "com.usebottles.bottles" - "com.github.tchx84.Flatseal" - "it.mijorus.gearlever" - ]; - - media = [ - "com.obsproject.Studio" - ]; - - flatpaks = - (if config.smayzy.flatpak.gaming.enable then gaming else [ ]) - ++ (if config.smayzy.flatpak.dev.enable then dev else [ ]) - ++ (if config.smayzy.flatpak.utils.enable then utils else [ ]) - ++ (if config.smayzy.flatpak.media.enable then media else [ ]); in { options.smayzy.flatpak = mkOption { @@ -61,13 +37,42 @@ in }; }; }; + default = {}; }; - config = mkIf config.smayzy.flatpak.enable { - services.flatpak = { - enable = true; - update.onActivation = true; - packages = flatpaks; - }; - }; + config = mkIf config.smayzy.flatpak.enable ( + let + gaming = [ + "com.heroicgameslauncher.hgl" + ]; + + dev = [ + "com.google.AndroidStudio" + ]; + + utils = [ + "com.usebottles.bottles" + "com.github.tchx84.Flatseal" + "it.mijorus.gearlever" + ]; + + media = [ + "com.obsproject.Studio" + ]; + + flatpaks = + (if config.smayzy.flatpak.gaming.enable then gaming else [ ]) + ++ (if config.smayzy.flatpak.dev.enable then dev else [ ]) + ++ (if config.smayzy.flatpak.utils.enable then utils else [ ]) + ++ (if config.smayzy.flatpak.media.enable then media else [ ]); + in + { + services.flatpak = { + enable = true; + update.onActivation = true; + packages = flatpaks; + }; + } + ); } + diff --git a/modules/nix/groups/default.nix b/modules/nix/groups/default.nix index d9ff4c4..a1adfcf 100644 --- a/modules/nix/groups/default.nix +++ b/modules/nix/groups/default.nix @@ -4,5 +4,6 @@ ./base.nix ./desktop.nix ./laptop.nix + ./server.nix ]; } diff --git a/modules/nix/groups/server.nix b/modules/nix/groups/server.nix new file mode 100644 index 0000000..763d63c --- /dev/null +++ b/modules/nix/groups/server.nix @@ -0,0 +1,19 @@ +{ lib, config, ... }: +let + inherit (lib) mkIf mkOption types; +in +{ + options.smayzy.server.enable = mkOption { + type = types.bool; + default = false; + description = "desktop settings"; + }; + + config = mkIf config.smayzy.server.enable { + smayzy = { + base = true; + power = "desktop"; + stylix.enable = true; + }; + }; +}