From e8d4263e65cd95281d88b87f6935ec2a36154668 Mon Sep 17 00:00:00 2001 From: James Walker Date: Wed, 22 Jun 2022 16:32:51 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20clean=20up=20flake.nix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .envrc | 1 + .gitignore | 1 + flake.lock | 16 ++++++++++++++ flake.nix | 62 ++++++++++++++++++------------------------------------ 4 files changed, 39 insertions(+), 41 deletions(-) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index b2be92b..d1da3a8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ result +.direnv \ No newline at end of file diff --git a/flake.lock b/flake.lock index aa7415d..d213622 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,20 @@ { "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -38,6 +53,7 @@ }, "root": { "inputs": { + "flake-utils": "flake-utils", "home-manager": "home-manager", "nixpkgs": "nixpkgs" } diff --git a/flake.nix b/flake.nix index 1f8c187..ea065fe 100644 --- a/flake.nix +++ b/flake.nix @@ -3,49 +3,29 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; home-manager.url = "github:nix-community/home-manager"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = { self, nixpkgs, home-manager }: { - homeConfigurations = { - aarch64-darwin = home-manager.lib.homeManagerConfiguration { - system = "aarch64-darwin"; - homeDirectory = "/Users/walkah"; - username = "walkah"; - stateVersion = "21.03"; - configuration = { config, pkgs, ... }: { - imports = [ - ./home.nix - ]; - }; - }; - x86_64-darwin = home-manager.lib.homeManagerConfiguration { - system = "x86_64-darwin"; - homeDirectory = "/Users/walkah"; - username = "walkah"; - stateVersion = "21.03"; - configuration = { config, pkgs, ... }: { - imports = [ - ./home.nix - ]; - }; - }; - x86_64-linux = home-manager.lib.homeManagerConfiguration { - system = "x86_64-linux"; - homeDirectory = "/home/walkah"; - username = "walkah"; - stateVersion = "21.03"; - configuration = { config, pkgs, ... }: { - imports = [ - ./home.nix - ]; - }; - }; - - }; - defaultPackage.aarch64-darwin = self.homeConfigurations.aarch64-darwin.activationPackage; - defaultPackage.x86_64-darwin = self.homeConfigurations.x86_64-darwin.activationPackage; - defaultPackage.x86_64-linux = self.homeConfigurations.x86_64-linux.activationPackage; - }; + outputs = { self, nixpkgs, home-manager, flake-utils, ... }: + flake-utils.lib.eachSystem [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ] + (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in + { + homeConfigurations = { + walkah = home-manager.lib.homeManagerConfiguration { + system = system; + homeDirectory = if pkgs.stdenv.isDarwin then "/Users/walkah" else "/home/walkah"; + username = "walkah"; + stateVersion = "21.03"; + configuration = { config, pkgs, ... }: { + imports = [ ./home.nix ]; + }; + }; + }; + packages.default = + self.homeConfigurations.${system}.walkah.activationPackage; + }); }