From 76a594ca9f59b36746837a1cafa65ee120d84ddc Mon Sep 17 00:00:00 2001 From: Geoffrey Preud'homme Date: Tue, 26 Mar 2024 16:18:17 +0100 Subject: [PATCH] Import some dependencies where they are needed --- curacao/hardware.nix | 55 ++++++++++++----------- flake.nix | 17 +++---- hm/desktop/browser/default.nix | 5 ++- hm/vim/default.nix | 3 +- os/geoffrey.nix | 77 +++++++++++++++++--------------- os/style/default.nix | 5 ++- pindakaas/hardware.nix | 81 ++++++++++++++++++---------------- 7 files changed, 131 insertions(+), 112 deletions(-) diff --git a/curacao/hardware.nix b/curacao/hardware.nix index f948f32..ec65c1a 100644 --- a/curacao/hardware.nix +++ b/curacao/hardware.nix @@ -1,30 +1,35 @@ -{ lib, nixos-hardware, ... }: +{ pkgs, lib, config, nixos-hardware, ... }: { - # UEFI works here, and variables can be touched - boot.loader = { - efi.canTouchEfiVariables = lib.mkDefault true; - grub = { - enable = true; - efiSupport = true; - device = "nodev"; # Don't install on MBR - # TODO Maybe we could? In case the HDD doesn't boot anymore? + config = { + # UEFI works here, and variables can be touched + boot.loader = { + efi.canTouchEfiVariables = lib.mkDefault true; + grub = { + enable = true; + efiSupport = true; + device = "nodev"; # Don't install on MBR + # TODO Maybe we could? In case the HDD doesn't boot anymore? + }; }; - }; - hardware.cpu.intel.updateMicrocode = true; - frogeye.desktop = { - x11_screens = [ - "HDMI-1-3" - "DVI-I-2-1" - ]; - maxVideoHeight = 1440; - numlock = true; - phasesBrightness = { - enable = true; - jour = "40000"; - crepuscule = "10000"; - nuit = "1"; + hardware.cpu.intel.updateMicrocode = true; + frogeye.desktop = { + x11_screens = [ + "HDMI-1-3" + "DVI-I-2-1" + ]; + maxVideoHeight = 1440; + numlock = true; + phasesBrightness = { + enable = true; + jour = "40000"; + crepuscule = "10000"; + nuit = "1"; + }; }; + # Needs prefetched binary blobs, see https://nixos.wiki/wiki/Displaylink + services.xserver.videoDrivers = [ "displaylink" "modesetting" ]; }; - # Needs prefetched binary blobs, see https://nixos.wiki/wiki/Displaylink - services.xserver.videoDrivers = [ "displaylink" "modesetting" ]; + imports = [ + nixos-hardware.nixosModules.dell-g3-3779 + ]; } diff --git a/flake.nix b/flake.nix index a29c2e2..65de255 100644 --- a/flake.nix +++ b/flake.nix @@ -37,7 +37,7 @@ nur.url = "github:nix-community/NUR"; }; - outputs = { self, nixpkgs, disko, nixos-hardware, nix-on-droid, home-manager, stylix, nixvim, nixgl, nur, ... }: + outputs = { self, nixpkgs, disko, nix-on-droid, home-manager, stylix, nixgl, ... }@attrs: let nixpkgsConfig = { overlays = [ @@ -54,11 +54,15 @@ lib = { nixosSystem = { system, modules ? [ ] }: nixpkgs.lib.nixosSystem { inherit system; + specialArgs = attrs; modules = modules ++ [ self.nixosModules.dotfiles { nixpkgs = nixpkgsConfig; - home-manager.sharedModules = [ self.homeManagerModules.dotfiles ]; + home-manager = { + sharedModules = [ self.homeManagerModules.dotfiles ]; + extraSpecialArgs = attrs; + }; } ]; }; @@ -74,6 +78,7 @@ ]; }; homeManagerConfiguration = { system, modules ? [ ] }: home-manager.lib.homeManagerConfiguration { + specialArgs = attrs; pkgs = import nixpkgs (nixpkgsConfig // { inherit system; }); @@ -107,8 +112,6 @@ imports = [ ./os disko.nixosModules.disko - home-manager.nixosModules.home-manager - stylix.nixosModules.stylix ]; }; nixOnDroidModules.dotfiles = { @@ -121,8 +124,6 @@ imports = [ ./hm stylix.homeManagerModules.stylix - nixvim.homeManagerModules.nixvim - nur.hmModules.nur ]; }; # Actual configurations @@ -130,28 +131,24 @@ system = "x86_64-linux"; modules = [ ./curacao - nixos-hardware.nixosModules.dell-g3-3779 ]; }; nixosConfigurations.curacao-usb = lib.nixosSystem { system = "x86_64-linux"; modules = [ ./curacao/usb.nix - nixos-hardware.nixosModules.dell-g3-3779 ]; }; nixosConfigurations.pindakaas = lib.nixosSystem { system = "aarch64-linux"; modules = [ ./pindakaas - nixos-hardware.nixosModules.pine64-pinebook-pro ]; }; nixosConfigurations.pindakaas-sd = lib.nixosSystem { system = "aarch64-linux"; modules = [ ./pindakaas/sd.nix - nixos-hardware.nixosModules.pine64-pinebook-pro ]; }; nixOnDroidConfigurations.sprinkles = lib.nixOnDroidConfiguration { }; diff --git a/hm/desktop/browser/default.nix b/hm/desktop/browser/default.nix index 622cbb6..d02d9bd 100644 --- a/hm/desktop/browser/default.nix +++ b/hm/desktop/browser/default.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, config, ... }: +{ pkgs, lib, config, nur, ... }: { config = lib.mkIf config.frogeye.desktop.xorg { home.sessionVariables = { @@ -170,4 +170,7 @@ "${config.xsession.windowManager.i3.config.modifier}+m" = "exec ${config.programs.qutebrowser.package}/bin/qutebrowser --override-restore"; }; }; + imports = [ + nur.hmModules.nur + ]; } diff --git a/hm/vim/default.nix b/hm/vim/default.nix index d50453f..ce49529 100644 --- a/hm/vim/default.nix +++ b/hm/vim/default.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, config, ... }: +{ pkgs, lib, config, nixvim, ... }: { # config = lib.mkIf config.programs.nixvim.enable { # Somehow this is infinite recursion? config = { @@ -135,6 +135,7 @@ }; imports = [ + nixvim.homeManagerModules.nixvim ./code.nix ./completion.nix ./decoration.nix diff --git a/os/geoffrey.nix b/os/geoffrey.nix index 29b4f36..452f830 100644 --- a/os/geoffrey.nix +++ b/os/geoffrey.nix @@ -1,42 +1,47 @@ -{ pkgs, lib, config, ... }: +{ pkgs, lib, config, home-manager, ... }: { - users.users.root.initialHashedPassword = "$y$j9T$e64bjL7iyVlniEKwKbM9g0$cCn74za0r6L9QMO20Fdxz3/SX0yvhz3Xd6.2BhtbRL1"; # Not a real password + config = { + users.users.root.initialHashedPassword = "$y$j9T$e64bjL7iyVlniEKwKbM9g0$cCn74za0r6L9QMO20Fdxz3/SX0yvhz3Xd6.2BhtbRL1"; # Not a real password - users.users.geoffrey = { - isNormalUser = true; - extraGroups = [ "adbusers" "wheel" ]; - shell = pkgs.zsh; + users.users.geoffrey = { + isNormalUser = true; + extraGroups = [ "adbusers" "wheel" ]; + shell = pkgs.zsh; - initialHashedPassword = "$y$j9T$e64bjL7iyVlniEKwKbM9g0$cCn74za0r6L9QMO20Fdxz3/SX0yvhz3Xd6.2BhtbRL1"; # Not a real password - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPE41gxrO8oZ5n3saapSwZDViOQphm6RzqgsBUyA88pU geoffrey@frogeye.fr" - ]; - }; - - # Won't allow to set the shell otherwise, - # even though home-manager sets it - programs.zsh.enable = true; - - home-manager = { - users.geoffrey = { pkgs, ... }: { - frogeye = lib.mkDefault config.frogeye; - # Propagating options that way doesn't seem to conserve priority info, - # this is not great. Hopefully mkDefault resolve conflicts. + initialHashedPassword = "$y$j9T$e64bjL7iyVlniEKwKbM9g0$cCn74za0r6L9QMO20Fdxz3/SX0yvhz3Xd6.2BhtbRL1"; # Not a real password + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPE41gxrO8oZ5n3saapSwZDViOQphm6RzqgsBUyA88pU geoffrey@frogeye.fr" + ]; }; - # Makes VMs able to re-run - useUserPackages = true; - # Adds consistency - useGlobalPkgs = true; + + # Won't allow to set the shell otherwise, + # even though home-manager sets it + programs.zsh.enable = true; + + home-manager = { + users.geoffrey = { pkgs, ... }: { + frogeye = lib.mkDefault config.frogeye; + # Propagating options that way doesn't seem to conserve priority info, + # this is not great. Hopefully mkDefault resolve conflicts. + }; + # Makes VMs able to re-run + useUserPackages = true; + # Adds consistency + useGlobalPkgs = true; + }; + + specialisation = { + dark.configuration.frogeye.polarity = "dark"; + light.configuration.frogeye.polarity = "light"; + }; + + # Fix https://nix-community.github.io/home-manager/index.html#_why_do_i_get_an_error_message_about_literal_ca_desrt_dconf_literal_or_literal_dconf_service_literal + programs.dconf.enable = true; + + # Because everything is encrypted and I'm the only user, this is fine. + services.xserver.displayManager.autoLogin.user = "geoffrey"; }; - - specialisation = { - dark.configuration.frogeye.polarity = "dark"; - light.configuration.frogeye.polarity = "light"; - }; - - # Fix https://nix-community.github.io/home-manager/index.html#_why_do_i_get_an_error_message_about_literal_ca_desrt_dconf_literal_or_literal_dconf_service_literal - programs.dconf.enable = true; - - # Because everything is encrypted and I'm the only user, this is fine. - services.xserver.displayManager.autoLogin.user = "geoffrey"; + imports = [ + home-manager.nixosModules.home-manager + ]; } diff --git a/os/style/default.nix b/os/style/default.nix index ab0fa91..4c18755 100644 --- a/os/style/default.nix +++ b/os/style/default.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, config, ... }: +{ pkgs, lib, config, stylix, ... }: { config = { boot = { @@ -16,4 +16,7 @@ # Maybe because people patch mono with nerdfonts and that isn't compatible? }; }; + imports = [ + stylix.nixosModules.stylix + ]; } diff --git a/pindakaas/hardware.nix b/pindakaas/hardware.nix index 64b4259..d085653 100644 --- a/pindakaas/hardware.nix +++ b/pindakaas/hardware.nix @@ -1,44 +1,49 @@ -{ pkgs, lib, config, ... }: +{ pkgs, lib, config, nixos-hardware, ... }: { - boot = { - # nixos-hardware use latest kernel by default. It has been set a while ago, we maybe don't need it anymore? - kernelPackages = pkgs.linuxPackages; + config = { + boot = { + # nixos-hardware use latest kernel by default. It has been set a while ago, we maybe don't need it anymore? + kernelPackages = pkgs.linuxPackages; - # Otherwise it will not show stage1 echo and prompt - # UPST - kernelParams = [ "console=tty0" ]; + # Otherwise it will not show stage1 echo and prompt + # UPST + kernelParams = [ "console=tty0" ]; - # EFI Variables don't seem to work (no generation appear in systemd-boot with SD) - loader.efi.canTouchEfiVariables = false; - }; - - frogeye.desktop = { - x11_screens = [ "DP-1" "eDP-1" ]; - maxVideoHeight = 1080; - phasesBrightness = { - enable = true; - jour = "3500"; - crepuscule = "3000"; - nuit = "700"; + # EFI Variables don't seem to work (no generation appear in systemd-boot with SD) + loader.efi.canTouchEfiVariables = false; }; + + frogeye.desktop = { + x11_screens = [ "DP-1" "eDP-1" ]; + maxVideoHeight = 1080; + phasesBrightness = { + enable = true; + jour = "3500"; + crepuscule = "3000"; + nuit = "700"; + }; + }; + + # Hardware decoding as suggested in link, works but doesn't seem to help much + # (at least in dropped frames and perf stat output). + # https://wiki.pine64.org/wiki/Mainline_Hardware_Decoding#mpv + # Might be worth if using CI to build. + + home-manager.sharedModules = [{ + # gpu-hq is too much for it to handle, even with hw decoding + config.programs.mpv.config.profile = lib.mkForce "default"; + }]; + + zramSwap = { + # Not capable of building itself otherwise + enable = true; + memoryPercent = 150; # Factory settings + }; + + # Fixes black font on Alacritty + environment.variables.PAN_MESA_DEBUG = "gl3"; }; - - # Hardware decoding as suggested in link, works but doesn't seem to help much - # (at least in dropped frames and perf stat output). - # https://wiki.pine64.org/wiki/Mainline_Hardware_Decoding#mpv - # Might be worth if using CI to build. - - home-manager.sharedModules = [{ - # gpu-hq is too much for it to handle, even with hw decoding - config.programs.mpv.config.profile = lib.mkForce "default"; - }]; - - zramSwap = { - # Not capable of building itself otherwise - enable = true; - memoryPercent = 150; # Factory settings - }; - - # Fixes black font on Alacritty - environment.variables.PAN_MESA_DEBUG = "gl3"; + imports = [ + nixos-hardware.nixosModules.pine64-pinebook-pro + ]; }