Universe/worlds/maryland.nix

123 lines
3.2 KiB
Nix

# Universe - The big bang to my universe
#
# Copyright (c) 2023-2024 Sameer Rahmani <lxsameer@gnu.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
{ nixpkgs,
modules,
system,
inputs,
pkgs,
utils,
hostBuilderConfig ? {
inVM = false;
},
...
}@params:
let
this = { pkgs, config, lib, ... }: {
time.timeZone = lib.mkDefault "Europe/Dublin";
networking.hostName = "maryland";
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
boot.initrd.kernelModules = [ "amdgpu" ];
boot.kernelParams = [ "radeon.cik_support=0" "amdgpu.cik_support=1" ];
hardware.enableRedistributableFirmware = true;
hardware.cpu.amd.updateMicrocode = true;
services.xserver.enable = true;
services.xserver.autorun = lib.mkForce true;
services.xserver.desktopManager.plasma5.enable = true;
services.xserver.desktopManager.plasma5.runUsingSystemd = true;
services.xserver.displayManager = lib.mkForce {
defaultSession = "plasma";
sddm.enable = true;
};
services.dbus.enable = true;
# I want to fully control my users via nix
users.mutableUsers = false;
networking.extraHosts = ''
192.168.0.86 sameer
'';
services.printing.enable = true;
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
fileSystems."/".neededForBoot = true;
services.gvfs.enable = true;
networking.firewall = {
enable = true;
allowedTCPPorts = [ 8000 22 ];
};
};
mary = pkgs.callPackage ../users/mary/default.nix {};
fg42 = inputs.fg42.packages.${system}.default;
inVM = (utils.sanitizeBuilderConfig hostBuilderConfig).inVM;
host = if inVM then "marylandVM" else "maryland";
in {
installer = import ./installer.nix (params // {
inherit host;
diskModule = (modules.disk-installer
host
(if inVM then ./maryland/vm.disk.nix else ./maryland/disks.nix));
});
maryland = nixpkgs.lib.nixosSystem {
inherit system;
modules = (with modules; [
"${nixpkgs}/nixos/modules/profiles/minimal.nix"
"${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
this
(disk
(if inVM then ./maryland/vm.disk.nix else ./maryland/disks.nix))
bootable
base
mary.user
desktop
mary.style
yubikey
virtualisation.podman
inputs.home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.mary = mary.desktop;
home-manager.extraSpecialArgs = {
inherit inputs fg42;
};
}
]);
# Pass these attributes to all the modules for this
# host
specialArgs = { inherit inputs hostBuilderConfig; };
};
}