Universe/worlds/majin.nix

104 lines
2.7 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 = "majin";
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;
# I want to fully control my users via nix
users.mutableUsers = false;
networking.extraHosts = ''
192.168.0.122 mc
192.168.0.202 mary
'';
fileSystems."/home".neededForBoot = true;
services.gvfs.enable = true;
networking.firewall = {
enable = true;
allowedTCPPorts = [ 8000 ];
};
};
lxsameer = pkgs.callPackage ../users/lxsameer/default.nix {};
fg42 = inputs.fg42.packages.${system}.default;
inVM = (utils.sanitizeBuilderConfig hostBuilderConfig).inVM;
host = if inVM then "majinVM" else "majin";
in {
installer = import ./installer.nix (params // {
diskModule = (modules.disk-installer
host
(if inVM then ./majin/vm.disk.nix else ./majin/disks.nix));
});
majin = 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 ./majin/vm.disk.nix else ./majin/disks.nix))
bootable
base
lxsameer.user
desktop
styles
yubikey
virtualisation.podman
inputs.home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.lxsameer = lxsameer.desktop;
home-manager.extraSpecialArgs = {
inherit inputs fg42;
};
}
]);
# Pass these attributes to all the modules for this
# host
specialArgs = { inherit inputs hostBuilderConfig; };
};
}