diff --git a/flake.lock b/flake.lock index fea8e52..19b2543 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,25 @@ { "nodes": { + "hjem": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1737619027, + "narHash": "sha256-jEzZs9dHdmVP5X9HCC/7jrv08aWFfqZV5cZ+cZWYGA4=", + "owner": "feel-co", + "repo": "hjem", + "rev": "48cfa21987672a31a358b7e4d582fc174556e633", + "type": "github" + }, + "original": { + "owner": "feel-co", + "repo": "hjem", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1737469691, @@ -18,7 +38,24 @@ }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "hjem": "hjem", + "nixpkgs": "nixpkgs", + "systems": "systems" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 3a54c19..2d7a2ad 100644 --- a/flake.nix +++ b/flake.nix @@ -1,33 +1,52 @@ { inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + systems.url = "github:nix-systems/default"; + + hjem = { + url = "github:feel-co/hjem"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { self, nixpkgs, + systems, + hjem, ... }: let - inherit (nixpkgs) lib; + forAllSystems = function: + nixpkgs.lib.genAttrs (import systems) (system: function nixpkgs.legacyPackages.${system}); - forAllSystems = fn: - lib.genAttrs lib.systems.flakeExposed ( - system: - fn ( - import nixpkgs { - inherit system; - config.allowUnfree = true; - } - ) - ); + loadPackages = pkgs: let + packageNames = builtins.attrNames (builtins.readDir ./pkgs); + in + nixpkgs.lib.genAttrs packageNames (name: pkgs.callPackage (./pkgs + "/${name}") {}); + + loadModules = dir: let + moduleNames = builtins.attrNames (builtins.readDir dir); + in + nixpkgs.lib.genAttrs moduleNames (name: import (dir + "/${name}")); + + loadOverlays = let + overlayNames = builtins.attrNames (builtins.readDir ./overlays); + in + nixpkgs.lib.genAttrs overlayNames (name: import (./overlays + "/${name}")); in { - formatter = forAllSystems (pkgs: pkgs.alejandra); - overlays.default = _: prev: self.packages.${prev.stdenv.hostPlatform.system} or {}; + packages = forAllSystems loadPackages; + + nixosModules = loadModules ./modules/nixos; + hjemModules = loadModules ./modules/hjem; + + overlays = loadOverlays; }; + nixConfig = { - extra-substituters = ["https://blahai.cachix.org"]; + extra-substituters = ["https://blahai.cachix.org" "https://nix-community.cachix.org/"]; extra-trusted-public-keys = [ "blahai.cachix.org-1:7Pg+JDWpcIogeN3HesRnOb4dl6FSwl/ZHC+QUmb65So=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; }; } diff --git a/modules/hjem/default.nix b/modules/hjem/default.nix new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/modules/hjem/default.nix @@ -0,0 +1 @@ +{} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/modules/nixos/default.nix @@ -0,0 +1 @@ +{} diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1 @@ +{} diff --git a/pkgs/jkps/default.nix b/pkgs/jkps/default.nix new file mode 100644 index 0000000..b9f8f97 --- /dev/null +++ b/pkgs/jkps/default.nix @@ -0,0 +1,30 @@ +{ + stdenv, + lib, + fetchFromGitHub, + cmake, + sfml, +}: +stdenv.mkDerivation rec { + pname = "jkps"; + version = "0.3"; + + src = fetchFromGitHub { + owner = "JekiTheMonkey"; + repo = "JKPS"; + rev = "6d144f511ab8124d5947cfdada77e5584e002a9b"; + sha256 = "sha256-NveKqapYq//8COndyUpSP8dHiKfTkiH7Yy6b+zdaxtQ="; + }; + + buildInputs = [cmake sfml]; + + installPhase = '' + install -D -m777 ./JKPS "$out/bin/JKPS" + ''; + + meta = { + description = "A keys-per-second meter for rhythm games, useful for streaming and making videos"; + homepage = "https://github.com/JekiTheMonkey/JKPS"; + license = lib.licenses.mit; + }; +}