From 104f2c13f6d371c923411a832ded84fc8b5c03c7 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Sun, 24 Sep 2023 15:17:04 +0300 Subject: [PATCH] fix: update flakes --- back/flake.nix | 49 +++++++++-------------- flake.lock | 6 +-- flake.nix | 104 +++++++++++++++++++++--------------------------- front/flake.nix | 28 ++++--------- 4 files changed, 74 insertions(+), 113 deletions(-) diff --git a/back/flake.nix b/back/flake.nix index 514f253..0b4e505 100644 --- a/back/flake.nix +++ b/back/flake.nix @@ -3,23 +3,11 @@ inputs = { }; - outputs = - inputs: - let - inputs_ = - let flakes = (import ../.).outputs.inputs.flakes; in - { - inherit (flakes.source-flake) flake-utils nixpkgs; - inherit (flakes) drv-tools devshell codium; - haskell-tools = flakes.language-tools.haskell; - }; - - outputs = outputs_ { } // { inputs = inputs_; outputs = outputs_; }; - - outputs_ = - inputs__: - let inputs = inputs_ // inputs__; in - inputs.flake-utils.lib.eachDefaultSystem (system: + outputs = inputs: + let flakes = (import ../.).outputs.inputs.flakes; in + flakes.makeFlake { + inputs = { inherit (flakes.all) flake-utils nixpkgs drv-tools devshell codium haskell-tools; }; + perSystem = { inputs, system }: let pkgs = inputs.nixpkgs.legacyPackages.${system}; inherit (inputs.codium.lib.${system}) writeSettingsJSON mkCodium; @@ -29,18 +17,17 @@ inherit (inputs.codium.lib.${system}) extensions settingsNix extensionsCommon settingsCommonNix; packageName = "try-phi-back"; - override = - { - overrides = self: super: { - eo-utils = self.callCabal2nix "eo-utils" ./eo-utils { }; - phi-utils = self.callCabal2nix "phi-utils" ./phi-utils { }; - language-utils = self.callCabal2nix "language-utils" ./language-utils { inherit (self) phi-utils eo-utils; }; - "${packageName}" = - pkgs.haskell.lib.overrideCabal - (self.callCabal2nix packageName ./${packageName} { inherit (self) language-utils phi-utils eo-utils; }) - (x: { librarySystemDepends = [ pkgs.zlib ] ++ (x.librarySystemDepends or [ ]); }); - }; + override = { + overrides = self: super: { + eo-utils = self.callCabal2nix "eo-utils" ./eo-utils { }; + phi-utils = self.callCabal2nix "phi-utils" ./phi-utils { }; + language-utils = self.callCabal2nix "language-utils" ./language-utils { inherit (self) phi-utils eo-utils; }; + "${packageName}" = + pkgs.haskell.lib.overrideCabal + (self.callCabal2nix packageName ./${packageName} { inherit (self) language-utils phi-utils eo-utils; }) + (x: { librarySystemDepends = [ pkgs.zlib ] ++ (x.librarySystemDepends or [ ]); }); }; + }; inherit (toolsGHC { version = "928"; @@ -138,9 +125,9 @@ inherit packages devShells; image = backImage; - }); - in - outputs; + }; + }; + nixConfig = { extra-substituters = [ diff --git a/flake.lock b/flake.lock index 9403ded..93c267b 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "flakes": { "locked": { - "lastModified": 1689788335, - "narHash": "sha256-P7z3oJQNxtRrYAMTWTevbix+qe/fNO5UodAVkBMADPY=", + "lastModified": 1695516974, + "narHash": "sha256-t82xdp0ljWfsG+ShsbfUjh/3hCOshA5ULdvf8g/RoFs=", "owner": "deemp", "repo": "flakes", - "rev": "b526e0daa53c83dd74d17caf3bd6c6e7021ef57e", + "rev": "17132d6528702ac111d21ef6f3bd86fb26b6530a", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 0e66b0f..a1a6c6c 100644 --- a/flake.nix +++ b/flake.nix @@ -1,70 +1,58 @@ { inputs.flakes.url = "github:deemp/flakes"; - outputs = - inputs: - let - inputs_ = - let flakes = inputs.flakes.flakes; in - { - inherit (flakes.source-flake) flake-utils nixpkgs; - inherit (flakes) drv-tools flakes-tools workflows devshell codium; - inherit flakes; - }; - - outputs = outputs_ { } // { inputs = inputs_; outputs = outputs_; }; - - outputs_ = - inputs__: - let inputs = inputs_ // inputs__; in - inputs.flake-utils.lib.eachDefaultSystem (system: - let - pkgs = inputs.nixpkgs.legacyPackages.${system}; - inherit (inputs.codium.lib.${system}) writeSettingsJSON mkCodium; - inherit (inputs.drv-tools.lib.${system}) mkShellApps getExe; - inherit (inputs.flakes-tools.lib.${system}) mkFlakesTools; - inherit (inputs.codium.lib.${system}) extensions settingsNixCommon extensionsCommon; - inherit (inputs.devshell.lib.${system}) mkShell mkRunCommands; + outputs = inputs: inputs.flakes.makeFlake { + inputs = { + inherit (inputs.flakes.all) flake-utils nixpkgs drv-tools flakes-tools workflows devshell codium; + inherit (inputs) flakes; + }; + perSystem = { inputs, system }: + let + pkgs = inputs.nixpkgs.legacyPackages.${system}; + inherit (inputs.codium.lib.${system}) writeSettingsJSON mkCodium; + inherit (inputs.drv-tools.lib.${system}) mkShellApps getExe; + inherit (inputs.flakes-tools.lib.${system}) mkFlakesTools; + inherit (inputs.codium.lib.${system}) extensions settingsNixCommon extensionsCommon; + inherit (inputs.devshell.lib.${system}) mkShell mkRunCommands; - backDir = "back"; - frontDir = "front"; - scripts = mkShellApps { - back = { - text = "cd ${backDir} && nix run"; - description = "Run backend"; - }; - front = { - text = "cd ${frontDir} && nix run"; - description = "Run frontend"; - }; + backDir = "back"; + frontDir = "front"; + scripts = mkShellApps { + back = { + text = "cd ${backDir} && nix run"; + description = "Run backend"; }; + front = { + text = "cd ${frontDir} && nix run"; + description = "Run frontend"; + }; + }; - packages = { - inherit (mkFlakesTools { dirs = [ "front" "back" "." ]; root = ./.; }) pushToCachix updateLocks; - - writeSettings = writeSettingsJSON settingsNixCommon; - codium = mkCodium { extensions = extensionsCommon; }; + packages = { + inherit (mkFlakesTools { dirs = [ "front" "back" "." ]; root = ./.; }) pushToCachix updateLocks; - writeWorkflows = import ./nix-files/workflow.nix { - name = "ci"; - inherit backDir frontDir system; - inherit (inputs) workflows; - }; - } // scripts; + writeSettings = writeSettingsJSON settingsNixCommon; + codium = mkCodium { extensions = extensionsCommon; }; - devShells.default = mkShell { - commands = - mkRunCommands "ide" { "codium ." = packages.codium; inherit (packages) writeSettings; } - ++ mkRunCommands "infra" { inherit (packages) writeWorkflows pushToCachix updateLocks; } - ++ mkRunCommands "project" { inherit (packages) back front; } - ; + writeWorkflows = import ./nix-files/workflow.nix { + name = "ci"; + inherit backDir frontDir system; + inherit (inputs) workflows; }; - in - { - inherit packages devShells; - }); - in - outputs; + } // scripts; + + devShells.default = mkShell { + commands = + mkRunCommands "ide" { "codium ." = packages.codium; inherit (packages) writeSettings; } + ++ mkRunCommands "infra" { inherit (packages) writeWorkflows pushToCachix updateLocks; } + ++ mkRunCommands "project" { inherit (packages) back front; } + ; + }; + in + { + inherit packages devShells; + }; + }; nixConfig = { extra-substituters = [ diff --git a/front/flake.nix b/front/flake.nix index ba1912b..d279944 100644 --- a/front/flake.nix +++ b/front/flake.nix @@ -3,24 +3,11 @@ inputs = { }; - outputs = - inputs: - let - inputs_ = - let flakes = (import ../.).outputs.inputs.flakes; in - { - inherit (flakes.source-flake) flake-utils nixpkgs; - inherit (flakes) drv-tools devshell codium; - purescript-tools = flakes.language-tools.purescript; - }; - - outputs = outputs_ { } // { inputs = inputs_; outputs = outputs_; }; - - outputs_ = - inputs__: - let inputs = inputs_ // inputs__; in - - inputs.flake-utils.lib.eachDefaultSystem (system: + outputs = inputs: + let flakes = (import ../.).outputs.inputs.flakes; in + flakes.makeFlake { + inputs = { inherit (flakes.all) flake-utils nixpkgs drv-tools devshell codium purescript-tools; }; + perSystem = { inputs, system }: let pkgs = inputs.nixpkgs.legacyPackages.${system}; pursPkgs = inputs.purescript-tools.packages.${system}; @@ -67,9 +54,8 @@ in { inherit packages devShells; - }); - in - outputs; + }; + }; nixConfig = { extra-substituters = [