From dcddbd8c92c6bff6b71dde35d64fbd845e26df2e Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Fri, 20 Aug 2021 14:45:29 -0600 Subject: [PATCH] [NixOS] Provide inputs as a specialArgs --- nixos/flake.nix | 31 +++++++++++++++---------------- nixos/machines/adele.nix | 15 ++------------- nixos/raspberry-pi.nix | 6 +++++- 3 files changed, 22 insertions(+), 30 deletions(-) diff --git a/nixos/flake.nix b/nixos/flake.nix index 4a1b2970..010747d3 100644 --- a/nixos/flake.nix +++ b/nixos/flake.nix @@ -28,7 +28,7 @@ url = github:IvanMalison/notifications-tray-icon/master; }; }; - outputs = { + outputs = inputs@{ self, nix, nixpkgs, nixos-hardware, home-manager, taffybar, xmonad, xmonad-contrib, notifications-tray-icon }: @@ -56,30 +56,29 @@ nixos-hardware.nixosModules.raspberry-pi-4 ]; }); + mkNixosConfig = args@{ system ? "x86_64-linux", baseModules ? [ forAll ], modules ? [], specialArgs ? {}, ... }: + nixpkgs.lib.nixosSystem (args // { + inherit system; + modules = baseModules ++ modules; + specialArgs = { inherit inputs; } // specialArgs; + }); in { nixosConfigurations = { - ivanm-dfinity-razer = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ forAll ./machines/ivanm-dfinity-razer.nix ]; + ivanm-dfinity-razer = mkNixosConfig { + modules = [ ./machines/ivanm-dfinity-razer.nix ]; }; - ryzen-shine = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ forAll ./machines/ryzen-shine.nix ]; + ryzen-shine = mkNixosConfig { + modules = [ ./machines/ryzen-shine.nix ]; }; - adele = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ forAll ./machines/adele.nix ({ ... }: { - imports = [ - nixos-hardware.nixosModules.dell-xps-17-9700-intel - ]; - })]; + adele = mkNixosConfig { + modules = [ ./machines/adele.nix ]; }; - biskcomp = nixpkgs.lib.nixosSystem { + biskcomp = mkNixosConfig { system = "aarch64-linux"; modules = [ forAll piHardware ./machines/biskcomp.nix ]; }; - air-gapped-pi = nixpkgs.lib.nixosSystem { + air-gapped-pi = mkNixosConfig { system = "aarch64-linux"; modules = [ forAll piHardware ./machines/air-gapped-pi.nix ]; }; diff --git a/nixos/machines/adele.nix b/nixos/machines/adele.nix index edf3912a..a5145dc6 100644 --- a/nixos/machines/adele.nix +++ b/nixos/machines/adele.nix @@ -1,29 +1,18 @@ # 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, ... }: +{ config, lib, pkgs, inputs, ... }: { imports = [ ../full.nix ../base.nix + inputs.nixos-hardware.nixosModules.dell-xps-17-9700-intel ]; hardware.enableRedistributableFirmware = true; - boot.kernelPatches = [{ - name = "enable-soundwire-drivers"; - patch = null; - extraConfig = '' - SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES y - SND_SOC_INTEL_SOUNDWIRE_SOF_MACH m - SND_SOC_RT1308 m - ''; - ignoreConfigErrors = true; - }]; - boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; - boot.kernelPackages = pkgs.linuxPackages_latest; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; diff --git a/nixos/raspberry-pi.nix b/nixos/raspberry-pi.nix index 4ac4cbcf..b904c2b0 100644 --- a/nixos/raspberry-pi.nix +++ b/nixos/raspberry-pi.nix @@ -1,6 +1,10 @@ -{ config, pkgs, ... }: +{ config, pkgs, inputs, ... }: { + imports = [ + inputs.nixos-hardware.nixosModules.raspberry-pi-4 + ]; + hardware.raspberry-pi."4".fkms-3d.enable = true; boot = {