Import some dependencies where they are needed

This commit is contained in:
Geoffrey Preud'homme 2024-03-26 16:18:17 +01:00
parent 8d1d15a08e
commit 76a594ca9f
7 changed files with 131 additions and 112 deletions

View file

@ -1,30 +1,35 @@
{ lib, nixos-hardware, ... }: { pkgs, lib, config, nixos-hardware, ... }:
{ {
# UEFI works here, and variables can be touched config = {
boot.loader = { # UEFI works here, and variables can be touched
efi.canTouchEfiVariables = lib.mkDefault true; boot.loader = {
grub = { efi.canTouchEfiVariables = lib.mkDefault true;
enable = true; grub = {
efiSupport = true; enable = true;
device = "nodev"; # Don't install on MBR efiSupport = true;
# TODO Maybe we could? In case the HDD doesn't boot anymore? device = "nodev"; # Don't install on MBR
# TODO Maybe we could? In case the HDD doesn't boot anymore?
};
}; };
}; hardware.cpu.intel.updateMicrocode = true;
hardware.cpu.intel.updateMicrocode = true; frogeye.desktop = {
frogeye.desktop = { x11_screens = [
x11_screens = [ "HDMI-1-3"
"HDMI-1-3" "DVI-I-2-1"
"DVI-I-2-1" ];
]; maxVideoHeight = 1440;
maxVideoHeight = 1440; numlock = true;
numlock = true; phasesBrightness = {
phasesBrightness = { enable = true;
enable = true; jour = "40000";
jour = "40000"; crepuscule = "10000";
crepuscule = "10000"; nuit = "1";
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 imports = [
services.xserver.videoDrivers = [ "displaylink" "modesetting" ]; nixos-hardware.nixosModules.dell-g3-3779
];
} }

View file

@ -37,7 +37,7 @@
nur.url = "github:nix-community/NUR"; 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 let
nixpkgsConfig = { nixpkgsConfig = {
overlays = [ overlays = [
@ -54,11 +54,15 @@
lib = { lib = {
nixosSystem = { system, modules ? [ ] }: nixpkgs.lib.nixosSystem { nixosSystem = { system, modules ? [ ] }: nixpkgs.lib.nixosSystem {
inherit system; inherit system;
specialArgs = attrs;
modules = modules ++ [ modules = modules ++ [
self.nixosModules.dotfiles self.nixosModules.dotfiles
{ {
nixpkgs = nixpkgsConfig; 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 { homeManagerConfiguration = { system, modules ? [ ] }: home-manager.lib.homeManagerConfiguration {
specialArgs = attrs;
pkgs = import nixpkgs (nixpkgsConfig // { pkgs = import nixpkgs (nixpkgsConfig // {
inherit system; inherit system;
}); });
@ -107,8 +112,6 @@
imports = [ imports = [
./os ./os
disko.nixosModules.disko disko.nixosModules.disko
home-manager.nixosModules.home-manager
stylix.nixosModules.stylix
]; ];
}; };
nixOnDroidModules.dotfiles = { nixOnDroidModules.dotfiles = {
@ -121,8 +124,6 @@
imports = [ imports = [
./hm ./hm
stylix.homeManagerModules.stylix stylix.homeManagerModules.stylix
nixvim.homeManagerModules.nixvim
nur.hmModules.nur
]; ];
}; };
# Actual configurations # Actual configurations
@ -130,28 +131,24 @@
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
./curacao ./curacao
nixos-hardware.nixosModules.dell-g3-3779
]; ];
}; };
nixosConfigurations.curacao-usb = lib.nixosSystem { nixosConfigurations.curacao-usb = lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
./curacao/usb.nix ./curacao/usb.nix
nixos-hardware.nixosModules.dell-g3-3779
]; ];
}; };
nixosConfigurations.pindakaas = lib.nixosSystem { nixosConfigurations.pindakaas = lib.nixosSystem {
system = "aarch64-linux"; system = "aarch64-linux";
modules = [ modules = [
./pindakaas ./pindakaas
nixos-hardware.nixosModules.pine64-pinebook-pro
]; ];
}; };
nixosConfigurations.pindakaas-sd = lib.nixosSystem { nixosConfigurations.pindakaas-sd = lib.nixosSystem {
system = "aarch64-linux"; system = "aarch64-linux";
modules = [ modules = [
./pindakaas/sd.nix ./pindakaas/sd.nix
nixos-hardware.nixosModules.pine64-pinebook-pro
]; ];
}; };
nixOnDroidConfigurations.sprinkles = lib.nixOnDroidConfiguration { }; nixOnDroidConfigurations.sprinkles = lib.nixOnDroidConfiguration { };

View file

@ -1,4 +1,4 @@
{ pkgs, lib, config, ... }: { pkgs, lib, config, nur, ... }:
{ {
config = lib.mkIf config.frogeye.desktop.xorg { config = lib.mkIf config.frogeye.desktop.xorg {
home.sessionVariables = { home.sessionVariables = {
@ -170,4 +170,7 @@
"${config.xsession.windowManager.i3.config.modifier}+m" = "exec ${config.programs.qutebrowser.package}/bin/qutebrowser --override-restore"; "${config.xsession.windowManager.i3.config.modifier}+m" = "exec ${config.programs.qutebrowser.package}/bin/qutebrowser --override-restore";
}; };
}; };
imports = [
nur.hmModules.nur
];
} }

View file

@ -1,4 +1,4 @@
{ pkgs, lib, config, ... }: { pkgs, lib, config, nixvim, ... }:
{ {
# config = lib.mkIf config.programs.nixvim.enable { # Somehow this is infinite recursion? # config = lib.mkIf config.programs.nixvim.enable { # Somehow this is infinite recursion?
config = { config = {
@ -135,6 +135,7 @@
}; };
imports = [ imports = [
nixvim.homeManagerModules.nixvim
./code.nix ./code.nix
./completion.nix ./completion.nix
./decoration.nix ./decoration.nix

View file

@ -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 = { users.users.geoffrey = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ "adbusers" "wheel" ]; extraGroups = [ "adbusers" "wheel" ];
shell = pkgs.zsh; shell = pkgs.zsh;
initialHashedPassword = "$y$j9T$e64bjL7iyVlniEKwKbM9g0$cCn74za0r6L9QMO20Fdxz3/SX0yvhz3Xd6.2BhtbRL1"; # Not a real password initialHashedPassword = "$y$j9T$e64bjL7iyVlniEKwKbM9g0$cCn74za0r6L9QMO20Fdxz3/SX0yvhz3Xd6.2BhtbRL1"; # Not a real password
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPE41gxrO8oZ5n3saapSwZDViOQphm6RzqgsBUyA88pU geoffrey@frogeye.fr" "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.
}; };
# Makes VMs able to re-run
useUserPackages = true; # Won't allow to set the shell otherwise,
# Adds consistency # even though home-manager sets it
useGlobalPkgs = true; 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";
}; };
imports = [
specialisation = { home-manager.nixosModules.home-manager
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";
} }

View file

@ -1,4 +1,4 @@
{ pkgs, lib, config, ... }: { pkgs, lib, config, stylix, ... }:
{ {
config = { config = {
boot = { boot = {
@ -16,4 +16,7 @@
# Maybe because people patch mono with nerdfonts and that isn't compatible? # Maybe because people patch mono with nerdfonts and that isn't compatible?
}; };
}; };
imports = [
stylix.nixosModules.stylix
];
} }

View file

@ -1,44 +1,49 @@
{ pkgs, lib, config, ... }: { pkgs, lib, config, nixos-hardware, ... }:
{ {
boot = { config = {
# nixos-hardware use latest kernel by default. It has been set a while ago, we maybe don't need it anymore? boot = {
kernelPackages = pkgs.linuxPackages; # 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 # Otherwise it will not show stage1 echo and prompt
# UPST # UPST
kernelParams = [ "console=tty0" ]; kernelParams = [ "console=tty0" ];
# EFI Variables don't seem to work (no generation appear in systemd-boot with SD) # EFI Variables don't seem to work (no generation appear in systemd-boot with SD)
loader.efi.canTouchEfiVariables = false; loader.efi.canTouchEfiVariables = false;
};
frogeye.desktop = {
x11_screens = [ "DP-1" "eDP-1" ];
maxVideoHeight = 1080;
phasesBrightness = {
enable = true;
jour = "3500";
crepuscule = "3000";
nuit = "700";
}; };
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";
}; };
imports = [
# Hardware decoding as suggested in link, works but doesn't seem to help much nixos-hardware.nixosModules.pine64-pinebook-pro
# (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";
} }