Skyler Grey | deea2f7 | 2023-05-31 20:14:49 +0200 | [diff] [blame] | 1 | { |
| 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 Grey | 40db1d4 | 2023-06-02 14:31:24 +0200 | [diff] [blame] | 29 | scripts = [ |
Skyler Grey | 8fffb18 | 2023-06-02 15:30:01 +0200 | [diff] [blame] | 30 | [ "ui" "pnpx shadcn-svelte add" ] |
| 31 | [ "nx" "pnpm nx" ] |
Skyler Grey | deea2f7 | 2023-05-31 20:14:49 +0200 | [diff] [blame] | 32 | ]; |
| 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 Grey | 8fffb18 | 2023-06-02 15:30:01 +0200 | [diff] [blame] | 46 | inherit (pkgs); |
Skyler Grey | 40db1d4 | 2023-06-02 14:31:24 +0200 | [diff] [blame] | 47 | 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 Grey | deea2f7 | 2023-05-31 20:14:49 +0200 | [diff] [blame] | 57 | }; |
| 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 | } |