Compare commits
9 Commits
fdd7831732
...
sandbox
| Author | SHA1 | Date | |
|---|---|---|---|
|
3b6f4c7f28
|
|||
|
5b19dec3c3
|
|||
|
97b7348c2b
|
|||
|
b6ae96cb84
|
|||
|
25735d5bd1
|
|||
|
3aff25b448
|
|||
|
e6cad243de
|
|||
|
0a6e024b78
|
|||
|
3c643a411e
|
@@ -1,2 +1,3 @@
|
|||||||
# nix fmt
|
# nix fmt & statix
|
||||||
f011c8d71ba09bd94ab04b8d771858b90a03fbf9
|
f011c8d71ba09bd94ab04b8d771858b90a03fbf9
|
||||||
|
3aff25b4486a143cd6282f8845c16216598e1c7e
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
38
flake.nix
38
flake.nix
@@ -50,15 +50,19 @@
|
|||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
my-lib = import ./lib { lib = nixpkgs.lib; };
|
my-lib = import ./lib { inherit (nixpkgs) lib; };
|
||||||
|
|
||||||
overlays = [
|
overlays = [
|
||||||
(_: prev: {
|
(_: prev: {
|
||||||
claude-code =
|
inherit
|
||||||
|
(
|
||||||
(import inputs.nixpkgs-unstable {
|
(import inputs.nixpkgs-unstable {
|
||||||
system = prev.stdenv.hostPlatform.system;
|
inherit (prev.stdenv.hostPlatform) system;
|
||||||
config.allowUnfree = true;
|
config.allowUnfree = true;
|
||||||
}).claude-code;
|
})
|
||||||
|
)
|
||||||
|
claude-code
|
||||||
|
;
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -90,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 (
|
||||||
@@ -103,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
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ in
|
|||||||
inputs.self.nixosModules.initrd-ssh
|
inputs.self.nixosModules.initrd-ssh
|
||||||
];
|
];
|
||||||
|
|
||||||
# Modules
|
|
||||||
yubikey.enable = true;
|
yubikey.enable = true;
|
||||||
openssh.enable = true;
|
openssh.enable = true;
|
||||||
desktop.enable = true;
|
desktop.enable = true;
|
||||||
@@ -58,7 +57,6 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Stylix theming
|
|
||||||
stylix = {
|
stylix = {
|
||||||
enable = true;
|
enable = true;
|
||||||
polarity = "dark";
|
polarity = "dark";
|
||||||
@@ -66,28 +64,22 @@ in
|
|||||||
base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-material-dark-medium.yaml";
|
base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-material-dark-medium.yaml";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Boot
|
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
|
||||||
# Locale
|
|
||||||
time.timeZone = "Europe/Ljubljana";
|
time.timeZone = "Europe/Ljubljana";
|
||||||
environment.variables.TZ = "America/New_York";
|
environment.variables.TZ = "America/New_York";
|
||||||
i18n.defaultLocale = "en_US.UTF-8";
|
i18n.defaultLocale = "en_US.UTF-8";
|
||||||
|
|
||||||
# nix-ld for pip-installed binaries
|
# WARN:(@janezicmatej) nix-ld for running pip-installed binaries outside nix, probably want to drop this
|
||||||
# WARN:(matej) probably want to drop this in the future
|
|
||||||
programs.nix-ld.enable = true;
|
programs.nix-ld.enable = true;
|
||||||
programs.nix-ld.libraries = options.programs.nix-ld.libraries.default;
|
programs.nix-ld.libraries = options.programs.nix-ld.libraries.default;
|
||||||
|
|
||||||
# Security
|
|
||||||
security.pki.certificateFiles = [ packages.ca-matheo-si ];
|
security.pki.certificateFiles = [ packages.ca-matheo-si ];
|
||||||
services.gnome.gnome-keyring.enable = true;
|
services.gnome.gnome-keyring.enable = true;
|
||||||
|
|
||||||
# Services
|
|
||||||
services.teamviewer.enable = true;
|
services.teamviewer.enable = true;
|
||||||
|
|
||||||
# Programs
|
|
||||||
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;
|
||||||
@@ -99,12 +91,10 @@ in
|
|||||||
localNetworkGameTransfers.openFirewall = true;
|
localNetworkGameTransfers.openFirewall = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Hardware
|
|
||||||
hardware.keyboard.zsa.enable = true;
|
hardware.keyboard.zsa.enable = true;
|
||||||
hardware.ledger.enable = true;
|
hardware.ledger.enable = true;
|
||||||
hardware.bluetooth.powerOnBoot = true;
|
hardware.bluetooth.powerOnBoot = true;
|
||||||
|
|
||||||
# Networking
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "matej-nixos";
|
hostName = "matej-nixos";
|
||||||
useDHCP = false;
|
useDHCP = false;
|
||||||
@@ -123,7 +113,6 @@ in
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# XDG
|
|
||||||
xdg.mime.defaultApplications = {
|
xdg.mime.defaultApplications = {
|
||||||
"application/pdf" = "org.pwmt.zathura.desktop";
|
"application/pdf" = "org.pwmt.zathura.desktop";
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
inputs.self.nixosModules.initrd-ssh
|
inputs.self.nixosModules.initrd-ssh
|
||||||
];
|
];
|
||||||
|
|
||||||
# Modules
|
|
||||||
yubikey.enable = true;
|
yubikey.enable = true;
|
||||||
openssh.enable = true;
|
openssh.enable = true;
|
||||||
desktop.enable = true;
|
desktop.enable = true;
|
||||||
@@ -44,7 +43,6 @@
|
|||||||
networkModule = "r8169";
|
networkModule = "r8169";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Stylix theming
|
|
||||||
stylix = {
|
stylix = {
|
||||||
enable = true;
|
enable = true;
|
||||||
polarity = "dark";
|
polarity = "dark";
|
||||||
@@ -52,7 +50,7 @@
|
|||||||
base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-material-dark-medium.yaml";
|
base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-material-dark-medium.yaml";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Boot - Lanzaboote secure boot
|
# lanzaboote secure boot
|
||||||
boot.kernelParams = [ "btusb.reset=1" ];
|
boot.kernelParams = [ "btusb.reset=1" ];
|
||||||
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;
|
||||||
@@ -61,18 +59,15 @@
|
|||||||
pkiBundle = "/var/lib/sbctl";
|
pkiBundle = "/var/lib/sbctl";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Locale
|
|
||||||
time.timeZone = "Europe/Ljubljana";
|
time.timeZone = "Europe/Ljubljana";
|
||||||
environment.variables.TZ = "Europe/Ljubljana";
|
environment.variables.TZ = "Europe/Ljubljana";
|
||||||
|
|
||||||
# Services
|
|
||||||
services.udisks2.enable = true;
|
services.udisks2.enable = true;
|
||||||
|
|
||||||
# Programs
|
|
||||||
programs._1password.enable = true;
|
programs._1password.enable = true;
|
||||||
programs._1password-gui.enable = true;
|
programs._1password-gui.enable = true;
|
||||||
|
|
||||||
# Higher sample rate pipewire for audio equipment
|
# higher sample rate for audio equipment
|
||||||
services.pipewire.extraConfig.pipewire.adjust-sample-rate = {
|
services.pipewire.extraConfig.pipewire.adjust-sample-rate = {
|
||||||
"context.properties" = {
|
"context.properties" = {
|
||||||
"default.clock.rate" = 192000;
|
"default.clock.rate" = 192000;
|
||||||
@@ -80,12 +75,10 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# System packages
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
easyeffects
|
easyeffects
|
||||||
];
|
];
|
||||||
|
|
||||||
# XDG
|
|
||||||
xdg.mime.defaultApplications = {
|
xdg.mime.defaultApplications = {
|
||||||
"application/pdf" = "org.pwmt.zathura.desktop";
|
"application/pdf" = "org.pwmt.zathura.desktop";
|
||||||
};
|
};
|
||||||
|
|||||||
132
hosts/sandbox/configuration.nix
Normal file
132
hosts/sandbox/configuration.nix
Normal 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";
|
||||||
|
}
|
||||||
18
hosts/sandbox/hardware-configuration.nix
Normal file
18
hosts/sandbox/hardware-configuration.nix
Normal 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";
|
||||||
|
}
|
||||||
34
justfile
34
justfile
@@ -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}})"
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -15,12 +15,10 @@ let
|
|||||||
hostHWConfig = ../hosts/${name}/hardware-configuration.nix;
|
hostHWConfig = ../hosts/${name}/hardware-configuration.nix;
|
||||||
hasHWConfig = builtins.pathExists hostHWConfig;
|
hasHWConfig = builtins.pathExists hostHWConfig;
|
||||||
|
|
||||||
# Load NixOS-level user config (account, groups, SSH keys)
|
|
||||||
userNixosConfigs = map (user: ../users/${user}/nixos.nix) (
|
userNixosConfigs = map (user: ../users/${user}/nixos.nix) (
|
||||||
builtins.filter (user: builtins.pathExists ../users/${user}/nixos.nix) users
|
builtins.filter (user: builtins.pathExists ../users/${user}/nixos.nix) users
|
||||||
);
|
);
|
||||||
|
|
||||||
# Load home-manager user config
|
|
||||||
userHMConfigs = nixpkgs.lib.genAttrs users (user: import ../users/${user}/home-manager.nix);
|
userHMConfigs = nixpkgs.lib.genAttrs users (user: import ../users/${user}/home-manager.nix);
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|||||||
@@ -12,26 +12,20 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.desktop.enable {
|
config = lib.mkIf config.desktop.enable {
|
||||||
# Audio
|
|
||||||
services.pipewire = {
|
services.pipewire = {
|
||||||
enable = true;
|
enable = true;
|
||||||
pulse.enable = true;
|
pulse.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Bluetooth
|
|
||||||
hardware.bluetooth.enable = true;
|
hardware.bluetooth.enable = true;
|
||||||
services.blueman.enable = true;
|
services.blueman.enable = true;
|
||||||
|
|
||||||
# Security
|
|
||||||
security.polkit.enable = true;
|
security.polkit.enable = true;
|
||||||
|
|
||||||
# D-Bus
|
|
||||||
services.dbus.enable = true;
|
services.dbus.enable = true;
|
||||||
|
|
||||||
# Player control
|
|
||||||
services.playerctld.enable = true;
|
services.playerctld.enable = true;
|
||||||
|
|
||||||
# XDG Portals
|
|
||||||
xdg.portal = {
|
xdg.portal = {
|
||||||
enable = true;
|
enable = true;
|
||||||
xdgOpenUsePortal = true;
|
xdgOpenUsePortal = true;
|
||||||
@@ -41,7 +35,6 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Fonts
|
|
||||||
fonts.packages = with pkgs; [
|
fonts.packages = with pkgs; [
|
||||||
font-awesome
|
font-awesome
|
||||||
nerd-fonts.jetbrains-mono
|
nerd-fonts.jetbrains-mono
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ let
|
|||||||
# TODO:(@janezicmatej) restructure keys import
|
# TODO:(@janezicmatej) restructure keys import
|
||||||
keys = import ../../users/matej/keys.nix;
|
keys = import ../../users/matej/keys.nix;
|
||||||
|
|
||||||
cfg = config.initrd-ssh;
|
# generate host keys for new machines: ./scripts/initrd-ssh-keygen.sh
|
||||||
|
|
||||||
# Generate keys on new machines: ./scripts/initrd-ssh-keygen.sh
|
|
||||||
keyDir = "/etc/secrets/initrd";
|
keyDir = "/etc/secrets/initrd";
|
||||||
|
|
||||||
mkIpString =
|
mkIpString =
|
||||||
@@ -32,25 +30,21 @@ in
|
|||||||
|
|
||||||
address = lib.mkOption {
|
address = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "Static IP address";
|
|
||||||
example = "10.222.0.247";
|
example = "10.222.0.247";
|
||||||
};
|
};
|
||||||
|
|
||||||
gateway = lib.mkOption {
|
gateway = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "Gateway address";
|
|
||||||
example = "10.222.0.1";
|
example = "10.222.0.1";
|
||||||
};
|
};
|
||||||
|
|
||||||
netmask = lib.mkOption {
|
netmask = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "255.255.255.0";
|
default = "255.255.255.0";
|
||||||
description = "Network mask";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
interface = lib.mkOption {
|
interface = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "Network interface";
|
|
||||||
example = "enp5s0";
|
example = "enp5s0";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -58,21 +52,19 @@ in
|
|||||||
authorizedKeys = lib.mkOption {
|
authorizedKeys = lib.mkOption {
|
||||||
type = lib.types.listOf lib.types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
default = keys.sshAuthorizedKeys;
|
default = keys.sshAuthorizedKeys;
|
||||||
description = "SSH public keys authorized for initrd unlock";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
networkModule = lib.mkOption {
|
networkModule = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "Kernel module for network interface (e.g., r8169, e1000e)";
|
|
||||||
example = "r8169";
|
example = "r8169";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf config.initrd-ssh.enable {
|
||||||
boot.initrd.kernelModules = [ cfg.networkModule ];
|
boot.initrd.kernelModules = [ config.initrd-ssh.networkModule ];
|
||||||
boot.kernelParams = lib.mkIf cfg.ip.enable [
|
boot.kernelParams = lib.mkIf config.initrd-ssh.ip.enable [
|
||||||
"ip=${mkIpString cfg.ip}"
|
"ip=${mkIpString config.initrd-ssh.ip}"
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.initrd.network = {
|
boot.initrd.network = {
|
||||||
@@ -84,7 +76,7 @@ in
|
|||||||
"${keyDir}/ssh_host_rsa_key"
|
"${keyDir}/ssh_host_rsa_key"
|
||||||
"${keyDir}/ssh_host_ed25519_key"
|
"${keyDir}/ssh_host_ed25519_key"
|
||||||
];
|
];
|
||||||
authorizedKeys = cfg.authorizedKeys;
|
inherit (config.initrd-ssh) authorizedKeys;
|
||||||
};
|
};
|
||||||
postCommands = ''
|
postCommands = ''
|
||||||
echo 'cryptsetup-askpass' >> /root/.profile
|
echo 'cryptsetup-askpass' >> /root/.profile
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
port = lib.mkOption {
|
port = lib.mkOption {
|
||||||
type = lib.types.port;
|
type = lib.types.port;
|
||||||
default = 22;
|
default = 22;
|
||||||
description = "SSH server port";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -4,9 +4,6 @@
|
|||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
|
||||||
cfg = config.tuigreet;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
tuigreet = {
|
tuigreet = {
|
||||||
@@ -14,23 +11,20 @@ in
|
|||||||
|
|
||||||
command = lib.mkOption {
|
command = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "Session command to launch";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf config.tuigreet.enable {
|
||||||
services.greetd = {
|
services.greetd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
useTextGreeter = true;
|
useTextGreeter = true;
|
||||||
settings = {
|
settings = {
|
||||||
default_session = {
|
default_session = {
|
||||||
command = builtins.toString (
|
command = pkgs.writeShellScript "tuigreet-session" ''
|
||||||
pkgs.writeShellScript "tuigreet-session" ''
|
|
||||||
${pkgs.util-linux}/bin/setterm --blank 1 --powersave powerdown --powerdown 1
|
${pkgs.util-linux}/bin/setterm --blank 1 --powersave powerdown --powerdown 1
|
||||||
exec ${pkgs.tuigreet}/bin/tuigreet --time --remember --cmd ${cfg.command}
|
exec ${pkgs.tuigreet}/bin/tuigreet --time --remember --cmd ${config.tuigreet.command}
|
||||||
''
|
'';
|
||||||
);
|
|
||||||
user = "greeter";
|
user = "greeter";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
55
modules/nixos/vm-guest.nix
Normal file
55
modules/nixos/vm-guest.nix
Normal 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
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -4,9 +4,6 @@
|
|||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
|
||||||
cfg = config.workstation;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
workstation = {
|
workstation = {
|
||||||
@@ -14,7 +11,7 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf config.workstation.enable {
|
||||||
virtualisation.docker = {
|
virtualisation.docker = {
|
||||||
enable = true;
|
enable = true;
|
||||||
logDriver = "json-file";
|
logDriver = "json-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 {
|
||||||
|
|||||||
@@ -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";
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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 ];
|
|
||||||
|
|
||||||
}
|
|
||||||
1
statix.toml
Normal file
1
statix.toml
Normal file
@@ -0,0 +1 @@
|
|||||||
|
disabled = ["repeated_keys"]
|
||||||
@@ -17,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;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ 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 = [
|
||||||
@@ -99,7 +99,6 @@ in
|
|||||||
luajit
|
luajit
|
||||||
nodejs_22 # copilot
|
nodejs_22 # copilot
|
||||||
|
|
||||||
# treesitter
|
|
||||||
tree-sitter
|
tree-sitter
|
||||||
|
|
||||||
# lua_fzf
|
# lua_fzf
|
||||||
@@ -109,7 +108,6 @@ in
|
|||||||
gnumake
|
gnumake
|
||||||
delta
|
delta
|
||||||
|
|
||||||
# language server
|
|
||||||
pyright
|
pyright
|
||||||
typescript-language-server
|
typescript-language-server
|
||||||
lua-language-server
|
lua-language-server
|
||||||
@@ -117,7 +115,6 @@ in
|
|||||||
nil
|
nil
|
||||||
nixd
|
nixd
|
||||||
|
|
||||||
# formatters
|
|
||||||
nixpkgs-fmt
|
nixpkgs-fmt
|
||||||
stylua
|
stylua
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user