Compare commits

...

21 Commits

Author SHA1 Message Date
3b6f4c7f28 wip 2026-02-23 00:52:39 +01:00
5b19dec3c3 chore: remove unneeded toString 2026-02-22 13:13:50 +01:00
97b7348c2b chore: use config instead of cfg everywhere 2026-02-22 13:03:26 +01:00
b6ae96cb84 feat: refactor packages for nicer devux 2026-02-22 12:43:18 +01:00
25735d5bd1 chore: blame ignore 3aff25b448 2026-02-22 12:11:10 +01:00
3aff25b448 chore: run statix 2026-02-22 12:10:47 +01:00
e6cad243de feat: setup statix linter 2026-02-22 12:10:24 +01:00
0a6e024b78 chore: remove unused packages 2026-02-22 02:25:04 +01:00
3c643a411e chore: cleanup comments and remove module config descriptions 2026-02-22 02:03:52 +01:00
fdd7831732 feat: claude-code overlay from nixpkgs-unstable 2026-02-22 01:56:01 +01:00
103efdb7a9 feat: restart bluetooth on boot for matej-tower 2026-02-22 01:55:24 +01:00
8406979975 feat: extract initrd-ssh module from hardware config 2026-02-21 20:45:24 +01:00
a2abf10e39 fix: typo in pipewire config 2026-02-21 18:17:03 +01:00
957209d2a0 feat: extract nvidia module and cleanup matej-nixos HW config 2026-02-21 13:23:57 +01:00
2c3bce4844 chore: blame ignore f011c8d71b 2026-02-21 12:57:52 +01:00
f011c8d71b chore: run nix fmt 2026-02-21 12:56:46 +01:00
a3cf0b7523 feat: extract tuigreet and workstation modules 2026-02-21 12:56:24 +01:00
edc1e6149a merge: host config cleanup 2026-02-21 03:52:18 +01:00
93265b474b feat: move and cleanup host configs 2026-02-21 03:52:01 +01:00
127e451678 feat: add users/{user}/nixos.nix support 2026-02-21 03:47:32 +01:00
cc96675ea3 feat: extract some config into modules 2026-02-21 03:45:34 +01:00
35 changed files with 837 additions and 705 deletions

3
.git-blame-ignore-revs Normal file
View File

@@ -0,0 +1,3 @@
# nix fmt & statix
f011c8d71ba09bd94ab04b8d771858b90a03fbf9
3aff25b4486a143cd6282f8845c16216598e1c7e

View File

@@ -4,3 +4,11 @@ repos:
hooks: hooks:
- id: nixfmt-nix - id: nixfmt-nix
args: [--, --check] args: [--, --check]
- repo: local
hooks:
- id: statix
name: statix
entry: statix check
language: system
files: \.nix$
pass_filenames: false

View File

@@ -50,9 +50,21 @@
}: }:
let let
my-lib = import ./lib { lib = nixpkgs.lib; }; my-lib = import ./lib { inherit (nixpkgs) lib; };
overlays = [ ]; overlays = [
(_: prev: {
inherit
(
(import inputs.nixpkgs-unstable {
inherit (prev.stdenv.hostPlatform) system;
config.allowUnfree = true;
})
)
claude-code
;
})
];
mkHost = my-lib.mkHost { mkHost = my-lib.mkHost {
inherit inherit
@@ -82,11 +94,17 @@
system = "x86_64-linux"; system = "x86_64-linux";
users = [ ]; users = [ ];
}; };
# nixos-rebuild build-image --image-variant qemu --flake .#sandbox
sandbox = mkHost "sandbox" {
system = "x86_64-linux";
users = [ "gorazd" ];
};
}; };
nixosModules = import ./modules/nixos { nixosModules = import ./modules/nixos {
inherit my-lib; inherit my-lib;
lib = nixpkgs.lib; inherit (nixpkgs) lib;
} { }; } { };
} }
// flake-utils.lib.eachDefaultSystem ( // flake-utils.lib.eachDefaultSystem (
@@ -95,15 +113,25 @@
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
in in
{ {
packages = import ./packages { packages =
import ./packages
{
inherit my-lib; inherit my-lib;
lib = nixpkgs.lib; inherit (nixpkgs) lib;
} (inputs // { inherit system; }); }
{
pkgs = nixpkgs.legacyPackages.${system};
pkgs-unstable = inputs.nixpkgs-unstable.legacyPackages.${system};
pkgs-master = inputs.nixpkgs-master.legacyPackages.${system};
};
formatter = pkgs.nixfmt-tree; formatter = pkgs.nixfmt-tree;
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
packages = [ pkgs.pre-commit ]; packages = [
pkgs.pre-commit
pkgs.statix
];
}; };
} }
); );

View File

@@ -1,5 +1,19 @@
{ pkgs, lib, ... }:
{ {
pkgs,
lib,
inputs,
...
}:
let
keys = import ../../users/matej/keys.nix;
in
{
imports = [
inputs.self.nixosModules.openssh
];
openssh.enable = true;
image.modules.iso-installer = { image.modules.iso-installer = {
isoImage.squashfsCompression = "zstd -Xcompression-level 6"; isoImage.squashfsCompression = "zstd -Xcompression-level 6";
}; };
@@ -10,17 +24,6 @@
}; };
boot.loader.grub.device = lib.mkDefault "/dev/sda"; boot.loader.grub.device = lib.mkDefault "/dev/sda";
services.openssh = {
enable = true;
ports = [ 22 ];
settings = {
PasswordAuthentication = false;
AllowUsers = null;
PermitRootLogin = "no";
StreamLocalBindUnlink = "yes";
};
};
networking.firewall.allowedTCPPorts = [ 22 ]; networking.firewall.allowedTCPPorts = [ 22 ];
users = { users = {
@@ -38,14 +41,9 @@
"wheel" "wheel"
"users" "users"
]; ];
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = keys.sshAuthorizedKeys;
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICQGLdINKzs+sEy62Pefng0bcedgU396+OryFgeH99/c janezicmatej"
];
}; };
}; };
# boot.extraModulePackages = [ pkgs.linuxPackages.r8125 ];
# boot.blacklistedKernelModules = [ "r8169" ];
system.stateVersion = "25.05"; system.stateVersion = "25.05";
} }

View File

@@ -1,7 +1,3 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ {
config, config,
lib, lib,
@@ -20,9 +16,46 @@ in
inputs.stylix.nixosModules.stylix inputs.stylix.nixosModules.stylix
inputs.self.nixosModules.yubikey inputs.self.nixosModules.yubikey
inputs.self.nixosModules.sway inputs.self.nixosModules.sway
inputs.self.nixosModules.openssh
inputs.self.nixosModules.desktop
inputs.self.nixosModules.printing
inputs.self.nixosModules.zsh
inputs.self.nixosModules.gnupg
inputs.self.nixosModules.tuigreet
inputs.self.nixosModules.workstation
inputs.self.nixosModules.nvidia
inputs.self.nixosModules.initrd-ssh
]; ];
yubikey.enable = true; yubikey.enable = true;
openssh.enable = true;
desktop.enable = true;
printing.enable = true;
zsh.enable = true;
gnupg.enable = true;
workstation.enable = true;
tuigreet = {
enable = true;
command = "sway";
};
sway = {
enable = true;
cmdFlags = [ "--unsupported-gpu" ];
};
nvidia.enable = true;
initrd-ssh = {
enable = true;
networkModule = "r8169";
ip = {
enable = true;
address = "10.222.0.247";
gateway = "10.222.0.1";
interface = "enp5s0";
};
};
stylix = { stylix = {
enable = true; enable = true;
@@ -31,263 +64,58 @@ in
base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-material-dark-medium.yaml"; base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-material-dark-medium.yaml";
}; };
virtualisation.docker = {
enable = true;
logDriver = "json-file";
};
# WARN:(matej) probably want to drop this in the future
# i added this to get ruff working when installed via pip
programs.nix-ld.enable = true;
programs.nix-ld.libraries = options.programs.nix-ld.libraries.default;
services.blueman.enable = true;
security.polkit.enable = true;
security.pki.certificateFiles = [ packages.ca-matheo-si ];
services.gnome.gnome-keyring.enable = true;
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
services.tailscale = {
enable = true;
useRoutingFeatures = "both";
};
# Set your time zone.
time.timeZone = "Europe/Ljubljana"; time.timeZone = "Europe/Ljubljana";
environment.variables.TZ = "America/New_York"; environment.variables.TZ = "America/New_York";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8"; i18n.defaultLocale = "en_US.UTF-8";
#console = { # WARN:(@janezicmatej) nix-ld for running pip-installed binaries outside nix, probably want to drop this
# font = "Lat2-Terminus16"; programs.nix-ld.enable = true;
# keyMap = "us"; programs.nix-ld.libraries = options.programs.nix-ld.libraries.default;
# #useXkbConfig = true;
#};
users.defaultUserShell = pkgs.zsh; security.pki.certificateFiles = [ packages.ca-matheo-si ];
users.users.matej = { services.gnome.gnome-keyring.enable = true;
uid = 1000;
isNormalUser = true;
home = "/home/matej";
extraGroups = [
"wheel"
"docker"
];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICQGLdINKzs+sEy62Pefng0bcedgU396+OryFgeH99/c janezicmatej"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDk00+Km03epQXQs+xEwwH3zcurACzkEH+kDOPBw6RQe openpgp:0xB095D449"
];
};
services.teamviewer.enable = true; services.teamviewer.enable = true;
users.groups.matej = {
gid = 1000;
members = [ "matej" ];
};
home-manager.backupFileExtension = "backup";
home-manager.users.matej = {
home.stateVersion = "24.11";
home.packages = [ ];
};
programs.zsh = {
enable = true;
};
environment.etc."zshenv".text = ''
export ZDOTDIR=$HOME/.config/zsh
'';
# Wayland, X, etc. support for session vars
# systemd.user.sessionVariables = config.home-manager.users.matej.home.sessionVariables; };
# enable Sway window manager
sway = {
enable = true;
cmdFlags = [ "--unsupported-gpu" ];
};
services.greetd = {
enable = true;
settings = {
default_session = {
command = "${pkgs.tuigreet}/bin/tuigreet --time --remember --cmd sway";
user = "greeter";
};
};
};
# users.users.greeter = {
# isSystemUser = true;
# description = "greetd user";
# group = "nogroup";
# home = "/var/lib/greetd";
# };
programs.thunderbird.enable = true; programs.thunderbird.enable = true;
programs._1password.enable = true; programs._1password.enable = true;
programs._1password-gui.enable = true; programs._1password-gui.enable = true;
programs.firefox.enable = true;
services.playerctld.enable = true;
fonts.packages = with pkgs; [
font-awesome
nerd-fonts.jetbrains-mono
maple-mono.NF
];
programs.gnupg.agent = {
enable = true;
enableExtraSocket = true;
enableSSHSupport = true;
};
programs.steam = { programs.steam = {
enable = true; enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server dedicatedServer.openFirewall = true;
localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers localNetworkGameTransfers.openFirewall = true;
}; };
hardware.keyboard.zsa.enable = true; hardware.keyboard.zsa.enable = true;
hardware.ledger.enable = true; hardware.ledger.enable = true;
hardware.bluetooth.powerOnBoot = true;
environment.systemPackages = with pkgs; [ networking = {
# discord hostName = "matej-nixos";
vesktop useDHCP = false;
rocketchat-desktop networkmanager.enable = true;
telegram-desktop interfaces.enp5s0.ipv4.addresses = [
slack {
# address = "10.222.0.247";
ghostty prefixLength = 24;
mdbook }
pass
google-chrome
# nodejs
pavucontrol
protonmail-bridge
python3
zathura
smartmontools
marksman
mdformat
jellyfin-media-player
cider-2
libnotify # need this for runelite
bolt-launcher
ledger-live-desktop
]; ];
firewall.enable = false;
# Enable the X11 windowing system. defaultGateway = "10.222.0.1";
# services.xserver.enable = true; nameservers = [
"1.1.1.1"
# Configure keymap in X11 "8.8.8.8"
# services.xserver.xkb.layout = "us";
# services.xserver.xkb.options = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
services.printing.enable = true;
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
# Enable sound.
# hardware.pulseaudio.enable = true;
# OR
services.pipewire = {
enable = true;
# alsa.enable = true;
# alsa.support32Bit = true;
pulse.enable = true;
# jack.enable = true;
};
services.dbus.enable = true;
xdg = {
portal = {
xdgOpenUsePortal = true;
enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-wlr
pkgs.xdg-desktop-portal-gtk
]; ];
}; };
mime.defaultApplications = {
xdg.mime.defaultApplications = {
"application/pdf" = "org.pwmt.zathura.desktop"; "application/pdf" = "org.pwmt.zathura.desktop";
}; };
};
# Enable touchpad support (enabled default in most desktopManager).
# services.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
# users.users.alice = {
# isNormalUser = true;
# extraGroups = [ "wheel" ]; # Enable sudo for the user.
# packages = with pkgs; [
# tree
# ];
# };
programs.firefox.enable = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
# environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
# ];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh = {
enable = true;
ports = [ 22 ];
settings = {
PasswordAuthentication = false;
AllowUsers = null;
PermitRootLogin = "no";
StreamLocalBindUnlink = "yes";
};
};
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
# to actually do that.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "24.11"; # Did you read the comment?
system.stateVersion = "24.11";
} }

View File

@@ -1,6 +1,4 @@
# Do not modify this file! It was generated by nixos-generate-config # autogenerated by 'nixos-generate-config'
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ {
config, config,
lib, lib,
@@ -14,45 +12,17 @@
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
hardware.firmware = [ pkgs.linux-firmware ];
boot.initrd.availableKernelModules = [ boot.initrd.availableKernelModules = [
"nvme" "nvme"
"xhci_pci" "xhci_pci"
"ahci" "ahci"
"usbhid" "usbhid"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [
"dm-snapshot"
"r8169"
];
boot.kernelModules = [
"kvm-amd"
]; ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
boot.kernelParams = [
"ip=10.222.0.247::10.222.0.1:255.255.255.0::enp5s0:none"
];
boot.initrd.network = {
enable = true;
ssh = {
enable = true;
port = 22;
hostKeys = [
"/etc/secrets/initrd/ssh_host_rsa_key"
"/etc/secrets/initrd/ssh_host_ed25519_key"
];
authorizedKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICQGLdINKzs+sEy62Pefng0bcedgU396+OryFgeH99/c janezicmatej"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDk00+Km03epQXQs+xEwwH3zcurACzkEH+kDOPBw6RQe openpgp:0xB095D449"
];
};
postCommands = ''
echo 'cryptsetup-askpass' >> /root/.profile
'';
};
boot.initrd.luks.devices."cryptlvm".device = boot.initrd.luks.devices."cryptlvm".device =
"/dev/disk/by-uuid/af0608c0-67cd-4ae4-b12c-252fa947da40"; "/dev/disk/by-uuid/af0608c0-67cd-4ae4-b12c-252fa947da40";
@@ -75,76 +45,6 @@
{ device = "/dev/disk/by-uuid/ff4750e7-3a9f-42c2-bb68-c458a6560540"; } { device = "/dev/disk/by-uuid/ff4750e7-3a9f-42c2-bb68-c458a6560540"; }
]; ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking = {
useDHCP = false;
hostName = "matej-nixos";
networkmanager.enable = true; # Easiest to use and most distros use this by default.
interfaces.enp5s0.ipv4.addresses = [
{
address = "10.222.0.247";
prefixLength = 24;
}
];
firewall = {
enable = false;
allowedTCPPorts = lib.range 8800 8900;
};
defaultGateway = "10.222.0.1";
nameservers = [
"1.1.1.1"
"8.8.8.8"
];
};
# networking.interfaces.enp4s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
# TODO: maybe move later
hardware.bluetooth.enable = true; # enables support for Bluetooth
hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot
# Enable OpenGL
hardware.graphics = {
enable = true;
};
# Load nvidia driver for Xorg and Wayland
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
# Modesetting is required.
modesetting.enable = true;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
# Enable this if you have graphical corruption issues or application crashes after waking
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
# of just the bare essentials.
powerManagement.enable = false;
# Fine-grained power management. Turns off GPU when not in use.
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
powerManagement.finegrained = false;
# Use the NVidia open source kernel module (not to be confused with the
# independent third-party "nouveau" open source driver).
# Support is limited to the Turing and later architectures. Full list of
# supported GPUs is at:
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
# Only available from driver 515.43.04+
open = true;
# Enable the Nvidia settings menu,
# accessible via `nvidia-settings`.
nvidiaSettings = true;
# Optionally, you may need to select the appropriate driver version for your specific GPU.
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
} }

View File

@@ -1,7 +1,3 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ {
config, config,
lib, lib,
@@ -11,26 +7,41 @@
... ...
}: }:
let
packages = inputs.self.outputs.packages.${pkgs.stdenv.hostPlatform.system};
in
{ {
networking.hostName = "matej-tower";
imports = [ imports = [
inputs.stylix.nixosModules.stylix inputs.stylix.nixosModules.stylix
inputs.lanzaboote.nixosModules.lanzaboote inputs.lanzaboote.nixosModules.lanzaboote
inputs.self.nixosModules.yubikey inputs.self.nixosModules.yubikey
inputs.self.nixosModules.sway inputs.self.nixosModules.sway
inputs.self.nixosModules.openssh
inputs.self.nixosModules.desktop
inputs.self.nixosModules.printing
inputs.self.nixosModules.zsh
inputs.self.nixosModules.gnupg
inputs.self.nixosModules.tuigreet
inputs.self.nixosModules.workstation
inputs.self.nixosModules.initrd-ssh
]; ];
sway.enable = true;
yubikey.enable = true; yubikey.enable = true;
openssh.enable = true;
desktop.enable = true;
printing.enable = true;
zsh.enable = true;
gnupg.enable = true;
workstation.enable = true;
tuigreet = {
enable = true;
command = "sway";
};
sway.enable = true;
fonts.packages = with pkgs; [ initrd-ssh = {
font-awesome enable = true;
nerd-fonts.jetbrains-mono networkModule = "r8169";
maple-mono.NF };
];
stylix = { stylix = {
enable = true; enable = true;
@@ -39,254 +50,38 @@ in
base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-material-dark-medium.yaml"; base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-material-dark-medium.yaml";
}; };
virtualisation.docker = { # lanzaboote secure boot
enable = true; boot.kernelParams = [ "btusb.reset=1" ];
logDriver = "json-file";
};
# Use the systemd-boot EFI boot loader.
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
boot.loader.systemd-boot.enable = lib.mkForce false; boot.loader.systemd-boot.enable = lib.mkForce false;
boot.lanzaboote = { boot.lanzaboote = {
enable = true; enable = true;
pkiBundle = "/var/lib/sbctl"; pkiBundle = "/var/lib/sbctl";
}; };
services.udev.packages = with pkgs; [ time.timeZone = "Europe/Ljubljana";
yubikey-personalization environment.variables.TZ = "Europe/Ljubljana";
];
services.tailscale = {
enable = true;
useRoutingFeatures = "both";
};
services.udisks2.enable = true; services.udisks2.enable = true;
security.polkit.enable = true;
hardware.bluetooth.enable = true;
services.blueman.enable = true;
users.defaultUserShell = pkgs.zsh;
programs.zsh = {
enable = true;
};
environment.etc."zshenv".text = ''
export ZDOTDIR=$HOME/.config/zsh
'';
programs._1password.enable = true; programs._1password.enable = true;
programs._1password-gui.enable = true; programs._1password-gui.enable = true;
users.users.matej = { # higher sample rate for audio equipment
uid = 1000; services.pipewire.extraConfig.pipewire.adjust-sample-rate = {
isNormalUser = true;
home = "/home/matej";
extraGroups = [
"wheel"
"docker"
];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICQGLdINKzs+sEy62Pefng0bcedgU396+OryFgeH99/c janezicmatej"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDk00+Km03epQXQs+xEwwH3zcurACzkEH+kDOPBw6RQe openpgp:0xB095D449"
];
};
services.openssh = {
enable = true;
ports = [ 22 ];
settings = {
PasswordAuthentication = false;
AllowUsers = null;
PermitRootLogin = "no";
StreamLocalBindUnlink = "yes";
};
};
services.greetd = {
enable = true;
useTextGreeter = true;
settings = {
default_session = {
user = "greeter";
command = ''
${pkgs.tuigreet}/bin/tuigreet \
--time \
--remember \
--cmd "sway"
'';
};
};
};
networking.hostName = "matej-tower"; # Define your hostname.
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Set your time zone.
# time.timeZone = "Europe/Amsterdam";
time.timeZone = "Europe/Ljubljana";
environment.variables.TZ = "Europe/Ljubljana";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# useXkbConfig = true; # use xkb.options in tty.
# };
# Enable the X11 windowing system.
# services.xserver.enable = true;
# Configure keymap in X11
# services.xserver.xkb.layout = "us";
# services.xserver.xkb.options = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# services.pulseaudio.enable = true;
# OR
# services.pipewire = {
# enable = true;
# pulse.enable = true;
# };
# Enable touchpad support (enabled default in most desktopManager).
# services.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
# users.users.alice = {
# isNormalUser = true;
# extraGroups = [ "wheel" ]; # Enable sudo for the user.
# packages = with pkgs; [
# tree
# ];
# };
# programs.firefox.enable = true;
services.printing.enable = true;
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
services.pipewire = {
enable = true;
# alsa.enable = true;
# alsa.support32Bit = true;
pulse.enable = true;
# jack.enable = true;
extraConfig.pipewire.adjust-sample-rate = {
"context.properties" = { "context.properties" = {
"default.clock.rate" = 192000; "default.clock.rate" = 192000;
#"defautlt.allowed-rates" = [ 192000 48000 44100 ]; "default.allowed-rates" = [ 192000 ];
"defautlt.allowed-rates" = [ 192000 ];
# "default.clock.quantum" = 32;
# "default.clock.min-quantum" = 32;
# "default.clock.max-quantum" = 32;
};
};
};
services.dbus.enable = true;
services.playerctld.enable = true;
xdg = {
portal = {
xdgOpenUsePortal = true;
enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-wlr
pkgs.xdg-desktop-portal-gtk
];
};
mime.defaultApplications = {
"application/pdf" = "org.pwmt.zathura.desktop";
}; };
}; };
# List packages installed in system profile.
# You can use https://search.nixos.org/ to find more packages (and options).
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
vim
wget
ghostty
vesktop
rocketchat-desktop
telegram-desktop
slack
mdbook
google-chrome
pavucontrol
protonmail-bridge
python3
zathura
smartmontools
marksman
mdformat
jellyfin-media-player
cider-2
bolt-launcher
easyeffects easyeffects
]; ];
# Some programs need SUID wrappers, can be configured further or are xdg.mime.defaultApplications = {
# started in user sessions. "application/pdf" = "org.pwmt.zathura.desktop";
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
programs.gnupg.agent = {
enable = true;
enableExtraSocket = true;
enableSSHSupport = true;
}; };
# List services that you want to enable: system.stateVersion = "25.05";
# Enable the OpenSSH daemon.
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
# to actually do that.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "25.05"; # Did you read the comment?
} }

View File

@@ -1,6 +1,4 @@
# Do not modify this file! It was generated by nixos-generate-config # autogenerated by 'nixos-generate-config'
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ {
config, config,
lib, lib,
@@ -20,13 +18,9 @@
"nvme" "nvme"
"xhci_pci" "xhci_pci"
"ahci" "ahci"
"usb_storage" "usbhid"
"sd_mod"
];
boot.initrd.kernelModules = [
"dm-snapshot"
"r8169"
]; ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-amd" ]; boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
@@ -51,34 +45,6 @@
{ device = "/dev/disk/by-uuid/e0952ef2-1a9a-4022-bbcf-b2f016384258"; } { device = "/dev/disk/by-uuid/e0952ef2-1a9a-4022-bbcf-b2f016384258"; }
]; ];
boot.initrd.network = {
enable = true;
ssh = {
enable = true;
port = 22;
hostKeys = [
"/etc/secrets/initrd/ssh_host_rsa_key"
"/etc/secrets/initrd/ssh_host_ed25519_key"
];
authorizedKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICQGLdINKzs+sEy62Pefng0bcedgU396+OryFgeH99/c janezicmatej"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDk00+Km03epQXQs+xEwwH3zcurACzkEH+kDOPBw6RQe openpgp:0xB095D449"
];
};
postCommands = ''
echo 'cryptsetup-askpass' >> /root/.profile
'';
};
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp11s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
} }

View File

@@ -0,0 +1,132 @@
{
pkgs,
lib,
inputs,
...
}:
{
imports = [
./hardware-configuration.nix
inputs.self.nixosModules.vm-guest
inputs.self.nixosModules.desktop
inputs.self.nixosModules.zsh
];
vm-guest.enable = true;
desktop.enable = true;
zsh.enable = true;
programs.labwc.enable = true;
# labwc stacking compositor with auto-login
services.greetd =
let
labwc-session = pkgs.writeShellScript "labwc-session" ''
export XDG_SESSION_TYPE=wayland
export XDG_CURRENT_DESKTOP=labwc:wlroots
# software renderer for qemu virtio-vga
export WLR_RENDERER=pixman
export WLR_DRM_NO_ATOMIC=1
exec ${pkgs.labwc}/bin/labwc
'';
in
{
enable = true;
settings = {
default_session = {
command = labwc-session;
user = "gorazd";
};
initial_session = {
command = labwc-session;
user = "gorazd";
};
};
};
users = {
groups.gorazd = {
gid = 1000;
};
users.gorazd = {
group = "gorazd";
uid = 1000;
isNormalUser = true;
home = "/home/gorazd";
createHome = true;
password = "sandbox";
extraGroups = [
"wheel"
"users"
];
};
};
# 9p mounts for host files
fileSystems."/home/gorazd/projects" = {
device = "projects";
fsType = "9p";
options = [
"trans=virtio"
"version=9p2000.L"
"msize=65536"
"nofail"
];
};
fileSystems."/mnt/host-claude" = {
device = "hostclaude";
fsType = "9p";
options = [
"trans=virtio"
"version=9p2000.L"
"msize=65536"
"nofail"
];
};
fileSystems."/mnt/host-home" = {
device = "hosthome";
fsType = "9p";
options = [
"trans=virtio"
"version=9p2000.L"
"msize=65536"
"nofail"
"ro"
];
};
# pre-auth claude-code from host config
systemd.services.claude-auth = {
description = "Copy claude-code credentials from host mount";
after = [
"mnt-host\\x2dclaude.mount"
"mnt-host\\x2dhome.mount"
];
requires = [
"mnt-host\\x2dclaude.mount"
"mnt-host\\x2dhome.mount"
];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = pkgs.writeShellScript "claude-auth" ''
mkdir -p /home/gorazd/.claude
cp -a /mnt/host-claude/. /home/gorazd/.claude/
cp /mnt/host-home/.claude.json /home/gorazd/.claude.json || true
chown -R gorazd:gorazd /home/gorazd/.claude /home/gorazd/.claude.json
'';
};
};
environment.systemPackages = with pkgs; [
claude-code
labwc
sfwbar
foot
firefox
];
system.stateVersion = "25.11";
}

View File

@@ -0,0 +1,18 @@
{
lib,
modulesPath,
...
}:
{
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
autoResize = true;
fsType = "ext4";
};
boot.loader.grub.device = lib.mkDefault "/dev/vda";
}

View File

@@ -24,3 +24,37 @@ iso:
# garbage collect old generations # garbage collect old generations
clean: clean:
sudo nix-collect-garbage $(nix eval --raw -f ./nix.nix nix.gc.options) sudo nix-collect-garbage $(nix eval --raw -f ./nix.nix nix.gc.options)
# build sandbox VM image
sandbox-build:
nixos-rebuild build-image --image-variant qemu --flake .#sandbox
# run sandbox with GUI (ephemeral, changes discarded)
sandbox-run:
nix shell nixpkgs#qemu -c qemu-system-x86_64 -enable-kvm -m 8G -smp 4 \
-drive file=$(find -L result -name '*.qcow2' | head -1),format=qcow2,snapshot=on \
-vga virtio -display gtk,zoom-to-fit=false \
-device virtio-serial-pci \
-chardev qemu-vdagent,id=ch1,name=vdagent,clipboard=on \
-device virtserialport,chardev=ch1,id=ch1,name=com.redhat.spice.0 \
-virtfs local,path=$HOME/git,mount_tag=projects,security_model=mapped-xattr,id=fs0 \
-virtfs local,path=$HOME/.claude,mount_tag=hostclaude,security_model=mapped-xattr,id=fs1 \
-virtfs local,path=$HOME,mount_tag=hosthome,security_model=mapped-xattr,id=fs2,readonly=on \
-nic user,hostfwd=tcp::2222-:22
# run sandbox headless (ephemeral, changes discarded)
sandbox-run-headless:
nix shell nixpkgs#qemu -c qemu-system-x86_64 -enable-kvm -m 8G -smp 4 \
-drive file=$(find -L result -name '*.qcow2' | head -1),format=qcow2,snapshot=on \
-virtfs local,path=$HOME/git,mount_tag=projects,security_model=mapped-xattr,id=fs0 \
-virtfs local,path=$HOME/.claude,mount_tag=hostclaude,security_model=mapped-xattr,id=fs1 \
-virtfs local,path=$HOME,mount_tag=hosthome,security_model=mapped-xattr,id=fs2,readonly=on \
-nic user,hostfwd=tcp::2222-:22 -nographic
# ssh into running sandbox
sandbox-ssh:
ssh -A -p 2222 gorazd@localhost
# hot-mount a host directory into the running sandbox
sandbox-mount path:
ssh -p 2222 gorazd@localhost "mkdir -p ~/mnt/$(basename {{path}}) && sshfs matej@10.0.2.2:{{path}} ~/mnt/$(basename {{path}})"

View File

@@ -1,6 +1,6 @@
lib: lib:
# takes dir as an argument and creates an attribute set by importing all .nix files in that directory # import all .nix files in dir as attribute set
dir: dir:
let let
readDir = builtins.readDir dir; readDir = builtins.readDir dir;

View File

@@ -15,10 +15,12 @@ let
hostHWConfig = ../hosts/${name}/hardware-configuration.nix; hostHWConfig = ../hosts/${name}/hardware-configuration.nix;
hasHWConfig = builtins.pathExists hostHWConfig; hasHWConfig = builtins.pathExists hostHWConfig;
userHMConfigs = nixpkgs.lib.genAttrs users ( userNixosConfigs = map (user: ../users/${user}/nixos.nix) (
user: import ../users/${user}/home-manager.nix { inherit inputs; } builtins.filter (user: builtins.pathExists ../users/${user}/nixos.nix) users
); );
userHMConfigs = nixpkgs.lib.genAttrs users (user: import ../users/${user}/home-manager.nix);
in in
nixpkgs.lib.nixosSystem { nixpkgs.lib.nixosSystem {
inherit system; inherit system;
@@ -31,11 +33,13 @@ nixpkgs.lib.nixosSystem {
hostConfig hostConfig
] ]
++ nixpkgs.lib.optional hasHWConfig hostHWConfig ++ nixpkgs.lib.optional hasHWConfig hostHWConfig
++ userNixosConfigs
++ [ ++ [
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
{ {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.backupFileExtension = "backup";
home-manager.users = userHMConfigs; home-manager.users = userHMConfigs;
home-manager.extraSpecialArgs = { inherit inputs; }; home-manager.extraSpecialArgs = { inherit inputs; };
} }

44
modules/nixos/desktop.nix Normal file
View File

@@ -0,0 +1,44 @@
{
lib,
config,
pkgs,
...
}:
{
options = {
desktop = {
enable = lib.mkEnableOption "base desktop environment";
};
};
config = lib.mkIf config.desktop.enable {
services.pipewire = {
enable = true;
pulse.enable = true;
};
hardware.bluetooth.enable = true;
services.blueman.enable = true;
security.polkit.enable = true;
services.dbus.enable = true;
services.playerctld.enable = true;
xdg.portal = {
enable = true;
xdgOpenUsePortal = true;
extraPortals = [
pkgs.xdg-desktop-portal-wlr
pkgs.xdg-desktop-portal-gtk
];
};
fonts.packages = with pkgs; [
font-awesome
nerd-fonts.jetbrains-mono
maple-mono.NF
];
};
}

20
modules/nixos/gnupg.nix Normal file
View File

@@ -0,0 +1,20 @@
{
lib,
config,
...
}:
{
options = {
gnupg = {
enable = lib.mkEnableOption "GnuPG agent with SSH support";
};
};
config = lib.mkIf config.gnupg.enable {
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
enableExtraSocket = true;
};
};
}

View File

@@ -0,0 +1,86 @@
{
lib,
config,
...
}:
let
# TODO:(@janezicmatej) restructure keys import
keys = import ../../users/matej/keys.nix;
# generate host keys for new machines: ./scripts/initrd-ssh-keygen.sh
keyDir = "/etc/secrets/initrd";
mkIpString =
{
address,
gateway,
netmask,
interface,
...
}:
"${address}::${gateway}:${netmask}::${interface}:none";
in
{
options = {
initrd-ssh = {
enable = lib.mkEnableOption "SSH in initrd for remote LUKS unlock";
ip = {
enable = lib.mkEnableOption "static IP for initrd (otherwise DHCP)";
address = lib.mkOption {
type = lib.types.str;
example = "10.222.0.247";
};
gateway = lib.mkOption {
type = lib.types.str;
example = "10.222.0.1";
};
netmask = lib.mkOption {
type = lib.types.str;
default = "255.255.255.0";
};
interface = lib.mkOption {
type = lib.types.str;
example = "enp5s0";
};
};
authorizedKeys = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = keys.sshAuthorizedKeys;
};
networkModule = lib.mkOption {
type = lib.types.str;
example = "r8169";
};
};
};
config = lib.mkIf config.initrd-ssh.enable {
boot.initrd.kernelModules = [ config.initrd-ssh.networkModule ];
boot.kernelParams = lib.mkIf config.initrd-ssh.ip.enable [
"ip=${mkIpString config.initrd-ssh.ip}"
];
boot.initrd.network = {
enable = true;
ssh = {
enable = true;
port = 22;
hostKeys = [
"${keyDir}/ssh_host_rsa_key"
"${keyDir}/ssh_host_ed25519_key"
];
inherit (config.initrd-ssh) authorizedKeys;
};
postCommands = ''
echo 'cryptsetup-askpass' >> /root/.profile
'';
};
};
}

23
modules/nixos/nvidia.nix Normal file
View File

@@ -0,0 +1,23 @@
{
lib,
config,
...
}:
{
options = {
nvidia.enable = lib.mkEnableOption "NVIDIA GPU support";
};
config = lib.mkIf config.nvidia.enable {
hardware.graphics.enable = true;
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
modesetting.enable = true;
open = true;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
};
}

29
modules/nixos/openssh.nix Normal file
View File

@@ -0,0 +1,29 @@
{
lib,
config,
...
}:
{
options = {
openssh = {
enable = lib.mkEnableOption "hardened SSH server";
port = lib.mkOption {
type = lib.types.port;
default = 22;
};
};
};
config = lib.mkIf config.openssh.enable {
services.openssh = {
enable = true;
ports = [ config.openssh.port ];
settings = {
PasswordAuthentication = false;
AllowUsers = null;
PermitRootLogin = "no";
StreamLocalBindUnlink = "yes";
};
};
};
}

View File

@@ -0,0 +1,21 @@
{
lib,
config,
...
}:
{
options = {
printing = {
enable = lib.mkEnableOption "CUPS printing with Avahi discovery";
};
};
config = lib.mkIf config.printing.enable {
services.printing.enable = true;
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
};
}

View File

@@ -12,7 +12,6 @@
cmdFlags = lib.mkOption { cmdFlags = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
default = [ ]; default = [ ];
description = "additional command line flags to pass to sway";
}; };
}; };
}; };
@@ -24,23 +23,20 @@
wrapperFeatures.gtk = true; wrapperFeatures.gtk = true;
extraOptions = config.sway.cmdFlags; extraOptions = config.sway.cmdFlags;
extraSessionCommands = '' extraSessionCommands = ''
# Fix for some Java AWT applications (e.g. Android Studio), # fix for java awt apps not rendering
# use this if they aren't displayed properly:
export _JAVA_AWT_WM_NONREPARENTING=1 export _JAVA_AWT_WM_NONREPARENTING=1
''; '';
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# default extra packages
brightnessctl brightnessctl
foot foot
grim grim
pulseaudio pulseaudio
swayidle swayidle
# swaylock - use swaylock-effects instead # use swaylock-effects instead of swaylock
swaylock-effects swaylock-effects
wmenu wmenu
# additional things i like
slurp slurp
wofi wofi
wl-clipboard wl-clipboard

View File

@@ -0,0 +1,33 @@
{
lib,
config,
pkgs,
...
}:
{
options = {
tuigreet = {
enable = lib.mkEnableOption "greetd with tuigreet";
command = lib.mkOption {
type = lib.types.str;
};
};
};
config = lib.mkIf config.tuigreet.enable {
services.greetd = {
enable = true;
useTextGreeter = true;
settings = {
default_session = {
command = pkgs.writeShellScript "tuigreet-session" ''
${pkgs.util-linux}/bin/setterm --blank 1 --powersave powerdown --powerdown 1
exec ${pkgs.tuigreet}/bin/tuigreet --time --remember --cmd ${config.tuigreet.command}
'';
user = "greeter";
};
};
};
};
}

View File

@@ -0,0 +1,55 @@
{
pkgs,
lib,
config,
...
}:
{
options = {
vm-guest = {
enable = lib.mkEnableOption "VM guest configuration";
};
};
config = lib.mkIf config.vm-guest.enable {
services.qemuGuest.enable = true;
services.spice-vdagentd.enable = true;
# 9p for host file mounting
boot.initrd.availableKernelModules = [
"9p"
"9pnet_virtio"
];
boot.kernelModules = [
"9p"
"9pnet_virtio"
];
# ssh with agent forwarding for git and hot-mount
services.openssh = {
enable = true;
ports = [ 22 ];
settings = {
PasswordAuthentication = true;
PermitRootLogin = "no";
AllowAgentForwarding = true;
StreamLocalBindUnlink = "yes";
};
};
networking = {
useDHCP = true;
firewall.allowedTCPPorts = [ 22 ];
};
security.sudo.wheelNeedsPassword = false;
environment.systemPackages = with pkgs; [
curl
wget
htop
sshfs
];
};
}

View File

@@ -0,0 +1,29 @@
{
lib,
config,
pkgs,
...
}:
{
options = {
workstation = {
enable = lib.mkEnableOption "workstation utilities";
};
};
config = lib.mkIf config.workstation.enable {
virtualisation.docker = {
enable = true;
logDriver = "json-file";
};
services.tailscale = {
enable = true;
useRoutingFeatures = "both";
};
environment.systemPackages = with pkgs; [
smartmontools
];
};
}

19
modules/nixos/zsh.nix Normal file
View File

@@ -0,0 +1,19 @@
{
lib,
config,
...
}:
{
options = {
zsh = {
enable = lib.mkEnableOption "zsh with ZDOTDIR in ~/.config/zsh";
};
};
config = lib.mkIf config.zsh.enable {
programs.zsh.enable = true;
environment.etc."zshenv".text = ''
export ZDOTDIR=$HOME/.config/zsh
'';
};
}

View File

@@ -1,7 +1,6 @@
{ nixpkgs, system, ... }: { pkgs, ... }:
let let
pkgs = import nixpkgs { inherit system; };
version = "v0.3.2"; version = "v0.3.2";
in in
pkgs.rustPlatform.buildRustPackage { pkgs.rustPlatform.buildRustPackage {

View File

@@ -1,13 +1,12 @@
{ nixpkgs, system, ... }: { pkgs, ... }:
let let
pkgs = import nixpkgs { inherit system; };
version = "C6r62em"; version = "C6r62em";
in in
pkgs.stdenv.mkDerivation { pkgs.stdenv.mkDerivation {
pname = "ca-matheo-si"; pname = "ca-matheo-si";
version = version; inherit version;
src = pkgs.fetchurl { src = pkgs.fetchurl {
url = "http://ipa2.matheo.si/ipa/config/ca.crt"; url = "http://ipa2.matheo.si/ipa/config/ca.crt";

View File

@@ -1,8 +1,7 @@
{ nixpkgs-master, system, ... }: { pkgs-master, ... }:
let let
nixpkgs = nixpkgs-master; pkgs = pkgs-master;
pkgs = import nixpkgs { inherit system; };
version = "e24855c"; version = "e24855c";
in in
pkgs.buildGoModule.override pkgs.buildGoModule.override

View File

@@ -1,7 +1,6 @@
{ nixpkgs, system, ... }: { pkgs, ... }:
let let
pkgs = import nixpkgs { inherit system; };
version = "main"; version = "main";
in in
pkgs.stdenv.mkDerivation { pkgs.stdenv.mkDerivation {

View File

@@ -1,28 +0,0 @@
{ nixpkgs-master, system, ... }:
let
nixpkgs = nixpkgs-master;
pkgs = import nixpkgs { inherit system; };
version = "v1.25.0";
python = pkgs.python313;
in
python.pkgs.buildPythonPackage rec {
pname = "releasectl";
version = "1.2.0";
src = pkgs.fetchurl {
url = "https://gitlab.com/flarenetwork/infra-public/pipeliner/-/package_files/216813866/download";
sha256 = "sha256-ScBG8BoOKDdOAHTFP+zwyk+Kfu31WoKQSRkutOvnJ5E";
};
format = "wheel"; # if it uses poetry/PEP517, otherwise "setuptools"
# nativeBuildInputs = [ python.pkgs.setuptools python.pkgs.wheel ];
# propagatedBuildInputs = with python.pkgs; [
# # add runtime deps here if needed
# ];
# pyproject = true;
# build-system = [ pkgs.python313Packages.hatchling ];
}

24
scripts/initrd-ssh-keygen.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail
KEY_DIR="/etc/secrets/initrd"
echo "Generating initrd SSH host keys in $KEY_DIR"
sudo mkdir -p "$KEY_DIR"
if [[ ! -f "$KEY_DIR/ssh_host_rsa_key" ]]; then
sudo ssh-keygen -t rsa -N "" -f "$KEY_DIR/ssh_host_rsa_key"
echo "Generated: $KEY_DIR/ssh_host_rsa_key"
else
echo "Exists: $KEY_DIR/ssh_host_rsa_key"
fi
if [[ ! -f "$KEY_DIR/ssh_host_ed25519_key" ]]; then
sudo ssh-keygen -t ed25519 -N "" -f "$KEY_DIR/ssh_host_ed25519_key"
echo "Generated: $KEY_DIR/ssh_host_ed25519_key"
else
echo "Exists: $KEY_DIR/ssh_host_ed25519_key"
fi
echo "Done. Now run nixos-rebuild."

1
statix.toml Normal file
View File

@@ -0,0 +1 @@
disabled = ["repeated_keys"]

View File

@@ -1,5 +1,3 @@
{ inputs, ... }:
{ {
config, config,
lib, lib,
@@ -19,6 +17,26 @@ in
pkgs.git pkgs.git
]; ];
# labwc desktop menu (right-click)
xdg.configFile."labwc/menu.xml".text = ''
<?xml version="1.0" encoding="UTF-8"?>
<openbox_menu>
<menu id="root-menu" label="">
<item label="Terminal"><action name="Execute"><command>foot</command></action></item>
<item label="Firefox"><action name="Execute"><command>firefox</command></action></item>
<item label="Files"><action name="Execute"><command>foot -e ranger</command></action></item>
<separator />
<item label="Reconfigure"><action name="Reconfigure" /></item>
<item label="Exit"><action name="Exit" /></item>
</menu>
</openbox_menu>
'';
# labwc autostart panel
xdg.configFile."labwc/autostart".text = ''
sfwbar &
'';
programs.neovim = { programs.neovim = {
enable = true; enable = true;
vimAlias = true; vimAlias = true;

View File

@@ -1,5 +1,3 @@
{ inputs, ... }:
{ {
config, config,
lib, lib,
@@ -15,12 +13,11 @@ in
{ {
home.stateVersion = "24.11"; home.stateVersion = "24.11";
# TODO:(janezicmatej) do i need this here? # TODO:(@janezicmatej) do i need this here?
services.dunst.enable = true; services.dunst.enable = true;
home.packages = [ home.packages = [
pkgs.bibata-cursors pkgs.bibata-cursors
pkgs.pinentry-curses
pkgs.starship pkgs.starship
@@ -54,6 +51,31 @@ in
# need for gcp stuff # need for gcp stuff
pkgs.google-cloud-sdk pkgs.google-cloud-sdk
pkgs.google-cloud-sql-proxy pkgs.google-cloud-sql-proxy
# desktop apps
pkgs.vesktop
pkgs.rocketchat-desktop
pkgs.telegram-desktop
pkgs.slack
pkgs.ghostty
pkgs.google-chrome
pkgs.zathura
pkgs.pavucontrol
pkgs.jellyfin-media-player
pkgs.cider-2
pkgs.protonmail-bridge
pkgs.ledger-live-desktop
pkgs.bolt-launcher
pkgs.libnotify
# writing/docs
pkgs.mdbook
pkgs.marksman
pkgs.mdformat
# security
pkgs.gnupg
pkgs.pass
]; ];
home.file.".assets".source = inputs.assets; home.file.".assets".source = inputs.assets;
@@ -77,7 +99,6 @@ in
luajit luajit
nodejs_22 # copilot nodejs_22 # copilot
# treesitter
tree-sitter tree-sitter
# lua_fzf # lua_fzf
@@ -87,7 +108,6 @@ in
gnumake gnumake
delta delta
# language server
pyright pyright
typescript-language-server typescript-language-server
lua-language-server lua-language-server
@@ -95,7 +115,6 @@ in
nil nil
nixd nixd
# formatters
nixpkgs-fmt nixpkgs-fmt
stylua stylua
]; ];

6
users/matej/keys.nix Normal file
View File

@@ -0,0 +1,6 @@
{
sshAuthorizedKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICQGLdINKzs+sEy62Pefng0bcedgU396+OryFgeH99/c janezicmatej"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDk00+Km03epQXQs+xEwwH3zcurACzkEH+kDOPBw6RQe openpgp:0xB095D449"
];
}

27
users/matej/nixos.nix Normal file
View File

@@ -0,0 +1,27 @@
{
lib,
config,
pkgs,
...
}:
let
keys = import ./keys.nix;
in
{
users.users.matej = {
uid = 1000;
isNormalUser = true;
home = "/home/matej";
shell = pkgs.zsh;
extraGroups = [
"wheel"
"docker"
];
openssh.authorizedKeys.keys = keys.sshAuthorizedKeys;
};
users.groups.matej = {
gid = 1000;
members = [ "matej" ];
};
}