From 3a042bf97bc1c31752ba38d00de933c3d53e6e7f Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Tue, 23 Aug 2022 11:03:29 -0400 Subject: [PATCH 1/2] Switch to `flake-parts` --- flake.lock | 46 ++++++++++++++++++++++++++++++++-------------- flake.nix | 34 ++++++++++++++++------------------ 2 files changed, 48 insertions(+), 32 deletions(-) diff --git a/flake.lock b/flake.lock index ceaa5284..645f1839 100644 --- a/flake.lock +++ b/flake.lock @@ -1,27 +1,45 @@ { "nodes": { - "flake-utils": { + "flake-parts": { + "inputs": { + "nixpkgs": "nixpkgs" + }, "locked": { - "lastModified": 1649676176, - "narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678", + "lastModified": 1661009076, + "narHash": "sha256-phAE40gctVygRq3G3B6LhvD7u2qdQT21xsz8DdRDYFo=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "850d8a76026127ef02f040fb0dcfdb8b749dd9d9", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" + "id": "flake-parts", + "type": "indirect" } }, "nixpkgs": { "locked": { - "lastModified": 1651545648, - "narHash": "sha256-7f1JYFHtfTOvois5LdXrKXthjb6rE9i8ZxWDQyzYKAk=", + "lastModified": 1653581809, + "narHash": "sha256-Uvka0V5MTGbeOfWte25+tfRL3moECDh1VwokWSZUdoY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "83658b28fe638a170a19b8933aa008b30640fbd1", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1661239106, + "narHash": "sha256-C5OCLnrv2c4CHs9DMEtYKkjJmGL7ySAZ1PqPkHBonxQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "24c33ab7952544ad355d0677c9eea931b23f371c", + "rev": "963d27a0767422be9b8686a8493dcade6acee992", "type": "github" }, "original": { @@ -33,8 +51,8 @@ }, "root": { "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs_2" } } }, diff --git a/flake.nix b/flake.nix index c45c90ae..d4ae1ec4 100644 --- a/flake.nix +++ b/flake.nix @@ -3,24 +3,22 @@ # To update all inputs: # $ nix flake update --recreate-lock-file inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - inputs.flake-utils.url = "github:numtide/flake-utils"; - outputs = { self, nixpkgs, flake-utils }@inputs: - flake-utils.lib.eachDefaultSystem (system: - let - nixpkgs' = nixpkgs.legacyPackages.${system}; - pkgs = import self { - inherit system; - inputs = null; - nixpkgs = nixpkgs'; - }; - in - { - defaultPackage = pkgs.default; - - packages = pkgs; + outputs = { self, nixpkgs, flake-parts }@inputs: + flake-parts.lib.mkFlake { inherit self; } { + systems = nixpkgs.lib.systems.flakeExposed; + perSystem = { system, pkgs, ... }: + let + packages = import ./. { + inherit system; + inputs = null; + nixpkgs = pkgs; + }; + in + { + inherit packages; - devShell = pkgs.devShell; - } - ); + devShells.default = packages.devShell; + }; + }; } From becf50f2ff695b70561a9560a36f933bb2594378 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Tue, 23 Aug 2022 11:08:12 -0400 Subject: [PATCH 2/2] flake-parts: use the same nixpkgs --- flake.lock | 27 +++++++-------------------- flake.nix | 2 ++ 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/flake.lock b/flake.lock index 645f1839..9c02b5d4 100644 --- a/flake.lock +++ b/flake.lock @@ -2,7 +2,9 @@ "nodes": { "flake-parts": { "inputs": { - "nixpkgs": "nixpkgs" + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { "lastModified": 1661009076, @@ -13,27 +15,12 @@ "type": "github" }, "original": { - "id": "flake-parts", - "type": "indirect" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1653581809, - "narHash": "sha256-Uvka0V5MTGbeOfWte25+tfRL3moECDh1VwokWSZUdoY=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "83658b28fe638a170a19b8933aa008b30640fbd1", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", + "owner": "hercules-ci", + "repo": "flake-parts", "type": "github" } }, - "nixpkgs_2": { + "nixpkgs": { "locked": { "lastModified": 1661239106, "narHash": "sha256-C5OCLnrv2c4CHs9DMEtYKkjJmGL7ySAZ1PqPkHBonxQ=", @@ -52,7 +39,7 @@ "root": { "inputs": { "flake-parts": "flake-parts", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs" } } }, diff --git a/flake.nix b/flake.nix index d4ae1ec4..570ccd23 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,8 @@ # To update all inputs: # $ nix flake update --recreate-lock-file inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.flake-parts.url = "github:hercules-ci/flake-parts"; + inputs.flake-parts.inputs.nixpkgs.follows = "nixpkgs"; outputs = { self, nixpkgs, flake-parts }@inputs: flake-parts.lib.mkFlake { inherit self; } {