summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Magnusson <mathias@magnusson.space>2025-10-19 17:45:49 +0200
committerMathias Magnusson <mathias@magnusson.space>2025-10-19 17:46:34 +0200
commit671e66917b09c56ca9e717b300b874ed71b189ae (patch)
treec81a03308a7fa7828d49fc29d49f76bfec2e86ea
parent421733993cc9f0ce1ec4306cd0659fb5fe655846 (diff)
downloadoden-671e66917b09c56ca9e717b300b874ed71b189ae.tar.gz
nixfmt
-rw-r--r--configuration.nix26
-rw-r--r--disko.nix24
-rw-r--r--flake.nix31
-rw-r--r--hardware-configuration.nix23
-rw-r--r--impermanence.nix15
-rw-r--r--router.nix57
-rw-r--r--secrets/secrets.nix7
7 files changed, 125 insertions, 58 deletions
diff --git a/configuration.nix b/configuration.nix
index 1a4ea3e..69f83c0 100644
--- a/configuration.nix
+++ b/configuration.nix
@@ -1,15 +1,21 @@
-{ config, lib, pkgs, inputs, ... }:
-
{
- imports =
- [
- ./hardware-configuration.nix
- ./disko.nix
- ./impermanence.nix
- ./router.nix
- ];
+ config,
+ pkgs,
+ inputs,
+ ...
+}:
+{
+ imports = [
+ ./hardware-configuration.nix
+ ./disko.nix
+ ./impermanence.nix
+ ./router.nix
+ ];
- hardware.graphics.extraPackages = with pkgs; [ vpl-gpu-rt intel-media-driver ];
+ hardware.graphics.extraPackages = with pkgs; [
+ vpl-gpu-rt
+ intel-media-driver
+ ];
hardware.graphics.enable = true;
# Use the systemd-boot EFI boot loader.
diff --git a/disko.nix b/disko.nix
index 1f89ffa..cb4a05e 100644
--- a/disko.nix
+++ b/disko.nix
@@ -25,19 +25,35 @@
subvolumes = {
"/root" = {
mountpoint = "/";
- mountOptions = [ "subvol=root" "compress=zstd" "noatime" ];
+ mountOptions = [
+ "subvol=root"
+ "compress=zstd"
+ "noatime"
+ ];
};
"/home" = {
mountpoint = "/home";
- mountOptions = [ "subvol=home" "compress=zstd" "noatime" ];
+ mountOptions = [
+ "subvol=home"
+ "compress=zstd"
+ "noatime"
+ ];
};
"/nix" = {
mountpoint = "/nix";
- mountOptions = [ "subvol=nix" "compress=zstd" "noatime" ];
+ mountOptions = [
+ "subvol=nix"
+ "compress=zstd"
+ "noatime"
+ ];
};
"/nix/persist" = {
mountpoint = "/nix/persist";
- mountOptions = [ "subvol=persist" "compress=zstd" "noatime" ];
+ mountOptions = [
+ "subvol=persist"
+ "compress=zstd"
+ "noatime"
+ ];
};
};
};
diff --git a/flake.nix b/flake.nix
index 8337af5..61063fc 100644
--- a/flake.nix
+++ b/flake.nix
@@ -11,18 +11,25 @@
agenix.inputs.nixpkgs.follows = "nixpkgs";
agenix.inputs.darwin.follows = "";
};
- outputs = inputs@{ self, nixpkgs, disko, impermanence, agenix, ... }: {
- nixosConfigurations.oden = nixpkgs.lib.nixosSystem {
- modules = [
- ./configuration.nix
- disko.nixosModules.disko
- impermanence.nixosModules.impermanence
- agenix.nixosModules.default
- ];
- specialArgs = {
- inherit inputs;
+ outputs =
+ inputs@{
+ nixpkgs,
+ disko,
+ impermanence,
+ agenix,
+ ...
+ }:
+ {
+ nixosConfigurations.oden = nixpkgs.lib.nixosSystem {
+ modules = [
+ ./configuration.nix
+ disko.nixosModules.disko
+ impermanence.nixosModules.impermanence
+ agenix.nixosModules.default
+ ];
+ specialArgs = {
+ inherit inputs;
+ };
};
};
- };
}
-
diff --git a/hardware-configuration.nix b/hardware-configuration.nix
index df42bc0..e7fe300 100644
--- a/hardware-configuration.nix
+++ b/hardware-configuration.nix
@@ -1,14 +1,25 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
-{ config, lib, pkgs, modulesPath, ... }:
-
{
- imports =
- [ (modulesPath + "/installer/scan/not-detected.nix")
- ];
+ config,
+ lib,
+ modulesPath,
+ ...
+}:
+{
+ imports = [
+ (modulesPath + "/installer/scan/not-detected.nix")
+ ];
- boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ];
+ boot.initrd.availableKernelModules = [
+ "xhci_pci"
+ "ahci"
+ "nvme"
+ "usb_storage"
+ "usbhid"
+ "sd_mod"
+ ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
diff --git a/impermanence.nix b/impermanence.nix
index d3dae53..3fe347a 100644
--- a/impermanence.nix
+++ b/impermanence.nix
@@ -6,13 +6,16 @@ let
cfg = config.oden.persist;
in
{
- options.oden.persist = with lib; with types; {
- directories = mkOption {
- type = listOf str;
- default = [];
- description = "Directories that should be persisted";
+ options.oden.persist =
+ with lib;
+ with types;
+ {
+ directories = mkOption {
+ type = listOf str;
+ default = [ ];
+ description = "Directories that should be persisted";
+ };
};
- };
config = {
boot.initrd.postResumeCommands = lib.mkAfter ''
mkdir /btrfs_tmp
diff --git a/router.nix b/router.nix
index 338bc83..1b2eb51 100644
--- a/router.nix
+++ b/router.nix
@@ -16,25 +16,35 @@ in
internalInterfaces = [ "br0" ];
# forwardPorts = [{ sourcePort = 1234; destination = "10.69.0.2:12345"; }];
};
- bridges.br0.interfaces = [ lanInterface wifiInterface ];
- interfaces.br0.ipv4.addresses = [{
- address = "10.69.0.1";
- prefixLength = 16;
- }];
+ bridges.br0.interfaces = [
+ lanInterface
+ wifiInterface
+ ];
+ interfaces.br0.ipv4.addresses = [
+ {
+ address = "10.69.0.1";
+ prefixLength = 16;
+ }
+ ];
networkmanager = {
enable = true;
- unmanaged = [ "interface-name:${lanInterface}" "interface-name:${wifiInterface}" ];
- dispatcherScripts = [ {
- type = "basic";
- source = pkgs.writeScript "dynamic-dns-on-ipv4-change" ''
- #!/bin/sh
+ unmanaged = [
+ "interface-name:${lanInterface}"
+ "interface-name:${wifiInterface}"
+ ];
+ dispatcherScripts = [
+ {
+ type = "basic";
+ source = pkgs.writeScript "dynamic-dns-on-ipv4-change" ''
+ #!/bin/sh
- [ "$1" = "${wanInterface}" ] || exit
- [ "$2" = dhcp4-change ] || exit
- ${pkgs.curl}/bin/curl "$(cat "${config.age.secrets."dyndns-url.txt".path}")"
- date >> /home/mathias/networkmanager-dispatcherScripts-run
- '';
- } ];
+ [ "$1" = "${wanInterface}" ] || exit
+ [ "$2" = dhcp4-change ] || exit
+ ${pkgs.curl}/bin/curl "$(cat "${config.age.secrets."dyndns-url.txt".path}")"
+ date >> /home/mathias/networkmanager-dispatcherScripts-run
+ '';
+ }
+ ];
};
};
services.hostapd = {
@@ -65,11 +75,17 @@ in
domain = "m";
local = "/m/";
- server = [ "1.1.1.1" "1.0.0.1" ];
+ server = [
+ "1.1.1.1"
+ "1.0.0.1"
+ ];
interface = "br0";
dhcp-range = "10.69.0.50,10.69.0.254,255.255.0.0,1h";
- dhcp-option = [ "option:router,10.69.0.1" "option:dns-server,10.69.0.1" ];
+ dhcp-option = [
+ "option:router,10.69.0.1"
+ "option:dns-server,10.69.0.1"
+ ];
dhcp-authoritative = true;
no-hosts = true;
@@ -82,7 +98,10 @@ in
};
};
networking.nameservers = [ "127.0.0.1" ];
- networking.firewall.allowedUDPPorts = [ 53 67 ];
+ networking.firewall.allowedUDPPorts = [
+ 53
+ 67
+ ];
networking.firewall.allowedTCPPorts = [ 53 ];
oden.persist.directories = [ "/var/lib/dnsmasq" ];
diff --git a/secrets/secrets.nix b/secrets/secrets.nix
index 8673c6d..0125da8 100644
--- a/secrets/secrets.nix
+++ b/secrets/secrets.nix
@@ -12,4 +12,9 @@ let
"dyndns-url.txt.age"
];
in
-builtins.listToAttrs (map (name: { inherit name; value.publicKeys = keys; }) files)
+builtins.listToAttrs (
+ map (name: {
+ inherit name;
+ value.publicKeys = keys;
+ }) files
+)