nix-background-upgrade/flake.nix
Evie Litherland-Smith c477ec58a9 Rename main.py -> cli.py and add poetry pre-commit hooks
Add apps section to flake.nix output to explicitly define CLI output
path
2024-05-26 10:52:54 +01:00

48 lines
1.4 KiB
Nix

{
description = "Upgrade NixOS system (and/or home-manager) in the background, with notification support";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.poetry2nix.url = "github:nix-community/poetry2nix";
outputs = {
self,
nixpkgs,
poetry2nix,
}: let
supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system});
in {
packages = forAllSystems (system: let
inherit (poetry2nix.lib.mkPoetry2Nix {pkgs = pkgs.${system};}) mkPoetryApplication;
in {
default = mkPoetryApplication {
projectDir = self;
checkGroups = [];
};
});
apps = forAllSystems (system: {
default = {
type = "app";
program = "${self.packages.${system}.default}/bin/nix-background-upgrade";
};
});
devShells = forAllSystems (system: let
inherit (poetry2nix.lib.mkPoetry2Nix {pkgs = pkgs.${system};}) mkPoetryEnv;
in {
default = pkgs.${system}.mkShellNoCC {
packages = with pkgs.${system}; [
(mkPoetryEnv {
projectDir = self;
preferWheels = true;
extraPackages = ps: with ps; [python-lsp-server];
})
poetry
];
};
});
};
}