1
0
mirror of https://github.com/ellmau/nixos.git synced 2025-12-19 09:29:36 +01:00

CONF added variables for different features to be defined hostbased

Signed-off-by: Stefan Ellmauthaler <stefan.ellmauthaler@tu-dresden.de>
This commit is contained in:
Stefan Ellmauthaler 2021-11-16 14:42:33 +01:00
parent bd13d7941b
commit bc342f05e5
13 changed files with 77 additions and 32 deletions

View File

@ -1,4 +1,4 @@
{ pkgs, name, type, flakes, flakeOutputs, ...}: { pkgs, name, flakes, flakeOutputs, ...}:
{ config, pkgs, lib, ...}: { config, pkgs, lib, ...}:
{ {
imports = imports =
@ -11,7 +11,11 @@
./programs/aspell.nix ./programs/aspell.nix
# home-manager entry-point # home-manager entry-point
./users ./users
] ++ type; # layers
./layer
# options
./options.nix
];
time.timeZone = "Europe/Berlin"; time.timeZone = "Europe/Berlin";
@ -27,6 +31,7 @@
networking = { networking = {
useDHCP = false; useDHCP = false;
hostName = config.variables.hostName;
}; };
nix = { nix = {

View File

@ -6,9 +6,8 @@ let
system = if args ? system then args.system else "x86_64-linux"; system = if args ? system then args.system else "x86_64-linux";
extraModules = if args ? extraModules then args.extraModules else [ ]; extraModules = if args ? extraModules then args.extraModules else [ ];
extraOverlays = if args ? extraOverlays then args.extraOverlays else [ ]; extraOverlays = if args ? extraOverlays then args.extraOverlays else [ ];
type = if args ? type then args.type else [ ./layer/graphical.nix ];
pkgs = flakes.nixpkgs; pkgs = flakes.nixpkgs;
configuration = if args ? configuration then args.configuration else import ./baseconfiguration.nix {inherit extraOverlays system pkgs name type flakes flakeOutputs;} ; configuration = if args ? configuration then args.configuration else import ./baseconfiguration.nix {inherit extraOverlays system pkgs name flakes flakeOutputs;} ;
in in
{ {
inherit name; inherit name;
@ -35,6 +34,5 @@ flakes.nixpkgs.lib.listToAttrs (map mkMachine [
{ {
name = "ellmauthaler"; name = "ellmauthaler";
extraModules = [ flakes.home-manager.nixosModules.home-manager ]; extraModules = [ flakes.home-manager.nixosModules.home-manager ];
type = [ ./layer/server.nix ];
} }
]) ])

4
layer/default.nix Normal file
View File

@ -0,0 +1,4 @@
{ config, pkgs, lib, ...}:
{
imports = [ ./graphical.nix ];
}

View File

@ -1,13 +1,16 @@
{ config, pkgs, ... }: { config, pkgs, lib, ... }:
let
isgraphical = config.variables.graphical;
in
{ {
networking.networkmanager.enable = true; networking.networkmanager.enable = isgraphical;
services = { services = {
xserver = { xserver = {
enable = true; enable = isgraphical;
displayManager.lightdm.enable = true; displayManager.lightdm.enable = isgraphical;
windowManager.i3 = { windowManager.i3 = {
enable = true; enable = isgraphical;
extraPackages = with pkgs; [ extraPackages = with pkgs; [
rofi # launcher rofi # launcher
polybarFull # bar polybarFull # bar
@ -27,16 +30,16 @@
printing.enable = true; printing.enable = true;
}; };
sound.enable = true; sound.enable = isgraphical;
hardware = { hardware = {
pulseaudio.enable = true; pulseaudio.enable = isgraphical;
bluetooth.enable = true; bluetooth.enable = isgraphical;
}; };
services.blueman.enable = true; services.blueman.enable = isgraphical;
environment.systemPackages = with pkgs; [ environment.systemPackages = if isgraphical then with pkgs; [
firefox firefox
alacritty alacritty
thunderbird thunderbird
@ -46,5 +49,5 @@
keepassxc keepassxc
gnome.libsecret gnome.libsecret
arandr arandr
]; ] else [ ];
} }

View File

@ -1,7 +1,11 @@
{ config, pkgs, ...}: { config, pkgs, ...}:
{ {
networking ={
variables = {
hostName = "ellmauthaler"; hostName = "ellmauthaler";
};
networking = {
domain = "net"; domain = "net";
}; };
} }

View File

@ -1,4 +1,8 @@
{ config, pkgs, ...}: { config, pkgs, ...}:
{ {
networking.hostName = "nucturne"; # define the hostname variables= {
hostName = "nucturne";
graphical = true;
};
#networking.hostName = "nucturne"; # define the hostname
} }

View File

@ -2,7 +2,11 @@
{ {
imports = [ ./printer.nix ]; imports = [ ./printer.nix ];
networking.hostName = "stel-xps"; # define the hostname variables = {
hostName = "stel-xps";
graphical = true;
};
#networking.hostName = "stel-xps"; # define the hostname
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
brightnessctl brightnessctl

21
options.nix Normal file
View File

@ -0,0 +1,21 @@
{ config, pkgs, lib, ...}:
{
options.variables = with lib; {
hostName = mkOption {
type = types.str;
example = "nucturne";
description = "Hostname of the system";
default = "hostnamenotset";
};
graphical = mkOption {
type = types.bool;
default = false;
description = "Whether to enable the graphical environment";
};
server = mkOption {
type = types.bool;
default = false;
description = "Whether this system is a server";
};
};
}

View File

@ -2,7 +2,7 @@
{ {
home-manager.users.ellmau = { home-manager.users.ellmau = {
programs.autorandr = { programs.autorandr = {
enable = true; enable = config.variables.graphical;
profiles = { profiles = {
"home" = { "home" = {
fingerprint = { fingerprint = {

View File

@ -40,8 +40,8 @@
notify = true; notify = true;
tray = "auto"; tray = "auto";
}; };
blueman-applet.enable = true; blueman-applet.enable = config.variables.graphical;
network-manager-applet.enable = true ; network-manager-applet.enable = config.variables.graphical ;
gnome-keyring = { gnome-keyring = {
enable = true; enable = true;
components = [ "pkcs11" "secrets" "ssh" ]; components = [ "pkcs11" "secrets" "ssh" ];

View File

@ -2,7 +2,7 @@
{ {
home-manager.users.ellmau = { home-manager.users.ellmau = {
services.dunst = { services.dunst = {
enable = true; enable = config.variables.graphical;
iconTheme = { iconTheme = {
package = pkgs.numix-icon-theme; package = pkgs.numix-icon-theme;
name = "Numix"; name = "Numix";

View File

@ -1,10 +1,12 @@
{ config, pkgs, lib, ...}: { config, pkgs, lib, ...}:
{ {
home-manager.users.ellmau = { config = lib.mkIf config.variables.graphical {
xdg = { home-manager.users.ellmau = {
configFile."i3" = { xdg = {
source = conf/i3; configFile."i3" = {
recursive = true; source = conf/i3;
recursive = true;
};
}; };
}; };
}; };

View File

@ -1,8 +1,8 @@
{ pkgs, ...}: { config, pkgs, ...}:
{ {
home-manager.users.ellmau = { home-manager.users.ellmau = {
services.polybar = { services.polybar = {
enable = true; enable = config.variables.graphical;
package = pkgs.polybarFull; package = pkgs.polybarFull;
settings = settings =
let let