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
40 changes: 0 additions & 40 deletions .github/workflows/flake.yml

This file was deleted.

28 changes: 3 additions & 25 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

99 changes: 55 additions & 44 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,65 +24,92 @@
url = "github:DeclanRiedel/zed-thread-tui";
inputs.nixpkgs.follows = "nixpkgs";
};
opencode = {
url = "github:sst/opencode/v1.17.14";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = inputs@{ self, nixpkgs, home-manager, sops-nix, nixvim, nixpkgs-codex, nixpkgs-stable, worktrunk, ... }:
let
system = "x86_64-linux";
pkgsUnfree = import nixpkgs {
defaultSystem = "x86_64-linux";
defaultUser = { name = "declan"; home = "/home/declan"; };
hosts = {
machine = {
modules = [
./misc/config.nix
./modules/default.nix
./server/default.nix
];
};
vostro = {
modules = [
./hosts/vostro/default.nix
./modules/default.nix
./modules/ai-auto-update.nix
./modules/memory.nix
];
};
nixos-wsl = {
modules = [
inputs.nixos-wsl.nixosModules.default
./hosts/nixos-wsl/default.nix
];
};
};
mkPkgs = system: import nixpkgs {
inherit system;
config = {
allowUnfree = true;
android_sdk.accept_license = true;
};
};
pkgsCodex = import nixpkgs-codex {
inherit system;
config.allowUnfree = true;
overlays = [ inputs.opencode.overlays.default ];
};
pkgsStable = import nixpkgs-stable {
inherit system;
config.allowUnfree = true;
};
homeManagerModule = {
mkHomeManagerModule = hostConfig: {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "backup";
home-manager.extraSpecialArgs = { inherit inputs; };
home-manager.users.declan = {
home-manager.extraSpecialArgs = { inherit inputs hostConfig; };
home-manager.users.${hostConfig.user.name} = {
imports = [
./home-manager/home.nix
nixvim.homeModules.nixvim
worktrunk.homeModules.default
];
};
};
mkHost = modules:
mkHost = hostName: host:
let
system = host.system or defaultSystem;
pkgsUnfree = mkPkgs system;
pkgsCodex = import nixpkgs-codex {
inherit system;
config.allowUnfree = true;
};
pkgsStable = import nixpkgs-stable {
inherit system;
config.allowUnfree = true;
};
hostConfig = host // {
inherit hostName system;
user = host.user or defaultUser;
};
in
nixpkgs.lib.nixosSystem {
inherit system;
pkgs = pkgsUnfree;
modules = [
specialArgs = { inherit inputs hostConfig pkgsCodex pkgsStable; };
modules = host.modules ++ [
{
_module.args.pkgsCodex = pkgsCodex;
_module.args.pkgsStable = pkgsStable;
networking.hostName = nixpkgs.lib.mkDefault hostName;
}
] ++ modules ++ [
sops-nix.nixosModules.sops
inputs.stylix.nixosModules.stylix
home-manager.nixosModules.home-manager
homeManagerModule
(mkHomeManagerModule hostConfig)
];
};
pkgsUnfree = mkPkgs defaultSystem;
in
{
formatter.${system} = pkgsUnfree.nixpkgs-fmt;
formatter.${defaultSystem} = pkgsUnfree.nixpkgs-fmt;

apps.${system} = {
apps.${defaultSystem} = {
# `nix run .#switch [host]` — build and activate the config for the
# given host (defaults to the current hostname) via nh. Runs against
# the working tree (`.`) so uncommitted edits are picked up.
Expand All @@ -106,7 +133,7 @@
};
};

checks.${system} = {
checks.${defaultSystem} = {
format = pkgsUnfree.runCommand "nixos-format-check"
{
nativeBuildInputs = [ pkgsUnfree.nixpkgs-fmt ];
Expand Down Expand Up @@ -194,22 +221,6 @@
};
};

nixosConfigurations = {
machine = mkHost [
./misc/config.nix
./modules/default.nix
./server/default.nix
];

vostro = mkHost [
./hosts/vostro/default.nix
./modules/default.nix
];

nixos-wsl = mkHost [
inputs.nixos-wsl.nixosModules.default
./hosts/nixos-wsl/default.nix
];
};
nixosConfigurations = nixpkgs.lib.mapAttrs mkHost hosts;
};
}
2 changes: 2 additions & 0 deletions home-manager/fuzzel.nix
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"app Vesktop" \
"app Telegram" \
"app Bitwarden" \
"app Spotify" \
"app Settings" \
"app All apps" \
"dev NixOS flake in Zed" \
Expand Down Expand Up @@ -105,6 +106,7 @@
"app Vesktop") exec vesktop ;;
"app Telegram") exec telegram-desktop ;;
"app Bitwarden") exec bitwarden ;;
"app Spotify") run_shell 'spotify_player' ;;
"app Settings") exec xfce4-settings-manager ;;
"app All apps") exec "$fuzzel" ;;
"dev NixOS flake in Zed") exec zeditor "$HOME/.nixos" ;;
Expand Down
13 changes: 8 additions & 5 deletions home-manager/home.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{ config, inputs, lib, osConfig, pkgs, ... }:
{ config, hostConfig, inputs, lib, pkgs, ... }:

let
isWsl = osConfig.networking.hostName == "nixos-wsl";
isWsl = hostConfig.hostName == "nixos-wsl";
flakeDir = "${hostConfig.user.home}/.nixos";
in
{
home.username = "declan";
home.homeDirectory = "/home/declan";
home.username = hostConfig.user.name;
home.homeDirectory = hostConfig.user.home;
home.stateVersion = "24.05";

home.packages = [
Expand Down Expand Up @@ -74,7 +75,8 @@ in
cc = "claude --dangerously-skip-permissions";
codex = "codex --yolo";
ranger = "y";
switch = "/home/declan/.nixos/scripts/switch.sh";
switch = "${flakeDir}/scripts/switch.sh";
update-ai = "cd ${flakeDir} && nix flake update nixpkgs-codex && ${flakeDir}/scripts/switch.sh";
yazi = "y";
};
};
Expand Down Expand Up @@ -103,6 +105,7 @@ in

programs.nixvim = {
enable = true;
nixpkgs.source = inputs.nixpkgs;
imports = [ ../nixvim/config/default.nix ];
};
}
6 changes: 3 additions & 3 deletions home-manager/hyprland.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ inputs, lib, pkgs, ... }:
{ hostConfig, inputs, lib, pkgs, ... }:

let
zedThreadRunner = inputs.zed-thread-tui.packages.${pkgs.stdenv.hostPlatform.system}.default;
Expand Down Expand Up @@ -78,7 +78,7 @@ in
#!${pkgs.bash}/bin/bash
set -euo pipefail

wall_dir="/home/declan/.nixos/wall"
wall_dir="${hostConfig.user.home}/.nixos/wall"
state_dir="''${XDG_RUNTIME_DIR:-/tmp}/hyprpaper"
config="$state_dir/hyprpaper.conf"
wallpaper="$wall_dir/berserk.jpg"
Expand Down Expand Up @@ -168,7 +168,7 @@ in
address=$address
port=$port
enable_auth=true
username=declan
username=${hostConfig.user.name}
password=$(cat "$password_file")
private_key_file=$tls_key
certificate_file=$tls_cert
Expand Down
8 changes: 3 additions & 5 deletions hosts/nixos-wsl/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, pkgsCodex, ... }:
{ hostConfig, pkgs, pkgsCodex, ... }:

{
imports = [
Expand All @@ -9,11 +9,9 @@

system.stateVersion = "25.11";
nix.settings.experimental-features = [ "nix-command" "flakes" ];
#networking.hostName = lib.mkForce "nixos-wsl";

wsl = {
enable = true;
defaultUser = "declan";
defaultUser = hostConfig.user.name;
useWindowsDriver = true;
startMenuLaunchers = false;
wslConf = {
Expand Down Expand Up @@ -92,6 +90,6 @@
services.openssh.enable = true;
programs.ssh.startAgent = true;

users.users.declan.linger = true;
users.users.${hostConfig.user.name}.linger = true;
users.users.root.shell = pkgs.zsh;
}
6 changes: 2 additions & 4 deletions hosts/vostro/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, pkgs, ... }:
{ hostConfig, pkgs, ... }:

{
imports = [
Expand All @@ -16,9 +16,7 @@
"flakes"
];

networking.hostName = lib.mkForce "vostro";

users.users.declan.openssh.authorizedKeys.keys = [
users.users.${hostConfig.user.name}.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM6L3iyvr7PKLMkieNUsDVuywKC3xP12uobeMo5L8chv declan@declan-NucBox-K7-PLUS"
];

Expand Down
2 changes: 1 addition & 1 deletion hosts/vostro/hardware-configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
lib.mkDefault config.hardware.enableRedistributableFirmware;

networking.useDHCP = lib.mkDefault true;
networking.firewall.allowedTCPPorts = [ 22 4321 5432 5900 ];
networking.firewall.allowedTCPPorts = [ 22 4321 5432 5900 3000 8080];
networking.firewall.allowedTCPPortRanges = [
{
from = 5000;
Expand Down
Loading