Alejandra 💅

This commit is contained in:
Casper V. Kristensen 2024-03-05 22:57:41 +01:00
parent 163a7f38c4
commit a7b28837ee
61 changed files with 472 additions and 306 deletions

View file

@ -38,9 +38,13 @@
};
};
outputs = { self, nixpkgs, ... } @ inputs: {
# https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-fmt.html
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
outputs = {
self,
nixpkgs,
...
} @ inputs: {
# https://kamadorueda.com/alejandra/
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
nixosConfigurations = {
# Home desktop

View file

@ -1,4 +1,10 @@
{ config, lib, pkgs, modulesPath, ... }: {
{
config,
lib,
pkgs,
modulesPath,
...
}: {
# https://nixos.wiki/wiki/Install_NixOS_on_Hetzner_Cloud
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
@ -38,4 +44,3 @@
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
}

View file

@ -1,4 +1,8 @@
{ home-manager, lib, ... }: {
{
home-manager,
lib,
...
}: {
home-manager.users.caspervk = {
programs.git = {
userEmail = lib.mkForce "vk@magenta.dk";
@ -6,7 +10,6 @@
# https://docs.gitlab.com/ee/user/project/push_options.html
mr = "push --push-option=merge_request.create --push-option=merge_request.assign='vk'";
};
};
};
}

View file

@ -1,4 +1,11 @@
{ config, lib, pkgs, modulesPath, nixos-hardware, ... }: {
{
config,
lib,
pkgs,
modulesPath,
nixos-hardware,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
nixos-hardware.nixosModules.common-cpu-intel
@ -14,7 +21,6 @@
boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = [];
# https://elis.nu/blog/2020/05/nixos-tmpfs-as-root/
fileSystems."/" = {
device = "none";

View file

@ -18,7 +18,10 @@
};
};
workspaceOutputAssign = [
{ workspace = "9"; output = "eDP-1"; }
{
workspace = "9";
output = "eDP-1";
}
];
};
};

View file

@ -1,4 +1,11 @@
{ config, lib, pkgs, modulesPath, nixos-hardware, ... }: {
{
config,
lib,
pkgs,
modulesPath,
nixos-hardware,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
nixos-hardware.nixosModules.common-cpu-amd

View file

@ -14,8 +14,14 @@
};
};
workspaceOutputAssign = [
{ workspace = "8"; output = "DP-2"; }
{ workspace = "9"; output = "DP-2"; }
{
workspace = "8";
output = "DP-2";
}
{
workspace = "9";
output = "DP-2";
}
];
};
};

View file

@ -1,4 +1,10 @@
{ config, lib, pkgs, modulesPath, ... }: {
{
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
@ -36,4 +42,3 @@
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

View file

@ -10,7 +10,12 @@
];
routes = [
{routeConfig = {Gateway = "91.210.59.1";};}
{ routeConfig = { Gateway = "2a0d:3e83:1::1"; GatewayOnLink = true; }; }
{
routeConfig = {
Gateway = "2a0d:3e83:1::1";
GatewayOnLink = true;
};
}
];
};
};

View file

@ -3,8 +3,14 @@
settings = {
Nickname = "DXV7520";
ORPort = [
{ addr = "91.210.59.57"; port = 443; }
{ addr = "[2a0d:3e83:1:b284::1]"; port = 443; }
{
addr = "91.210.59.57";
port = 443;
}
{
addr = "[2a0d:3e83:1:b284::1]";
port = 443;
}
];
};
};

View file

@ -1,4 +1,11 @@
{ config, lib, pkgs, modulesPath, nixos-hardware, ... }: {
{
config,
lib,
pkgs,
modulesPath,
nixos-hardware,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
nixos-hardware.nixosModules.common-cpu-intel

View file

@ -1,4 +1,8 @@
{ agenix, pkgs, ... }: {
{
agenix,
pkgs,
...
}: {
# Agenix manages the deployment of secrets by public-key encrypting them to
# each system's ssh host key. See the README for more information.
# https://github.com/ryantm/agenix

View file

@ -19,7 +19,12 @@
# Persist docker volumes
environment.persistence."/nix/persist" = {
directories = [
{ directory = "/var/lib/docker"; user = "root"; group = "root"; mode = "0700"; }
{
directory = "/var/lib/docker";
user = "root";
group = "root";
mode = "0700";
}
];
};
}

View file

@ -1,4 +1,8 @@
{ config, home-manager, ... }: {
{
config,
home-manager,
...
}: {
# Like NixOS manages the system configuration, Home Manager manages the user
# environment.
#

View file

@ -28,10 +28,25 @@
hideMounts = true;
directories = [
# See comment above for /tmp
{ directory = "/tmp"; user = "root"; group = "root"; mode = "1777"; }
{
directory = "/tmp";
user = "root";
group = "root";
mode = "1777";
}
# Save the last run time of persistent timers so systemd knows if they were missed
{ directory = "/var/lib/systemd/timers"; user = "root"; group = "root"; mode = "0755"; }
{ directory = "/var/log"; user = "root"; group = "root"; mode = "0755"; }
{
directory = "/var/lib/systemd/timers";
user = "root";
group = "root";
mode = "0755";
}
{
directory = "/var/log";
user = "root";
group = "root";
mode = "0755";
}
];
files = [
"/etc/machine-id" # needed for /var/log

View file

@ -51,7 +51,12 @@
services.vnstat.enable = true;
environment.persistence."/nix/persist" = {
directories = [
{ directory = "/var/lib/vnstat"; user = "root"; group = "root"; mode = "0755"; }
{
directory = "/var/lib/vnstat";
user = "root";
group = "root";
mode = "0755";
}
];
};
}

View file

@ -1,4 +1,9 @@
{ nix-index-database, nixpkgs-unstable, nixpkgs, ... }: {
{
nix-index-database,
nixpkgs-unstable,
nixpkgs,
...
}: {
imports = [
nix-index-database.nixosModules.nix-index
];

View file

@ -1,4 +1,8 @@
{ config, pkgs, ... }: {
{
config,
pkgs,
...
}: {
users = {
# Don't allow imperative modifications to users (incompatible with impermanence)
mutableUsers = false;

View file

@ -1,4 +1,8 @@
{ home-manager, pkgs, ... }: {
{
home-manager,
pkgs,
...
}: {
home-manager.users.caspervk = {
programs.neovim = {
enable = true;

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
{
config,
lib,
pkgs,
...
}: {
# BorgBackup (short: Borg) is a deduplicating backup program.
# https://nixos.wiki/wiki/Borg_backup
# https://nixos.org/manual/nixos/stable/#module-borgbase

View file

@ -10,7 +10,11 @@
# It's easy to open a new terminal using Mod+Enter in sway, but it
# always opens in the home directly. This binds Control+Shift+Enter
# to open a new terminal in the current directory.
{ key = "Return"; mods = "Control|Shift"; action = "SpawnNewInstance"; }
{
key = "Return";
mods = "Control|Shift";
action = "SpawnNewInstance";
}
];
};
};

View file

@ -1,4 +1,9 @@
{ home-manager, lib, pkgs, ... }: {
{
home-manager,
lib,
pkgs,
...
}: {
# Clipboard manager. It can help persist clipboard contents after closing an
# application - which otherwise isn't supported in Wayland - but that breaks
# rich content copying in general. Therefore, we only use it for clipboard

View file

@ -14,7 +14,12 @@
# Persist flatpaks
environment.persistence."/nix/persist" = {
directories = [
{ directory = "/var/lib/flatpak"; user = "root"; group = "root"; mode = "0755"; }
{
directory = "/var/lib/flatpak";
user = "root";
group = "root";
mode = "0755";
}
];
};
}

View file

@ -14,7 +14,12 @@
# Persist WiFi passwords and other network configuration
environment.persistence."/nix/persist" = {
directories = [
{ directory = "/etc/NetworkManager/system-connections"; user = "root"; group = "root"; mode = "0700"; }
{
directory = "/etc/NetworkManager/system-connections";
user = "root";
group = "root";
mode = "0700";
}
];
};

View file

@ -1,4 +1,10 @@
{ home-manager, lib, nixpkgs, pkgs, ... }: {
{
home-manager,
lib,
nixpkgs,
pkgs,
...
}: {
# Packages useful on a desktop computer which don't require their own module
environment.systemPackages = with pkgs; [
@ -6,7 +12,8 @@
gimp
jetbrains.pycharm-professional
keepassxc
(kodi-wayland.withPackages (kodiPackages: with kodiPackages; [
(kodi-wayland.withPackages (kodiPackages:
with kodiPackages; [
jellyfin
]))
libqalculate
@ -19,7 +26,8 @@
webcord # discord
];
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [
"android-studio-stable"
"pycharm-professional"
"spotify"

View file

@ -1,4 +1,8 @@
{ home-manager, pkgs, ... }: {
{
home-manager,
pkgs,
...
}: {
# A window switcher, application launcher and dmenu replacement. Used to open
# programs, view the clipboard history, and select emojis.
# https://github.com/davatorium/rofi

View file

@ -1,4 +1,9 @@
{ home-manager, lib, pkgs, ... }: {
{
home-manager,
lib,
pkgs,
...
}: {
# https://nixos.wiki/wiki/Sway
programs.sway = {
@ -125,8 +130,7 @@
# https://github.com/Alexays/Waybar/wiki/Configuration
# https://github.com/Alexays/Waybar/blob/master/resources/config
programs.waybar =
let
programs.waybar = let
# It isn't possible to extend the default Waybar config in Home
# Manager; as soon as any setting is defined it overwrites the entire
# default configuration. To combat this, we parse the default config
@ -140,8 +144,7 @@
'';
};
defaultConfig = builtins.fromJSON (lib.readFile "${mkDefaultConfig}");
in
{
in {
enable = true;
settings = {
bar = lib.mkMerge [
@ -234,22 +237,33 @@
};
# https://github.com/swaywm/swayidle
services.swayidle =
let
services.swayidle = let
lock = "${pkgs.swaylock}/bin/swaylock --daemonize";
outputOff = "${pkgs.sway}/bin/swaymsg 'output * power off'";
outputOn = "${pkgs.sway}/bin/swaymsg 'output * power on'";
suspend = "${pkgs.systemd}/bin/systemctl suspend";
in
{
in {
enable = true;
events = [
{ event = "lock"; command = lock; }
{ event = "before-sleep"; command = lock; }
{
event = "lock";
command = lock;
}
{
event = "before-sleep";
command = lock;
}
];
timeouts = [
{ timeout = 60 * 20; command = outputOff; resumeCommand = outputOn; }
{ timeout = 60 * 60 * 3; command = suspend; }
{
timeout = 60 * 20;
command = outputOff;
resumeCommand = outputOn;
}
{
timeout = 60 * 60 * 3;
command = suspend;
}
];
};

View file

@ -20,7 +20,12 @@
# Persist libvirt data
environment.persistence."/nix/persist" = {
directories = [
{ directory = "/var/lib/libvirt"; user = "root"; group = "root"; mode = "0755"; }
{
directory = "/var/lib/libvirt";
user = "root";
group = "root";
mode = "0755";
}
];
};
}

View file

@ -1,4 +1,8 @@
{ config, pkgs, ... }: {
{
config,
pkgs,
...
}: {
services.tor = {
enable = true;
openFirewall = true;
@ -26,7 +30,12 @@
environment.persistence."/nix/persist" = {
directories = [
{ directory = "/var/lib/tor"; user = "tor"; group = "tor"; mode = "0700"; }
{
directory = "/var/lib/tor";
user = "tor";
group = "tor";
mode = "0700";
}
];
};
}

View file

@ -2,7 +2,6 @@
# the agenix CLI tool to know which public keys to use for encryption. See the
# README for more information.
# https://github.com/ryantm/agenix
let
# Get a system's public key using:
# > cat /etc/ssh/ssh_host_ed25519_key.pub