blob: dd1ee6a5c399fb5aa28561a76c233b271c39730f [file] [log] [blame]
Skyler Greydeea2f72023-05-31 20:14:49 +02001{
2 description = "Description for the project";
3
4 inputs = {
5 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6 devenv.url = "github:cachix/devenv";
7 nix2container.url = "github:nlewo/nix2container";
8 nix2container.inputs.nixpkgs.follows = "nixpkgs";
9 mk-shell-bin.url = "github:rrbutani/nix-mk-shell-bin";
10 };
11
12 outputs = inputs@{ flake-parts, ... }:
13 flake-parts.lib.mkFlake { inherit inputs; } {
14 imports = [
15 inputs.devenv.flakeModule
16 ];
17 systems = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
18
19 perSystem = { config, self', inputs', pkgs, system, ... }: {
20 # Per-system attributes can be defined here. The self' and inputs'
21 # module parameters provide easy access to attributes of the same
22 # system.
23
24 # Equivalent to inputs'.nixpkgs.legacyPackages.hello;
25 packages.default = pkgs.hello;
26
27 devenv.shells.default =
28 let
Skyler Grey40db1d42023-06-02 14:31:24 +020029 scripts = [
Skyler Grey8fffb182023-06-02 15:30:01 +020030 [ "ui" "pnpx shadcn-svelte add" ]
31 [ "nx" "pnpm nx" ]
Skyler Greydeea2f72023-05-31 20:14:49 +020032 ];
33 in
34 {
35 name = "my-project";
36
37 # https://devenv.sh/reference/options/
38 packages = [
39 config.packages.default
40 ] ++ (builtins.attrValues {
41 inherit (pkgs.nodePackages)
42 pnpm
43 svelte-language-server
44 prettier;
45 }) ++ (builtins.attrValues {
Skyler Grey8fffb182023-06-02 15:30:01 +020046 inherit (pkgs);
Skyler Grey40db1d42023-06-02 14:31:24 +020047 nodejs-18_x = (pkgs.nodejs-18_x.override { enableNpm = true; });
48 });
49
50 scripts = pkgs.lib.pipe scripts [
51 (map (alias: {
52 name = builtins.elemAt alias 0;
53 value.exec = (builtins.elemAt alias 1) + " \"$@\"";
54 }))
55 pkgs.lib.listToAttrs
56 ];
Skyler Greydeea2f72023-05-31 20:14:49 +020057 };
58
59 };
60 flake = {
61 # The usual flake attributes can be defined here, including system-
62 # agnostic ones like nixosModule and system-enumerating ones, although
63 # those are more easily expressed in perSystem.
64
65 };
66 };
67}