Refactor config to merge modules from platforms
This commit is contained in:
parent
a3eecd7007
commit
0c4ce3e936
|
@ -1,30 +0,0 @@
|
|||
{ config, pkgs, tokyo-night-sddm-src, ... }:
|
||||
let
|
||||
tokyo-night-sddm = with pkgs.libsForQt5; pkgs.stdenv.mkDerivation {
|
||||
name = "tokyo-night-sddm";
|
||||
src = tokyo-night-sddm-src;
|
||||
installPhase = ''
|
||||
cp -f ${./tokyo-night-sddm/theme.conf} ./theme.conf
|
||||
mkdir -p $out/share/sddm/themes/tokyo-night-sddm
|
||||
mv * $out/share/sddm/themes/tokyo-night-sddm
|
||||
'';
|
||||
};
|
||||
in {
|
||||
environment.systemPackages = with pkgs.libsForQt5; [
|
||||
tokyo-night-sddm # Theme
|
||||
qtbase
|
||||
qtsvg
|
||||
qtquickcontrols2
|
||||
qtgraphicaleffects
|
||||
];
|
||||
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
|
||||
displayManager.defaultSession = "sway";
|
||||
displayManager.sddm = {
|
||||
enable = true;
|
||||
theme = "tokyo-night-sddm";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{ ... }:
|
||||
{
|
||||
{ config, lib, ... }:
|
||||
lib.mkIf (config.custom.platform == "laptop") {
|
||||
services.upower = {
|
||||
enable = true;
|
||||
|
|
@ -1,4 +1,15 @@
|
|||
{ config, pkgs, nur, username, fullname, ... }:
|
||||
let
|
||||
inherit (config.custom) platform;
|
||||
|
||||
hashedPassword =
|
||||
if platform == "desktop" then
|
||||
"$6$HYibiGhDN.JgLtw6$cecU7NjfumTUJSkFNFQG4uVgdd3tTPLGxK0zHAwYn3un/V43IUlyVBNKoRMLCQk65RckbD/.AjsLFVFKUUHVA/"
|
||||
else if platform == "laptop" then
|
||||
"$6$y3eb1phxFWnParRT$w1LNfxJ2ByHoiBa5ywh4STGuIK/r4Tnyxx2Xe/nlovrE6LuuLAVdKRFAroUTtUI/d2BNGI9ErjZ2z2Dl7w/t00"
|
||||
else
|
||||
"$6$vmmMT7pEY1W0Bj9R$Kb6nuwdg/KzCrGcUPkEo2jJ6a2NJRikiOeN8/I8ObU1K6rVYvgYqPVgPg9NkLaUScdh1PWcabuvaHCFLMw14A0";
|
||||
in
|
||||
{
|
||||
nix.package = pkgs.nixFlakes;
|
||||
nix.extraOptions = ''
|
||||
|
@ -12,6 +23,7 @@
|
|||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
networking.hostName = "kiana-${platform}";
|
||||
networking.wireless.enable = false;
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
|
@ -33,8 +45,11 @@
|
|||
description = fullname;
|
||||
extraGroups = [ "wheel" "networkmanager" ]; # Enable ‘sudo’ for the user.
|
||||
shell = pkgs.fish;
|
||||
inherit hashedPassword;
|
||||
};
|
||||
|
||||
users.users.root = { inherit hashedPassword; };
|
||||
|
||||
|
||||
fonts = {
|
||||
enableDefaultFonts = true;
|
|
@ -1,8 +1,9 @@
|
|||
{ config, pkgs, ... }:
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./packages.nix
|
||||
./login.nix
|
||||
./battery.nix
|
||||
];
|
||||
}
|
31
config/login.nix
Normal file
31
config/login.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{ config, lib, pkgs, tokyo-night-sddm-src, ... }:
|
||||
lib.mkIf (config.custom.platform != "mobile")
|
||||
(let
|
||||
tokyo-night-sddm = with pkgs.libsForQt5; pkgs.stdenv.mkDerivation {
|
||||
name = "tokyo-night-sddm";
|
||||
src = tokyo-night-sddm-src;
|
||||
installPhase = ''
|
||||
cp -f ${./tokyo-night-sddm/theme.conf} ./theme.conf
|
||||
mkdir -p $out/share/sddm/themes/tokyo-night-sddm
|
||||
mv * $out/share/sddm/themes/tokyo-night-sddm
|
||||
'';
|
||||
};
|
||||
in {
|
||||
environment.systemPackages = with pkgs.libsForQt5; [
|
||||
tokyo-night-sddm # Theme
|
||||
qtbase
|
||||
qtsvg
|
||||
qtquickcontrols2
|
||||
qtgraphicaleffects
|
||||
];
|
||||
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
|
||||
displayManager.defaultSession = "sway";
|
||||
displayManager.sddm = {
|
||||
enable = true;
|
||||
theme = "tokyo-night-sddm";
|
||||
};
|
||||
};
|
||||
})
|
|
@ -1,11 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
let hashedPassword = "$6$HYibiGhDN.JgLtw6$cecU7NjfumTUJSkFNFQG4uVgdd3tTPLGxK0zHAwYn3un/V43IUlyVBNKoRMLCQk65RckbD/.AjsLFVFKUUHVA/";
|
||||
in {
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
# Passwords
|
||||
users.users.kiana = { inherit hashedPassword; };
|
||||
users.users.root = { inherit hashedPassword; };
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
../../common/home-manager
|
||||
./waybar.nix
|
||||
];
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
# Home manager is being weird about conflicts,
|
||||
# so I'm doing this. It sucks, but so does home
|
||||
# manager, so it's fine.
|
||||
|
||||
import ../../common/home-manager/wayland/waybar.nix
|
||||
[ "sway/workspaces" "sway/mode" "custom/sep" "cpu" "memory" "temperature" ]
|
||||
[ "sway/window" ]
|
||||
[ "pulseaudio" "network" "clock" "idle_inhibitor" ]
|
30
flake.nix
30
flake.nix
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
description = "System conf";
|
||||
inputs = rec {
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nur.url = "github:nix-community/NUR";
|
||||
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
||||
|
@ -20,21 +20,26 @@ outputs = { self,
|
|||
system = "x86_64-linux";
|
||||
username = "kiana";
|
||||
fullname = "Kiana Sheibani";
|
||||
moduleArgs = inputs // { inherit system username fullname; };
|
||||
moduleArgs = { inherit system username fullname; } // inputs;
|
||||
lib = nixpkgs.lib;
|
||||
in {
|
||||
nixosConfigurations = {
|
||||
"${username}-desktop" = lib.makeOverridable lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [
|
||||
{ _module.args = moduleArgs; }
|
||||
./desktop/config
|
||||
./common/config
|
||||
./config
|
||||
|
||||
./platform.nix
|
||||
./hardware-configuration/desktop.nix
|
||||
{ _module.args = moduleArgs;
|
||||
custom.platform = "desktop"; }
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.users.${username} = import ./home-manager;
|
||||
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.${username} = import ./desktop/home-manager;
|
||||
home-manager.sharedModules = [ ./platform.nix { custom.platform = "desktop"; } ];
|
||||
home-manager.extraSpecialArgs = moduleArgs;
|
||||
}
|
||||
];
|
||||
|
@ -43,15 +48,20 @@ outputs = { self,
|
|||
"${username}-laptop" = lib.makeOverridable lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [
|
||||
{ _module.args = moduleArgs; }
|
||||
./laptop/config
|
||||
./common/config
|
||||
./config
|
||||
|
||||
{ _module.args = moduleArgs;
|
||||
custom.platform = "laptop"; }
|
||||
./platform.nix
|
||||
./hardware-configuration/laptop.nix
|
||||
home-manager.nixosModules.home-manager
|
||||
nixos-hardware.nixosModules.microsoft-surface
|
||||
{
|
||||
home-manager.users.${username} = import ./home-manager;
|
||||
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.${username} = import ./laptop/home-manager;
|
||||
home-manager.sharedModules = [ ./platform.nix { custom.platform = "laptop"; } ];
|
||||
home-manager.extraSpecialArgs = moduleArgs;
|
||||
}
|
||||
];
|
||||
|
|
|
@ -2,12 +2,7 @@
|
|||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-amd" ];
|
||||
|
@ -25,5 +20,6 @@
|
|||
|
||||
swapDevices = [ ];
|
||||
|
||||
hardware.enableRedistributableFirmware = lib.mkDefault true;
|
||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
|
@ -2,9 +2,10 @@
|
|||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
boot.loader.grub.useOSProber = true;
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
hardware.enableAllFirmware = true;
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usbhid" "usb_storage" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
|
@ -10,5 +10,6 @@
|
|||
./swaylock.nix
|
||||
./mako.nix
|
||||
./rofi.nix
|
||||
./waybar.nix
|
||||
];
|
||||
}
|
|
@ -124,7 +124,7 @@ in {
|
|||
};
|
||||
|
||||
output."*" = {
|
||||
bg = "${../../../assets/background.png} fill";
|
||||
bg = "${../../assets/background.png} fill";
|
||||
};
|
||||
};
|
||||
};
|
|
@ -1,7 +1,4 @@
|
|||
modules-left:
|
||||
modules-center:
|
||||
modules-right:
|
||||
{ pkgs, ... }:
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
programs.waybar = {
|
||||
enable = true;
|
||||
|
@ -12,7 +9,16 @@ modules-right:
|
|||
height = 32;
|
||||
margin = "8 8 0";
|
||||
|
||||
inherit modules-left modules-center modules-right;
|
||||
|
||||
modules-left = [ "sway/workspaces" "sway/mode" "custom/sep" "cpu" "memory" "temperature" ];
|
||||
modules-center = [ "sway/window" ];
|
||||
|
||||
modules-right =
|
||||
if config.custom.platform == "laptop" then
|
||||
[ "battery" "pulseaudio" "backlight" "network" "clock" "idle_inhibitor" ]
|
||||
else
|
||||
[ "pulseaudio" "network" "clock" "idle_inhibitor" ];
|
||||
|
||||
|
||||
modules = {
|
||||
"sway/workspaces" = {
|
||||
|
@ -237,7 +243,7 @@ modules-right:
|
|||
#pulseaudio {
|
||||
background-color: @altblend;
|
||||
${
|
||||
if builtins.elem "backlight" modules-right then
|
||||
if config.custom.platform == "laptop" then
|
||||
''
|
||||
margin: 3px 0px 3px 2px;
|
||||
padding-right: 5px;
|
|
@ -1,18 +0,0 @@
|
|||
{ ... }:
|
||||
let hashedPassword = "$6$y3eb1phxFWnParRT$w1LNfxJ2ByHoiBa5ywh4STGuIK/r4Tnyxx2Xe/nlovrE6LuuLAVdKRFAroUTtUI/d2BNGI9ErjZ2z2Dl7w/t00";
|
||||
in {
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
./battery.nix
|
||||
];
|
||||
|
||||
networking.hostName = "kiana-laptop";
|
||||
|
||||
boot.loader.grub.useOSProber = true;
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
hardware.enableAllFirmware = true;
|
||||
|
||||
# Passwords
|
||||
users.users.kiana = { inherit hashedPassword; };
|
||||
users.users.root = { inherit hashedPassword; };
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
../../common/home-manager
|
||||
./waybar.nix
|
||||
];
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
# Home manager is being weird about conflicts,
|
||||
# so I'm doing this. It sucks, but so does home
|
||||
# manager, so it's fine.
|
||||
|
||||
import ../../common/home-manager/wayland/waybar.nix
|
||||
[ "sway/workspaces" "sway/mode" "custom/sep" "cpu" "memory" "temperature" ]
|
||||
[ "sway/window" ]
|
||||
[ "battery" "pulseaudio" "backlight" "network" "clock" "idle_inhibitor" ]
|
7
platform.nix
Normal file
7
platform.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ lib, ... }:
|
||||
{
|
||||
options.custom.platform = lib.mkOption {
|
||||
description = "The platform to configure for";
|
||||
type = lib.types.enum [ "desktop" "laptop" "mobile" ];
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue