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 |
| 29 | aliases = map |
| 30 | (alias: pkgs.writeShellScriptBin |
| 31 | (builtins.elemAt alias 0) |
| 32 | ((builtins.elemAt alias 1) + " \"$@\"")) [ |
| 33 | [ "npm" "pnpm" ] |
| 34 | [ "npx" "pnpx" ] |
| 35 | [ "yarn" "pnpm" ] |
| 36 | [ "ui" "npx shadcn-svelte add"] |
| 37 | ]; |
| 38 | in |
| 39 | { |
| 40 | name = "my-project"; |
| 41 | |
| 42 | # https://devenv.sh/reference/options/ |
| 43 | packages = [ |
| 44 | config.packages.default |
| 45 | ] ++ (builtins.attrValues { |
| 46 | inherit (pkgs.nodePackages) |
| 47 | pnpm |
| 48 | svelte-language-server |
| 49 | prettier; |
| 50 | }) ++ (builtins.attrValues { |
| 51 | inherit (pkgs); |
| 52 | }) ++ aliases; |
| 53 | }; |
| 54 | |
| 55 | }; |
| 56 | flake = { |
| 57 | # The usual flake attributes can be defined here, including system- |
| 58 | # agnostic ones like nixosModule and system-enumerating ones, although |
| 59 | # those are more easily expressed in perSystem. |
| 60 | |
| 61 | }; |
| 62 | }; |
| 63 | } |