Skip to content

Commit

Permalink
flake: change default system
Browse files Browse the repository at this point in the history
  • Loading branch information
kraanzu committed Nov 7, 2024
1 parent 9504862 commit 130280b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@
};

outputs = inputs: let
# Define function to generate attributes for each system
forEachSystem = inputs.nixpkgs.lib.genAttrs inputs.nixpkgs.lib.platforms.all;

# Import nixpkgs for each system
pkgsFor = forEachSystem (
system:
import inputs.nixpkgs {
inherit system;
}
);

# Common Python packages used in both main package and devShell
mainPkgs = python3:
with python3; [
poetry-core
Expand All @@ -28,6 +31,7 @@
click
];

# Additional packages for the devShell
devShellPkgs = python3:
with python3; [
textual-dev
Expand All @@ -37,11 +41,13 @@
faker
];

# Native build inputs
nativeBuildInputs = pkgs:
with pkgs; [
poetry
];

# Define devShell for each system
devShellFor = system:
inputs.nixpkgs.lib.genAttrs ["default"] (
_:
Expand All @@ -59,6 +65,7 @@
}
);

# Define default package for each system
defaultPackageFor = system:
pkgsFor.${system}.python312Packages.buildPythonPackage {
pname = "dooit";
Expand All @@ -81,14 +88,17 @@
doCheck = false;
};
in {
# Define the devShells for each system
devShells = forEachSystem devShellFor;

# Define the default package for each system
packages = forEachSystem (
system: {
default = defaultPackageFor system;
}
);

defaultPackage = defaultPackageFor builtins.currentSystem;
# Expose a top-level `defaultPackage` that detects the current system
defaultPackage = defaultPackageFor inputs.nixpkgs.lib.systems.defaultSystem;
};
}

0 comments on commit 130280b

Please sign in to comment.