CS3502/flake.nix
2025-12-04 18:03:57 -05:00

44 lines
1.2 KiB
Nix

{
description = "Nix sandbox for CS4306 assignments";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
crane.url = "github:ipetkov/crane";
fenix.url = "github:nix-community/fenix";
fenix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, nixpkgs, systems, crane, fenix, ... }:
let
subdirs = [
"assignment1"
"assignment2"
"assignment3"
"project1"
"project2"
"project3"
];
eachSystem = nixpkgs.lib.genAttrs (import systems);
importFromSubdirs = file: eachSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in pkgs.lib.mergeAttrsList
(builtins.map (d:
builtins.mapAttrs
(_: v: pkgs.callPackage v { inherit inputs; })
(import ./${d}/${file}))
subdirs));
in {
packages = importFromSubdirs "default.nix";
checks = importFromSubdirs "test.nix";
devShells = eachSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
default = import ./shell.nix { inherit pkgs crane fenix; };
});
};
}