From b94882bf409c01bacb2c19332340d2e9c58b1927 Mon Sep 17 00:00:00 2001 From: seth Date: Fri, 17 Jan 2025 13:23:24 -0500 Subject: [PATCH] refactor: move development inputs/outputs back to dev flake MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit warning: updating lock file '/home/seth/repos/ctp-nix/flake.lock': • Removed input 'catppuccin-v1_1' • Removed input 'catppuccin-v1_2' • Removed input 'home-manager' • Removed input 'home-manager/nixpkgs' • Removed input 'home-manager-stable' • Removed input 'home-manager-stable/nixpkgs' • Removed input 'nixpkgs-stable' • Removed input 'nuscht-search' • Removed input 'nuscht-search/flake-utils' • Removed input 'nuscht-search/flake-utils/systems' • Removed input 'nuscht-search/ixx' • Removed input 'nuscht-search/ixx/flake-utils' • Removed input 'nuscht-search/ixx/nixpkgs' • Removed input 'nuscht-search/nixpkgs' warning: creating lock file '/home/seth/repos/ctp-nix/dev/flake.lock': • Added input 'catppuccin': 'path:../.' • Added input 'catppuccin/nixpkgs': 'github:NixOS/nixpkgs/8f3e1f807051e32d8c95cd12b9b421623850a34d?narHash=sha256-/qlNWm/IEVVH7GfgAIyP6EsVZI6zjAx1cV5zNyrs%2BrI%3D' (2025-01-04) • Added input 'catppuccin-v1_1': 'https://api.flakehub.com/f/pinned/catppuccin/nix/1.1.1/0193bdc0-b045-7eed-bbec-95611a8ecdf5/source.tar.gz?narHash=sha256-pCWJgwo77KD7EJpwynwKrWPZ//dwypHq2TfdzZWqK68%3D' (2024-12-13) • Added input 'catppuccin-v1_2': 'https://api.flakehub.com/f/pinned/catppuccin/nix/1.2.1/0193e646-1107-7f69-a402-f2a3988ecf1d/source.tar.gz?narHash=sha256-CFX4diEQHKvZYjnhf7TLg20m3ge1O4vqgplsk/Kuaek%3D' (2024-12-20) • Added input 'flake-utils': 'github:numtide/flake-utils/11707dc2f618dd54ca8739b309ec4fc024de578b?narHash=sha256-l0KFg5HjrsfsO/JpG%2Br7fRrqm12kzFHyUHqHCVpMMbI%3D' (2024-11-13) • Added input 'flake-utils/systems': 'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e?narHash=sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768%3D' (2023-04-09) • Added input 'home-manager': 'github:nix-community/home-manager/a0046af169ce7b1da503974e1b22c48ef4d71887?narHash=sha256-p5e/45V41YD3tMELuiNIoVCa25/w4nhOTm0B9MtdHFI%3D' (2025-01-17) • Added input 'home-manager/nixpkgs': follows 'nixpkgs' • Added input 'home-manager-stable': 'github:nix-community/home-manager/bd65bc3cde04c16755955630b344bc9e35272c56?narHash=sha256-dinzAqCjenWDxuy%2BMqUQq0I4zUSfaCvN9rzuCmgMZJY%3D' (2025-01-08) • Added input 'home-manager-stable/nixpkgs': follows 'nixpkgs-stable' • Added input 'nixpkgs': follows 'catppuccin/nixpkgs' • Added input 'nixpkgs-stable': 'github:NixOS/nixpkgs/e24b4c09e963677b1beea49d411cd315a024ad3a?narHash=sha256-puPDoVKxkuNmYIGMpMQiK8bEjaACcCksolsG36gdaNQ%3D' (2025-01-15) • Added input 'nuscht-search': 'github:NuschtOS/search/836908e3bddd837ae0f13e215dd48767aee355f0?narHash=sha256-Iv59gMDZajNfezTO0Fw6LHE7uKAShxbvMidmZREit7c%3D' (2025-01-02) • Added input 'nuscht-search/flake-utils': follows 'flake-utils' • Added input 'nuscht-search/ixx': 'github:NuschtOS/ixx/9fd01aad037f345350eab2cd45e1946cc66da4eb?narHash=sha256-EiOq8jF4Z/zQe0QYVc3%2BqSKxRK//CFHMB84aYrYGwEs%3D' (2024-10-26) • Added input 'nuscht-search/ixx/flake-utils': follows 'nuscht-search/flake-utils' • Added input 'nuscht-search/ixx/nixpkgs': follows 'nuscht-search/nixpkgs' • Added input 'nuscht-search/nixpkgs': follows 'nixpkgs' --- .github/workflows/ci.yml | 18 ++- .github/workflows/format.yml | 1 + .github/workflows/website.yml | 16 ++- dev/README.md | 4 + dev/flake.lock | 220 ++++++++++++++++++++++++++++++++++ dev/flake.nix | 140 ++++++++++++++++++++++ flake.lock | 174 +-------------------------- flake.nix | 201 ++++--------------------------- 8 files changed, 415 insertions(+), 359 deletions(-) create mode 100644 dev/README.md create mode 100644 dev/flake.lock create mode 100644 dev/flake.nix diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8f51293..fa144881 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,14 +4,16 @@ on: push: branches: [ main ] paths: + - '**.lock' - '**.nix' - - 'flake.lock' + - 'pkgs/**' - '.github/workflows/ci.yml' pull_request: paths: + - '**.lock' - '**.nix' - - 'flake.lock' + - 'pkgs/**' - '.github/workflows/ci.yml' workflow_dispatch: @@ -33,6 +35,10 @@ jobs: - name: Install Nix uses: cachix/install-nix-action@V27 + with: + # TODO: Remove when Nix 2.26 is released + # https://hydra.nixos.org/build/285560910 + install_url: https://hydra.nixos.org/build/285560910/download/1/install - name: Install Cachix uses: cachix/cachix-action@v15 @@ -42,7 +48,7 @@ jobs: - name: Run build run: | - nix run .#build-outputs -- 'packages' + nix run ./dev#build-outputs -- 'packages' modules: name: Test Modules @@ -61,6 +67,10 @@ jobs: - name: Install Nix uses: cachix/install-nix-action@V27 + with: + # TODO: Remove when Nix 2.26 is released + # https://hydra.nixos.org/build/285560910 + install_url: https://hydra.nixos.org/build/285560910/download/1/install - name: Install Cachix uses: cachix/cachix-action@v15 @@ -70,7 +80,7 @@ jobs: - name: Run tests run: | - nix run .#build-outputs -- 'checks' + nix run ./dev#build-outputs -- 'checks' release-gate: name: Release Gate diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 2222467f..1b085770 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -5,6 +5,7 @@ on: branches: [ main ] paths: - "**.nix" + - "**.lock" - ".github/workflows/format.yml" workflow_dispatch: diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 5915461b..d52b2ad6 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -4,18 +4,20 @@ on: push: branches: [main] paths: - - 'docs/**' - - 'CHANGELOG.md' - '**.lock' - '**.nix' + - 'docs/**' + - 'pkgs/**' + - 'CHANGELOG.md' - '.github/workflows/website.yml' pull_request: paths: - - 'docs/**' - - 'CHANGELOG.md' - '**.lock' - '**.nix' + - 'docs/**' + - 'pkgs/**' + - 'CHANGELOG.md' - '.github/workflows/website.yml' workflow_dispatch: @@ -32,6 +34,10 @@ jobs: - name: Install Nix uses: cachix/install-nix-action@V27 + with: + # TODO: Remove when Nix 2.26 is released + # https://hydra.nixos.org/build/285560910 + install_url: https://hydra.nixos.org/build/285560910/download/1/install - name: Install Cachix uses: cachix/cachix-action@v15 @@ -44,7 +50,7 @@ jobs: nix build \ --print-build-logs \ --show-trace \ - '.#site' + './dev#site' - name: Get artifact directory id: find-path diff --git a/dev/README.md b/dev/README.md new file mode 100644 index 00000000..cb0ec59d --- /dev/null +++ b/dev/README.md @@ -0,0 +1,4 @@ +> [!WARNING] +> This is using features from the currently unstable Nix 2.26 release. +> ***It will not evaluate on versions prior to 2.26***. +> It is recommended to enter a shell with it by running `nix shell 'github:NixOS/nix/043df13f724cc084a805372b0455cc6d8684cd5b#nix-cli'` diff --git a/dev/flake.lock b/dev/flake.lock new file mode 100644 index 00000000..cebce915 --- /dev/null +++ b/dev/flake.lock @@ -0,0 +1,220 @@ +{ + "nodes": { + "catppuccin": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "path": "../.", + "type": "path" + }, + "original": { + "path": "../.", + "type": "path" + }, + "parent": [] + }, + "catppuccin-v1_1": { + "locked": { + "lastModified": 1734055249, + "narHash": "sha256-pCWJgwo77KD7EJpwynwKrWPZ//dwypHq2TfdzZWqK68=", + "rev": "7221d6ca17ac36ed20588e1c3a80177ac5843fa7", + "revCount": 326, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/catppuccin/nix/1.1.1/0193bdc0-b045-7eed-bbec-95611a8ecdf5/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/catppuccin/nix/1.1.%2A.tar.gz" + } + }, + "catppuccin-v1_2": { + "locked": { + "lastModified": 1734734291, + "narHash": "sha256-CFX4diEQHKvZYjnhf7TLg20m3ge1O4vqgplsk/Kuaek=", + "rev": "1e4c3803b8da874ff75224ec8512cb173036bbd8", + "revCount": 344, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/catppuccin/nix/1.2.1/0193e646-1107-7f69-a402-f2a3988ecf1d/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/catppuccin/nix/1.2.%2A.tar.gz" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1737120639, + "narHash": "sha256-p5e/45V41YD3tMELuiNIoVCa25/w4nhOTm0B9MtdHFI=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "a0046af169ce7b1da503974e1b22c48ef4d71887", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager-stable": { + "inputs": { + "nixpkgs": [ + "nixpkgs-stable" + ] + }, + "locked": { + "lastModified": 1736373539, + "narHash": "sha256-dinzAqCjenWDxuy+MqUQq0I4zUSfaCvN9rzuCmgMZJY=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "bd65bc3cde04c16755955630b344bc9e35272c56", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-24.11", + "repo": "home-manager", + "type": "github" + } + }, + "ixx": { + "inputs": { + "flake-utils": [ + "nuscht-search", + "flake-utils" + ], + "nixpkgs": [ + "nuscht-search", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729958008, + "narHash": "sha256-EiOq8jF4Z/zQe0QYVc3+qSKxRK//CFHMB84aYrYGwEs=", + "owner": "NuschtOS", + "repo": "ixx", + "rev": "9fd01aad037f345350eab2cd45e1946cc66da4eb", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "ref": "v0.0.6", + "repo": "ixx", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1736012469, + "narHash": "sha256-/qlNWm/IEVVH7GfgAIyP6EsVZI6zjAx1cV5zNyrs+rI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "8f3e1f807051e32d8c95cd12b9b421623850a34d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1736916166, + "narHash": "sha256-puPDoVKxkuNmYIGMpMQiK8bEjaACcCksolsG36gdaNQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e24b4c09e963677b1beea49d411cd315a024ad3a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nuscht-search": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "ixx": "ixx", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1735854821, + "narHash": "sha256-Iv59gMDZajNfezTO0Fw6LHE7uKAShxbvMidmZREit7c=", + "owner": "NuschtOS", + "repo": "search", + "rev": "836908e3bddd837ae0f13e215dd48767aee355f0", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "repo": "search", + "type": "github" + } + }, + "root": { + "inputs": { + "catppuccin": "catppuccin", + "catppuccin-v1_1": "catppuccin-v1_1", + "catppuccin-v1_2": "catppuccin-v1_2", + "flake-utils": "flake-utils", + "home-manager": "home-manager", + "home-manager-stable": "home-manager-stable", + "nixpkgs": [ + "catppuccin", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable", + "nuscht-search": "nuscht-search" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/dev/flake.nix b/dev/flake.nix new file mode 100644 index 00000000..1bb84fc0 --- /dev/null +++ b/dev/flake.nix @@ -0,0 +1,140 @@ +{ + description = "Development Flake for catppuccin/nix"; + + inputs = { + # WARN: This handling of `path:` is a Nix 2.26 feature. The Flake won't work on versions prior to it + # https://github.com/NixOS/nix/pull/10089 + catppuccin.url = "path:../."; + nixpkgs.follows = "catppuccin/nixpkgs"; + + flake-utils.url = "github:numtide/flake-utils"; + + # Module versions we test against (aside from NixOS unstable) + + nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.11"; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + home-manager-stable = { + url = "github:nix-community/home-manager/release-24.11"; + inputs.nixpkgs.follows = "nixpkgs-stable"; + }; + + # Our option search generator + + nuscht-search = { + url = "github:NuschtOS/search"; + inputs = { + nixpkgs.follows = "nixpkgs"; + flake-utils.follows = "flake-utils"; + }; + }; + + # Track some of our minor releases to index in said search + + catppuccin-v1_1 = { + url = "https://flakehub.com/f/catppuccin/nix/1.1.*.tar.gz"; + }; + + catppuccin-v1_2 = { + url = "https://flakehub.com/f/catppuccin/nix/1.2.*.tar.gz"; + }; + }; + + outputs = + { + self, + nixpkgs, + catppuccin, + ... + }@inputs: + + let + inherit (nixpkgs) lib; + inherit (inputs.flake-utils.lib) eachDefaultSystem mkApp; + + mkApp' = drv: mkApp { inherit drv; }; + + # Versions of the modules we want to index in our search + searchVersions = { + "v1.1" = inputs.catppuccin-v1_1; + "v1.2" = inputs.catppuccin-v1_2; + "rolling" = self; + }; + + mergeAttrs = lib.foldl' lib.recursiveUpdate { }; + in + + mergeAttrs [ + (eachDefaultSystem ( + system: + + let + pkgs = nixpkgs.legacyPackages.${system}; + pkgsStable = inputs.nixpkgs-stable.legacyPackages.${system}; + + kernelName = pkgs.stdenv.hostPlatform.parsed.kernel.name; + + callWith = pkgs: lib.flip pkgs.callPackage; + callUnstable = callWith pkgs { inherit (inputs) home-manager; }; + callStable = callWith pkgsStable { home-manager = inputs.home-manager-stable; }; + in + + { + apps = { + build-outputs = mkApp' ( + pkgs.writeShellApplication { + name = "build-outputs"; + + runtimeInputs = [ pkgs.nix-fast-build ]; + + text = '' + usage="Usage: $0 " + + attribute="''${1:-}" + if [ -z "$attribute" ]; then + echo -n "$usage" + exit 1 + fi + + args=( + "--no-nom" + "--skip-cached" + "--flake" "${catppuccin.outPath}#$attribute.${system}" + ) + + nix-fast-build "''${args[@]}" + ''; + } + ); + + serve = mkApp self.packages.${system}.site.serve; + }; + + checks = + { + darwin = { + test-unstable = callUnstable (catppuccin + "/modules/tests/darwin.nix"); + test-stable = callStable (catppuccin + "/modules/tests/darwin.nix"); + }; + + linux = { + test-unstable = callUnstable (catppuccin + "/modules/tests/nixos.nix"); + test-stable = callStable (catppuccin + "/modules/tests/nixos.nix"); + }; + } + .${kernelName} or { }; + + packages = { + site = pkgs.callPackage (catppuccin + "/docs/package.nix") { + inherit inputs searchVersions; + nuscht-search = inputs.nuscht-search.packages.${system}; + }; + }; + } + )) + ]; +} diff --git a/flake.lock b/flake.lock index 52f61a84..8fb5d40f 100644 --- a/flake.lock +++ b/flake.lock @@ -1,118 +1,5 @@ { "nodes": { - "catppuccin-v1_1": { - "locked": { - "lastModified": 1734055249, - "narHash": "sha256-pCWJgwo77KD7EJpwynwKrWPZ//dwypHq2TfdzZWqK68=", - "rev": "7221d6ca17ac36ed20588e1c3a80177ac5843fa7", - "revCount": 326, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/catppuccin/nix/1.1.1/0193bdc0-b045-7eed-bbec-95611a8ecdf5/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/catppuccin/nix/1.1.%2A.tar.gz" - } - }, - "catppuccin-v1_2": { - "locked": { - "lastModified": 1734734291, - "narHash": "sha256-CFX4diEQHKvZYjnhf7TLg20m3ge1O4vqgplsk/Kuaek=", - "rev": "1e4c3803b8da874ff75224ec8512cb173036bbd8", - "revCount": 344, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/catppuccin/nix/1.2.1/0193e646-1107-7f69-a402-f2a3988ecf1d/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/catppuccin/nix/1.2.%2A.tar.gz" - } - }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "home-manager": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1736508663, - "narHash": "sha256-ZOaGwa+WnB7Zn3YXimqjmIugAnHePdXCmNu+AHkq808=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "2532b500c3ed2b8940e831039dcec5a5ea093afc", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, - "home-manager-stable": { - "inputs": { - "nixpkgs": [ - "nixpkgs-stable" - ] - }, - "locked": { - "lastModified": 1736373539, - "narHash": "sha256-dinzAqCjenWDxuy+MqUQq0I4zUSfaCvN9rzuCmgMZJY=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "bd65bc3cde04c16755955630b344bc9e35272c56", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "release-24.11", - "repo": "home-manager", - "type": "github" - } - }, - "ixx": { - "inputs": { - "flake-utils": [ - "nuscht-search", - "flake-utils" - ], - "nixpkgs": [ - "nuscht-search", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1729958008, - "narHash": "sha256-EiOq8jF4Z/zQe0QYVc3+qSKxRK//CFHMB84aYrYGwEs=", - "owner": "NuschtOS", - "repo": "ixx", - "rev": "9fd01aad037f345350eab2cd45e1946cc66da4eb", - "type": "github" - }, - "original": { - "owner": "NuschtOS", - "ref": "v0.0.6", - "repo": "ixx", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1736012469, @@ -129,68 +16,9 @@ "type": "github" } }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1736061677, - "narHash": "sha256-DjkQPnkAfd7eB522PwnkGhOMuT9QVCZspDpJJYyOj60=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "cbd8ec4de4469333c82ff40d057350c30e9f7d36", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-24.11", - "repo": "nixpkgs", - "type": "github" - } - }, - "nuscht-search": { - "inputs": { - "flake-utils": "flake-utils", - "ixx": "ixx", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1735854821, - "narHash": "sha256-Iv59gMDZajNfezTO0Fw6LHE7uKAShxbvMidmZREit7c=", - "owner": "NuschtOS", - "repo": "search", - "rev": "836908e3bddd837ae0f13e215dd48767aee355f0", - "type": "github" - }, - "original": { - "owner": "NuschtOS", - "repo": "search", - "type": "github" - } - }, "root": { "inputs": { - "catppuccin-v1_1": "catppuccin-v1_1", - "catppuccin-v1_2": "catppuccin-v1_2", - "home-manager": "home-manager", - "home-manager-stable": "home-manager-stable", - "nixpkgs": "nixpkgs", - "nixpkgs-stable": "nixpkgs-stable", - "nuscht-search": "nuscht-search" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" + "nixpkgs": "nixpkgs" } } }, diff --git a/flake.nix b/flake.nix index 9862afa8..6cfdf6f1 100644 --- a/flake.nix +++ b/flake.nix @@ -3,61 +3,10 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - - /* - Inputs below this are optional and can be removed - - ``` - { - inputs.catppuccin = { - url = "github:catppuccin/nix"; - inputs = { - nixpkgs-stable.follows = ""; - home-manager.follows = ""; - home-manager-stable.follows = ""; - nuscht-search.follows = ""; - catppuccin-v1_1.follows = ""; - catppuccin-v1_2.follows = ""; - }; - }; - } - ``` - */ - - nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.11"; - - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - home-manager-stable = { - url = "github:nix-community/home-manager/release-24.11"; - inputs.nixpkgs.follows = "nixpkgs-stable"; - }; - - nuscht-search = { - url = "github:NuschtOS/search"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - # Track some of our minor releases to index in our search - - catppuccin-v1_1 = { - url = "https://flakehub.com/f/catppuccin/nix/1.1.*.tar.gz"; - }; - - catppuccin-v1_2 = { - url = "https://flakehub.com/f/catppuccin/nix/1.2.*.tar.gz"; - }; }; outputs = - { - self, - nixpkgs, - ... - }@inputs: + { self, nixpkgs }: let inherit (nixpkgs) lib; @@ -65,7 +14,8 @@ # Systems for public outputs systems = lib.systems.flakeExposed; - # Systems for development relatedo otuputs + # Systems for development related outputs + # (that evaluate more exotic packages cleanly, unlike some systems above) devSystems = [ "x86_64-linux" "aarch64-linux" @@ -73,27 +23,8 @@ "aarch64-darwin" ]; - # flake-utils pollyfill - forEachSystem = - systems: fn: - lib.foldl' ( - acc: system: - lib.recursiveUpdate acc ( - lib.mapAttrs (lib.const (value: { - ${system} = value; - })) (fn system) - ) - ) { } systems; - - forEachDefaultSystem = forEachSystem systems; - forEachDevSystem = forEachSystem devSystems; - - # Versions of the modules we want to index in our search - searchVersions = { - "v1.1" = inputs.catppuccin-v1_1; - "v1.2" = inputs.catppuccin-v1_2; - "rolling" = self; - }; + forAllSystems = lib.genAttrs systems; + forAllDevSystems = lib.genAttrs devSystems; mkModule = { @@ -109,119 +40,35 @@ catppuccin.sources = lib.mkDefault self.packages.${pkgs.stdenv.hostPlatform.system}; }; - - mergeAttrs = lib.foldl' lib.recursiveUpdate { }; in - mergeAttrs [ - # Public outputs - (forEachDefaultSystem ( + { + packages = forAllSystems ( system: - let pkgs = nixpkgs.legacyPackages.${system}; catppuccinPackages = (import ./default.nix { inherit pkgs; }).packages; in - - { - packages = catppuccinPackages // { - default = catppuccinPackages.whiskers; - }; + catppuccinPackages + // { + default = catppuccinPackages.whiskers; } - )) - - { - homeManagerModules.catppuccin = mkModule { - type = "homeManager"; - file = ./modules/home-manager; - }; - - nixosModules.catppuccin = mkModule { - type = "nixos"; - file = ./modules/nixos; - }; - } - - # Development outputs - (forEachDevSystem ( - system: - - let - pkgs = nixpkgs.legacyPackages.${system}; - pkgsStable = inputs.nixpkgs-stable.legacyPackages.${system}; - in - - { - apps = { - build-outputs = { - type = "app"; - program = lib.getExe ( - pkgs.writeShellApplication { - name = "build-outputs"; - - runtimeInputs = [ pkgs.nix-fast-build ]; - - text = '' - usage="Usage: $0 " + ); - attribute="''${1:-}" - if [ -z "$attribute" ]; then - echo -n "$usage" - exit 1 - fi + devShells = forAllDevSystems (system: { + default = import ./shell.nix { pkgs = nixpkgs.legacyPackages.${system}; }; + }); - args=( - "--no-nom" - "--skip-cached" - "--flake" "${self.outPath}#$attribute.${system}" - ) + formatter = forAllDevSystems (system: nixpkgs.legacyPackages.${system}.nixfmt); - nix-fast-build "''${args[@]}" - ''; - } - ); - }; - - serve = { - type = "app"; - program = lib.getExe self.packages.${system}.site.serve; - }; - }; - - checks = - - let - kernelName = pkgs.stdenv.hostPlatform.parsed.kernel.name; - - callWith = pkgs: lib.flip pkgs.callPackage; - callUnstable = callWith pkgs { inherit (inputs) home-manager; }; - callStable = callWith pkgsStable { home-manager = inputs.home-manager-stable; }; - in - - { - darwin = { - test-unstable = callUnstable ./modules/tests/darwin.nix; - test-stable = callStable ./modules/tests/darwin.nix; - }; - - linux = { - test-unstable = callUnstable ./modules/tests/nixos.nix; - test-stable = callStable ./modules/tests/nixos.nix; - }; - } - .${kernelName} or { }; - - devShells.default = import ./shell.nix { inherit pkgs; }; - - formatter = pkgs.nixfmt-rfc-style; + homeManagerModules.catppuccin = mkModule { + type = "homeManager"; + file = ./modules/home-manager; + }; - packages = { - site = pkgs.callPackage ./docs/package.nix { - inherit inputs searchVersions; - nuscht-search = inputs.nuscht-search.packages.${system}; - }; - }; - } - )) - ]; + nixosModules.catppuccin = mkModule { + type = "nixos"; + file = ./modules/nixos; + }; + }; }