2023-08-15 21:13:14 +00:00
|
|
|
{
|
|
|
|
description = "A very basic flake";
|
|
|
|
|
|
|
|
inputs = {
|
2023-12-31 23:25:38 +00:00
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
2024-01-02 14:12:45 +00:00
|
|
|
poetry2nix-lib = {
|
2023-12-31 23:25:38 +00:00
|
|
|
url = "github:nix-community/poetry2nix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2023-08-15 21:13:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = {
|
|
|
|
self,
|
|
|
|
nixpkgs,
|
2024-01-02 14:12:45 +00:00
|
|
|
poetry2nix-lib,
|
2023-08-15 21:13:14 +00:00
|
|
|
} @ inputs: let
|
|
|
|
supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
|
|
|
|
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
|
|
|
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system});
|
2024-01-02 14:12:45 +00:00
|
|
|
poetry2nix = forAllSystems (system: poetry2nix-lib.lib.mkPoetry2Nix {pkgs = pkgs.${system};});
|
2023-08-15 21:13:14 +00:00
|
|
|
in {
|
2023-10-13 11:56:55 +00:00
|
|
|
# `nix build`
|
2023-08-15 21:13:14 +00:00
|
|
|
packages = forAllSystems (system: {
|
2024-01-02 14:12:45 +00:00
|
|
|
default = poetry2nix.${system}.mkPoetryApplication {
|
2023-10-13 13:20:28 +00:00
|
|
|
projectDir = self;
|
|
|
|
};
|
2023-08-15 21:13:14 +00:00
|
|
|
});
|
|
|
|
|
2023-12-31 23:46:57 +00:00
|
|
|
# `nix fmt`
|
|
|
|
formatter = forAllSystems (system: pkgs.${system}.alejandra);
|
|
|
|
|
2023-10-13 11:56:55 +00:00
|
|
|
# `nix develop`
|
2023-08-15 21:13:14 +00:00
|
|
|
devShells = forAllSystems (system: {
|
2024-01-02 14:12:45 +00:00
|
|
|
default = let
|
|
|
|
poetryEnv = poetry2nix.${system}.mkPoetryEnv {projectDir = self;};
|
|
|
|
in
|
|
|
|
pkgs.${system}.mkShellNoCC {
|
|
|
|
packages = with pkgs.${system};
|
|
|
|
[
|
|
|
|
poetry
|
|
|
|
]
|
|
|
|
++ [poetryEnv];
|
|
|
|
};
|
2023-08-15 21:13:14 +00:00
|
|
|
});
|
|
|
|
|
2023-08-19 15:44:50 +00:00
|
|
|
# TODO: Home Manager Module
|
2023-08-15 21:13:14 +00:00
|
|
|
# homeManagerModules.default = import ./nix/hm-module.nix self;
|
2023-08-19 15:44:50 +00:00
|
|
|
|
2023-08-15 21:13:14 +00:00
|
|
|
# NixOS Module
|
2023-08-19 15:44:50 +00:00
|
|
|
nixosModules.default = import ./nix/module.nix inputs;
|
2023-08-15 21:13:14 +00:00
|
|
|
};
|
|
|
|
}
|