Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin nixpkgs to working commit #1893

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 61 additions & 56 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
# Last working commit from nixos-small-unstable
nixpkgs.url = "github:NixOS/nixpkgs?rev=75e28c029ef2605f9841e0baa335d70065fe7ae2";

treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
Expand All @@ -17,13 +18,13 @@
};

outputs =
{ self
, nixpkgs
, flake-utils
, nix-github-actions
, treefmt-nix
, systems
,
{
self,
nixpkgs,
flake-utils,
nix-github-actions,
treefmt-nix,
systems,
}:
let
eachSystem = f: nixpkgs.lib.genAttrs (import systems) (system: f nixpkgs.legacyPackages.${system});
Expand All @@ -35,7 +36,8 @@

githubActions =
let
mkPkgs = system:
mkPkgs =
system:
import nixpkgs {
config = {
allowAliases = false;
Expand Down Expand Up @@ -69,10 +71,11 @@
in
{
# Aggregate all tests into one derivation so that only one GHA runner is scheduled for all darwin jobs
aggregate = pkgs.runCommand "darwin-aggregate"
{
env.TEST_INPUTS = lib.concatStringsSep " " (lib.attrValues (lib.filterAttrs (_: v: lib.isDerivation v) tests));
} "touch $out";
aggregate = pkgs.runCommand "darwin-aggregate" {
env.TEST_INPUTS = lib.concatStringsSep " " (
lib.attrValues (lib.filterAttrs (_: v: lib.isDerivation v) tests)
);
} "touch $out";
};
aarch64-darwin =
let
Expand All @@ -82,11 +85,11 @@
in
{
# Aggregate all tests into one derivation so that only one GHA runner is scheduled for all darwin jobs
aggregate =
pkgs.runCommand "darwin-aggregate"
{
env.TEST_INPUTS = lib.concatStringsSep " " (lib.attrValues (lib.filterAttrs (_: v: lib.isDerivation v) tests));
} "touch $out";
aggregate = pkgs.runCommand "darwin-aggregate" {
env.TEST_INPUTS = lib.concatStringsSep " " (
lib.attrValues (lib.filterAttrs (_: v: lib.isDerivation v) tests)
);
} "touch $out";
};
};
};
Expand All @@ -99,48 +102,50 @@
default = self.templates.app;
};
}
// (flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowAliases = false;
};
// (flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
config.allowAliases = false;
};

poetry2nix = import ./default.nix { inherit pkgs; };
p2nix-tools = pkgs.callPackage ./tools { inherit poetry2nix; };
in
rec {
formatter = treefmtEval.${system}.config.build.wrapper;
poetry2nix = import ./default.nix { inherit pkgs; };
p2nix-tools = pkgs.callPackage ./tools { inherit poetry2nix; };
in
rec {
formatter = treefmtEval.${system}.config.build.wrapper;

packages = {
poetry2nix = poetry2nix.cli;
default = poetry2nix.cli;
};
packages = {
poetry2nix = poetry2nix.cli;
default = poetry2nix.cli;
};

devShells = {
default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
p2nix-tools.env
p2nix-tools.flamegraph
nixpkgs-fmt
poetry
niv
jq
nix-prefetch-git
nix-eval-jobs
nix-build-uncached
];
devShells = {
default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
p2nix-tools.env
p2nix-tools.flamegraph
nixpkgs-fmt
poetry
niv
jq
nix-prefetch-git
nix-eval-jobs
nix-build-uncached
];
};
};
};

apps = {
poetry = {
# https://wiki.nixos.org/wiki/Flakes
type = "app";
program = "${pkgs.poetry}/bin/poetry";
apps = {
poetry = {
# https://wiki.nixos.org/wiki/Flakes
type = "app";
program = "${pkgs.poetry}/bin/poetry";
};
poetry2nix = flake-utils.lib.mkApp { drv = packages.poetry2nix; };
default = apps.poetry2nix;
};
poetry2nix = flake-utils.lib.mkApp { drv = packages.poetry2nix; };
default = apps.poetry2nix;
};
}));
}
));
}
3 changes: 2 additions & 1 deletion templates/app/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
# Last working commit from nixos-small-unstable
nixpkgs.url = "github:NixOS/nixpkgs?rev=75e28c029ef2605f9841e0baa335d70065fe7ae2";
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
Expand Down
Loading