From 234e37175bedd061252a311cc3d08f4898132aae Mon Sep 17 00:00:00 2001 From: Quentin Aristote Date: Sun, 13 Nov 2022 22:59:21 +0100 Subject: flake: interface modules and overlays --- configuration.nix | 10 ---------- flake.lock | 32 +++++++++++++++++++------------- flake.nix | 44 ++++++++++++++++++++++++++++++++------------ tests/configuration.nix | 2 +- 4 files changed, 52 insertions(+), 36 deletions(-) delete mode 100644 configuration.nix diff --git a/configuration.nix b/configuration.nix deleted file mode 100644 index 958a63c..0000000 --- a/configuration.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ ... }: - -{ - imports = [ ./config ./modules ]; - - nixpkgs = { - overlays = - [ (final: prev: { personal = import ./pkgs { pkgs = final; }; }) ]; - }; -} diff --git a/flake.lock b/flake.lock index eb376cd..7eee262 100644 --- a/flake.lock +++ b/flake.lock @@ -3,18 +3,20 @@ "data": { "inputs": { "flake-utils": [ - "personal-webpage" + "personal-webpage", + "flake-utils" ], "nixpkgs": [ - "personal-webpage" + "personal-webpage", + "nixpkgs" ] }, "locked": { - "lastModified": 1668340813, - "narHash": "sha256-S3rKgiJqBGsH69zU/A3tlogMC/jpICHtSAzd/CBTVUI=", + "lastModified": 1668375475, + "narHash": "sha256-rp+tPVJkm8QWG48MBhk/+qblvYOmSpLamfAZkhMnyKw=", "owner": "qaristote", "repo": "info", - "rev": "946290203abdc6075b01a40672509bbaabd260d5", + "rev": "5a8c11a5fae47a8eaad7a90ac3a70020243ceb48", "type": "github" }, "original": { @@ -33,9 +35,8 @@ "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" + "id": "flake-utils", + "type": "indirect" } }, "nixpkgs": { @@ -55,15 +56,19 @@ "personal-webpage": { "inputs": { "data": "data", - "flake-utils": "flake-utils", - "nixpkgs": [] + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { - "lastModified": 1668369630, - "narHash": "sha256-aaXUpBgOhMjDYDSsnGs28MExA4o0cXn7tV5ndfxpikU=", + "lastModified": 1668375580, + "narHash": "sha256-eviU7Gx1Y1yTKsWdKQJ0fI/gA/L3MtDp5ZLbleSthzk=", "owner": "qaristote", "repo": "webpage", - "rev": "b0cb171f641dca185cad98506d6c0e104c67dab0", + "rev": "19a0c33863da3223145e4e1c1315d5332ff53df5", "type": "github" }, "original": { @@ -74,6 +79,7 @@ }, "root": { "inputs": { + "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", "personal-webpage": "personal-webpage" } diff --git a/flake.nix b/flake.nix index 6ca1663..ac3ee30 100644 --- a/flake.nix +++ b/flake.nix @@ -1,21 +1,41 @@ { - inputs.personal-webpage = { - url = "github:qaristote/webpage"; - inputs.nixpkgs.follows = ""; + inputs = { + personal-webpage = { + url = "github:qaristote/webpage"; + inputs = { + nixpkgs.follows = "/nixpkgs"; + flake-utils.follows = "/flake-utils"; + }; + }; }; - outputs = { self, nixpkgs, ... }@attrs: { - nixosConfigurations = { - hermes = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = attrs; - modules = [ ./configuration.nix ./hardware-configuration.nix ]; + outputs = { self, nixpkgs, personal-webpage, flake-utils, ... }@attrs: + flake-utils.lib.eachDefaultSystem (system: { + overlays.default = final: prev: { + personal = import ./pkgs { pkgs = final; } // { + webpage = personal-webpage.defaultPackage."${system}"; + }; }; - hermes-test = nixpkgs.lib.nixosSystem { + }) // { + nixosModules.default = import ./modules; + nixosConfigurations = let system = "x86_64-linux"; specialArgs = attrs; - modules = [ ./tests/configuration.nix ]; + commonModules = [ + self.nixosModules.default + ({ ... }: { + nixpkgs.overlays = [ self.overlays."${system}".default ]; + }) + ]; + in { + hermes = nixpkgs.lib.nixosSystem { + inherit system specialArgs; + modules = commonModules ++ [ ./config ./hardware-configuration.nix ]; + }; + hermes-test = nixpkgs.lib.nixosSystem { + inherit system specialArgs; + modules = commonModules ++ [ ./tests/configuration.nix ]; + }; }; }; - }; } diff --git a/tests/configuration.nix b/tests/configuration.nix index 73c4bfa..37b043c 100644 --- a/tests/configuration.nix +++ b/tests/configuration.nix @@ -13,7 +13,7 @@ let enableACME = lib.mkForce false; }; in { - imports = [ ../configuration.nix ]; + imports = [ ../config ]; boot.isContainer = true; -- cgit v1.2.3