From 1fe7f3e9ef0efb477691bae622e495889f90dd9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=A4dorf?= Date: Sat, 28 Oct 2023 16:19:53 +0200 Subject: [PATCH] chore: update to flake-parts --- flake.lock | 120 +++++++++++++---------------------------------------- flake.nix | 67 +++++++++++------------------- 2 files changed, 54 insertions(+), 133 deletions(-) diff --git a/flake.lock b/flake.lock index 025ae1f..2590ed4 100644 --- a/flake.lock +++ b/flake.lock @@ -1,41 +1,20 @@ { "nodes": { - "devshell": { + "flake-parts": { "inputs": { - "nixpkgs": [ - "nixpkgs" - ], - "systems": "systems" + "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1687944744, - "narHash": "sha256-4ZtRVG/5yWHPZpkit1Ak5Mo1DDnkx1AG1HpNu/P+n5U=", - "owner": "numtide", - "repo": "devshell", - "rev": "3864857b2754ab0e16c7c7c626f0e5a1d4e42f38", + "lastModified": 1696343447, + "narHash": "sha256-B2xAZKLkkeRFG5XcHHSXXcP7To9Xzr59KXeZiRf4vdQ=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4", "type": "github" }, "original": { - "owner": "numtide", - "repo": "devshell", - "type": "github" - } - }, - "flake-utils": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1687709756, - "narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "hercules-ci", + "repo": "flake-parts", "type": "github" } }, @@ -55,69 +34,28 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1696019113, + "narHash": "sha256-X3+DKYWJm93DRSdC5M6K5hLqzSya9BjibtBsuARoPco=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f5892ddac112a1e9b3612c39af1b72987ee5783a", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { - "devshell": "devshell", - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs", - "tritonshell-module": "tritonshell-module" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "tritonshell-module": { - "inputs": { - "devshell": [ - "devshell" - ], - "flake-utils": [ - "flake-utils" - ], - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1686817625, - "narHash": "sha256-UUt00+BuPiqBv5it8eG99KLWVa7F392PPt52TPO20Zs=", - "ref": "main", - "rev": "c2280bb09683372f2f482bea3a8bd1112cf990e7", - "revCount": 62, - "type": "git", - "url": "https://git.greenbaum.cloud/dev/tritonshell" - }, - "original": { - "ref": "main", - "type": "git", - "url": "https://git.greenbaum.cloud/dev/tritonshell" + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" } } }, diff --git a/flake.nix b/flake.nix index 5e0f202..ad66f05 100644 --- a/flake.nix +++ b/flake.nix @@ -3,56 +3,39 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - - flake-utils.url = "github:numtide/flake-utils"; - - devshell.url = "github:numtide/devshell"; - devshell.inputs.nixpkgs.follows = "nixpkgs"; - - tritonshell-module.url = "git+https://git.greenbaum.cloud/dev/tritonshell?ref=main"; - tritonshell-module.inputs.devshell.follows = "devshell"; - tritonshell-module.inputs.flake-utils.follows = "flake-utils"; - tritonshell-module.inputs.nixpkgs.follows = "nixpkgs"; + flake-parts.url = "github:hercules-ci/flake-parts"; }; - outputs = { self, flake-utils, devshell, tritonshell-module, nixpkgs }: - flake-utils.lib.simpleFlake { - inherit self nixpkgs; - name = "infra-project"; - preOverlays = [ devshell.overlays.default ]; - shell = { pkgs }: - let - google-font-downloader = pkgs.writeShellScriptBin "google-font-downloader" '' - echo "Attempting to fetch $1" - ${pkgs.nodejs}/bin/npx google-font-downloader -- $1 - rm ./_includes/styles/typography.scss || true - echo "/* To regenerate this file, run $ google-font-downloader '$1' */" >> ./_includes/styles/typography.scss - echo "" >> ./_includes/styles/stypography.scss - cat ./google-fonts-*.css >> ./_includes/styles/typography.scss - rm ./google-fonts-*.css || true - ''; - in - pkgs.devshell.mkShell { - imports = [ tritonshell-module.devshellModules.x86_64-linux.tritonshell ]; - # Now the tritonshell environment nix module options are available - environment = { - enable = true; - # CUSTOMIZE if desired, default options are: - #cnsBaseDomain = "greenbaum.zone"; - #dataCenters = [ "cgn-1" "lev-1" ]; - #mantaDomain = "eu-central.manta.greenbaum.cloud"; - #tritonApiDomain = "api.greenbaum.cloud"; - }; + outputs = inputs@{ self, ... }: + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "x86_64-linux" "aarch64-linux" ]; - # Add additional packages you'd like to be available in your devshell - # PATH here - devshell.packages = with pkgs; [ + perSystem = { system, pkgs, config, ... }: { + _module.args = { + inherit inputs; + pkgs = import inputs.nixpkgs { inherit system; }; + }; + + devShells.default = let + google-font-downloader = pkgs.writeShellScriptBin "google-font-downloader" '' + echo "Attempting to fetch $1" + ${pkgs.nodejs}/bin/npx google-font-downloader -- $1 + rm ./_includes/styles/typography.scss || true + echo "/* To regenerate this file, run $ google-font-downloader '$1' */" >> ./_includes/styles/typography.scss + echo "" >> ./_includes/styles/stypography.scss + cat ./google-fonts-*.css >> ./_includes/styles/typography.scss + rm ./google-fonts-*.css || true + ''; + in pkgs.mkShell { + buildInputs = with pkgs; [ deno google-font-downloader ]; - bash.extra = '' + + shellHook = '' export NVIM_USE_DENOLS=1 ''; }; + }; }; }