|
| 1 | +{ |
| 2 | + description = "Flake for acm-aws"; |
| 3 | + |
| 4 | + inputs = { |
| 5 | + nixpkgs.url = "github:nixos/nixpkgs?ref=50aa30a13c4ab5e7ba282da460a3e3d44e9d0eb3"; |
| 6 | + |
| 7 | + flake-utils.url = "github:numtide/flake-utils"; |
| 8 | + |
| 9 | + gomod2nix.url = "github:nix-community/gomod2nix"; |
| 10 | + gomod2nix.inputs.nixpkgs.follows = "nixpkgs"; |
| 11 | + gomod2nix.inputs.flake-utils.follows = "flake-utils"; |
| 12 | + |
| 13 | + poetry2nix.url = "github:nix-community/poetry2nix"; |
| 14 | + poetry2nix.inputs.nixpkgs.follows = "nixpkgs"; |
| 15 | + poetry2nix.inputs.flake-utils.follows = "flake-utils"; |
| 16 | + |
| 17 | + nix-npm-buildpackage.url = "github:serokell/nix-npm-buildpackage"; |
| 18 | + nix-npm-buildpackage.inputs.nixpkgs.follows = "nixpkgs"; |
| 19 | + }; |
| 20 | + |
| 21 | + outputs = { |
| 22 | + self, |
| 23 | + nixpkgs, |
| 24 | + flake-utils, |
| 25 | + gomod2nix, |
| 26 | + poetry2nix, |
| 27 | + nix-npm-buildpackage, |
| 28 | + }@inputs: |
| 29 | + |
| 30 | + flake-utils.lib.eachDefaultSystem (system: |
| 31 | + let |
| 32 | + pkgs = nixpkgs.legacyPackages.${system}; |
| 33 | + overlays = self.overlays.${system}; |
| 34 | + in |
| 35 | + { |
| 36 | + overlays = { |
| 37 | + # Overlay for the build tools that our packages use. |
| 38 | + buildTools = final: prev: { |
| 39 | + # |
| 40 | + # Build tools |
| 41 | + # |
| 42 | + inherit (gomod2nix.legacyPackages.${system}) |
| 43 | + mkGoEnv buildGoApplication; |
| 44 | + inherit (poetry2nix.lib.mkPoetry2Nix { pkgs = prev; }) |
| 45 | + mkPoetryApplication; |
| 46 | + inherit (nix-npm-buildpackage.legacyPackages.${system}) |
| 47 | + buildNpmPackage |
| 48 | + buildYarnPackage; |
| 49 | + buildDenoPackage = final.callPackage ./nix/packaging/deno.nix { }; |
| 50 | + buildJavaPackage = final.callPackage ./nix/packaging/java.nix { }; |
| 51 | + buildGradlePackage = final.callPackage ./nix/packaging/gradle.nix { }; |
| 52 | + buildPoetryPackage = final.callPackage ./nix/packaging/poetry.nix { }; |
| 53 | + |
| 54 | + # |
| 55 | + # Miscellanous tools |
| 56 | + # |
| 57 | + nix-update = final.callPackage ./nix/nix-update.nix { }; |
| 58 | + |
| 59 | + # |
| 60 | + # Miscellanous utility derivations |
| 61 | + # |
| 62 | + pkgutil = final.callPackage ./nix/pkgutil.nix { }; |
| 63 | + sources = import ./nix/sources.nix { |
| 64 | + inherit system; |
| 65 | + pkgs = prev; |
| 66 | + }; |
| 67 | + }; |
| 68 | + # Overlay adding our own packages. |
| 69 | + default = final: prev: self.packages.${system}; |
| 70 | + }; |
| 71 | + |
| 72 | + packages = import ./packages { |
| 73 | + pkgs = nixpkgs.legacyPackages.${system}.extend (overlays.buildTools); |
| 74 | + }; |
| 75 | + |
| 76 | + nixosConfigurations = { |
| 77 | + cirno = nixpkgs.lib.nixosSystem { |
| 78 | + system = "x86_64-linux"; |
| 79 | + modules = [ |
| 80 | + ({ ... }: { nixpkgs.overlays = [ overlays.default ]; }) |
| 81 | + ./servers/base.nix |
| 82 | + ./servers/cirno/configuration.nix |
| 83 | + ]; |
| 84 | + specialArgs = inputs // { inherit self; }; |
| 85 | + }; |
| 86 | + cs306 = nixpkgs.lib.nixosSystem { |
| 87 | + system = "x86_64-linux"; |
| 88 | + modules = [ |
| 89 | + ({ ... }: { nixpkgs.overlays = [ overlays.default ]; }) |
| 90 | + ./servers/base.nix |
| 91 | + ./servers/cs306/configuration.nix |
| 92 | + ]; |
| 93 | + specialArgs = inputs // { inherit self; }; |
| 94 | + }; |
| 95 | + }; |
| 96 | + } |
| 97 | + ); |
| 98 | +} |
0 commit comments