From 645cd891ba5503ffc0c310e24e8b440f44313b81 Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 25 Nov 2024 09:23:54 -0500 Subject: [PATCH] refactor: merge subflake back into main flake this is annoying to maintain --- .github/workflows/ci.yml | 8 +-- .github/workflows/website.yml | 2 +- dev/flake.lock | 87 -------------------------- dev/flake.nix | 114 ---------------------------------- flake.lock | 62 +++++++++++++++++- flake.nix | 93 ++++++++++++++++++++++++++- pkgs/init-port.py | 5 ++ 7 files changed, 161 insertions(+), 210 deletions(-) delete mode 100644 dev/flake.lock delete mode 100644 dev/flake.nix diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35ce7a9a..d6127f44 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,9 +41,7 @@ jobs: - name: Format changes run: | - nix run \ - --inputs-from ./dev \ - 'nixpkgs#nixfmt-rfc-style' -- . + nix fmt - name: Commit changes run: | @@ -75,7 +73,7 @@ jobs: - name: Run tests run: | nix run \ - --inputs-from ./dev \ + --inputs-from . \ github:Mic92/nix-fast-build -- \ --no-nom \ - --flake "./dev#checks.$(nix eval --raw --impure --expr builtins.currentSystem)" + --flake ".#checks.$(nix eval --raw --impure --expr builtins.currentSystem)" diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 8805c4ea..5586ade6 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -37,7 +37,7 @@ jobs: nix build \ --print-build-logs \ --show-trace \ - './dev#site' + '.#site' - name: Get artifact directory id: find-path diff --git a/dev/flake.lock b/dev/flake.lock deleted file mode 100644 index 2c9b0aa2..00000000 --- a/dev/flake.lock +++ /dev/null @@ -1,87 +0,0 @@ -{ - "nodes": { - "home-manager": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1730837930, - "narHash": "sha256-0kZL4m+bKBJUBQse0HanewWO0g8hDdCvBhudzxgehqc=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "2f607e07f3ac7e53541120536708e824acccfaa8", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, - "home-manager-stable": { - "inputs": { - "nixpkgs": [ - "nixpkgs-stable" - ] - }, - "locked": { - "lastModified": 1726989464, - "narHash": "sha256-Vl+WVTJwutXkimwGprnEtXc/s/s8sMuXzqXaspIGlwM=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "2f23fa308a7c067e52dfcc30a0758f47043ec176", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "release-24.05", - "repo": "home-manager", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1730785428, - "narHash": "sha256-Zwl8YgTVJTEum+L+0zVAWvXAGbWAuXHax3KzuejaDyo=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "4aa36568d413aca0ea84a1684d2d46f55dbabad7", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1730883749, - "narHash": "sha256-mwrFF0vElHJP8X3pFCByJR365Q2463ATp2qGIrDUdlE=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "dba414932936fde69f0606b4f1d87c5bc0003ede", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-24.05", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "home-manager": "home-manager", - "home-manager-stable": "home-manager-stable", - "nixpkgs": "nixpkgs", - "nixpkgs-stable": "nixpkgs-stable" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/dev/flake.nix b/dev/flake.nix deleted file mode 100644 index 0a3dcd48..00000000 --- a/dev/flake.nix +++ /dev/null @@ -1,114 +0,0 @@ -{ - description = "Soothing pastel theme for Nix"; - - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05"; - - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - home-manager-stable = { - url = "github:nix-community/home-manager/release-24.05"; - inputs.nixpkgs.follows = "nixpkgs-stable"; - }; - }; - - outputs = - { - self, - nixpkgs, - nixpkgs-stable, - home-manager, - home-manager-stable, - }: - let - systems = [ - "x86_64-linux" - "aarch64-linux" - "x86_64-darwin" - "aarch64-darwin" - ]; - - nixpkgsFor = nixpkgs.lib.genAttrs systems (system: { - unstable = nixpkgs.legacyPackages.${system}; - stable = nixpkgs-stable.legacyPackages.${system}; - }); - - forAllSystems = nixpkgs.lib.genAttrs systems; - in - { - apps = forAllSystems ( - system: - let - pkgs = nixpkgsFor.${system}.unstable; - inherit (pkgs) lib; - in - { - serve = { - type = "app"; - program = lib.getExe self.packages.${system}.site.serve; - }; - } - ); - - checks = forAllSystems ( - system: - import ../tests rec { - inherit home-manager home-manager-stable; - inherit (nixpkgs) lib; - nixpkgs = nixpkgsFor.${system}.unstable; - nixpkgs-stable = nixpkgsFor.${system}.stable; - } - ); - - formatter = forAllSystems (system: nixpkgsFor.${system}.unstable.nixfmt-rfc-style); - - packages = forAllSystems ( - system: - let - pkgs = nixpkgsFor.${system}.unstable; - inherit (pkgs) lib; - - version = self.shortRev or self.dirtyShortRev or "unknown"; - mkOptionDoc = pkgs.callPackage ../docs/options-doc.nix { }; - mkSite = pkgs.callPackage ../docs/mk-site.nix { }; - packages' = self.packages.${system}; - in - { - nixos-doc = mkOptionDoc { - inherit version; - moduleRoot = ../modules/nixos; - }; - - home-manager-doc = mkOptionDoc { - inherit version; - moduleRoot = ../modules/home-manager; - }; - - site = mkSite rec { - pname = "catppuccin-nix-website"; - inherit version; - - src = lib.fileset.toSource { - root = ../.; - fileset = lib.fileset.unions [ - ../CHANGELOG.md - ../docs/src - ../docs/book.toml - ../docs/theme - ]; - }; - sourceRoot = "${src.name}/docs"; - - nixosDoc = packages'.nixos-doc; - homeManagerDoc = packages'.home-manager-doc; - }; - - default = packages'.site; - } - ); - }; -} diff --git a/flake.lock b/flake.lock index d98d6b86..3d5708f1 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,46 @@ { "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1732482255, + "narHash": "sha256-GUffLwzawz5WRVfWaWCg78n/HrBJrOG7QadFY6rtV8A=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "a9953635d7f34e7358d5189751110f87e3ac17da", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager-stable": { + "inputs": { + "nixpkgs": [ + "nixpkgs-stable" + ] + }, + "locked": { + "lastModified": 1726989464, + "narHash": "sha256-Vl+WVTJwutXkimwGprnEtXc/s/s8sMuXzqXaspIGlwM=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "2f23fa308a7c067e52dfcc30a0758f47043ec176", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-24.05", + "repo": "home-manager", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1732014248, @@ -16,9 +57,28 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1731797254, + "narHash": "sha256-df3dJApLPhd11AlueuoN0Q4fHo/hagP75LlM5K1sz9g=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e8c38b73aeb218e27163376a2d617e61a2ad9b59", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "home-manager": "home-manager", + "home-manager-stable": "home-manager-stable", + "nixpkgs": "nixpkgs", + "nixpkgs-stable": "nixpkgs-stable" } } }, diff --git a/flake.nix b/flake.nix index db16f6d7..fe06cbae 100644 --- a/flake.nix +++ b/flake.nix @@ -3,10 +3,45 @@ 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 = ""; + }; + }; + } + ``` + */ + + nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05"; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + home-manager-stable = { + url = "github:nix-community/home-manager/release-24.05"; + inputs.nixpkgs.follows = "nixpkgs-stable"; + }; }; outputs = - { nixpkgs, self }: + { + self, + nixpkgs, + nixpkgs-stable, + home-manager, + home-manager-stable, + }: let inherit (nixpkgs) lib; @@ -45,17 +80,71 @@ system: let pkgs = nixpkgs.legacyPackages.${system}; + pkgsStable = nixpkgs-stable.legacyPackages.${system}; in { + apps = { + serve = { + type = "app"; + program = lib.getExe self.packages.${system}.site.serve; + }; + }; + + checks = import ./tests rec { + inherit home-manager home-manager-stable; + inherit (nixpkgs) lib; + nixpkgs = pkgs; + nixpkgs-stable = pkgsStable; + }; + devShells.default = import ./shell.nix { inherit pkgs; }; formatter = pkgs.nixfmt-rfc-style; packages = let + packages' = self.packages.${system}; + catppuccinPackages = import ./default.nix { inherit pkgs; }; + + docVersion = self.shortRev or self.dirtyShortRev or "unknown"; + mkOptionDoc = pkgs.callPackage ./docs/options-doc.nix { }; + mkSite = pkgs.callPackage ./docs/mk-site.nix { }; in - catppuccinPackages // { default = pkgs.emptyFile; }; + catppuccinPackages + // { + default = pkgs.emptyFile; + + nixos-doc = mkOptionDoc { + version = docVersion; + moduleRoot = ./modules/nixos; + }; + + home-manager-doc = mkOptionDoc { + version = docVersion; + moduleRoot = ./modules/home-manager; + }; + + site = mkSite rec { + pname = "catppuccin-nix-website"; + version = docVersion; + + src = lib.fileset.toSource { + root = ./.; + fileset = lib.fileset.unions [ + ./CHANGELOG.md + ./docs/src + ./docs/book.toml + ./docs/theme + ]; + }; + + sourceRoot = "${src.name}/docs"; + + nixosDoc = packages'.nixos-doc; + homeManagerDoc = packages'.home-manager-doc; + }; + }; } )) diff --git a/pkgs/init-port.py b/pkgs/init-port.py index 5107444b..fc441290 100755 --- a/pkgs/init-port.py +++ b/pkgs/init-port.py @@ -5,8 +5,13 @@ import subprocess import os +<<<<<<<< HEAD:pkgs/init-port.py # Root of the packages directory ROOT = os.path.dirname(os.path.abspath(__file__)) +======== +# Root of the repository +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +>>>>>>>> 33b3faf (refactor: merge subflake back into main flake):scripts/init-port.py FETCH_COMMAND = [ "nix",