about summary refs log tree commit diff stats
path: root/nix-conf/home/flake.nix
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2025-07-25 21:04:48 +0100
committerDavid Morgan <djm_uk@protonmail.com>2025-07-25 21:04:48 +0100
commitd5f60319870f8daa4a312ace911aee97445cccc9 (patch)
tree399f57cea0884e96910348b696fb78ada5dfc248 /nix-conf/home/flake.nix
parent83dd90f135afbd0690bcca34df5f960975ff0160 (diff)
downloaddotfiles-master.tar.gz
Use flakes + nix-darwin on MacOS HEAD master
Diffstat (limited to 'nix-conf/home/flake.nix')
-rw-r--r--nix-conf/home/flake.nix117
1 files changed, 117 insertions, 0 deletions
diff --git a/nix-conf/home/flake.nix b/nix-conf/home/flake.nix
new file mode 100644
index 0000000..03af5b7
--- /dev/null
+++ b/nix-conf/home/flake.nix
@@ -0,0 +1,117 @@
+{
+  description = "Home Manager configuration";
+
+  inputs = {
+    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
+    nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-25.05";
+    nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
+    home-manager = {
+      url = "github:nix-community/home-manager";
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
+    home-manager-stable = {
+      url = "github:nix-community/home-manager/release-25.05";
+      inputs.nixpkgs.follows = "nixpkgs-stable";
+    };
+    sops-nix = {
+      url = "github:Mic92/sops-nix";
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
+    nix-darwin = {
+      url = "github:nix-darwin/nix-darwin/master";
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
+    darwin-system-certs = {
+      url = "/private/etc/ssl/cert.pem";
+      flake = false;
+    };
+  };
+
+  outputs =
+    {
+      self,
+      nixpkgs,
+      nixpkgs-stable,
+      nixpkgs-unstable,
+      nix-darwin,
+      home-manager,
+      home-manager-stable,
+      sops-nix,
+      ...
+    }@inputs:
+    let
+      darwin-system = "aarch64-darwin";
+      linux-system = "x86_64-linux";
+      linux-arm-system = "aarch64-linux";
+      linux-pkgs = nixpkgs-stable.legacyPackages.${linux-system};
+      darwin-overlay-unstable = final: prev: {
+        unstable = nixpkgs-unstable.legacyPackages.${darwin-system};
+      };
+      linux-overlay-unstable = final: prev: {
+        unstable = nixpkgs-unstable.legacyPackages.${linux-system};
+      };
+      linux-arm-overlay-unstable = final: prev: {
+        unstable = nixpkgs-unstable.legacyPackages.${linux-arm-system};
+      };
+    in
+    {
+      darwinConfigurations."LDN-DMORGAN" = nix-darwin.lib.darwinSystem {
+        modules = [
+          # TODO move to separate file
+          (
+            { pkgs, ... }:
+            {
+              nix.settings.experimental-features = "nix-command flakes";
+              nix.settings.trusted-users = [
+                "dmorgan"
+                "@staff"
+              ];
+              nix.settings.ssl-cert-file = "/Users/dmorgan/certs/full-cert.pem";
+              system.configurationRevision = self.rev or self.dirtyRev or null;
+              system.stateVersion = 6;
+              nixpkgs.hostPlatform = "aarch64-darwin";
+              ids.gids.nixbld = 30000;
+              users.users.dmorgan.home = "/Users/dmorgan";
+              fonts.packages = [
+                pkgs.aporetic
+                pkgs.meslo-lgs-nf
+                pkgs.fira-code
+              ];
+            }
+          )
+          home-manager.darwinModules.home-manager
+          {
+            nixpkgs.overlays = [ darwin-overlay-unstable ];
+            nixpkgs.config.allowUnfreePredicate =
+              pkg: builtins.elem (nixpkgs.lib.getName pkg) [ "aspell-dict-en-science" ];
+            home-manager = {
+              useGlobalPkgs = true;
+              useUserPackages = true;
+              extraSpecialArgs = {
+                inherit inputs;
+                system = darwin-system;
+              };
+              users.dmorgan = ./otm.nix;
+            };
+          }
+        ];
+      };
+      # WIP: TODO: migrate home configs to nixos config
+      homeConfigurations."djm-egalmoth" = home-manager-stable.lib.homeManagerConfiguration {
+        pkgs = linux-pkgs;
+        extraSpecialArgs = {
+          inherit inputs;
+          system = linux-system;
+        };
+        modules = [
+          (
+            { config, pkgs, ... }:
+            {
+              nixpkgs.overlays = [ linux-overlay-unstable ];
+            }
+          )
+          ./egalmoth.nix
+        ];
+      };
+    };
+}