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 = [ imports = [
./gui ./gui
./network ./network
./terminal
]; ];
} }

View file

@ -1,4 +1,4 @@
{ lib, pkgs, config, ... }: { pkgs, config, lib, ... }:
with lib; with lib;
let let
@ -24,7 +24,12 @@ let
in 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 = [ environment.systemPackages = [
(pkgs.pass.withExtensions (ext: [ ext.pass-otp ])) (pkgs.pass.withExtensions (ext: [ ext.pass-otp ]))

View file

@ -3,10 +3,10 @@ with lib;
{ {
options.components.gui.suspend.enable = mkOption { options.components.gui.suspend.enable = mkOption {
type = lib.types.bool; 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 = { systemd.services.screenlock = {
before = [ "sleep.target" ]; 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 let
networkStatus = networkStatus =
@ -375,7 +376,13 @@ let
''; '';
in 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;
@ -394,4 +401,5 @@ in
pkgs.upower pkgs.upower
]; ];
};
} }

View file

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

View file

@ -7,15 +7,12 @@
#./icecast.nix #./icecast.nix
./audio.nix ./audio.nix
./cachix.nix ./cachix.nix
./direnv.nix
./mail-stuff.nix ./mail-stuff.nix
./network.nix ./network.nix
./packages.nix ./packages.nix
./remote-install.nix
./size.nix ./size.nix
./user.nix ./user.nix
./yubikey.nix ./yubikey.nix
./wtf.nix
]; ];
components.network.sshd.onlyTincAccess = lib.mkDefault true; 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
'')
];
}