Compare commits

..

8 Commits

Author SHA1 Message Date
Joshua Yuen a37bdf6c60
Update README.md 2025-08-22 17:54:24 -04:00
Joshua Yuen 537af1f5cc
Add control arrow keys to zsh 2025-08-22 17:54:08 -04:00
Joshua Yuen 915bde542c
Add fzf 2025-08-22 11:25:22 -04:00
Joshua Yuen cbdf7d65a5
Remove repeated lsp options 2025-08-22 11:25:08 -04:00
Joshua Yuen 0175408c1c
Fix nixd nixpkgs configuration 2025-08-22 10:51:12 -04:00
Joshua Yuen 44f01c403c
Update sddm settings 2025-08-22 10:06:37 -04:00
Joshua Yuen c56cadcbea
Add alternative nil lsp 2025-08-22 10:04:56 -04:00
Joshua Yuen c3cc521997
Add LSP and formatter 2025-08-22 08:46:56 -04:00
42 changed files with 298 additions and 218 deletions

43
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,43 @@
{
// Nix settings
"nix.enableLanguageServer": true,
"nix.serverPath": "nixd",
"nix.serverSettings": {
"nil": {
"formatting": {
"command": ["nix fmt"]
},
"nix": {
"flake": {
"maxMemoryMB": 16384,
"autoEvalInputs": true,
"nixpkgsInputName": "nixpkgs"
}
}
},
"nixd": {
"nixpkgs": {
"expr": "import (builtins.getFlake (builtins.toString ./.)).inputs.nixpkgs { }"
},
"formatting": {
"command": [
"nix fmt"
]
},
"options": {
"nixos": {
"expr": "(builtins.getFlake (builtins.toString ./.)).nixosConfigurations.nixos.options"
},
"nixos-home-manager": {
"expr": "(builtins.getFlake (builtins.toString ./.)).nixosConfigurations.nixos.options.home-manager.users.type.getSubOptions []"
},
// "home-manager": {
// "expr": "(builtins.getFlake (builtins.toString ./)).homeConfigurations.<name>.options"
// }
}
}
},
"nixEnvSelector.useFlakes": true,
"nixEnvSelector.suggestion": true,
"nixEnvSelector.nixFile": "${workspaceFolder}/flake.nix",
}

View File

@ -15,4 +15,17 @@
https://gist.github.com/FlakM/0535b8aa7efec56906c5ab5e32580adf
# Building NixOS ISO
`nix build .#nixosConfigurations.live.config.system.build.isoImage`
`nix build .#nixosConfigurations.live.config.system.build.isoImage`
# Misc
## Garbage collection
`nix-collect-garbage -d`
## Fonts
### Checking installed fonts
`fc-list`
### Debugging kitty fonts
`kitty --debug-font-fallback`
## SDDM virtual keyboard ??ZZ
- https://unix.stackexchange.com/questions/43976/list-all-valid-kbd-layouts-variants-and-toggle-options-to-use-with-setxkbmap
- https://github.com/NixOS/nixpkgs/issues/254523

107
flake.nix
View File

@ -18,53 +18,70 @@
};
};
outputs = { nixpkgs, home-manager, install-system, ... } @ inputs: let
system = "x86_64-linux";
host = "vm";
profile = "vm";
username = "josh";
in {
nixosConfigurations = {
nixos = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit host;
inherit profile;
inherit username;
outputs =
{
nixpkgs,
home-manager,
install-system,
...
}@inputs:
let
system = "x86_64-linux";
host = "vm";
profile = "vm";
username = "josh";
in
{
nixosConfigurations = {
nixos = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit host;
inherit profile;
inherit username;
};
modules = [
./hosts/${host}
];
};
modules = [
./hosts/${host}
live = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit host;
inherit profile;
inherit username;
};
modules = [
(nixpkgs + "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix")
{ environment.systemPackages = [ install-system.packages.${system}.default ]; }
./hosts/${host}
];
};
nixosvm = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit host;
inherit profile;
inherit username;
};
modules = [
./hosts/${host}
];
};
};
devShell.${system} = nixpkgs.legacyPackages.${system}.pkgs.mkShell {
packages = with nixpkgs.legacyPackages.${system}.pkgs; [
nil
nixd
];
};
live = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit host;
inherit profile;
inherit username;
};
modules = [
(nixpkgs + "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix")
{ environment.systemPackages = [ install-system.packages.${system}.default ]; }
./hosts/${host}
];
};
nixosvm = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit host;
inherit profile;
inherit username;
};
modules = [
./hosts/${host}
];
};
formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-tree;
};
};
}
}

View File

@ -26,4 +26,4 @@
modules.shell.defaultShell = "zsh";
modules.pipewire.enable = true;
}
}

View File

@ -1,3 +1,3 @@
{
}
}

View File

@ -4,6 +4,6 @@
}:
{
environment.systemPackages = with pkgs; [
];
}
}

View File

@ -6,4 +6,4 @@
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true;
};
}
}

View File

@ -20,4 +20,4 @@
./user.nix
inputs.stylix.nixosModules.stylix
];
}
}

View File

@ -14,8 +14,13 @@ in
};
# Add wayland screensharing support if PipeWire is enabled
environment.systemPackages = with pkgs; []
++ (if pipewireCfg.enable
then [ (wrapFirefox (firefox-unwrapped.override { pipewireSupport = true; }) {}) ]
else [ firefox ]);
}
environment.systemPackages =
with pkgs;
[ ]
++ (
if pipewireCfg.enable then
[ (wrapFirefox (firefox-unwrapped.override { pipewireSupport = true; }) { }) ]
else
[ firefox ]
);
}

View File

@ -6,13 +6,14 @@
{
fonts = {
fontconfig.enable = true;
packages = with pkgs; [
font-awesome
montserrat
nerd-fonts.jetbrains-mono
noto-fonts-emoji
] ++ (if config.modules.zsh.enable
then [ nerd-fonts.meslo-lg ]
else []);
packages =
with pkgs;
[
font-awesome
montserrat
nerd-fonts.jetbrains-mono
noto-fonts-emoji
]
++ (if config.modules.zsh.enable then [ nerd-fonts.meslo-lg ] else [ ]);
};
}
}

View File

@ -14,4 +14,4 @@ in
wayland = true;
};
};
}
}

View File

@ -14,4 +14,4 @@ in
withUWSM = true;
};
};
}
}

View File

@ -1,5 +1,4 @@
{
config,
host,
pkgs,
...
@ -12,4 +11,4 @@
};
environment.systemPackages = with pkgs; [ networkmanagerapplet ];
}
}

View File

@ -1,5 +1,4 @@
{
config,
pkgs,
...
}:
@ -14,4 +13,4 @@
tmux
vim
];
}
}

View File

@ -22,4 +22,4 @@ in
# Allows Pipewire to use the realtime scheduler for increased performance
security.rtkit.enable = true;
};
}
}

View File

@ -11,4 +11,4 @@ in
config = mkIf cfg.enable {
services.desktopManager.plasma6.enable = true;
};
}
}

View File

@ -18,6 +18,8 @@ in
};
# To prevent getting stuck at shutdown
systemd.extraConfig = "DefaultTimeoutStopSec=10s";
systemd.settings.Manager = {
DefaultTimeoutStopSec = "10s";
};
};
}
}

View File

@ -5,4 +5,4 @@
services = {
};
}
}

View File

@ -6,12 +6,12 @@
stylix = {
enable = true;
base16Scheme = "${pkgs.base16-schemes}/share/themes/blueish.yaml";
polarity = "dark";
fonts = {
emoji = {
package = pkgs.noto-fonts-emoji;
package = pkgs.noto-fonts-emoji;
name = "Noto Color Emoji";
};
monospace = {
@ -34,4 +34,4 @@
};
};
};
}
}

View File

@ -1,11 +1,9 @@
{
config,
lib,
...
}:
with lib;
let
cfg = config.system;
cfg = config.system;
in
{
nix = {
@ -35,4 +33,4 @@ in
};
system.stateVersion = "25.05";
}
}

View File

@ -2,13 +2,11 @@
config,
host,
inputs,
lib,
pkgs,
profile,
username,
...
}:
with lib;
let
shellCfg = config.modules.shell;
in
@ -18,7 +16,14 @@ in
useUserPackages = true;
useGlobalPkgs = false;
backupFileExtension = "backup";
extraSpecialArgs = { inherit host inputs profile username; };
extraSpecialArgs = {
inherit
host
inputs
profile
username
;
};
users.${username} = {
imports = [ ./../home ];
home = {
@ -39,10 +44,13 @@ in
];
shell = pkgs.${shellCfg.defaultShell};
ignoreShellProgramCheck = true;
packages = with pkgs; [
fzf
];
};
# Set /etc/shells so GDM will show our user when ZSH is selected
environment.shells = with pkgs; [ pkgs.${shellCfg.defaultShell} ];
environment.shells = [ pkgs.${shellCfg.defaultShell} ];
nix.settings.allowed-users = [ "${username}" ];
}
}

View File

@ -5,4 +5,4 @@
imports = [
./vm-guest-services.nix
];
}
}

View File

@ -1,7 +1,6 @@
{
config,
lib,
pkgs,
...
}:
with lib;
@ -18,4 +17,4 @@ in
services.spice-vdagentd.enable = true;
services.spice-webdavd.enable = true;
};
}
}

View File

@ -1,5 +1,4 @@
{
host,
...
}:
{
@ -9,4 +8,4 @@
./xdg.nix
./zsh
];
}
}

View File

@ -1,9 +1,7 @@
{
lib,
osConfig,
...
}:
with lib;
let
cfg = osConfig.modules.hyprland;
in
@ -12,7 +10,7 @@ in
bind = [
# Misc
"$modifier,Return,exec,${cfg.terminal}"
# Window management
"$modifier,C,killactive"
"$modifier,F,fullscreen, 1"
@ -56,4 +54,4 @@ in
"$modifier,mouse:273,resizewindow"
];
};
}
}

View File

@ -6,4 +6,4 @@
./binds.nix
./hyprland.nix
];
}
}

View File

@ -1,5 +1,4 @@
{
host,
lib,
osConfig,
pkgs,
@ -62,4 +61,4 @@ in
};
};
};
}
}

View File

@ -1,5 +1,4 @@
{
config,
lib,
osConfig,
pkgs,
@ -29,4 +28,4 @@ in
'';
};
};
}
}

View File

@ -1,10 +1,8 @@
{
lib,
osConfig,
pkgs,
...
}:
with lib;
let
hyprlandCfg = osConfig.modules.hyprland;
pipewireCfg = osConfig.modules.pipewire;
@ -17,27 +15,31 @@ in
mimeApps.enable = true;
portal = {
enable = true;
extraPortals = []
++ (if hyprlandCfg.enable
then [ pkgs.xdg-desktop-portal-hyprland ]
else [])
++ (if pipewireCfg.enable
then [
pkgs.xdg-desktop-portal-wlr
pkgs.xdg-desktop-portal-gtk
]
else [])
++ (if plasmaCfg.enable
then [ pkgs.kdePackages.xdg-desktop-portal-kde ]
else []);
configPackages = []
++ (if hyprlandCfg.enable
then [ pkgs.hyprland ]
else [])
++ (if plasmaCfg.enable
# TODO: use the correct packages or config
then [ pkgs.kdePackages.kde-gtk-config ]
else []);
extraPortals =
[ ]
++ (if hyprlandCfg.enable then [ pkgs.xdg-desktop-portal-hyprland ] else [ ])
++ (
if pipewireCfg.enable then
[
pkgs.xdg-desktop-portal-wlr
pkgs.xdg-desktop-portal-gtk
]
else
[ ]
)
++ (if plasmaCfg.enable then [ pkgs.kdePackages.xdg-desktop-portal-kde ] else [ ]);
configPackages =
[ ]
++ (if hyprlandCfg.enable then [ pkgs.hyprland ] else [ ])
++ (
if
plasmaCfg.enable
# TODO: use the correct packages or config
then
[ pkgs.kdePackages.kde-gtk-config ]
else
[ ]
);
};
};
}
}

View File

@ -1,12 +1,9 @@
{
config,
lib,
osConfig,
pkgs,
profile,
...
}:
with lib;
let
cfg = osConfig.modules.zsh;
xdgCfg = config.xdg;
@ -19,7 +16,8 @@ in
programs.zsh = {
enable = cfg.enable;
dotDir = "${xdgCfg.configHome}/zsh";
autosuggestion.enable = true;
autosuggestion.enable = false;
enableCompletion = true;
syntaxHighlighting = {
enable = true;
highlighters = [
@ -31,9 +29,13 @@ in
};
historySubstringSearch.enable = true;
history = {
append = true;
ignoreDups = false;
ignoreSpace = true;
save = 100000;
share = true;
size = 100000;
extended = true;
};
initContent = ''
@ -48,6 +50,16 @@ in
# Tab to accept current selection
bind-key -M menuselect '^I' accept-and-infer-next-history
# Control arrow keys
bindkey '^[[1;5C' forward-word
bindkey '^[[1;5D' backward-word
# Load fzf keybindings
if [ -n "''${commands[fzf-share]}" ]; then
source "$(fzf-share)/key-bindings.zsh";
source "$(fzf-share)/completion.zsh";
fi
'';
shellAliases = {
@ -69,4 +81,4 @@ in
}
];
};
}
}

View File

@ -2,7 +2,6 @@
config,
lib,
osConfig,
pkgs,
...
}:
with lib;
@ -16,4 +15,4 @@ in
source = ./p10k.zsh;
};
};
}
}

View File

@ -11,4 +11,4 @@
./system.nix
./zsh.nix
];
}
}

View File

@ -1,12 +1,8 @@
{
config,
lib,
...
}:
with lib;
let
cfg = config.modules.displayManager;
in
{
options.modules.displayManager = {
displayManager = mkOption {
@ -20,4 +16,4 @@ in
'';
};
};
}
}

View File

@ -1,16 +1,12 @@
{
config,
lib,
...
}:
with lib;
let
cfg = config.modules.hyprland;
in
{
options.modules.hyprland = {
enable = mkEnableOption {
default = false;
default = false;
description = "Enable Hyprland";
};
terminal = mkOption {
@ -26,9 +22,9 @@ in
monitor = mkOption {
type = types.listOf types.str;
default = [ ",preferred,auto,1" ];
description = ''
description = ''
Monitors to use for Hyprland.
'';
};
};
}
}

View File

@ -1,12 +1,8 @@
{
config,
lib,
...
}:
with lib;
let
cfg = config.modules.pipewire;
in
{
options.modules.pipewire = {
enable = mkEnableOption {
@ -14,4 +10,4 @@ in
description = "Enable PipeWire";
};
};
}
}

View File

@ -1,12 +1,8 @@
{
config,
lib,
...
}:
with lib;
let
cfg = config.modules.plasma;
in
{
options.modules.plasma = {
enable = mkEnableOption {
@ -14,4 +10,4 @@ in
description = "Enable Plasma";
};
};
}
}

View File

@ -22,11 +22,17 @@ in
};
};
config.assertions = []
++ (if cfg.defaultShell == "zsh"
then [{
config.assertions =
[ ]
++ (
if cfg.defaultShell == "zsh" then
[
{
assertion = zshCfg.enable;
message = "You have selected zsh as the default shell, but you haven't enabled it in your configuration.\n\nPlease enable it by adding `modules.zsh.enable = true`.";
}]
else []);
}
}
]
else
[ ]
);
}

View File

@ -1,20 +1,16 @@
{
config,
lib,
...
}:
with lib;
let
cfg = config.system;
in
{
options.system = {
locale = mkOption {
type = types.str;
type = types.str;
default = "en_US.UTF-8";
};
keyMap = mkOption {
keyMap = mkOption {
type = types.str;
default = "us";
};
@ -24,4 +20,4 @@ in
default = "US/Eastern";
};
};
}
}

View File

@ -1,12 +1,8 @@
{
config,
lib,
...
}:
with lib;
let
cfg = config.modules.zsh;
in
{
options.modules.zsh = {
enable = mkEnableOption {
@ -14,4 +10,4 @@ in
default = true;
};
};
}
}

View File

@ -19,4 +19,4 @@
# drivers.nvidia-prime.enable = false;
# drivers.intel.enable = false;
vm.guest-services.enable = true;
}
}

View File

@ -2,29 +2,32 @@
description = "_template package and shell environment";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
};
outputs = { self, nixpkgs, ... }: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system}.pkgs;
name = builtins.baseNameOf (builtins.toString ./.);
shellApplication = pkgs.writeShellApplication {
inherit name;
outputs =
{ nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system}.pkgs;
name = builtins.baseNameOf (builtins.toString ./.);
shellApplication = pkgs.writeShellApplication {
inherit name;
text = builtins.readFile ./${name}.sh;
text = builtins.readFile ./${name}.sh;
runtimeInputs = with pkgs; [
coreutils
gnused
unixtools.column
];
runtimeInputs = with pkgs; [
coreutils
gnused
unixtools.column
];
};
in
{
packages.${system}.default = shellApplication;
devShells.${system}.default = pkgs.mkShell {
packages = [ shellApplication ];
};
};
in {
packages.${system}.default = shellApplication;
devShells.${system}.default = pkgs.mkShell {
packages = [ shellApplication ];
};
};
}
}

View File

@ -2,28 +2,31 @@
description = "install-system package and shell environment";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
};
outputs = { self, nixpkgs, ... }: let
pkgs = nixpkgs.legacyPackages.x86_64-linux.pkgs;
name = builtins.baseNameOf (builtins.toString ./.);
shellApplication = pkgs.writeShellApplication {
inherit name;
outputs =
{ nixpkgs, ... }:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux.pkgs;
name = builtins.baseNameOf (builtins.toString ./.);
shellApplication = pkgs.writeShellApplication {
inherit name;
text = builtins.readFile ./${name}.sh;
text = builtins.readFile ./${name}.sh;
runtimeInputs = with pkgs; [
coreutils
gnused
unixtools.column
];
runtimeInputs = with pkgs; [
coreutils
gnused
unixtools.column
];
};
in
{
packages.x86_64-linux.default = shellApplication;
devShells.x86_64-linux.default = pkgs.mkShell {
packages = [ shellApplication ];
};
};
in {
packages.x86_64-linux.default = shellApplication;
devShells.x86_64-linux.default = pkgs.mkShell {
packages = [ shellApplication ];
};
};
}
}