diff options
author | Irene Knapp <ireneista@irenes.space> | 2024-03-12 18:06:24 -0700 |
---|---|---|
committer | Irene Knapp <ireneista@irenes.space> | 2024-03-12 18:06:24 -0700 |
commit | ddbfb81fd041af226f4550be741440a01ea07591 (patch) | |
tree | 03bb1bef61bc1fe48a7faa349e535aa8442dfdc8 /flake.nix | |
parent | c03767751bb1064eb68a84937c1fbc77d1e2c2b5 (diff) |
nix flake, based on my rust flake template
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..a01f74d --- /dev/null +++ b/flake.nix @@ -0,0 +1,37 @@ +{ + inputs = { + nixpkgs = { + type = "github"; + owner = "NixOS"; + repo = "nixpkgs"; + ref = "nixos-23.05"; + }; + + crane = { + inputs.nixpkgs.follows = "nixpkgs"; + url = "github:ipetkov/crane"; + }; + }; + + outputs = { self, nixpkgs, crane }: + let supportedSystems = [ "aarch64-linux" "x86_64-linux" ]; + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); + in { + packages = forAllSystems (system: let pkgs = nixpkgsFor.${system}; in { + default = crane.lib.${system}.buildPackage { + src = ./.; + }; + }); + + devShells = forAllSystems (system: let pkgs = nixpkgsFor.${system}; in { + default = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + cargo + rustc + ]; + }; + }); + }; +} + |