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, ...}:
{
imports =
@ -11,7 +11,11 @@
./programs/aspell.nix
# home-manager entry-point
./users
] ++ type;
# layers
./layer
# options
./options.nix
];
time.timeZone = "Europe/Berlin";
@ -27,6 +31,7 @@
networking = {
useDHCP = false;
hostName = config.variables.hostName;
};
nix = {

View File

@ -6,9 +6,8 @@ let
system = if args ? system then args.system else "x86_64-linux";
extraModules = if args ? extraModules then args.extraModules else [ ];
extraOverlays = if args ? extraOverlays then args.extraOverlays else [ ];
type = if args ? type then args.type else [ ./layer/graphical.nix ];
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
{
inherit name;
@ -35,6 +34,5 @@ flakes.nixpkgs.lib.listToAttrs (map mkMachine [
{
name = "ellmauthaler";
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 = {
xserver = {
enable = true;
displayManager.lightdm.enable = true;
enable = isgraphical;
displayManager.lightdm.enable = isgraphical;
windowManager.i3 = {
enable = true;
enable = isgraphical;
extraPackages = with pkgs; [
rofi # launcher
polybarFull # bar
@ -27,16 +30,16 @@
printing.enable = true;
};
sound.enable = true;
sound.enable = isgraphical;
hardware = {
pulseaudio.enable = true;
bluetooth.enable = true;
pulseaudio.enable = isgraphical;
bluetooth.enable = isgraphical;
};
services.blueman.enable = true;
services.blueman.enable = isgraphical;
environment.systemPackages = with pkgs; [
environment.systemPackages = if isgraphical then with pkgs; [
firefox
alacritty
thunderbird
@ -46,5 +49,5 @@
keepassxc
gnome.libsecret
arandr
];
] else [ ];
}

View File

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

View File

@ -1,4 +1,8 @@
{ 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 ];
networking.hostName = "stel-xps"; # define the hostname
variables = {
hostName = "stel-xps";
graphical = true;
};
#networking.hostName = "stel-xps"; # define the hostname
environment.systemPackages = with pkgs; [
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 = {
programs.autorandr = {
enable = true;
enable = config.variables.graphical;
profiles = {
"home" = {
fingerprint = {

View File

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

View File

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

View File

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

View File

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