Fix these two templates

This commit is contained in:
Lillian Violet 2024-01-18 13:42:47 +01:00
parent 0ea67a261e
commit 4e96eb7733
2 changed files with 64 additions and 57 deletions

View file

@ -2,34 +2,39 @@
description = "A Nix-flake-based Purescript development environment"; description = "A Nix-flake-based Purescript development environment";
inputs = { inputs = {
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
easy-purescript-nix = { easy-purescript-nix = {
url = "github:justinwoo/easy-purescript-nix"; url = "github:justinwoo/easy-purescript-nix";
flake = false; flake = false;
}; };
}; };
outputs = { self, nixpkgs, easy-purescript-nix }: outputs = {
let self,
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ]; # "aarch64-linux" not supported nixpkgs,
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { easy-purescript-nix,
pkgs = import nixpkgs { inherit system; }; }: let
}); supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-darwin"]; # "aarch64-linux" not supported
in forEachSupportedSystem = f:
{ nixpkgs.lib.genAttrs supportedSystems (system:
devShells = forEachSupportedSystem ({ pkgs }: { f {
default = pkgs = import nixpkgs {inherit system;};
let });
easy-ps = import easy-purescript-nix { inherit pkgs; }; in {
in devShells = forEachSupportedSystem ({pkgs}: {
pkgs.mkShell { default = let
packages = (with pkgs; [ nodejs ]) ++ (with easy-ps; [ easy-ps = import easy-purescript-nix {inherit pkgs;};
in
pkgs.mkShell {
packages =
(with pkgs; [nodejs])
++ (with easy-ps; [
purs purs
spago spago
purescript-language-server purescript-language-server
purs-tidy purs-tidy
]); ]);
}; };
}); });
}; };
} }

View file

@ -2,48 +2,50 @@
description = "A Nix-flake-based Rust development environment"; description = "A Nix-flake-based Rust development environment";
inputs = { inputs = {
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
rust-overlay = { rust-overlay = {
url = "github:oxalica/rust-overlay"; url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
}; };
outputs = { self, nixpkgs, rust-overlay }: outputs = {
let self,
overlays = [ nixpkgs,
rust-overlay.overlays.default rust-overlay,
(final: prev: { }: let
rustToolchain = overlays = [
let rust-overlay.overlays.default
rust = prev.rust-bin; (final: prev: {
in rustToolchain = let
if builtins.pathExists ./rust-toolchain.toml then rust = prev.rust-bin;
rust.fromRustupToolchainFile ./rust-toolchain.toml in
else if builtins.pathExists ./rust-toolchain then if builtins.pathExists ./rust-toolchain.toml
rust.fromRustupToolchainFile ./rust-toolchain then rust.fromRustupToolchainFile ./rust-toolchain.toml
else else if builtins.pathExists ./rust-toolchain
rust.stable.latest.default; then rust.fromRustupToolchainFile ./rust-toolchain
}) else rust.stable.latest.default;
]; })
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
pkgs = import nixpkgs { inherit overlays system; }; forEachSupportedSystem = f:
}); nixpkgs.lib.genAttrs supportedSystems (system:
in f {
{ pkgs = import nixpkgs {inherit overlays system;};
devShells = forEachSupportedSystem ({ pkgs }: { });
default = pkgs.mkShell { in {
packages = with pkgs; [ devShells = forEachSupportedSystem ({pkgs}: {
rustToolchain default = pkgs.mkShell {
openssl packages = with pkgs; [
pkg-config rustToolchain
cargo-deny openssl
cargo-edit pkg-config
cargo-watch cargo-deny
rust-analyzer cargo-edit
]; cargo-watch
}; rust-analyzer
}); ];
}; };
});
};
} }