diff options
| -rw-r--r-- | .github/workflows/update-inputs.yaml | 6 | ||||
| -rw-r--r-- | ci.nix | 35 | ||||
| -rw-r--r-- | flake.lock | 124 | ||||
| -rw-r--r-- | flake.nix | 95 | ||||
| -rw-r--r-- | garnix.yaml | 2 | ||||
| -rw-r--r-- | modules/default.nix | 10 | ||||
| -rw-r--r-- | pkgs/all-packages.nix | 21 | ||||
| -rw-r--r-- | pkgs/default.nix | 46 | ||||
| -rw-r--r-- | templates/default.nix | 14 |
9 files changed, 268 insertions, 85 deletions
diff --git a/.github/workflows/update-inputs.yaml b/.github/workflows/update-inputs.yaml index 6161f51..91a975b 100644 --- a/.github/workflows/update-inputs.yaml +++ b/.github/workflows/update-inputs.yaml @@ -1,9 +1,9 @@ name: update inputs on: - schedule: - # run every saturday - - cron: "0 0 * * 6" + #schedule: + # # run every saturday + # - cron: "0 0 * * 6" workflow_dispatch: permissions: @@ -0,0 +1,35 @@ +{ + inputs, + self, + ... +}: { + imports = [ + inputs.effects.flakeModule + ]; + + hercules-ci.flake-update = { + enable = true; + autoMergeMethod = "rebase"; + + flakes = { + ".".commitSummary = "flake: update inputs"; + }; + + when = { + minute = 0; + hour = [0]; + dayOfWeek = ["Sun"]; + }; + }; + + herculesCI = {lib, ...}: let + ciSystems = ["x86_64-linux" "aarch64-linux"]; + findCompatible = lib.filterAttrs (s: _: builtins.elem s ciSystems); + in { + inherit ciSystems; + + onPush.default.outputs = lib.mkForce { + packages = findCompatible self.packages; + }; + }; +} @@ -1,5 +1,29 @@ { "nodes": { + "effects": { + "inputs": { + "flake-parts": "flake-parts", + "hercules-ci-agent": [ + "hercules-ci-agent" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1689397210, + "narHash": "sha256-fVxZnqxMbsDkB4GzGAs/B41K0wt/e+B/fLxmTFF/S20=", + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "rev": "0a63bfa3f00a3775ea3a6722b247880f1ffe91ce", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -16,6 +40,63 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1688466019, + "narHash": "sha256-VeM2akYrBYMsb4W/MmBo1zmaMfgbL4cH3Pu8PGyIwJ0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8e8d955c22df93dbe24f19ea04f47a74adbdc5ec", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "haskell-flake": { + "locked": { + "lastModified": 1684780604, + "narHash": "sha256-2uMZsewmRn7rRtAnnQNw1lj0uZBMh4m6Cs/7dV5YF08=", + "owner": "srid", + "repo": "haskell-flake", + "rev": "74210fa80a49f1b6f67223debdbf1494596ff9f2", + "type": "github" + }, + "original": { + "owner": "srid", + "ref": "0.3.0", + "repo": "haskell-flake", + "type": "github" + } + }, + "hercules-ci-agent": { + "inputs": { + "flake-parts": [ + "parts" + ], + "haskell-flake": "haskell-flake", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1688568579, + "narHash": "sha256-ON0M56wtY/TIIGPkXDlJboAmuYwc73Hi8X9iJGtxOhM=", + "owner": "hercules-ci", + "repo": "hercules-ci-agent", + "rev": "367dd8cd649b57009a6502e878005a1e54ad78c5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "hercules-ci-agent", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1692356644, @@ -31,10 +112,51 @@ "type": "indirect" } }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1688049487, + "narHash": "sha256-100g4iaKC9MalDjUW9iN6Jl/OocTDtXdeAj7pEGIRh4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4bc72cae107788bf3f24f30db2e2f685c9298dc9", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "parts": { + "inputs": { + "nixpkgs-lib": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1690933134, + "narHash": "sha256-ab989mN63fQZBFrkk4Q8bYxQCktuHmBIBqUG1jl6/FQ=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "59cf3f1447cfc75087e7273b04b31e689a8599fb", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "root": { "inputs": { + "effects": "effects", "flake-compat": "flake-compat", - "nixpkgs": "nixpkgs" + "hercules-ci-agent": "hercules-ci-agent", + "nixpkgs": "nixpkgs", + "parts": "parts" } } }, @@ -3,84 +3,59 @@ nixConfig = { extra-substituters = [ + "https://getchoo.cachix.org" "https://cache.garnix.io" ]; extra-trusted-public-keys = [ + "getchoo.cachix.org-1:ftdbAUJVNaFonM0obRGgR5+nUmdLMM+AOvDOSx0z5tE=" "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ]; }; inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; + flake-compat = { url = "github:edolstra/flake-compat"; flake = false; }; - }; - - outputs = { - self, - nixpkgs, - ... - }: let - systems = [ - "x86_64-linux" - "x86_64-darwin" - "aarch64-linux" - "aarch64-darwin" - ]; - - inherit (nixpkgs) lib; - - forAllSystems = lib.genAttrs systems; - nixpkgsFor = forAllSystems (system: - import nixpkgs { - inherit system; - overlays = [self.overlays.default]; - }); - forEachSystem = fn: - forAllSystems (system: - fn { - inherit system; - pkgs = nixpkgsFor.${system}; - }); - in { - flakeModules = { - default = import ./modules/flake; - homeConfigurations = import ./modules/flake/homeConfigurations.nix; - homeManagerModules = import ./modules/flake/homeManagerModules.nix; - hydraJobs = import ./modules/flake/hydraJobs.nix; + effects = { + url = "github:hercules-ci/hercules-ci-effects"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.hercules-ci-agent.follows = "hercules-ci-agent"; }; - formatter = forEachSystem (p: p.pkgs.alejandra); - - packages = forEachSystem ( - { - pkgs, - system, - }: let - p = let - packages = import ./pkgs pkgs; - in - lib.filterAttrs (_: v: - builtins.elem system (v.meta.platforms or []) && !(v.meta.broken or false)) - packages; - in - p // {default = p.treefetch;} - ); + parts = { + url = "github:hercules-ci/flake-parts"; + inputs.nixpkgs-lib.follows = "nixpkgs"; + }; - overlays.default = final: _: import ./pkgs final; + hercules-ci-agent = { + url = "github:hercules-ci/hercules-ci-agent"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-parts.follows = "parts"; + }; + }; - templates = let - # string -> string -> {} - mkTemplate = name: description: { - path = "${self}/templates/${name}"; - inherit description; + outputs = {parts, ...} @ inputs: + parts.lib.mkFlake {inherit inputs;} { + imports = [ + ./pkgs + ./modules + ./templates + ./ci.nix + ]; + + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + + perSystem = {pkgs, ...}: { + formatter = pkgs.alejandra; }; - in { - basic = mkTemplate "basic" "minimal boilerplate for my flakes"; - full = mkTemplate "full" "big template for complex flakes (using flake-parts)"; }; - }; } diff --git a/garnix.yaml b/garnix.yaml index 00227d6..f215263 100644 --- a/garnix.yaml +++ b/garnix.yaml @@ -1,7 +1,5 @@ builds: exclude: [] include: - - "packages.x86_64-linux.*" - - "packages.aarch64-linux.*" - "packages.aarch64-darwin.modrinth-app" - "packages.aarch64-darwin.modrinth-app-unwrapped" diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..9b68c34 --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,10 @@ +_: { + flake = { + flakeModules = { + default = import ./flake; + homeConfigurations = import ./flake/homeConfigurations.nix; + homeManagerModules = import ./flake/homeManagerModules.nix; + hydraJobs = import ./flake/hydraJobs.nix; + }; + }; +} diff --git a/pkgs/all-packages.nix b/pkgs/all-packages.nix new file mode 100644 index 0000000..6a8f12e --- /dev/null +++ b/pkgs/all-packages.nix @@ -0,0 +1,21 @@ +pkgs: let + inherit (pkgs) callPackage; +in { + # original packages + cfspeedtest = callPackage ./cfspeedtest.nix {}; + check-pr = callPackage ./check-pr.nix {}; + fastfetch = callPackage ./fastfetch.nix {}; + huion = callPackage ./huion.nix {}; + klassy = pkgs.libsForQt5.callPackage ./klassy.nix {}; + mommy = callPackage ./mommy.nix {}; + nixgc = callPackage ./nixgc.nix {}; + modrinth-app-unwrapped = callPackage ./modrinth-app { + inherit (pkgs.nodePackages) pnpm; + inherit (pkgs.darwin.apple_sdk.frameworks) CoreServices Security WebKit; + }; + modrinth-app = callPackage ./modrinth-app/wrapper.nix {}; + treefetch = callPackage ./treefetch.nix {}; + swhkd = callPackage ./swhkd {}; + vim-just = callPackage ./vim-just.nix {}; + xwaylandvideobridge = callPackage ./xwaylandvideobridge.nix {}; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index 6a8f12e..8471def 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,21 +1,29 @@ -pkgs: let - inherit (pkgs) callPackage; -in { - # original packages - cfspeedtest = callPackage ./cfspeedtest.nix {}; - check-pr = callPackage ./check-pr.nix {}; - fastfetch = callPackage ./fastfetch.nix {}; - huion = callPackage ./huion.nix {}; - klassy = pkgs.libsForQt5.callPackage ./klassy.nix {}; - mommy = callPackage ./mommy.nix {}; - nixgc = callPackage ./nixgc.nix {}; - modrinth-app-unwrapped = callPackage ./modrinth-app { - inherit (pkgs.nodePackages) pnpm; - inherit (pkgs.darwin.apple_sdk.frameworks) CoreServices Security WebKit; +{ + self, + inputs, + ... +}: { + perSystem = { + lib, + pkgs, + system, + ... + }: { + _module.args.pkgs = import inputs.nixpkgs { + inherit system; + overlays = [self.overlays.default]; + }; + + packages = let + p = let + packages = import ./all-packages.nix pkgs; + in + lib.filterAttrs (_: v: + builtins.elem system (v.meta.platforms or []) && !(v.meta.broken or false)) + packages; + in + p // {default = p.treefetch;}; }; - modrinth-app = callPackage ./modrinth-app/wrapper.nix {}; - treefetch = callPackage ./treefetch.nix {}; - swhkd = callPackage ./swhkd {}; - vim-just = callPackage ./vim-just.nix {}; - xwaylandvideobridge = callPackage ./xwaylandvideobridge.nix {}; + + flake.overlays.default = final: _: import ./all-packages.nix final; } diff --git a/templates/default.nix b/templates/default.nix new file mode 100644 index 0000000..67d62a0 --- /dev/null +++ b/templates/default.nix @@ -0,0 +1,14 @@ +{self, ...}: { + flake = { + templates = let + # string -> string -> {} + mkTemplate = name: description: { + path = "${self}/templates/${name}"; + inherit description; + }; + in { + basic = mkTemplate "basic" "minimal boilerplate for my flakes"; + full = mkTemplate "full" "big template for complex flakes (using flake-parts)"; + }; + }; +} |
