From 2c64ba85303b8352dc8391ce662088417ac21923 Mon Sep 17 00:00:00 2001 From: James Patrick Date: Mon, 13 Dec 2021 22:28:47 -0500 Subject: [PATCH] Switched to using flake-utils This reducies the number of things that I will need at sometime in the theortical future, by doing more work now. --- flake.lock | 53 +++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 62 ++++++++++++++++++++++++++++++++---------------------- 2 files changed, 89 insertions(+), 26 deletions(-) diff --git a/flake.lock b/flake.lock index f67eba9..04ce7ad 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,35 @@ { "nodes": { + "emacs-overlay": { + "locked": { + "lastModified": 1639416884, + "narHash": "sha256-ucI8w/JcQQzEbppfPBK7HPfsy3HRi5hy2FoksuvkPCc=", + "owner": "nix-community", + "repo": "emacs-overlay", + "rev": "9516033899da467b8fcee6536a61ea66ebd0c4fa", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "emacs-overlay", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -69,10 +99,31 @@ }, "root": { "inputs": { + "emacs-overlay": "emacs-overlay", "home-manager": "home-manager", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", - "nur": "nur" + "nur": "nur", + "utils": "utils" + } + }, + "utils": { + "inputs": { + "flake-utils": "flake-utils" + }, + "locked": { + "lastModified": 1632420560, + "narHash": "sha256-8Tsa4Hp/CHCA6J8/E7EODhp75z5N1NBhFiOb3lBv/tI=", + "owner": "gytis-ivaskevicius", + "repo": "flake-utils-plus", + "rev": "4b1bcafcfcd78bd36ceabfe3872822ba5c7fcbe8", + "type": "github" + }, + "original": { + "owner": "gytis-ivaskevicius", + "ref": "v1.3.0", + "repo": "flake-utils-plus", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 48b8c2d..735d253 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,7 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + utils.url = "github:gytis-ivaskevicius/flake-utils-plus/v1.3.0"; home-manager = { url = "github:nix-community/home-manager"; @@ -18,35 +19,46 @@ url = "github:NixOS/nixos-hardware/master"; inputs.nixpkgs.follows = "nixpkgs"; }; + + emacs-overlay = { + url = "github:nix-community/emacs-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - # All outputs for the system (configs) - outputs = { home-manager, nixpkgs, nur, nixos-hardware, ... }: - let - system = "x86_64-linux"; - pkgs = import nixpkgs { - inherit system; - config = { allowUnfree = true; }; + outputs = inputs@{ self, utils, nixpkgs, nixos-hardware, nur, home-manager + , emacs-overlay, ... }: + utils.lib.mkFlake { + hosts = { + nil.modules = [ + nixos-hardware.nixosModules.lenovo-thinkpad-t14-amd-gen1 + ./hosts/nil.nix + ]; }; - lib = nixpkgs.lib; - in { - nixosConfigurations = { - # Config is based on hostname - nil = lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - nixos-hardware.nixosModules.lenovo-thinkpad-t14-amd-gen1 - ./hosts/nil.nix - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.james = import ./home.nix; - } - { nixpkgs.overlays = [ nur.overlay ]; } - ]; - }; + # Shared logic below. + inherit self inputs; + supportedSystems = [ "x86_64-linux" ]; + channels.nixpkgs = { + input = nixpkgs; + overlaysBuilder = channels: [ ]; }; + channelsConfig = { allowUnfree = true; }; + sharedOverlays = [ nur.overlay emacs-overlay.overlay ]; + hostDefaults = { + modules = [ + nixos-hardware.nixosModules.lenovo-thinkpad-t14-amd-gen1 + ./hosts/nil.nix + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.james = import ./home.nix; + } + { nixpkgs.overlays = [ nur.overlay ]; } + ]; + system = "x86_64-linux"; + }; + }; }