Update to Nix 2.28 (#41)

* Format all Nix files

* flake.lock: Update, temporary to Nixpkgs master

Needed for Nix 2.28 until Hydra advances.

Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/8edf06bea5bcbee082df1b7369ff973b91618b8d?narHash=sha256-sQxuJm8rHY20xq6Ah%2BGwIUkF95tWjGRd1X8xF%2BPkk38%3D' (2024-11-22)
  → 'github:NixOS/nixpkgs/ef3a956f697525883b77192cbe208233ea0f8f79?narHash=sha256-oxI9TLgnQbQ/WL0tIwVSIooLbXq4PW1QUhf5aQmXFgk%3D' (2025-04-09)

* Update to Nix 2.28
This commit is contained in:
John Ericson 2025-04-09 18:28:10 -04:00 committed by GitHub
parent 6e8d82a451
commit 101b4a552f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 109 additions and 94 deletions

View File

@ -1,8 +1,10 @@
#include <cstddef>
#include <cstdlib>
#include <nix/store-api.hh>
#include <nix/shared.hh>
#include <nix/log-store.hh>
#include <nix/store/store-api.hh>
#include <nix/store/log-store.hh>
#include <nix/main/shared.hh>
#include "nix.hh"
using namespace nix;

View File

@ -1,9 +1,14 @@
(import (
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash; }
) {
src = ./.;
}).defaultNix
(import
(
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{
src = ./.;
}
).defaultNix

8
flake.lock generated
View File

@ -18,16 +18,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1732238832,
"narHash": "sha256-sQxuJm8rHY20xq6Ah+GwIUkF95tWjGRd1X8xF+Pkk38=",
"lastModified": 1744174375,
"narHash": "sha256-oxI9TLgnQbQ/WL0tIwVSIooLbXq4PW1QUhf5aQmXFgk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8edf06bea5bcbee082df1b7369ff973b91618b8d",
"rev": "ef3a956f697525883b77192cbe208233ea0f8f79",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"ref": "master",
"repo": "nixpkgs",
"type": "github"
}

141
flake.nix
View File

@ -1,5 +1,7 @@
{ inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
{
inputs = {
# Temporary, until Nixpkgs master has Nix 2.28
nixpkgs.url = "github:NixOS/nixpkgs/master";
utils.url = "github:numtide/flake-utils";
@ -9,7 +11,8 @@
};
};
outputs = { nixpkgs, utils, ... }:
outputs =
{ nixpkgs, utils, ... }:
let
compiler = "ghc94";
@ -21,25 +24,21 @@
haskell = prev.haskell // {
packages = prev.haskell.packages // {
"${compiler}" = prev.haskell.packages."${compiler}".override (old: {
overrides =
final.lib.fold final.lib.composeExtensions (old.overrides or (_: _: { })) [
(final.haskell.lib.packageSourceOverrides {
nix-serve-ng = ./.;
overrides = final.lib.fold final.lib.composeExtensions (old.overrides or (_: _: { })) [
(final.haskell.lib.packageSourceOverrides {
nix-serve-ng = ./.;
base16 = "1.0";
})
(haskellPackagesNew: haskellPackagesOld: {
nix-serve-ng =
final.haskell.lib.overrideCabal
haskellPackagesOld.nix-serve-ng
(old: {
executableSystemDepends = (old.executableSystemDepends or []) ++ [
final.boost.dev
final.nixVersions.nix_2_24
];
});
})
];
base16 = "1.0";
})
(haskellPackagesNew: haskellPackagesOld: {
nix-serve-ng = final.haskell.lib.overrideCabal haskellPackagesOld.nix-serve-ng (old: {
executableSystemDepends = (old.executableSystemDepends or [ ]) ++ [
final.boost.dev
final.nixVersions.nix_2_28
];
});
})
];
});
};
};
@ -50,58 +49,62 @@
};
in
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
config = { };
utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
config = { };
overlays = [ overlay ];
overlays = [ overlay ];
inherit system;
};
inherit (pkgs) nix-serve-ng;
in
rec {
packages.default = nix-serve-ng;
defaultPackage = packages.default;
apps.default = {
type = "app";
program = "${nix-serve-ng}/bin/nix-serve";
};
defaultApp = apps.default;
devShells.default =
(pkgs.haskell.lib.doBenchmark
pkgs.haskell.packages."${compiler}".nix-serve-ng
).env;
devShell = devShells.default;
}) // rec {
overlays = {
# The default overlay only adds the exports for
# `pkgs.haskell.packages."${compiler}".nix-serve-ng` and
# `pkgs.nix-serve-ng`
default = overlay;
# This overlay additionally overrides `pkgs.nix-serve` to refer to
# `pkgs.nix-serve-ng`
override = final: prev: {
nix-serve = final.nix-serve-ng;
};
inherit system;
};
# The NixOS module is a thin wrapper around the overlay to replace
# `nix-serve` with `nix-serve-ng`
#
# You can continue to use the old `services.nix-serve` NixOS options.
nixosModules.default = {
nixpkgs.overlays = [ overlays.default overlays.override ];
inherit (pkgs) nix-serve-ng;
in
rec {
packages.default = nix-serve-ng;
defaultPackage = packages.default;
apps.default = {
type = "app";
program = "${nix-serve-ng}/bin/nix-serve";
};
defaultApp = apps.default;
devShells.default =
(pkgs.haskell.lib.doBenchmark pkgs.haskell.packages."${compiler}".nix-serve-ng).env;
devShell = devShells.default;
}
)
// rec {
overlays = {
# The default overlay only adds the exports for
# `pkgs.haskell.packages."${compiler}".nix-serve-ng` and
# `pkgs.nix-serve-ng`
default = overlay;
# This overlay additionally overrides `pkgs.nix-serve` to refer to
# `pkgs.nix-serve-ng`
override = final: prev: {
nix-serve = final.nix-serve-ng;
};
};
# The NixOS module is a thin wrapper around the overlay to replace
# `nix-serve` with `nix-serve-ng`
#
# You can continue to use the old `services.nix-serve` NixOS options.
nixosModules.default = {
nixpkgs.overlays = [
overlays.default
overlays.override
];
};
};
}

View File

@ -1,9 +1,14 @@
(import (
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash; }
) {
src = ./.;
}).shellNix
(import
(
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{
src = ./.;
}
).shellNix