From 6075aec39ab2500a37ecdbdd9023ade8750d7985 Mon Sep 17 00:00:00 2001 From: "Mohamed C." Date: Fri, 16 Aug 2024 22:25:25 +0200 Subject: [PATCH] flake experiments, add steamdeck hosts file --- flake.nix | 107 +++++++++++++++--------------------- hosts/steamdeck/default.nix | 24 ++++++++ 2 files changed, 67 insertions(+), 64 deletions(-) diff --git a/flake.nix b/flake.nix index 8bed5b4..a15cdb8 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { description = "Moe.OS"; - # Define Inputs + inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; home-manager = { @@ -14,21 +14,13 @@ inputs.home-manager.follows = "home-manager"; }; }; - # Define Outputs, import Modules - outputs = - { - nixpkgs, - home-manager, - jovian, - plasma-manager, - ... - }: + + outputs = { nixpkgs, home-manager, jovian, plasma-manager, ... }: let - # Define system globally since I have no aarch devices system = "x86_64-linux"; pkgs = import nixpkgs { inherit system; }; lib = nixpkgs.lib; - # NixOS Modules for all hosts + systemModules = [ home-manager.nixosModules.home-manager ./modules/system/apps-shell @@ -43,31 +35,22 @@ ./modules/system/upgrades ./modules/system/users ]; - # Home Manager Modules for all hosts + userModules = [ ./modules/user/git ./modules/user/homeversion ]; - in - { + in { nixosConfigurations = { - # Workstation config - # user and hostName variable inside hostConfig so we can call it in other modules - workstation = - let - user = "mo"; - hostName = "workstation"; - in + workstation = let + user = "mo"; + hostName = "workstation"; + in lib.nixosSystem { + inherit system; specialArgs = { - inherit systemModules; - inherit userModules; - inherit system; - inherit user; - inherit hostName; + inherit systemModules userModules user hostName; }; - system = system; - # Device specific NixOS Modules modules = systemModules ++ [ jovian.nixosModules.jovian ./hosts/${hostName} @@ -80,52 +63,48 @@ ./modules/system/plasma ./modules/system/steam { - # Device specific Home Manager Modules home-manager.users.${user}.imports = userModules ++ [ ./modules/user/plasma ]; - # Issue with Plasma Manager, has to be imported in a special way home-manager.sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ]; } ]; }; - }; - # Steamdeck config - # user and hostName variable inside hostConfig so we can call it in other modules - steamdeck = - let + + steamdeck = let user = "deck"; hostName = "steamdeck"; in - lib.nixosSystem { - specialArgs = { - inherit systemModules; - inherit userModules; + lib.nixosSystem { inherit system; - inherit user; - inherit hostName; + specialArgs = { + inherit systemModules userModules user hostName; + }; + modules = systemModules ++ [ + jovian.nixosModules.jovian + ./hosts/${hostName} + ./modules/system/apps-misc + ./modules/system/browser + ./modules/system/controller + ./modules/system/jovian-${hostName} + ./modules/system/lact + ./modules/system/plasma + ./modules/system/steam + { + home-manager.users.${user}.imports = userModules ++ [ + ./modules/user/plasma + ]; + home-manager.sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ]; + } + ] ++ lib.optional (!lib.hasAttr "system.build.isoImage" pkgs.nixos) [ + { + # Define ISO only if it hasn't been defined yet + system.build.isoImage = pkgs.nixos.install { + modules = [ ./hosts/${hostName} ]; + }; + } + ]; }; - system = system; - # Device specific NixOS Modules - modules = systemModules ++ [ - jovian.nixosModules.jovian - ./hosts/${hostName} - ./modules/system/apps-misc - ./modules/system/browser - ./modules/system/controller - ./modules/system/jovian-${hostName} - ./modules/system/lact - ./modules/system/plasma - ./modules/system/steam - { - # Device specific Home Manager Modules - home-manager.users.${user}.imports = userModules ++ [ - ./modules/user/plasma - ]; - # Issue with Plasma Manager, has to be imported in a special way - home-manager.sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ]; - } - ]; - }; + }; }; } diff --git a/hosts/steamdeck/default.nix b/hosts/steamdeck/default.nix index e69de29..2440752 100644 --- a/hosts/steamdeck/default.nix +++ b/hosts/steamdeck/default.nix @@ -0,0 +1,24 @@ +{ ... }: +{ + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + + fileSystems."/" = + { device = "/dev/disk/by-partlabel/root"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-partlabel/EFI"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = [ { + device = "/var/lib/swapfile"; + size = 16*1024; + }]; +}