summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseth <[email protected]>2023-11-02 08:15:15 -0400
committerseth <[email protected]>2023-11-02 08:19:27 -0400
commit7ded7c99e0e77e1aaf46802c42625b267ddc8a69 (patch)
tree8b827fc22cad1e2fe40a23b97fd7728fa1d29c84
parent4fffa9ece74302f5cc34ab5bf7548d378ba4d277 (diff)
modules+systems+seth: use homebrew over nix on darwin & make features module
-rw-r--r--modules/darwin/desktop.nix1
-rw-r--r--modules/nixos/default.nix1
-rw-r--r--modules/nixos/features/default.nix6
-rw-r--r--modules/nixos/features/tailscale.nix22
-rw-r--r--modules/nixos/features/virtualisation.nix10
-rw-r--r--systems/caroline/default.nix7
-rw-r--r--systems/common.nix7
-rw-r--r--systems/glados/default.nix23
-rw-r--r--users/seth/desktop/default.nix19
-rw-r--r--users/seth/system.nix2
10 files changed, 50 insertions, 48 deletions
diff --git a/modules/darwin/desktop.nix b/modules/darwin/desktop.nix
index 23664f9..7b439a9 100644
--- a/modules/darwin/desktop.nix
+++ b/modules/darwin/desktop.nix
@@ -23,6 +23,7 @@
casks = [
"chromium"
+ "iterm2"
];
};
diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix
index f43e8ae..aadc5bd 100644
--- a/modules/nixos/default.nix
+++ b/modules/nixos/default.nix
@@ -2,6 +2,7 @@
flake.nixosModules = {
default = ./base.nix;
desktop = ./desktop;
+ features = ./features;
gnome = ./desktop/gnome;
plasma = ./desktop/plasma;
budgie = ./desktop/budgie;
diff --git a/modules/nixos/features/default.nix b/modules/nixos/features/default.nix
new file mode 100644
index 0000000..ade778e
--- /dev/null
+++ b/modules/nixos/features/default.nix
@@ -0,0 +1,6 @@
+{
+ imports = [
+ ./tailscale.nix
+ ./virtualisation.nix
+ ];
+}
diff --git a/modules/nixos/features/tailscale.nix b/modules/nixos/features/tailscale.nix
index d015437..ecb793a 100644
--- a/modules/nixos/features/tailscale.nix
+++ b/modules/nixos/features/tailscale.nix
@@ -5,18 +5,16 @@
...
}: let
cfg = config.features.tailscale;
- inherit (lib) mkDefault mkEnableOption mkIf optionalAttrs;
-
- baseDir = ../../../secrets/systems/${config.networking.hostName};
+ secretsDir = ../../../secrets/systems/${config.networking.hostName};
in {
options.features.tailscale = {
- enable = mkEnableOption "enable support for tailscale";
- ssh.enable = mkEnableOption "enable support for tailscale ssh";
+ enable = lib.mkEnableOption "enable support for tailscale";
+ ssh.enable = lib.mkEnableOption "enable support for tailscale ssh";
};
- config = mkIf cfg.enable {
- age.secrets = mkIf cfg.ssh.enable {
- tailscaleAuthKey.file = "${baseDir}/tailscaleAuthKey.age";
+ config = lib.mkIf cfg.enable {
+ age.secrets = lib.mkIf cfg.ssh.enable {
+ tailscaleAuthKey.file = "${secretsDir}/tailscaleAuthKey.age";
};
networking.firewall =
@@ -24,16 +22,14 @@ in {
allowedUDPPorts = [config.services.tailscale.port];
trustedInterfaces = ["tailscale0"];
}
- // optionalAttrs cfg.ssh.enable {
+ // lib.optionalAttrs cfg.ssh.enable {
allowedTCPPorts = [22];
};
- services = {
- tailscale.enable = mkDefault true;
- };
+ services.tailscale.enable = true;
# https://tailscale.com/kb/1096/nixos-minecraft/
- systemd.services = mkIf cfg.ssh.enable {
+ systemd.services = lib.mkIf cfg.ssh.enable {
tailscale-autoconnect = {
description = "Automatic connection to Tailscale";
diff --git a/modules/nixos/features/virtualisation.nix b/modules/nixos/features/virtualisation.nix
index 206a98e..2c9c527 100644
--- a/modules/nixos/features/virtualisation.nix
+++ b/modules/nixos/features/virtualisation.nix
@@ -5,17 +5,19 @@
...
}: let
cfg = config.features.virtualisation;
- inherit (lib) mkEnableOption mkIf;
in {
- options.features.virtualisation.enable = mkEnableOption "enable podman";
+ options.features.virtualisation = {
+ enable = lib.mkEnableOption "enable podman";
+ };
- config.virtualisation = mkIf cfg.enable {
+ config.virtualisation = lib.mkIf cfg.enable {
podman = {
enable = true;
- enableNvidia = true;
+ enableNvidia = lib.mkDefault (config.hardware.nvidia.enable or false);
extraPackages = with pkgs; [podman-compose];
autoPrune.enable = true;
};
+
oci-containers.backend = "podman";
};
}
diff --git a/systems/caroline/default.nix b/systems/caroline/default.nix
index ae09dca..5c65705 100644
--- a/systems/caroline/default.nix
+++ b/systems/caroline/default.nix
@@ -1,5 +1,10 @@
{
- homebrew.casks = ["altserver"];
+ homebrew.casks = [
+ "altserver"
+ "discord"
+ "spotify"
+ "prismlauncher"
+ ];
networking = rec {
computerName = "caroline";
diff --git a/systems/common.nix b/systems/common.nix
index 8bd29cb..fcaa51e 100644
--- a/systems/common.nix
+++ b/systems/common.nix
@@ -24,6 +24,7 @@ in {
++ [
self.nixosModules.default
self.nixosModules.hardware
+ self.nixosModules.features
hmSetup
@@ -50,10 +51,6 @@ in {
hmSetup
{
- home-manager.users.seth = {
- desktop.enable = true;
- };
-
system.stateVersion = 4;
}
];
@@ -61,9 +58,9 @@ in {
server = [
inputs.agenix.nixosModules.default
self.nixosModules.default
+ self.nixosModules.features
self.nixosModules.server
self.nixosModules.services
- ../modules/nixos/features/tailscale.nix
{
features.tailscale = {
diff --git a/systems/glados/default.nix b/systems/glados/default.nix
index e5a275a..d79b6e1 100644
--- a/systems/glados/default.nix
+++ b/systems/glados/default.nix
@@ -6,8 +6,6 @@
imports = [
./boot.nix
./hardware-configuration.nix
- ../../modules/nixos/features/tailscale.nix
- ../../modules/nixos/features/virtualisation.nix
self.nixosModules.desktop
self.nixosModules.gnome
];
@@ -48,18 +46,21 @@
fwupd.enable = true;
};
- systemd = {
- services."prepare-kexec".wantedBy = ["multi-user.target"];
- tmpfiles.rules = let
- nproc = 12;
- in
- builtins.map
- (n: "w /sys/devices/system/cpu/cpu${builtins.toString n}/cpufreq/energy_performance_preference - - - - ${"balance_performance"}")
- (lib.range 0 (nproc - 1));
- };
+ # set energy preference for pstate driver
+ systemd.tmpfiles.rules = let
+ nproc = 12;
+ in
+ builtins.map
+ (n: "w /sys/devices/system/cpu/cpu${builtins.toString n}/cpufreq/energy_performance_preference - - - - ${"balance_performance"}")
+ (lib.range 0 (nproc - 1));
powerManagement.cpuFreqGovernor = "powersave";
+ programs.steam = {
+ enable = true;
+ remotePlay.openFirewall = true;
+ };
+
zramSwap = {
enable = true;
algorithm = "zstd";
diff --git a/users/seth/desktop/default.nix b/users/seth/desktop/default.nix
index 6815ab2..fb4b894 100644
--- a/users/seth/desktop/default.nix
+++ b/users/seth/desktop/default.nix
@@ -13,18 +13,11 @@
];
config = lib.mkIf config.desktop.enable {
- home.packages = with pkgs;
- [
- discord
- element-desktop
- spotify
- prismlauncher
- ]
- ++ lib.optionals stdenv.isDarwin [
- iterm2
- ]
- ++ lib.optionals stdenv.isLinux [
- steam
- ];
+ home.packages = with pkgs; [
+ discord
+ element-desktop
+ spotify
+ prismlauncher
+ ];
};
}
diff --git a/users/seth/system.nix b/users/seth/system.nix
index 6d9d213..e6b22d7 100644
--- a/users/seth/system.nix
+++ b/users/seth/system.nix
@@ -24,9 +24,9 @@
imports =
[
./.
- ./desktop
]
++ lib.optionals pkgs.stdenv.isLinux [
+ ./desktop
./programs/chromium.nix
./programs/firefox
./programs/mangohud.nix