Skip to content

Commit

Permalink
refactor: move common code into config-common
Browse files Browse the repository at this point in the history
  • Loading branch information
icecreammatt committed Mar 23, 2024
1 parent 7ec93c1 commit d978084
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 48 deletions.
36 changes: 34 additions & 2 deletions hosts/nixos/config-common.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
{
pkgs,
user,
lib,
username,
darkmode,
system,
inputs,
nixpkgs,
...
}: {
}: let
pkgs = import nixpkgs {
config.allowUnfree = true;
system = "${system}";
overlays = [
(import ../../overlay/overlay.nix)
];
};
in {
imports = [
./networking.nix
../../modules/keyboard-dev.nix
];

nixpkgs.config.allowUnfree = true;

time.timeZone = "America/Los_Angeles";

users.defaultUserShell = pkgs.fish;
Expand All @@ -28,6 +47,7 @@
nix.settings.experimental-features = ["nix-command" "flakes"];

environment.systemPackages = with pkgs; [
inputs.helix-flake.packages."${system}".default
fish
git
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
Expand All @@ -44,4 +64,16 @@
PasswordAuthentication = false;
};
};

home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {inherit user username darkmode;};
users."${user}" = {
home.stateVersion = "23.11";
imports = [
../../modules/shell/git.nix
];
};
};
}
47 changes: 8 additions & 39 deletions hosts/nixos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -74,53 +74,23 @@
];
};

gaming = lib.nixosSystem {
# inherit hyprland;
gaming = lib.nixosSystem rec {
system = "x86_64-linux";
specialArgs = {
inherit user darkmode;
};
pkgs = import nixpkgs {
config.allowUnfree = true;
system = "x86_64-linux";
overlays = [
(import ../../overlay/overlay.nix)
];
inherit inputs user darkmode username system nixpkgs;
};
modules = [
./gaming/configuration.nix
./config-common.nix
{
environment.systemPackages = [
helix-flake.packages."x86_64-linux".default
];
}
./networking.nix
./gaming/configuration.nix
sops-nix.nixosModules.sops
inputs.xremap-flake.nixosModules.default
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = {inherit user username darkmode;};
home-manager.users."${user}" = {
home.stateVersion = "23.11";
imports = [
./gaming/nixos-packages.nix
../../modules/common.nix
../../modules/common-linux.nix
../../modules/common-linux-gui.nix
../../modules/shell/git.nix
../../modules/rust.nix
../../modules/DE/rofi.nix
# ../../modules/DE/hypr.nix
# ../../modules/DE/waybar.nix
];
};
}

hyprland.nixosModules.default
{
programs.hyprland.enable = false;
programs = {
hyprland.enable = false;
keyboard-dev.enable = true;
};
}
];
};
Expand All @@ -139,7 +109,6 @@
modules = [
nixos-hardware.nixosModules.raspberry-pi-4
./config-common.nix
./networking.nix
./pi4/configuration.nix
{
environment.systemPackages = [
Expand Down
36 changes: 29 additions & 7 deletions hosts/nixos/gaming/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,23 @@
{
config,
lib,
pkgs,
user,
username,
darkmode,
system,
nixpkgs,
...
}: let
hostname = "gaming";
nixos_plymouth = pkgs.callPackage ./nixos-plymouth.nix {};

pkgs = import nixpkgs {
config.allowUnfree = true;
system = "${system}";
overlays = [
(import ../../../overlay/overlay.nix)
];
};
in {
imports = [
# Include the results of the hardware scan.
Expand All @@ -21,6 +32,23 @@ in {
../../../modules/editors/arduino.nix
];

home-manager = {
extraSpecialArgs = {inherit pkgs;};
users."${user}" = {
imports = [
../gaming/nixos-packages.nix
../../../modules/common.nix
../../../modules/common-linux.nix
../../../modules/common-linux-gui.nix
../../../modules/shell/git.nix
../../../modules/rust.nix
../../../modules/DE/rofi.nix
# ../../modules/DE/hypr.nix
# ../../modules/DE/waybar.nix
];
};
};

system.autoUpgrade.enable = false;
services.blueman.enable = true;
services.xserver.videoDrivers = ["nvidia"];
Expand Down Expand Up @@ -291,12 +319,6 @@ in {
extraGroups = ["networkmanager" "wheel"];
};

# Allow unfree packages
# nixpkgs.config.allowUnfree = true;

# List packages installed in system profile. To search, run:
# $ nix search wget

environment.sessionVariables = {
WLR_NO_HARDWARE_CURSORS = "1";
};
Expand Down

0 comments on commit d978084

Please sign in to comment.