|
15 | 15 | }; |
16 | 16 |
|
17 | 17 | inputs = { |
18 | | - nixpkgs = { |
19 | | - url = "github:NixOS/nixpkgs/nixos-unstable"; |
20 | | - }; |
21 | | - |
22 | | - nix-filter = { |
23 | | - url = "github:numtide/nix-filter"; |
24 | | - }; |
25 | | - |
| 18 | + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; |
| 19 | + nix-filter.url = "github:numtide/nix-filter"; |
26 | 20 | libnbtplusplus = { |
27 | 21 | url = "github:FreesmTeam/libnbtplusplus"; |
28 | 22 | flake = false; |
29 | 23 | }; |
30 | | - |
31 | | - flake-compat = { |
32 | | - url = "github:edolstra/flake-compat"; |
33 | | - flake = false; |
34 | | - }; |
35 | 24 | }; |
36 | 25 |
|
37 | 26 | outputs = { |
38 | 27 | self, |
39 | 28 | nixpkgs, |
40 | | - libnbtplusplus, |
41 | 29 | nix-filter, |
| 30 | + libnbtplusplus, |
42 | 31 | ... |
43 | 32 | }: let |
44 | | - inherit (nixpkgs) lib; |
45 | | - systems = lib.systems.flakeExposed; |
46 | | - forAllSystems = lib.genAttrs systems; |
47 | | - nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system}); |
| 33 | + systems = [ |
| 34 | + "x86_64-linux" |
| 35 | + "aarch64-linux" |
| 36 | + "x86_64-darwin" |
| 37 | + "aarch64-darwin" |
| 38 | + ]; |
| 39 | + |
| 40 | + forEachSystem = nixpkgs.lib.genAttrs systems; |
48 | 41 | in { |
49 | | - formatter = forAllSystems (system: nixpkgsFor.${system}.alejandra); |
50 | | - devShells = forAllSystems ( |
51 | | - system: let |
52 | | - pkgs = nixpkgsFor.${system}; |
53 | | - in { |
54 | | - default = pkgs.mkShell { |
55 | | - inputsFrom = [ |
56 | | - self.packages.${system}.freesmlauncher-unwrapped |
57 | | - ]; |
58 | | - buildInputs = [ |
59 | | - pkgs.ccache |
60 | | - pkgs.ninja |
61 | | - ]; |
62 | | - shellHook = '' |
63 | | - # https://discourse.nixos.org/t/qt-development-environment-on-a-flake-system/23707/5 |
64 | | - setQtEnvironment=$(mktemp) |
65 | | - random=$(openssl rand -base64 20 | sed "s/[^a-zA-Z0-9]//g") |
66 | | - makeWrapper "$(type -p sh)" "$setQtEnvironment" "''${qtWrapperArgs[@]}" --argv0 "$random" |
67 | | - sed "/$random/d" -i "$setQtEnvironment" |
68 | | - source "$setQtEnvironment" |
69 | | - ''; |
70 | | - }; |
71 | | - } |
72 | | - ); |
| 42 | + overlays.default = final: prev: { |
| 43 | + freesmlauncher-unwrapped = final.callPackage ./nix/unwrapped.nix { |
| 44 | + inherit nix-filter libnbtplusplus self; |
| 45 | + }; |
| 46 | + |
| 47 | + freesmlauncher = final.callPackage ./nix/wrapper.nix; |
| 48 | + }; |
73 | 49 |
|
74 | | - overlays = { |
75 | | - default = final: prev: { |
76 | | - freesmlauncher-unwrapped = prev.callPackage ./nix/unwrapped.nix { |
77 | | - inherit |
78 | | - libnbtplusplus |
79 | | - nix-filter |
80 | | - self |
81 | | - ; |
82 | | - }; |
| 50 | + packages = forEachSystem (system: let |
| 51 | + pkgs = import nixpkgs {inherit system;}; |
83 | 52 |
|
84 | | - freesmlauncher = final.callPackage ./nix/wrapper.nix {}; |
| 53 | + freesmlauncher-unwrapped = pkgs.callPackage ./nix/unwrapped.nix { |
| 54 | + inherit nix-filter libnbtplusplus self; |
| 55 | + }; |
| 56 | + |
| 57 | + freesmlauncher = pkgs.callPackage ./nix/wrapper.nix { |
| 58 | + inherit freesmlauncher-unwrapped; |
85 | 59 | }; |
86 | | - }; |
87 | 60 |
|
88 | | - packages = forAllSystems ( |
89 | | - system: let |
90 | | - pkgs = nixpkgsFor.${system}; |
| 61 | + freesmlauncher-unwrapped-debug = freesmlauncher-unwrapped.overrideAttrs { |
| 62 | + cmakeBuildType = "Debug"; |
| 63 | + dontStrip = true; |
| 64 | + }; |
91 | 65 |
|
92 | | - freesmPackages = lib.makeScope pkgs.newScope (final: self.overlays.default final pkgs); |
| 66 | + freesmlauncher-debug = pkgs.callPackage ./nix/wrapper.nix { |
| 67 | + freesmlauncher-unwrapped = freesmlauncher-unwrapped-debug; |
| 68 | + }; |
| 69 | + in { |
| 70 | + inherit freesmlauncher freesmlauncher-unwrapped freesmlauncher-debug freesmlauncher-unwrapped-debug; |
93 | 71 |
|
94 | | - packages = { |
95 | | - inherit (freesmPackages) freesmlauncher-unwrapped freesmlauncher; |
96 | | - default = freesmPackages.freesmlauncher; |
97 | | - }; |
98 | | - in |
99 | | - lib.filterAttrs (_: lib.meta.availableOn pkgs.stdenv.hostPlatform) packages |
100 | | - ); |
| 72 | + default = freesmlauncher; |
| 73 | + }); |
101 | 74 |
|
102 | | - legacyPackages = forAllSystems ( |
103 | | - system: let |
104 | | - freesmPackages = self.packages.${system}; |
105 | | - legacyPackages = self.legacyPackages.${system}; |
106 | | - in { |
107 | | - freesmlauncher-debug = freesmPackages.freesmlauncher.override { |
108 | | - freesmlauncher-unwrapped = legacyPackages.freesmlauncher-unwrapped-debug; |
109 | | - }; |
| 75 | + devShells = forEachSystem (system: let |
| 76 | + pkgs = import nixpkgs { |
| 77 | + inherit system; |
| 78 | + overlays = [self.overlays.default]; |
| 79 | + }; |
| 80 | + in { |
| 81 | + default = pkgs.mkShell { |
| 82 | + inputsFrom = [pkgs.freesmlauncher-unwrapped]; |
| 83 | + |
| 84 | + packages = with pkgs; [ |
| 85 | + ccache |
| 86 | + ninja |
| 87 | + ]; |
| 88 | + }; |
| 89 | + }); |
110 | 90 |
|
111 | | - freesmlauncher-unwrapped-debug = freesmPackages.freesmlauncher-unwrapped.overrideAttrs { |
112 | | - cmakeBuildType = "Debug"; |
113 | | - dontStrip = true; |
114 | | - }; |
115 | | - } |
| 91 | + formatter = forEachSystem ( |
| 92 | + system: |
| 93 | + (import nixpkgs {inherit system;}).alejandra |
116 | 94 | ); |
117 | 95 | }; |
118 | 96 | } |
0 commit comments