# SPDX-FileCopyrightText: 2025 Nitesh Kumar Debnath # # SPDX-License-Identifier: GPL-3.0-or-later { config, inputs, lib, withSystem, ... }: let inherit (config.meta) username; inherit (config.flake) wrappers; nixosModules = config.flake.modules.nixos; flakeInputs = inputs._meta |> lib.filterAttrs (_name: value: value.type != "fixed"); in { flake.modules.nixos.readOnlyPkgs = { ... }: { # this needs to be a hardcoded system configuration # do not import it in every machine nixpkgs.pkgs = withSystem "x86_64-linux" ({ pkgs, ... }: pkgs); # perSystem module arguments imports = [ inputs.nixpkgs.nixosModules.readOnlyPkgs ]; }; flake.modules.nixos.tjmaxxer.imports = [ nixosModules.readOnlyPkgs ]; flake.modules.nixos.msi-colgate.imports = [ nixosModules.readOnlyPkgs ]; flake.modules.nixos.disko-elysium.imports = [ nixosModules.readOnlyPkgs ]; flake.modules.nixos.pc = { pkgs, config, ... }: { imports = [ inputs.nix-index-database.nixosModules.default inputs.run0-sudo-shim.nixosModules.default ] ++ lib.mapAttrsToList (_: v: v.install) wrappers; # Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). _module.args.unstablePkgs = withSystem config.nixpkgs.hostPlatform.system ( { unstablePkgs, ... }: unstablePkgs ); # unstable injection nix.settings = { trusted-users = [ username "@wheel" ]; }; nix.registry = lib.mapAttrs (_name: value: { to = value; }) flakeInputs; # Bootloader. boot.loader.systemd-boot = { edk2-uefi-shell.enable = true; enable = true; }; boot.loader.efi.canTouchEfiVariables = lib.mkDefault true; boot.initrd.systemd.enable = true; boot.zswap.enable = true; boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; boot.supportedFilesystems = { exfat = true; }; services.fwupd.enable = true; services.btrfs.autoScrub.enable = lib.mkDefault true; hardware.facter.detected.dhcp.enable = false; services.gvfs.enable = true; services.udisks2.enable = true; # services.desktopManager.cosmic.enable = true; # Set your time zone. assertions = [ { assertion = config.time.timeZone != "America/Los_Angeles"; message = '' NixOS is known to cause cancer in the state of California. Please contact your local representative for details. ''; } { assertion = config.time.timeZone != "America/Denver"; message = '' I dont even know what is going on in the state of Colorado but thats also not allowed anymore. ''; } ]; # Select internationalisation properties. i18n.defaultLocale = "en_IN.UTF-8"; # bypasses locale builder requirement to be valid i18n.extraLocales = "all"; services.dbus.implementation = "broker"; # Configure keymap in X11 services.xserver.xkb = { layout = "us"; variant = ""; }; # run0 settings # TODO: Update to vendored shim in 26.11 # security.sudo.enable = false; security.polkit.persistentAuthentication = true; security.run0-sudo-shim.enable = true; # persistentAuth.enable = true; # system.tools.nixos-rebuild.enableRun0Elevation = true; # Enable sound with pipewire. services.pulseaudio.enable = false; security.rtkit.enable = true; services.pipewire = lib.mkIf config.hardware.graphics.enable { enable = true; alsa.enable = true; # alsa.support32Bit = true; pulse.enable = true; # If you want to use JACK applications, uncomment this jack.enable = true; }; hardware.keyboard.qmk.enable = true; hardware.keyboard.qmk.keychronSupport = true; services.udev.packages = [ pkgs.sane-airscan pkgs.via ]; environment.systemPackages = [ pkgs.via ]; programs.nh = { enable = true; clean.enable = true; clean.extraArgs = "--keep 5 --keep-since 3d"; flake = "/home/${username}/nixos-machine"; }; programs.nix-index-database.comma.enable = true; users.users.${username} = { # For some reason it actually still works. packages = lib.attrValues { inherit (pkgs) vlc github-cli; }; }; documentation.dev.enable = true; programs.appimage.enable = true; programs.appimage.package = pkgs.appimage-run.override { extraPkgs = pkgs: [ pkgs.icu ]; }; }; }