From 5524721426232c5e51067b480f864f859aece977 Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Sat, 10 Jun 2023 13:27:44 +0530 Subject: [PATCH] initial setup for home-manager on darwin --- flake.lock | 22 ++++++++++++++++++++++ flake.nix | 36 ++++++++++++++++++++++++++++++------ home/darwin.nix | 10 ++++++++++ home/programs/neovim.nix | 6 +++--- 4 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 home/darwin.nix diff --git a/flake.lock b/flake.lock index 6151d43..e6d81d6 100644 --- a/flake.lock +++ b/flake.lock @@ -33,6 +33,27 @@ "type": "github" } }, + "darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1686210161, + "narHash": "sha256-cgP8P2Gk4WtOzd/Y7nEmweLpPOtMKVvHCIcq9zm9qMk=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "40e4b85baac86969f94d6dba893aeae015c562c1", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -289,6 +310,7 @@ }, "root": { "inputs": { + "darwin": "darwin", "home-manager": "home-manager", "impermanence": "impermanence", "lanzaboote": "lanzaboote", diff --git a/flake.nix b/flake.nix index d3e2a38..78ebf0d 100644 --- a/flake.nix +++ b/flake.nix @@ -6,6 +6,9 @@ url = "github:NixOS/nixpkgs/nixos-unstable"; }; + darwin.url = "github:lnl7/nix-darwin/master"; + darwin.inputs.nixpkgs.follows = "nixpkgs"; + home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; @@ -29,20 +32,24 @@ outputs = { self, nixpkgs, + darwin, home-manager, impermanence, lanzaboote, nixneovimplugins, - } @ inputs: { + } @ inputs: let + user = (import ./secrets.nix).users; + in { formatter."x86_64-linux" = nixpkgs.legacyPackages."x86_64-linux".alejandra; - nixosConfigurations = let - user = (import ./secrets.nix).users; - in { + formatter."x86_64-darwin" = nixpkgs.legacyPackages."x86_64-darwin".alejandra; + nixosConfigurations = { Skipper = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; pkgs = import nixpkgs { inherit system; - config = {allowUnfree = true;}; + config = { + allowUnfree = true; + }; overlays = [(import ./packages) nixneovimplugins.overlays.default]; }; specialArgs = inputs; @@ -76,7 +83,9 @@ system = "aarch64-linux"; pkgs = import nixpkgs { inherit system; - config = {allowUnfree = true;}; + config = { + allowUnfree = true; + }; }; specialArgs = inputs; modules = [ @@ -88,5 +97,20 @@ ]; }; }; + homeConfigurations."${user.primary.userName}@Alex" = home-manager.lib.homeManagerConfiguration { + pkgs = import nixpkgs { + system = "x86_64-darwin"; + config = { + allowUnfree = true; + }; + overlays = [nixneovimplugins.overlays.default]; + }; + + # Specify your home configuration modules here, for example, + # the path to your home.nix. + modules = [ + (import ./home/darwin.nix {inherit user;}) + ]; + }; }; } diff --git a/home/darwin.nix b/home/darwin.nix new file mode 100644 index 0000000..bb537e2 --- /dev/null +++ b/home/darwin.nix @@ -0,0 +1,10 @@ +{user, ...}: { + home = { + username = user.primary.userName; + homeDirectory = "/Users/${user.primary.userName}"; + stateVersion = "23.11"; + }; + programs.home-manager.enable = true; + + imports = [./programs/neovim.nix]; +} diff --git a/home/programs/neovim.nix b/home/programs/neovim.nix index 44c7f60..027c373 100644 --- a/home/programs/neovim.nix +++ b/home/programs/neovim.nix @@ -1,7 +1,7 @@ {pkgs, ...}: { - xdg.desktopEntries."nvim".name = "Neovim wrapper"; - xdg.desktopEntries."nvim".exec = "nvim %F"; - xdg.desktopEntries."nvim".noDisplay = true; + #xdg.desktopEntries."nvim".name = "Neovim wrapper"; + #xdg.desktopEntries."nvim".exec = "nvim %F"; + #xdg.desktopEntries."nvim".noDisplay = true; programs.neovim = { enable = true;