diff --git a/flake.lock b/flake.lock
index a89291e..42cdbe9 100644
--- a/flake.lock
+++ b/flake.lock
@@ -172,6 +172,23 @@
"type": "github"
}
},
+ "nix-darwin": {
+ "inputs": {
+ "nixpkgs": "nixpkgs_3"
+ },
+ "locked": {
+ "lastModified": 1730184279,
+ "narHash": "sha256-6OB+WWR6gnaWiqSS28aMJypKeK7Pjc2Wm6L0MtOrTuA=",
+ "owner": "LnL7",
+ "repo": "nix-darwin",
+ "rev": "b379bd4d872d159e5189053ce9a4adf86d56db4b",
+ "type": "github"
+ },
+ "original": {
+ "id": "nix-darwin",
+ "type": "indirect"
+ }
+ },
"nixpkgs": {
"locked": {
"lastModified": 1703013332,
@@ -221,6 +238,19 @@
}
},
"nixpkgs_3": {
+ "locked": {
+ "lastModified": 1729665710,
+ "narHash": "sha256-AlcmCXJZPIlO5dmFzV3V2XF6x/OpNWUV8Y/FMPGd8Z4=",
+ "path": "/nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source",
+ "rev": "2768c7d042a37de65bb1b5b3268fc987e534c49d",
+ "type": "path"
+ },
+ "original": {
+ "id": "nixpkgs",
+ "type": "indirect"
+ }
+ },
+ "nixpkgs_4": {
"locked": {
"lastModified": 1726463316,
"narHash": "sha256-gI9kkaH0ZjakJOKrdjaI/VbaMEo9qBbSUl93DnU7f4c=",
@@ -243,7 +273,8 @@
"disko": "disko",
"dotfiles": "dotfiles",
"home-manager": "home-manager_2",
- "nixpkgs": "nixpkgs_3",
+ "nix-darwin": "nix-darwin",
+ "nixpkgs": "nixpkgs_4",
"nixpkgs-stable": "nixpkgs-stable"
}
},
diff --git a/flake.nix b/flake.nix
index e585e98..10e5c6f 100644
--- a/flake.nix
+++ b/flake.nix
@@ -37,6 +37,7 @@
self,
agenix,
home-manager,
+ nix-darwin,
nixpkgs,
nixpkgs-stable,
...
diff --git a/hosts/m3-kratos/default.nix b/hosts/m3-kratos/default.nix
index 9f604f6..09fd218 100644
--- a/hosts/m3-kratos/default.nix
+++ b/hosts/m3-kratos/default.nix
@@ -38,6 +38,7 @@
./configuration.nix
./secrets.nix
./services
+ ./specialisations.nix
];
extraServices.podman.enable = true;
}
diff --git a/hosts/m3-kratos/specialisations.nix b/hosts/m3-kratos/specialisations.nix
new file mode 100644
index 0000000..a43084c
--- /dev/null
+++ b/hosts/m3-kratos/specialisations.nix
@@ -0,0 +1,83 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}: {
+ specialisation = {
+ "HTTPD".configuration = {
+ system.nixos.tags = ["HTTPD"];
+ services.httpd.enable = true;
+ services.httpd.virtualHosts."foo.example.com" = {
+ documentRoot = "/var/www/foo";
+ extraConfig = ''
+
+ Options Indexes FollowSymLinks MultiViews
+ AllowOverride None
+ Require all granted
+
+ '';
+ };
+ };
+ "NGINX".configuration = {
+ system.nixos.tags = ["NGINX"];
+ services.httpd.enable = false;
+ services.nginx.enable = true;
+ services.nginx.config = ''
+ http {
+ server {
+ listen 80;
+ server_name bar.example.com;
+
+ root /var/www/bar;
+
+ location / {
+ index index.html;
+ }
+ }
+ }
+ '';
+ };
+ "NVIDIA".configuration = {
+ boot.kernelParams = [
+ "nvidia.NVreg_PreserveVideoMemoryAllocations=1"
+ "nvidia-drm.modeset=1"
+ ];
+ system.nixos.tags = ["NVIDIA"];
+ services.xserver.videoDrivers = ["nvidia"];
+ hardware = {
+ nvidia = {
+ open = false;
+ package = config.boot.kernelPackages.nvidiaPackages.stable;
+ modesetting.enable = true;
+ powerManagement.enable = true;
+ };
+ graphics = {
+ enable = true;
+ enable32Bit = true;
+ };
+ };
+ environment.sessionVariables = {
+ GBM_BACKEND = "nvidia-drm";
+ __GLX_VENDOR_LIBRARY_NAME = "nvidia";
+ LIBVA_DRIVER_NAME = "nvidia";
+ QT_QPA_PLATFORM = "wayland";
+ WLR_NO_HARDWARE_CURSORS = "1";
+ XDG_SESSION_TYPE = "wayland";
+ };
+ };
+ };
+ environment.systemPackages = [
+ (pkgs.writeShellScriptBin "switch-spec" ''
+ if [ $# -ne 1 ]; then
+ echo "Usage: switch-spec "
+ exit 1
+ fi
+
+ sudo /nix/var/nix/profiles/system/specialisation/$1/bin/switch-to-configuration switch
+ '')
+ ];
+ environment.sessionVariables = lib.mkIf (config.specialisation != {}) {
+ SPECIALISATION = "NONE";
+ };
+}
diff --git a/justfile b/justfile
new file mode 100644
index 0000000..652cefc
--- /dev/null
+++ b/justfile
@@ -0,0 +1,42 @@
+
+# List available commands
+default:
+ @just --list
+
+# Deploy system configuration
+deploy SYSTEM:
+ nixos-rebuild switch --flake .#{{SYSTEM}} --target-host {{SYSTEM}} --use-remote-sudo
+
+# Update flake
+update:
+ nix flake update
+
+# Commit and push changes
+commit MESSAGE:
+ git add .
+ git commit -m "{{MESSAGE}}"
+ git push
+
+# Update, commit, and push changes
+update-and-commit MESSAGE: update
+ @just commit "{{MESSAGE}}"
+
+# Deploy, update, commit, and push changes
+deploy-update-commit SYSTEM MESSAGE: (deploy SYSTEM) update
+ @just commit "{{MESSAGE}}"
+
+# Check flake
+check:
+ nix flake check
+
+# Show flake info
+show:
+ nix flake show
+
+# Build system configuration
+build SYSTEM:
+ nixos-rebuild build --flake .#{{SYSTEM}}
+
+# Enter a development shell
+dev-shell:
+ nix develop