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 <cstddef>
#include <cstdlib> #include <cstdlib>
#include <nix/store-api.hh>
#include <nix/shared.hh> #include <nix/store/store-api.hh>
#include <nix/log-store.hh> #include <nix/store/log-store.hh>
#include <nix/main/shared.hh>
#include "nix.hh" #include "nix.hh"
using namespace nix; using namespace nix;

View File

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

8
flake.lock generated
View File

@ -18,16 +18,16 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1732238832, "lastModified": 1744174375,
"narHash": "sha256-sQxuJm8rHY20xq6Ah+GwIUkF95tWjGRd1X8xF+Pkk38=", "narHash": "sha256-oxI9TLgnQbQ/WL0tIwVSIooLbXq4PW1QUhf5aQmXFgk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "8edf06bea5bcbee082df1b7369ff973b91618b8d", "rev": "ef3a956f697525883b77192cbe208233ea0f8f79",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixpkgs-unstable", "ref": "master",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "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"; utils.url = "github:numtide/flake-utils";
@ -9,7 +11,8 @@
}; };
}; };
outputs = { nixpkgs, utils, ... }: outputs =
{ nixpkgs, utils, ... }:
let let
compiler = "ghc94"; compiler = "ghc94";
@ -21,25 +24,21 @@
haskell = prev.haskell // { haskell = prev.haskell // {
packages = prev.haskell.packages // { packages = prev.haskell.packages // {
"${compiler}" = prev.haskell.packages."${compiler}".override (old: { "${compiler}" = prev.haskell.packages."${compiler}".override (old: {
overrides = overrides = final.lib.fold final.lib.composeExtensions (old.overrides or (_: _: { })) [
final.lib.fold final.lib.composeExtensions (old.overrides or (_: _: { })) [ (final.haskell.lib.packageSourceOverrides {
(final.haskell.lib.packageSourceOverrides { nix-serve-ng = ./.;
nix-serve-ng = ./.;
base16 = "1.0"; base16 = "1.0";
}) })
(haskellPackagesNew: haskellPackagesOld: { (haskellPackagesNew: haskellPackagesOld: {
nix-serve-ng = nix-serve-ng = final.haskell.lib.overrideCabal haskellPackagesOld.nix-serve-ng (old: {
final.haskell.lib.overrideCabal executableSystemDepends = (old.executableSystemDepends or [ ]) ++ [
haskellPackagesOld.nix-serve-ng final.boost.dev
(old: { final.nixVersions.nix_2_28
executableSystemDepends = (old.executableSystemDepends or []) ++ [ ];
final.boost.dev });
final.nixVersions.nix_2_24 })
]; ];
});
})
];
}); });
}; };
}; };
@ -50,58 +49,62 @@
}; };
in in
utils.lib.eachDefaultSystem (system: utils.lib.eachDefaultSystem (
let system:
pkgs = import nixpkgs { let
config = { }; pkgs = import nixpkgs {
config = { };
overlays = [ overlay ]; overlays = [ overlay ];
inherit system; 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;
};
}; };
# The NixOS module is a thin wrapper around the overlay to replace inherit (pkgs) nix-serve-ng;
# `nix-serve` with `nix-serve-ng`
# in
# You can continue to use the old `services.nix-serve` NixOS options. rec {
nixosModules.default = { packages.default = nix-serve-ng;
nixpkgs.overlays = [ overlays.default overlays.override ];
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 ( (import
let (
lock = builtins.fromJSON (builtins.readFile ./flake.lock); let
in fetchTarball { lock = builtins.fromJSON (builtins.readFile ./flake.lock);
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; in
sha256 = lock.nodes.flake-compat.locked.narHash; } fetchTarball {
) { url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
src = ./.; sha256 = lock.nodes.flake-compat.locked.narHash;
}).shellNix }
)
{
src = ./.;
}
).shellNix