Apply nixfmt

This commit is contained in:
Alexander Heldt
2024-09-02 21:55:26 +02:00
parent bda8def5fe
commit f15701f426
61 changed files with 803 additions and 488 deletions

View File

@@ -1,4 +1,10 @@
{ inputs, pkgs, lib, config, ... }: {
inputs,
pkgs,
lib,
config,
...
}:
let let
flakePath = config.config-manager.flakePath; flakePath = config.config-manager.flakePath;
nixosConfiguration = config.config-manager.nixosConfiguration; nixosConfiguration = config.config-manager.nixosConfiguration;
@@ -12,49 +18,49 @@ let
throw "'config-manager.nixosConfiguration' cannot be empty" throw "'config-manager.nixosConfiguration' cannot be empty"
else else
pkgs.writeShellScriptBin "cm" '' pkgs.writeShellScriptBin "cm" ''
help() { help() {
cat << EOF cat << EOF
Usage: Usage:
cm [flag] cm [flag]
Flags: Flags:
--update updates the flake --update updates the flake
--switch rebuilds + switches configuration (using 'nh') --switch rebuilds + switches configuration (using 'nh')
--build-test-vm, --btvm build test-vm --build-test-vm, --btvm build test-vm
--run-test-vm, --rtvm run test-vm --run-test-vm, --rtvm run test-vm
EOF EOF
} }
update() { update() {
echo -e "\033[0;31mUPDATING FLAKE\033[0m" echo -e "\033[0;31mUPDATING FLAKE\033[0m"
nix flake update ${flakePath} nix flake update ${flakePath}
} }
switch() { switch() {
nixos-rebuild dry-build --flake ${flakePath}#${nixosConfiguration} nixos-rebuild dry-build --flake ${flakePath}#${nixosConfiguration}
${nh}/bin/nh os switch --hostname ${nixosConfiguration} ${flakePath} ${nh}/bin/nh os switch --hostname ${nixosConfiguration} ${flakePath}
} }
build-test-vm() { build-test-vm() {
nixos-rebuild build-vm --flake ${flakePath}#test-vm nixos-rebuild build-vm --flake ${flakePath}#test-vm
} }
run-test-vm() { run-test-vm() {
${flakePath}/result/bin/run-test-vm-vm ${flakePath}/result/bin/run-test-vm-vm
} }
case $1 in case $1 in
--update) --update)
update ;; update ;;
--switch) --switch)
switch ;; switch ;;
--build-test-vm | --btvm) --build-test-vm | --btvm)
build-test-vm ;; build-test-vm ;;
--run-test-vm | --rtvm) --run-test-vm | --rtvm)
run-test-vm ;; run-test-vm ;;
--help | *) --help | *)
help ;; help ;;
esac esac
''; '';
in in
{ {

View File

@@ -11,7 +11,7 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nix-gc-env.url= "github:Julow/nix-gc-env"; nix-gc-env.url = "github:Julow/nix-gc-env";
home-manager = { home-manager = {
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";
@@ -39,51 +39,62 @@
}; };
}; };
outputs = { ... }@inputs: { outputs =
nixosConfigurations = { { ... }@inputs:
pinwheel = inputs.nixpkgs.lib.nixosSystem { {
system = "x86_64-linux"; nixosConfigurations = {
specialArgs = { inherit inputs; }; pinwheel = inputs.nixpkgs.lib.nixosSystem {
modules = [ system = "x86_64-linux";
./hosts/pinwheel/configuration.nix specialArgs = {
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x1-10th-gen inherit inputs;
./hosts/pinwheel/home.nix };
]; modules = [
}; ./hosts/pinwheel/configuration.nix
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x1-10th-gen
./hosts/pinwheel/home.nix
];
};
backwards = inputs.nixpkgs.lib.nixosSystem { backwards = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { inherit inputs; }; specialArgs = {
modules = [ inherit inputs;
./hosts/backwards/configuration.nix };
./hosts/backwards/home.nix modules = [
]; ./hosts/backwards/configuration.nix
}; ./hosts/backwards/home.nix
];
};
tadpole = inputs.nixpkgs.lib.nixosSystem { tadpole = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { inherit inputs; }; specialArgs = {
modules = [ inherit inputs;
./hosts/tadpole/configuration.nix };
./hosts/tadpole/home.nix modules = [
]; ./hosts/tadpole/configuration.nix
}; ./hosts/tadpole/home.nix
];
};
test-vm = inputs.nixpkgs.lib.nixosSystem { test-vm = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { inherit inputs; }; specialArgs = {
modules = [ ./hosts/test-vm/configuration.nix ]; inherit inputs;
}; };
}; modules = [ ./hosts/test-vm/configuration.nix ];
devShells = let
system = "x86_64-linux";
pkgs = inputs.nixpkgs.legacyPackages.${system};
in
{
${system}.default = pkgs.mkShell {
packages = [ pkgs.nixfmt-rfc-style ];
}; };
}; };
};
devShells =
let
system = "x86_64-linux";
pkgs = inputs.nixpkgs.legacyPackages.${system};
in
{
${system}.default = pkgs.mkShell {
packages = [ pkgs.nixfmt-rfc-style ];
};
};
};
} }

View File

@@ -1,14 +1,16 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
imports = imports = [
[ ../../config-manager/default.nix
../../config-manager/default.nix ../../shared-modules/syncthing.nix
../../shared-modules/syncthing.nix ./hardware-configuration.nix
./hardware-configuration.nix ./modules
./modules ];
];
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
console.keyMap = "sv-latin1"; console.keyMap = "sv-latin1";
@@ -25,8 +27,11 @@
users.users.alex = { users.users.alex = {
isNormalUser = true; isNormalUser = true;
description = "alex"; description = "alex";
extraGroups = [ "networkmanager" "wheel" ]; extraGroups = [
packages = []; "networkmanager"
"wheel"
];
packages = [ ];
}; };
environment.variables.EDITOR = "vim"; environment.variables.EDITOR = "vim";

View File

@@ -1,32 +1,47 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = imports = [
[ (modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/bad3d82a-7bb8-490f-bd01-a4b16fe6f33d"; device = "/dev/disk/by-uuid/bad3d82a-7bb8-490f-bd01-a4b16fe6f33d";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/D049-60DD"; device = "/dev/disk/by-uuid/D049-60DD";
fsType = "vfat"; fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ]; options = [
}; "fmask=0077"
"dmask=0077"
swapDevices =
[ { device = "/dev/disk/by-uuid/ff4de0e5-2c60-4ee7-a55c-450727efb921"; }
]; ];
};
swapDevices = [
{ device = "/dev/disk/by-uuid/ff4de0e5-2c60-4ee7-a55c-450727efb921"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # 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 # (the default) this is the recommended approach. When using systemd-networkd it's

View File

@@ -1,4 +1,9 @@
{ inputs, lib, config, ... }: {
inputs,
lib,
config,
...
}:
let let
configurationLimit = config.mod.gc.configurationLimit; configurationLimit = config.mod.gc.configurationLimit;
in in

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.git.enable; enabled = config.mod.git.enable;
in in

View File

@@ -12,10 +12,12 @@
wlp1s0 = { wlp1s0 = {
useDHCP = false; useDHCP = false;
ipv4 = { ipv4 = {
addresses = [{ addresses = [
address = "192.168.50.202"; {
prefixLength = 24; address = "192.168.50.202";
}]; prefixLength = 24;
}
];
}; };
}; };
}; };

View File

@@ -45,7 +45,7 @@ in
environmentFile = config.age.secrets.restic-cloud-sync-key.path; environmentFile = config.age.secrets.restic-cloud-sync-key.path;
repositoryFile = config.age.secrets.restic-cloud-sync-repository.path; repositoryFile = config.age.secrets.restic-cloud-sync-repository.path;
paths = ["/home/alex/sync"]; paths = [ "/home/alex/sync" ];
timerConfig = { timerConfig = {
OnCalendar = "*-*-* 0/12:00:00"; # Every 12th hour, i.e. twice a day OnCalendar = "*-*-* 0/12:00:00"; # Every 12th hour, i.e. twice a day
@@ -70,4 +70,3 @@ in
}; };
}; };
} }

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.ssh.enable; enabled = config.mod.ssh.enable;
@@ -41,10 +46,12 @@ in
enable = true; enable = true;
ports = [ 1122 ]; ports = [ 1122 ];
hostKeys = [{ hostKeys = [
path = "${rootSSHKeyPath}/root.backwards"; {
type = "ed25519"; path = "${rootSSHKeyPath}/root.backwards";
}]; type = "ed25519";
}
];
settings = { settings = {
PasswordAuthentication = false; PasswordAuthentication = false;

View File

@@ -39,7 +39,10 @@ in
folders = { folders = {
org = { org = {
path = "/home/alex/sync/org"; path = "/home/alex/sync/org";
devices = [ "phone" "pinwheel" ]; devices = [
"phone"
"pinwheel"
];
versioning = { versioning = {
type = "staggered"; type = "staggered";
params = { params = {

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.transmission.enable; enabled = config.mod.transmission.enable;
in in

View File

@@ -1,15 +1,17 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
imports = imports = [
[ ../../config-manager/default.nix
../../config-manager/default.nix ../../nix-wrapper/default.nix
../../nix-wrapper/default.nix ../../shared-modules/syncthing.nix
../../shared-modules/syncthing.nix ./hardware-configuration.nix
./hardware-configuration.nix ./modules
./modules ];
];
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
users.users.alex = { users.users.alex = {

View File

@@ -1,29 +1,40 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, modulesPath, ... }: {
config,
lib,
modulesPath,
...
}:
{ {
imports = imports = [
[ (modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ]; boot.initrd.availableKernelModules = [
"xhci_pci"
"thunderbolt"
"nvme"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ]; boot.kernelModules = [ ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/9c3ef2ad-0244-4310-9984-2e548ced3e22"; device = "/dev/disk/by-uuid/9c3ef2ad-0244-4310-9984-2e548ced3e22";
fsType = "ext4"; fsType = "ext4";
}; };
boot.initrd.luks.devices."luks-f569d036-e500-4839-bc78-ce4b032840d8".device = "/dev/disk/by-uuid/f569d036-e500-4839-bc78-ce4b032840d8"; boot.initrd.luks.devices."luks-f569d036-e500-4839-bc78-ce4b032840d8".device = "/dev/disk/by-uuid/f569d036-e500-4839-bc78-ce4b032840d8";
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/FCAE-6849"; device = "/dev/disk/by-uuid/FCAE-6849";
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = [ ]; swapDevices = [ ];

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
hyprlandEnabled = config.mod.hyprland.enable; hyprlandEnabled = config.mod.hyprland.enable;

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.bluetooth.enable; enabled = config.mod.bluetooth.enable;
in in
@@ -37,77 +42,87 @@ in
threshold = "30"; threshold = "30";
}; };
in in
{ {
timers = timers =
let let
mkTimer = device: { mkTimer = device: {
name = "notify-low-battery-for-${device.name}"; name = "notify-low-battery-for-${device.name}";
value = { value = {
unitConfig = { unitConfig = {
Description = "notify-battery-low timer for '${device.name}'"; Description = "notify-battery-low timer for '${device.name}'";
}; };
wantedBy = [ "timers.target" ]; wantedBy = [ "timers.target" ];
timerConfig = { timerConfig = {
Unit = "notify-low-battery-for-${device.name}.service"; Unit = "notify-low-battery-for-${device.name}.service";
OnCalendar = "*-*-* *:00:00"; # Every hour OnCalendar = "*-*-* *:00:00"; # Every hour
Persistent = true; Persistent = true;
};
}; };
}; };
in };
builtins.listToAttrs (builtins.map mkTimer [ trackpad headphones ]); in
builtins.listToAttrs (
builtins.map mkTimer [
trackpad
headphones
]
);
services = services =
let let
mkService = device: { mkService = device: {
name = "notify-low-battery-for-${device.name}"; name = "notify-low-battery-for-${device.name}";
value = { value = {
unitConfig = { unitConfig = {
Description = "check battery level of '${device.name}'"; Description = "check battery level of '${device.name}'";
}; };
wantedBy = [ "default.target" ]; wantedBy = [ "default.target" ];
serviceConfig = { serviceConfig = {
Type = "exec"; Type = "exec";
}; };
path = [ path = [
pkgs.upower pkgs.upower
pkgs.gawk pkgs.gawk
pkgs.bc pkgs.bc
pkgs.libnotify pkgs.libnotify
]; ];
script = '' script = ''
CONNECTED=$(upower --show-info /org/freedesktop/UPower/devices/${device.id} | grep native-path | awk '{print $2}') CONNECTED=$(upower --show-info /org/freedesktop/UPower/devices/${device.id} | grep native-path | awk '{print $2}')
[ "$CONNECTED" == "(null)" ] && exit 0 [ "$CONNECTED" == "(null)" ] && exit 0
CHECKING="/tmp/checking-dismiss-low-battery-${device.id}" CHECKING="/tmp/checking-dismiss-low-battery-${device.id}"
[ ! -f "$CHECKING" ] && touch $CHECKING || exit 0 [ ! -f "$CHECKING" ] && touch $CHECKING || exit 0
DISMISSED="/tmp/dismiss-low-battery-${device.id}" DISMISSED="/tmp/dismiss-low-battery-${device.id}"
PERCENT=$(upower --show-info /org/freedesktop/UPower/devices/${device.id} | grep percentage | grep -o '[0-9]*') PERCENT=$(upower --show-info /org/freedesktop/UPower/devices/${device.id} | grep percentage | grep -o '[0-9]*')
if (( $(echo "$PERCENT < ${device.threshold}" | bc) )); then if (( $(echo "$PERCENT < ${device.threshold}" | bc) )); then
echo "'${device.name}' is under threshold. battery = $PERCENT% - threshold = ${device.threshold}%" echo "'${device.name}' is under threshold. battery = $PERCENT% - threshold = ${device.threshold}%"
if [ ! -f "$DISMISSED" ]; then if [ ! -f "$DISMISSED" ]; then
DISMISS=$(notify-send --expire-time 0 "Low battery" "${device.name} has $PERCENT% battery" --action=dismiss=Dismiss) DISMISS=$(notify-send --expire-time 0 "Low battery" "${device.name} has $PERCENT% battery" --action=dismiss=Dismiss)
[ "$DISMISS" == "dismiss" ] && touch $DISMISSED && echo "'${device.name}' dismissed" [ "$DISMISS" == "dismiss" ] && touch $DISMISSED && echo "'${device.name}' dismissed"
fi
else
echo "'${device.name}' is over threshold. battery = $PERCENT% - threshold = ${device.threshold}%"
[ -f "$DISMISSED" ] && rm $DISMISSED && echo "'${device.name}' undismissed"
fi fi
else
echo "'${device.name}' is over threshold. battery = $PERCENT% - threshold = ${device.threshold}%"
[ -f "$DISMISSED" ] && rm $DISMISSED && echo "'${device.name}' undismissed"
fi
rm $CHECKING rm $CHECKING
''; '';
};
}; };
in };
builtins.listToAttrs (builtins.map mkService [ trackpad headphones ]); in
}; builtins.listToAttrs (
builtins.map mkService [
trackpad
headphones
]
);
};
}; };
} }

View File

@@ -1,4 +1,10 @@
{ inputs, pkgs, lib, config, ... }: {
inputs,
pkgs,
lib,
config,
...
}:
let let
configurationLimit = config.mod.gc.configurationLimit; configurationLimit = config.mod.gc.configurationLimit;
in in

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.c.enable; enabled = config.mod.c.enable;
in in

View File

@@ -1,6 +1,6 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
home-manager.users.alex= { home-manager.users.alex = {
home.packages = [ pkgs.ungoogled-chromium ]; home.packages = [ pkgs.ungoogled-chromium ];
}; };

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
dockerEnabled = config.mod.containers.docker.enable; dockerEnabled = config.mod.containers.docker.enable;
podmanEnabled = config.mod.containers.podman.enable; podmanEnabled = config.mod.containers.podman.enable;

View File

@@ -9,7 +9,6 @@ in
nix-direnv.enable = true; nix-direnv.enable = true;
}; };
programs.direnv.enableZshIntegration = lib.mkIf zshEnabled true; programs.direnv.enableZshIntegration = lib.mkIf zshEnabled true;
}; };
} }

View File

@@ -1,5 +1,5 @@
{ emacs, runCommand, ... }: { emacs, runCommand, ... }:
runCommand "default.el" {} '' runCommand "default.el" { } ''
cp ${./config.org} $TMPDIR/config.org cp ${./config.org} $TMPDIR/config.org
cd $TMPDIR cd $TMPDIR
${emacs}/bin/emacs --batch -Q \ ${emacs}/bin/emacs --batch -Q \
@@ -7,4 +7,4 @@ runCommand "default.el" {} ''
-f org-babel-tangle -f org-babel-tangle
mv config.el $out mv config.el $out
'' ''

View File

@@ -3,7 +3,7 @@ let
emacs = pkgs.emacsWithPackagesFromUsePackage { emacs = pkgs.emacsWithPackagesFromUsePackage {
package = pkgs.emacs-unstable; package = pkgs.emacs-unstable;
config = ./config.org; config = ./config.org;
defaultInitFile = pkgs.callPackage ./config.nix {}; defaultInitFile = pkgs.callPackage ./config.nix { };
alwaysEnsure = true; alwaysEnsure = true;
alwaysTangle = true; alwaysTangle = true;
@@ -40,9 +40,9 @@ in
home-manager.users.alex = { home-manager.users.alex = {
home.sessionVariables = { home.sessionVariables = {
EDITOR = "${e}/bin/e $@"; EDITOR = "${e}/bin/e $@";
VISUAL = "${e}/bin/e $@"; VISUAL = "${e}/bin/e $@";
TIG_EDITOR = "${e}/bin/e $@"; TIG_EDITOR = "${e}/bin/e $@";
}; };
home.packages = [ home.packages = [

View File

@@ -59,7 +59,7 @@ in
name = "alex"; name = "alex";
isDefault = true; isDefault = true;
settings = sharedSettings // {}; settings = sharedSettings // { };
}; };
work = { work = {
@@ -109,12 +109,14 @@ in
configFile."mimeapps.list".force = true; configFile."mimeapps.list".force = true;
}; };
home.packages = [
home.packages = [ ff ff-alex ]; ff
ff-alex
];
}; };
environment.variables = { environment.variables = {
MOZ_ENABLE_WAYLAND=1; MOZ_ENABLE_WAYLAND = 1;
BROWSER = "${ff-alex}/bin/ff-alex $@"; BROWSER = "${ff-alex}/bin/ff-alex $@";
}; };
} }

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.foot.enable; enabled = config.mod.foot.enable;

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.git.enable; enabled = config.mod.git.enable;
in in

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.go.enable; enabled = config.mod.go.enable;
in in
@@ -10,19 +15,19 @@ in
}; };
config = lib.mkIf enabled { config = lib.mkIf enabled {
nixpkgs.overlays = let nixpkgs.overlays =
buildGo122 = pkgs: pkg: let
pkg.override { buildGoModule = pkgs.buildGo122Module; }; buildGo122 = pkgs: pkg: pkg.override { buildGoModule = pkgs.buildGo122Module; };
in in
[ [
(final: prev: { (final: prev: {
go = prev.go_1_22; go = prev.go_1_22;
gopls = buildGo122 prev prev.gopls; gopls = buildGo122 prev prev.gopls;
go-tools = buildGo122 prev prev.go-tools; go-tools = buildGo122 prev prev.go-tools;
govulncheck = buildGo122 prev prev.govulncheck; govulncheck = buildGo122 prev prev.govulncheck;
gotestsum = buildGo122 prev prev.gotestsum; gotestsum = buildGo122 prev prev.gotestsum;
}) })
]; ];
home-manager.users.alex = { home-manager.users.alex = {
programs.go = { programs.go = {

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.greetd.enable; enabled = config.mod.greetd.enable;
in in
@@ -13,16 +18,17 @@ in
services.greetd = { services.greetd = {
enable = true; enable = true;
settings = let settings =
session = { let
user = "alex"; session = {
command = "${pkgs.hyprland}/bin/Hyprland"; user = "alex";
}; command = "${pkgs.hyprland}/bin/Hyprland";
in };
in
{ {
initial_session = session; initial_session = session;
default_session = session; default_session = session;
}; };
}; };
}; };
} }

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.hyprland.enable; enabled = config.mod.hyprland.enable;
in in
@@ -55,7 +60,7 @@ in
# 2 - Cursor focus will be detached from keyboard focus. Clicking on a window will move keyboard focus to that window. # 2 - Cursor focus will be detached from keyboard focus. Clicking on a window will move keyboard focus to that window.
follow_mouse = 2; follow_mouse = 2;
sensitivity = 0.30; sensitivity = 0.3;
touchpad = { touchpad = {
natural_scroll = false; natural_scroll = false;
tap-and-drag = false; tap-and-drag = false;
@@ -70,7 +75,7 @@ in
general = { general = {
layout = "dwindle"; layout = "dwindle";
gaps_in = 0; # gaps between windows gaps_in = 0; # gaps between windows
gaps_out = 0; # gaps between windows and monitor edges gaps_out = 0; # gaps between windows and monitor edges
"col.active_border" = "rgba(${config.lib.colors.foreground}ff)"; "col.active_border" = "rgba(${config.lib.colors.foreground}ff)";
@@ -82,54 +87,59 @@ in
no_gaps_when_only = 1; no_gaps_when_only = 1;
}; };
bind = let bind =
ws = x: let
let n = if (x + 1) < 10 ws =
then (x + 1) x:
else 0; let
in n = if (x + 1) < 10 then (x + 1) else 0;
in
builtins.toString n; builtins.toString n;
select = builtins.genList (x: "$mod, ${ws x}, workspace, ${builtins.toString (x + 1)}") 10; select = builtins.genList (x: "$mod, ${ws x}, workspace, ${builtins.toString (x + 1)}") 10;
move = builtins.genList (x: "$mod SHIFT, ${ws x}, movetoworkspacesilent, ${builtins.toString (x + 1)}") 10; move = builtins.genList (
x: "$mod SHIFT, ${ws x}, movetoworkspacesilent, ${builtins.toString (x + 1)}"
) 10;
magnifier = pkgs.writeShellScript "magnifier" '' magnifier = pkgs.writeShellScript "magnifier" ''
CURRENT=$(${pkgs.hyprland}/bin/hyprctl getoption cursor:zoom_factor -j | ${pkgs.jq}/bin/jq .float) CURRENT=$(${pkgs.hyprland}/bin/hyprctl getoption cursor:zoom_factor -j | ${pkgs.jq}/bin/jq .float)
DELTA=0.1 DELTA=0.1
UPDATED=1 UPDATED=1
case $1 in case $1 in
--increase) --increase)
UPDATED=$(echo $CURRENT + $DELTA | ${pkgs.bc}/bin/bc) ;; UPDATED=$(echo $CURRENT + $DELTA | ${pkgs.bc}/bin/bc) ;;
--decrease) --decrease)
UPDATED=$(echo $CURRENT - $DELTA | ${pkgs.bc}/bin/bc) ;; UPDATED=$(echo $CURRENT - $DELTA | ${pkgs.bc}/bin/bc) ;;
--reset) --reset)
UPDATED=1 UPDATED=1
esac esac
if (( $(echo "$UPDATED < 1" | bc) )); then UPDATED=1; fi if (( $(echo "$UPDATED < 1" | bc) )); then UPDATED=1; fi
${pkgs.hyprland}/bin/hyprctl keyword cursor:zoom_factor $UPDATED ${pkgs.hyprland}/bin/hyprctl keyword cursor:zoom_factor $UPDATED
''; '';
in in
select ++ move ++ [ select
"$mod, ESCAPE, killactive" ++ move
++ [
"$mod, ESCAPE, killactive"
"$mod, f, fullscreen, 1" "$mod, f, fullscreen, 1"
"$mod SHIFT, f, togglefloating, active" "$mod SHIFT, f, togglefloating, active"
"$mod, h, movefocus, l" "$mod, h, movefocus, l"
"$mod, j, movefocus, d" "$mod, j, movefocus, d"
"$mod, k, movefocus, u" "$mod, k, movefocus, u"
"$mod, l, movefocus, r" "$mod, l, movefocus, r"
"$mod CONTROL, 1, exec, ${magnifier} --increase" "$mod CONTROL, 1, exec, ${magnifier} --increase"
"$mod CONTROL, 2, exec, ${magnifier} --decrease" "$mod CONTROL, 2, exec, ${magnifier} --decrease"
"$mod CONTROL, 3, exec, ${magnifier} --reset" "$mod CONTROL, 3, exec, ${magnifier} --reset"
]; ];
bindm = [ bindm = [
# mouse movements # mouse movements
"$mod, mouse:272, movewindow" # left click "$mod, mouse:272, movewindow" # left click
"$mod, mouse:273, resizewindow" # right click "$mod, mouse:273, resizewindow" # right click
]; ];
@@ -183,62 +193,66 @@ in
pkgs.libnotify pkgs.libnotify
]; ];
script = let script =
moveWSToMonitor = monitor: first: last: let
if last < first moveWSToMonitor =
then throw "'first' has to be less than or equal to 'last'" monitor: first: last:
else if last < first then
builtins.genList (n: "dispatch moveworkspacetomonitor ${builtins.toString (first + n)} ${monitor}") (last - first + 1); throw "'first' has to be less than or equal to 'last'"
else
builtins.genList (
n: "dispatch moveworkspacetomonitor ${builtins.toString (first + n)} ${monitor}"
) (last - first + 1);
external = moveWSToMonitor "HDMI-A-1" 1 5; external = moveWSToMonitor "HDMI-A-1" 1 5;
internal = moveWSToMonitor "eDPI-1" 6 10; internal = moveWSToMonitor "eDPI-1" 6 10;
onlyInternal = moveWSToMonitor "eDPI-1" 1 10; onlyInternal = moveWSToMonitor "eDPI-1" 1 10;
in in
'' ''
update() { update() {
HDMI_STATUS=$(cat /sys/class/drm/card1-HDMI-A-1/status) HDMI_STATUS=$(cat /sys/class/drm/card1-HDMI-A-1/status)
INTERNAL_WIDTH=1920 INTERNAL_WIDTH=1920
INTERNAL_HEIGHT=1200 INTERNAL_HEIGHT=1200
if [ $HDMI_STATUS = "connected" ]; then if [ $HDMI_STATUS = "connected" ]; then
notify-send "Using external and laptop monitor" notify-send "Using external and laptop monitor"
hyprctl keyword monitor HDMI-A-1,preferred,0x0,1 hyprctl keyword monitor HDMI-A-1,preferred,0x0,1
HDMI=$(hyprctl monitors -j | jq '.[] | select(.name=="HDMI-A-1")') HDMI=$(hyprctl monitors -j | jq '.[] | select(.name=="HDMI-A-1")')
HDMI_WIDTH=$(echo $HDMI | jq .width) HDMI_WIDTH=$(echo $HDMI | jq .width)
HDMI_HEIGHT=$(echo $HDMI | jq .height) HDMI_HEIGHT=$(echo $HDMI | jq .height)
INTERNAL_POS_X=$(echo "($HDMI_WIDTH - $INTERNAL_WIDTH) / 2" | bc) INTERNAL_POS_X=$(echo "($HDMI_WIDTH - $INTERNAL_WIDTH) / 2" | bc)
if (( $(echo "$INTERNAL_POS_X < 0" | bc) )); then INTERNAL_POS_X=0; fi if (( $(echo "$INTERNAL_POS_X < 0" | bc) )); then INTERNAL_POS_X=0; fi
INTERNAL_POS_Y=$HDMI_HEIGHT INTERNAL_POS_Y=$HDMI_HEIGHT
hyprctl keyword monitor eDP-1,$INTERNAL_WIDTH"x"$INTERNAL_HEIGHT,$INTERNAL_POS_X"x"$INTERNAL_POS_Y,1 hyprctl keyword monitor eDP-1,$INTERNAL_WIDTH"x"$INTERNAL_HEIGHT,$INTERNAL_POS_X"x"$INTERNAL_POS_Y,1
hyprctl --batch "${lib.strings.concatStringsSep ";" (external ++ internal)}" hyprctl --batch "${lib.strings.concatStringsSep ";" (external ++ internal)}"
else else
notify-send "Using only laptop monitor" notify-send "Using only laptop monitor"
hyprctl --batch "keyword monitor HDMI-A,disable; keyword monitor eDP-1,$INTERNAL_WIDTH"x"$INTERNAL_HEIGHT,0x0,1" hyprctl --batch "keyword monitor HDMI-A,disable; keyword monitor eDP-1,$INTERNAL_WIDTH"x"$INTERNAL_HEIGHT,0x0,1"
hyprctl --batch "${lib.strings.concatStringsSep ";" onlyInternal}" hyprctl --batch "${lib.strings.concatStringsSep ";" onlyInternal}"
fi fi
} }
handle() { handle() {
case $1 in case $1 in
monitoradded\>\>*|monitorremoved\>\>*) monitoradded\>\>*|monitorremoved\>\>*)
echo "handling event: \"$1\"" echo "handling event: \"$1\""
update ;; update ;;
esac esac
} }
echo "Starting service with instance \"$HYPRLAND_INSTANCE_SIGNATURE\"" echo "Starting service with instance \"$HYPRLAND_INSTANCE_SIGNATURE\""
# Do initial configuration # Do initial configuration
update update
socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read -r line; do handle "$line"; done socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read -r line; do handle "$line"; done
''; '';
}; };
}; };
} }

View File

@@ -1,4 +1,4 @@
{ pkgs, ...}: { pkgs, ... }:
{ {
home-manager.users.alex = { home-manager.users.alex = {
home.packages = [ pkgs.nodePackages.typescript-language-server ]; home.packages = [ pkgs.nodePackages.typescript-language-server ];

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.keyboard.enable; enabled = config.mod.keyboard.enable;
in in

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
hyprlandEnabled = config.mod.hyprland.enable; hyprlandEnabled = config.mod.hyprland.enable;
in in

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.mullvad.enable; enabled = config.mod.mullvad.enable;
in in

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.openvpn.enable; enabled = config.mod.openvpn.enable;
in in

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.physlock.enable; enabled = config.mod.physlock.enable;
hyprlandEnabled = config.mod.hyprland.enable; hyprlandEnabled = config.mod.hyprland.enable;
@@ -31,11 +36,11 @@ in
let let
pause-music = "${pkgs.playerctl}/bin/playerctl -p spotify pause"; pause-music = "${pkgs.playerctl}/bin/playerctl -p spotify pause";
in in
[ [
# will lock the screen with `physlock`, see `lockOn.suspend # will lock the screen with `physlock`, see `lockOn.suspend
"$mod SHIFT, x, exec, ${pause-music}; systemctl suspend" "$mod SHIFT, x, exec, ${pause-music}; systemctl suspend"
"$mod, x, exec, ${pause-music}; ${config.security.wrapperDir}/physlock -d -s -m" "$mod, x, exec, ${pause-music}; ${config.security.wrapperDir}/physlock -d -s -m"
]; ];
}; };
}; };
}; };

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.power.enable; enabled = config.mod.power.enable;
lowbat = config.mod.lowbat; lowbat = config.mod.lowbat;
@@ -39,8 +44,8 @@ in
enable = true; enable = true;
settings = { settings = {
START_CHARGE_THRESH_BAT0=75; START_CHARGE_THRESH_BAT0 = 75;
STOP_CHARGE_THRESH_BAT0=80; STOP_CHARGE_THRESH_BAT0 = 80;
}; };
}; };
}; };
@@ -58,7 +63,7 @@ in
Persistent = true; Persistent = true;
}; };
wantedBy = ["timers.target"]; wantedBy = [ "timers.target" ];
}; };
}; };
@@ -78,28 +83,30 @@ in
pkgs.swaylock pkgs.swaylock
]; ];
script = let script =
pause-music = "${pkgs.playerctl}/bin/playerctl -p spotify pause"; let
in '' pause-music = "${pkgs.playerctl}/bin/playerctl -p spotify pause";
BATTERY_CAPACITY=$(cat /sys/class/power_supply/${lowbat.battery}/capacity) in
BATTERY_STATUS=$(cat /sys/class/power_supply/${lowbat.battery}/status) ''
echo "Battery capacity: $BATTERY_CAPACITY" BATTERY_CAPACITY=$(cat /sys/class/power_supply/${lowbat.battery}/capacity)
echo "Battery status: $BATTERY_STATUS"
if [[ $BATTERY_CAPACITY -le ${builtins.toString lowbat.notifyCapacity} && $BATTERY_STATUS = "Discharging" ]]; then
notify-send --expire-time=0 --urgency=critical "Battery Low"
fi
if [[ $BATTERY_CAPACITY -le ${builtins.toString lowbat.suspendCapacity} && $BATTERY_STATUS = "Discharging" ]]; then
notify-send --expire-time=0 --urgency=critical "Battery Critically Low" "Suspending in 60 seconds if power is not plugged in"
sleep 60s
BATTERY_STATUS=$(cat /sys/class/power_supply/${lowbat.battery}/status) BATTERY_STATUS=$(cat /sys/class/power_supply/${lowbat.battery}/status)
if [[ $BATTERY_STATUS = "Discharging" ]]; then echo "Battery capacity: $BATTERY_CAPACITY"
${pause-music}; ${pkgs.swaylock}/bin/swaylock -f; systemctl suspend echo "Battery status: $BATTERY_STATUS"
if [[ $BATTERY_CAPACITY -le ${builtins.toString lowbat.notifyCapacity} && $BATTERY_STATUS = "Discharging" ]]; then
notify-send --expire-time=0 --urgency=critical "Battery Low"
fi fi
fi
''; if [[ $BATTERY_CAPACITY -le ${builtins.toString lowbat.suspendCapacity} && $BATTERY_STATUS = "Discharging" ]]; then
notify-send --expire-time=0 --urgency=critical "Battery Critically Low" "Suspending in 60 seconds if power is not plugged in"
sleep 60s
BATTERY_STATUS=$(cat /sys/class/power_supply/${lowbat.battery}/status)
if [[ $BATTERY_STATUS = "Discharging" ]]; then
${pause-music}; ${pkgs.swaylock}/bin/swaylock -f; systemctl suspend
fi
fi
'';
}; };
}; };
}; };

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.python.enable; enabled = config.mod.python.enable;
in in

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.rust.enable; enabled = config.mod.rust.enable;
in in

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.scala.enable; enabled = config.mod.scala.enable;

View File

@@ -1,4 +1,10 @@
{ inputs, pkgs, lib, config, ...}: {
inputs,
pkgs,
lib,
config,
...
}:
let let
hyprlandEnabled = config.mod.hyprland.enable; hyprlandEnabled = config.mod.hyprland.enable;

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.scripts.enable; enabled = config.mod.scripts.enable;

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
hyprlandEnabled = config.mod.hyprland.enable; hyprlandEnabled = config.mod.hyprland.enable;
in in
@@ -20,24 +25,26 @@ in
home-manager.users.alex = { home-manager.users.alex = {
wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled { wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled {
settings = { settings = {
bind = let bind =
toggle-output-mute = pkgs.writeShellScript "toggle-output-mute" '' let
${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle toggle-output-mute = pkgs.writeShellScript "toggle-output-mute" ''
MUTED=$(${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep MUTED | wc -l) ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
echo $MUTED > /sys/class/leds/platform::mute/brightness MUTED=$(${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep MUTED | wc -l)
''; echo $MUTED > /sys/class/leds/platform::mute/brightness
'';
toggle-input-mute = pkgs.writeShellScript "toggle-input-mute" '' toggle-input-mute = pkgs.writeShellScript "toggle-input-mute" ''
${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
MUTED=$(${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_AUDIO_SOURCE@ | grep MUTED | wc -l) MUTED=$(${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_AUDIO_SOURCE@ | grep MUTED | wc -l)
echo $MUTED > /sys/class/leds/platform::micmute/brightness echo $MUTED > /sys/class/leds/platform::micmute/brightness
''; '';
in [ in
", XF86AudioRaiseVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 2%+" [
", XF86AudioLowerVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-" ", XF86AudioRaiseVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 2%+"
", XF86AudioMute, exec, ${toggle-output-mute}" ", XF86AudioLowerVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-"
", XF86AudioMicMute, exec, ${toggle-input-mute}" ", XF86AudioMute, exec, ${toggle-output-mute}"
]; ", XF86AudioMicMute, exec, ${toggle-input-mute}"
];
}; };
}; };

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
hyprlandEnabled = config.mod.hyprland.enable; hyprlandEnabled = config.mod.hyprland.enable;
in in
@@ -6,19 +11,21 @@ in
home-manager.users.alex = { home-manager.users.alex = {
wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled { wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled {
settings = { settings = {
bind = let bind =
prev = "${pkgs.playerctl}/bin/playerctl -p spotify previous"; let
next = "${pkgs.playerctl}/bin/playerctl -p spotify next"; prev = "${pkgs.playerctl}/bin/playerctl -p spotify previous";
in [ next = "${pkgs.playerctl}/bin/playerctl -p spotify next";
", XF86AudioPrev, exec, ${prev}" in
", XF86AudioNext, exec, ${next}" [
", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl -p spotify play-pause" ", XF86AudioPrev, exec, ${prev}"
", XF86AudioPause, exec, ${pkgs.playerctl}/bin/playerctl -p spoitfy play-pause" ", XF86AudioNext, exec, ${next}"
", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl -p spotify play-pause"
", XF86AudioPause, exec, ${pkgs.playerctl}/bin/playerctl -p spoitfy play-pause"
"$mod ALT, LEFT, exec, ${prev}" "$mod ALT, LEFT, exec, ${prev}"
"$mod ALT, RIGHT, exec, ${next}" "$mod ALT, RIGHT, exec, ${next}"
"$mod ALT, DOWN, exec, ${pkgs.playerctl}/bin/playerctl -p spotify play-pause" "$mod ALT, DOWN, exec, ${pkgs.playerctl}/bin/playerctl -p spotify play-pause"
]; ];
}; };
}; };

View File

@@ -129,9 +129,11 @@
enable = true; enable = true;
ports = [ 1122 ]; ports = [ 1122 ];
hostKeys = [{ hostKeys = [
path = "/etc/ssh/pinwheel"; {
type = "ed25519"; path = "/etc/ssh/pinwheel";
}]; type = "ed25519";
}
];
}; };
} }

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.swaylock.enable; enabled = config.mod.swaylock.enable;
hyprlandEnabled = config.mod.hyprland.enable; hyprlandEnabled = config.mod.hyprland.enable;
@@ -30,18 +35,19 @@ in
wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled { wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled {
settings = { settings = {
bind = let bind =
pause-music = "${pkgs.playerctl}/bin/playerctl -p spotify pause"; let
pause-music = "${pkgs.playerctl}/bin/playerctl -p spotify pause";
dpmsTimeout = config.mod.swaylock.dpmsTimeout; dpmsTimeout = config.mod.swaylock.dpmsTimeout;
dpms-lock = pkgs.writeShellScript "dpms-lock" '' dpms-lock = pkgs.writeShellScript "dpms-lock" ''
${pkgs.swayidle}/bin/swayidle \ ${pkgs.swayidle}/bin/swayidle \
timeout ${dpmsTimeout} "${pkgs.hyprland}/bin/hyprctl dispatch dpms off" \ timeout ${dpmsTimeout} "${pkgs.hyprland}/bin/hyprctl dispatch dpms off" \
resume "${pkgs.hyprland}/bin/hyprctl dispatch dpms on" & resume "${pkgs.hyprland}/bin/hyprctl dispatch dpms on" &
${pkgs.swaylock}/bin/swaylock && ${pkgs.procps}/bin/pkill swayidle ${pkgs.swaylock}/bin/swaylock && ${pkgs.procps}/bin/pkill swayidle
''; '';
in in
[ [
"$mod, x, exec, ${pause-music}; ${dpms-lock}" "$mod, x, exec, ${pause-music}; ${dpms-lock}"
"$mod SHIFT, x, exec, ${pause-music}; ${pkgs.swaylock}/bin/swaylock -f; systemctl suspend" "$mod SHIFT, x, exec, ${pause-music}; ${pkgs.swaylock}/bin/swaylock -f; systemctl suspend"

View File

@@ -21,7 +21,10 @@
folders = { folders = {
org = { org = {
path = "/home/alex/sync/org"; path = "/home/alex/sync/org";
devices = [ "phone" "backwards" ]; devices = [
"phone"
"backwards"
];
versioning = { versioning = {
type = "staggered"; type = "staggered";
params = { params = {

View File

@@ -1,4 +1,4 @@
{ pkgs, ...}: { pkgs, ... }:
{ {
home-manager.users.alex = { home-manager.users.alex = {
home.packages = [ home.packages = [

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.vm.enable; enabled = config.mod.vm.enable;
in in
@@ -26,8 +31,8 @@ in
home-manager.users.alex = { home-manager.users.alex = {
dconf.settings = { dconf.settings = {
"org/virt-manager/virt-manager/connections" = { "org/virt-manager/virt-manager/connections" = {
autoconnect = ["qemu:///system"]; autoconnect = [ "qemu:///system" ];
uris = ["qemu:///system"]; uris = [ "qemu:///system" ];
}; };
}; };
}; };

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
hyprlandEnabled = config.mod.hyprland.enable; hyprlandEnabled = config.mod.hyprland.enable;
@@ -194,8 +199,15 @@ in
"interval" = 60; "interval" = 60;
"format" = "<span font='10' rise='1000'>{icon}</span> {capacity}%"; "format" = "<span font='10' rise='1000'>{icon}</span> {capacity}%";
"format-time" = "{H}h {M}min"; "format-time" = "{H}h {M}min";
"format-charging" ="󰂄 {capacity}%"; "format-charging" = "󰂄 {capacity}%";
"format-icons" = ["󰁺" "󰁻" "󰁽" "󰁿" "󰂁" "󰁹" ]; "format-icons" = [
"󰁺"
"󰁻"
"󰁽"
"󰁿"
"󰂁"
"󰁹"
];
}; };
"clock" = { "clock" = {

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.wezterm.enable; enabled = config.mod.wezterm.enable;

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
gitEnabled = config.mod.git.enable; gitEnabled = config.mod.git.enable;
goEnabled = config.mod.go.enable; goEnabled = config.mod.go.enable;
@@ -7,16 +12,18 @@ in
{ {
home-manager.users.alex = { home-manager.users.alex = {
home.sessionVariables = { home.sessionVariables = {
GITHUB_ACTOR="Alexander Heldt"; GITHUB_ACTOR = "Alexander Heldt";
GITHUB_TOKEN="$(${pkgs.coreutils}/bin/cat ${config.age.secrets.work-github-token.path})"; GITHUB_TOKEN = "$(${pkgs.coreutils}/bin/cat ${config.age.secrets.work-github-token.path})";
}; };
home.packages = [ home.packages = [
(pkgs.callPackage ./syb-cli.nix {}) (pkgs.callPackage ./syb-cli.nix { })
(pkgs.jetbrains.plugins.addPlugins pkgs.jetbrains.idea-ultimate [ "ideavim" ]) (pkgs.jetbrains.plugins.addPlugins pkgs.jetbrains.idea-ultimate [ "ideavim" ])
(pkgs.google-cloud-sdk.withExtraComponents [ pkgs.google-cloud-sdk.components.gke-gcloud-auth-plugin ]) (pkgs.google-cloud-sdk.withExtraComponents [
(pkgs.graphite-cli.overrideAttrs(_: { pkgs.google-cloud-sdk.components.gke-gcloud-auth-plugin
])
(pkgs.graphite-cli.overrideAttrs (_: {
version = "1.4.3"; version = "1.4.3";
})) }))
pkgs.xdg-utils # needed by graphite-cli pkgs.xdg-utils # needed by graphite-cli

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.zsh.enable; enabled = config.mod.zsh.enable;
in in

View File

@@ -1,20 +1,22 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
imports = imports = [
[ ../../config-manager/default.nix
../../config-manager/default.nix ./hardware-configuration.nix
./hardware-configuration.nix ./modules
./modules ];
];
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
users.users.alex = { users.users.alex = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ "wheel" ]; extraGroups = [ "wheel" ];
packages = []; packages = [ ];
}; };
environment.variables.EDITOR = "vim"; environment.variables.EDITOR = "vim";

View File

@@ -1,26 +1,39 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = imports = [
[ (modulesPath + "/profiles/qemu-guest.nix") (modulesPath + "/profiles/qemu-guest.nix")
]; ];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; boot.initrd.availableKernelModules = [
"ahci"
"xhci_pci"
"virtio_pci"
"virtio_scsi"
"sd_mod"
"sr_mod"
];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ]; boot.kernelModules = [ ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/7a2b1179-6582-4ef1-b094-0f11449373ed"; device = "/dev/disk/by-uuid/7a2b1179-6582-4ef1-b094-0f11449373ed";
fsType = "ext4"; fsType = "ext4";
}; };
swapDevices = swapDevices = [
[ { device = "/dev/disk/by-uuid/aa0634e1-a1c2-4461-978a-cf1768f38b0c"; } { device = "/dev/disk/by-uuid/aa0634e1-a1c2-4461-978a-cf1768f38b0c"; }
]; ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # 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 # (the default) this is the recommended approach. When using systemd-networkd it's

View File

@@ -17,7 +17,7 @@
pkgs.git pkgs.git
pkgs.tig pkgs.tig
pkgs.vim pkgs.vim
]; ];
home.stateVersion = "24.05"; home.stateVersion = "24.05";
}; };

View File

@@ -1,4 +1,9 @@
{ inputs, lib, config, ... }: {
inputs,
lib,
config,
...
}:
let let
configurationLimit = config.mod.gc.configurationLimit; configurationLimit = config.mod.gc.configurationLimit;
in in

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
conf = config.mod.gitea; conf = config.mod.gitea;
gitDomain = "git.${conf.baseDomain}"; gitDomain = "git.${conf.baseDomain}";
@@ -26,7 +31,7 @@ in
webfingerAccounts = lib.mkOption { webfingerAccounts = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
default = []; default = [ ];
description = "The accounts that should be listed"; description = "The accounts that should be listed";
}; };
}; };
@@ -47,7 +52,7 @@ in
message = "There is no cert configured for ${conf.baseDomain} used by webfinger"; message = "There is no cert configured for ${conf.baseDomain} used by webfinger";
} }
{ {
assertion = conf.webfingerEnable && conf.webfingerAccounts != []; assertion = conf.webfingerEnable && conf.webfingerAccounts != [ ];
message = "Option 'mod.gitea.webfingerAccounts' cannot be empty"; message = "Option 'mod.gitea.webfingerAccounts' cannot be empty";
} }
]; ];
@@ -81,38 +86,43 @@ in
services.nginx = { services.nginx = {
virtualHosts."${conf.baseDomain}" = virtualHosts."${conf.baseDomain}" =
let let
mkWebfinger = account: mkWebfinger =
pkgs.writeTextDir (lib.escapeURL "acct:${account}") (lib.generators.toJSON {} { account:
subject = "acct:${account}"; pkgs.writeTextDir (lib.escapeURL "acct:${account}") (
links = [{ lib.generators.toJSON { } {
rel = "http://openid.net/specs/connect/1.0/issuer"; subject = "acct:${account}";
href = "https://${gitDomain}"; links = [
}]; {
}); rel = "http://openid.net/specs/connect/1.0/issuer";
href = "https://${gitDomain}";
}
];
}
);
webfingerRoot = pkgs.symlinkJoin { webfingerRoot = pkgs.symlinkJoin {
name = "${gitDomain}-webfinger"; name = "${gitDomain}-webfinger";
paths = builtins.map mkWebfinger conf.webfingerAccounts; paths = builtins.map mkWebfinger conf.webfingerAccounts;
}; };
in in
lib.mkIf conf.webfingerEnable { lib.mkIf conf.webfingerEnable {
forceSSL = true; forceSSL = true;
useACMEHost = conf.baseDomain; useACMEHost = conf.baseDomain;
locations."/.well-known/webfinger" = { locations."/.well-known/webfinger" = {
root = webfingerRoot; root = webfingerRoot;
extraConfig = '' extraConfig = ''
add_header Access-Control-Allow-Origin "*"; add_header Access-Control-Allow-Origin "*";
default_type "application/jrd+json"; default_type "application/jrd+json";
types { application/jrd+json json; } types { application/jrd+json json; }
if ($arg_resource) { if ($arg_resource) {
rewrite ^(.*)$ /$arg_resource break; rewrite ^(.*)$ /$arg_resource break;
} }
return 400; return 400;
''; '';
};
}; };
};
virtualHosts."${gitDomain}" = { virtualHosts."${gitDomain}" = {
forceSSL = true; forceSSL = true;

View File

@@ -31,7 +31,10 @@ in
networking = { networking = {
firewall = { firewall = {
allowedTCPPorts = [ 80 443 ]; allowedTCPPorts = [
80
443
];
}; };
}; };
}; };

View File

@@ -1,4 +1,9 @@
{ inputs, lib, config, ... }: {
inputs,
lib,
config,
...
}:
let let
enabled = config.mod.pppdotpm-site.enable; enabled = config.mod.pppdotpm-site.enable;

View File

@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
enabled = config.mod.ssh.enable; enabled = config.mod.ssh.enable;
@@ -41,10 +46,12 @@ in
enable = true; enable = true;
ports = [ 1122 ]; ports = [ 1122 ];
hostKeys = [{ hostKeys = [
path = "${rootSSHKeyPath}/root.tadpole"; {
type = "ed25519"; path = "${rootSSHKeyPath}/root.tadpole";
}]; type = "ed25519";
}
];
settings = { settings = {
PasswordAuthentication = false; PasswordAuthentication = false;

View File

@@ -1,4 +1,4 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
imports = [ imports = [
./ppp.pm-site.nix ./ppp.pm-site.nix
@@ -28,7 +28,7 @@
}; };
}; };
environment.systemPackages = []; environment.systemPackages = [ ];
system.stateVersion = "24.05"; system.stateVersion = "24.05";
}; };

View File

@@ -1,4 +1,9 @@
{ inputs, lib, config, ... }: {
inputs,
lib,
config,
...
}:
let let
enabled = config.mod.pppdotpm-site.enable; enabled = config.mod.pppdotpm-site.enable;
in in