component restructuring

This commit is contained in:
Ingolf Wagner 2023-05-28 20:22:23 +02:00
parent 13e17324da
commit a76af6013b
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
11 changed files with 100 additions and 55 deletions

View file

@ -2,5 +2,6 @@
imports = [
./gui
./network
./terminal
];
}

View file

@ -1,4 +1,4 @@
{ lib, pkgs, config, ... }:
{ pkgs, config, lib, ... }:
with lib;
let
@ -24,7 +24,12 @@ let
in
{
config = mkIf config.components.gui.enable {
options.components.gui.pass.enable = mkOption {
type = lib.types.bool;
default = config.components.gui.enable;
};
config = mkIf (config.components.gui.pass.enable) {
environment.systemPackages = [
(pkgs.pass.withExtensions (ext: [ ext.pass-otp ]))

View file

@ -3,10 +3,10 @@ with lib;
{
options.components.gui.suspend.enable = mkOption {
type = lib.types.bool;
default = true;
default = config.components.gui.enable;
};
config = mkIf (config.components.gui.enable && config.components.gui.suspend.enable) {
config = mkIf (config.components.gui.suspend.enable) {
systemd.services.screenlock = {
before = [ "sleep.target" ];

View file

@ -0,0 +1,18 @@
{ pkgs, lib, ... }:
with lib;
{
options.components.terminal = {
enable = lib.mkEnableOption "Terminal configurations";
};
imports = [
./direnv.nix
./hoard.nix
./remote-install.nix
./wtf.nix
];
config = mkIf config.components.terminal.enable {
# todo extract xorg stuff to prepare wayland
};
}

View file

@ -0,0 +1,21 @@
{ pkgs, config, lib, ... }:
with lib;
{
options.components.terminal.direnv.enable = mkOption {
type = lib.types.bool;
default = config.components.terminal.enable;
};
config = mkIf (config.components.terminal.direnv.enable) {
environment.systemPackages = [ pkgs.direnv ];
home-manager.users.mainUser.programs.direnv.enable = true;
programs.zsh.interactiveShellInit = ''
eval "$(${pkgs.direnv}/bin/direnv hook zsh)"
'';
programs.bash.interactiveShellInit = ''
eval "$(${pkgs.direnv}/bin/direnv hook bash)"
'';
};
}

View file

@ -0,0 +1,26 @@
{ pkgs, config, lib, ... }:
with lib;
{
options.components.terminal.remote-install.enable = mkOption {
type = lib.types.bool;
default = config.components.terminal.enable;
};
config = mkIf (config.components.terminal.remote-install.enable) {
services.tor = {
enable = true;
client.enable = true;
relay.onionServices.liveos.map = [{ port = 1337; }];
};
environment.systemPackages = [
(pkgs.writeShellScriptBin "remote-install-start-service" ''
echo "starting announcment server to receive remote-install iso onion id"
${pkgs.nmap}/bin/ncat -k -l -p 1337
'')
(pkgs.writeShellScriptBin "remote-install-get-hiddenReceiver" ''
sudo cat /var/lib/tor/onion/liveos/hostname
'')
];
};
}

View file

@ -1,4 +1,5 @@
{ pkgs, lib, config, ... }:
{ pkgs, config, lib, ... }:
with lib;
let
networkStatus =
@ -375,23 +376,30 @@ let
'';
in
{
options.components.terminal.wtf.enable = mkOption {
type = lib.types.bool;
default = config.components.terminal.enable;
};
config = mkIf (config.components.terminal.wtf.enable) {
services.upower.enable = true;
services.upower.enable = true;
environment.systemPackages = [
pkgs.unstable.wtf
(createDashboard {
json = qJson;
name = "q";
})
(createDashboard {
json = newsJson;
name = "news";
})
#activeUsers
#activeTasks
pkgs.upower
];
environment.systemPackages = [
pkgs.unstable.wtf
(createDashboard {
json = qJson;
name = "q";
})
(createDashboard {
json = newsJson;
name = "news";
})
#activeUsers
#activeTasks
pkgs.upower
];
};
}

View file

@ -25,6 +25,7 @@
components.gui.enable = true;
components.terminal.enable = true;
services.nginx.enable = true;

View file

@ -7,15 +7,12 @@
#./icecast.nix
./audio.nix
./cachix.nix
./direnv.nix
./mail-stuff.nix
./network.nix
./packages.nix
./remote-install.nix
./size.nix
./user.nix
./yubikey.nix
./wtf.nix
];
components.network.sshd.onlyTincAccess = lib.mkDefault true;

View file

@ -1,14 +0,0 @@
{ config, pkgs, ... }: {
environment.systemPackages = [ pkgs.direnv ];
home-manager.users.mainUser.programs.direnv.enable = true;
programs.zsh.interactiveShellInit = ''
eval "$(${pkgs.direnv}/bin/direnv hook zsh)"
'';
programs.bash.interactiveShellInit = ''
eval "$(${pkgs.direnv}/bin/direnv hook bash)"
'';
}

View file

@ -1,18 +0,0 @@
{ pkgs, ... }: {
services.tor = {
enable = true;
client.enable = true;
relay.onionServices.liveos.map = [{ port = 1337; }];
};
environment.systemPackages = [
(pkgs.writeShellScriptBin "remote-install-start-service" ''
echo "starting announcment server to receive remote-install iso onion id"
${pkgs.nmap}/bin/ncat -k -l -p 1337
'')
(pkgs.writeShellScriptBin "remote-install-get-hiddenReceiver" ''
sudo cat /var/lib/tor/onion/liveos/hostname
'')
];
}