kittypatch-flake/flake.nix

55 lines
1.5 KiB
Nix

# vim: set noet sw=2 ts=2 sts=2:
{
description = "kitty";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-23.05-small;
};
outputs = { self, nixpkgs }:
let
allSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = f: (nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs { inherit system; };
}));
in rec {
defaultPackage = forAllSystems ({pkgs}:
with pkgs;
callPackage ./kitty.nix { }
);
packages = forAllSystems ({pkgs}:
with pkgs;
{ default = callPackage ./kitty.nix { }; }
);
devShell = forAllSystems ({pkgs}:
with pkgs;
let
sw = callPackage ./kitty.nix { };
environment =
(lib.attrsets.filterAttrs (n: v: null != (builtins.match "^[A-Z_]+$" n)) sw)
// { RAILS_ENV = "development"; };
q = lib.strings.escapeShellArg;
in
mkShell {
name = "kitty-dev";
inputsFrom = [sw];
shellHook = ''
${lib.strings.concatStringsSep " " (builtins.attrValues (builtins.mapAttrs (n: v: "${n}=${q v}") environment))}
export ${lib.strings.concatStringsSep " " (builtins.attrValues (builtins.mapAttrs (n: v: q n) environment))}
'';
}
// environment
);
apps = forAllSystems ({pkgs}:
with pkgs;
let
kitty = callPackage ./kitty.nix { };
in {
server = {
type = "app";
program = "dev.sh";
};
}
);
};
}