Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions home-manager/packages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
inputs,
}:
let
inherit (inputs.env) isCI;
inherit (inputs.host) isDesktop;
in
with pkgs;
[
Expand Down Expand Up @@ -115,12 +115,15 @@ with pkgs;
tailscale
trashy
]
++ lib.optionals (stdenv.isLinux && !isCI) [
++ lib.optionals (stdenv.isLinux && isDesktop) [
_1password-gui
chromium
clickup
ffmpeg
ghostty
github-desktop
google-chrome
signal-desktop
slack
vlc
]
12 changes: 10 additions & 2 deletions lib/host.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
{
# Detect if running on kyber (requires --impure flag, which Makefile already uses)
# Detect if running on kyber (linux)
isKyber = builtins.getEnv "HOSTNAME" == "kyber" || builtins.getEnv "HOST" == "kyber";

# Detect if running on galactica (macOS node)
isGalactica = builtins.getEnv "HOSTNAME" == "galactica" || builtins.getEnv "HOST" == "galactica";

# Detect if running on matic (Framework 13" AMD AI 300)
# Detect if running on matic (Framework 13)
isMatic = builtins.getEnv "HOSTNAME" == "matic" || builtins.getEnv "HOST" == "matic";

# Desktop machines with GUI (matic, galactica)
isDesktop =
let
hostname = builtins.getEnv "HOSTNAME";
host = builtins.getEnv "HOST";
in
hostname == "matic" || host == "matic" || hostname == "galactica" || host == "galactica";
Comment on lines +12 to +17

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The implementation for isDesktop duplicates logic already present for isMatic and isGalactica and involves redundant calls to builtins.getEnv. While a broader refactoring of this file to use a recursive set (rec { ... }) would be the ideal way to eliminate this duplication, you can make this specific block more concise and maintainable by introducing a small helper function within the let expression. This will also make it easier to add more desktop hosts in the future.

  isDesktop =
    let
      hostname = builtins.getEnv "HOSTNAME";
      host = builtins.getEnv "HOST";
      isHost = name: hostname == name || host == name;
    in
    isHost "matic" || isHost "galactica";

Comment on lines +12 to +17

Copilot AI Feb 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The isDesktop property uses a let binding to extract environment variables, which is inconsistent with the pattern used by isKyber, isGalactica, and isMatic (lines 3, 6, 9). These properties directly inline builtins.getEnv calls. For consistency and maintainability, consider refactoring to match the established pattern:

isDesktop = builtins.getEnv "HOSTNAME" == "matic" || builtins.getEnv "HOST" == "matic" || builtins.getEnv "HOSTNAME" == "galactica" || builtins.getEnv "HOST" == "galactica";

Or alternatively, update all host detection properties to use the let binding pattern if that's preferred.

Copilot uses AI. Check for mistakes.

# Get the node name for OpenClaw remote mode
# Falls back to "unknown" if no hostname is detected
nodeName =
Expand Down
5 changes: 4 additions & 1 deletion lib/nixpkgs-config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
allowUnfreePredicate =
pkg:
builtins.elem (nixpkgsLib.getName pkg) [
"1password"
"claude-code"
"qwen-code"
"clickup"
"crush"
"qwen-code"
"slack"
Comment on lines +7 to +12

Copilot AI Feb 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing test coverage for newly added unfree packages. The packages "1password", "clickup", and "slack" have been added to the allowUnfreePredicate list, but the test in lib-nixpkgs-unfree-predicate (lines 84-88) only validates "claude-code", "qwen-code", and "crush". Following the established testing pattern, these new packages should also be tested to ensure they are correctly allowed by the unfree predicate.

Copilot uses AI. Check for mistakes.
];
joypixels.acceptLicense = true;
}
2 changes: 1 addition & 1 deletion named-hosts/matic/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ inputs.nixpkgs.lib.nixosSystem {
initialPassword = "changemeow"; # Change this after first login with: passwd
};

security.sudo.wheelNeedsPassword = true;
security.sudo.wheelNeedsPassword = false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

Disabling the password requirement for sudo (security.sudo.wheelNeedsPassword = false) significantly weakens the system's security posture. This configuration allows any process running as a user in the wheel group to gain root privileges without authentication, which is a considerable security risk. This risk is further compounded by the presence of a hardcoded initial password. While this might be convenient, it removes a critical layer of defense-in-depth, making the system vulnerable to easy privilege escalation. It is strongly recommended to require a password for administrative actions to maintain a basic security boundary.

        security.sudo.wheelNeedsPassword = true;

Copilot AI Feb 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting security.sudo.wheelNeedsPassword = false enables passwordless sudo for all users in the wheel group, allowing anyone who compromises a desktop login or SSH session for such a user to escalate to full root access without needing an additional secret. This turns any user-level compromise on matic into an immediate full system compromise. Require a password for sudo (or tightly restrict which commands can be run without a password) to preserve a second layer of authentication for privileged actions.

Suggested change
security.sudo.wheelNeedsPassword = false;
security.sudo.wheelNeedsPassword = true;

Copilot uses AI. Check for mistakes.

# AMD graphics with hardware acceleration
hardware.graphics.enable = true;
Expand Down
6 changes: 6 additions & 0 deletions tests/lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ in
else
''echo "FAIL: host.nodeName must exist and be a string" && exit 1''
}
${
if host ? isDesktop && builtins.isBool host.isDesktop then
''echo "lib/host.nix: isDesktop is a boolean (value: ${builtins.toString host.isDesktop})"''
else
''echo "FAIL: host.isDesktop must exist and be a boolean" && exit 1''
}
Comment on lines +47 to +52

Copilot AI Feb 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing test case for host.isMatic. The test file validates isKyber, isGalactica, nodeName, and isDesktop, but does not include a test for isMatic which is defined in lib/host.nix:9. According to the testing pattern established in this file, each boolean property from lib/host.nix should have a corresponding test.

Copilot uses AI. Check for mistakes.
touch $out
'';

Expand Down
Loading