Compare commits

...

85 commits
main ... main

Author SHA1 Message Date
eldritch horrors 5d9d94089f update nix-eval-jobs for 2.91-dev 2024-06-26 00:18:57 +02:00
eldritch horrors f6e6871f38 add pegtl to overlay for 2.91-dev 2024-06-25 22:00:47 +02:00
jade 909e593ae9 Return Lix module to main, with fixes from release-2.90 work 2024-06-18 23:32:31 -07:00
jade 376ecb8038 restore back to dev state 2024-06-18 23:31:00 -07:00
jade b64814c8c1 Make a working 2.90.0-rc1 overlay 2024-06-18 23:29:08 -07:00
jade 4e25f1ab68 Fix including the overlay twice exploding nixos-option by making it idempotent 2024-06-05 21:15:44 -07:00
jade b4b38e6b5f Update nix-eval-jobs for exploding the C++ API again
lix-project/nix-eval-jobs#7
https://gerrit.lix.systems/c/lix/+/1241/5
2024-05-29 19:39:36 -07:00
jade 38f31ee7c1 Update nix-eval-jobs for fix 2024-05-27 18:40:58 -06:00
jade 12b457c433 Show revision of n-e-j better 2024-05-27 13:03:12 -06:00
jade 18fa4a89e2 update lix and n-e-j in light of lix-project/nix-eval-jobs#5 2024-05-23 16:27:31 -07:00
jade 6cd2d62a21 add dirtyShortRev to make it work better 2024-05-23 16:25:45 -07:00
puck 53d713eb48 feat: add devenv to override list
Devenv overrides the Nix source with its own version of Nix 2.21, which
conflicts with the changes made to the package, especially the build
system.
2024-05-16 18:47:30 +00:00
puck 36dbb9dbfb Fix build-release-notes being required
This allows using versions of Lix earlier from before
8822fd7dd5254e781660704858f2eca386bdf5a2 again.
2024-05-16 12:43:22 +00:00
jade fbc1c1c4da Merge pull request 'Don't pass in 'false' as the value of build-release-notes (a drv)' (#28) from midnightveil/nixos-module:build-release-notes-is-a-drv into main
Reviewed-on: lix-project/nixos-module#28
2024-05-16 02:03:47 +00:00
julia 0c38126b49
Don't pass in 'false' as the value of build-release-notes (a drv)
7cfaf057e35b7bb329ffff344e30fdfc850566c3 in lix-project changed the
default there to always build the release notes anyway, so this
caused failures to build, as false is not a derivation.
2024-05-16 11:28:12 +10:00
puck 7e8a5498db Fix prefetch-npm-deps override when functionArgs is not supported 2024-05-15 19:35:30 +00:00
raito 87b7b7e4bd pins: update nix-eval-jobs
To obtain lix-project/nix-eval-jobs#3
fix.

Signed-off-by: Raito Bezarius <raito@lix.systems>
2024-05-11 17:52:03 +02:00
jade c8ab1e79ba Merge pull request 'cherrypick: "boehmgc: disable tests on aarch64-linux"' (#21) from ckiee/nixos-module:cherry-boehm-check into main
Reviewed-on: lix-project/nixos-module#21
2024-05-09 18:11:51 +00:00
jade d15ff50703 Merge pull request 'feat: Add overrides for incompatible packages' (#27) from arcuru/nixos-module:override into main
Reviewed-on: lix-project/nixos-module#27
2024-05-08 21:11:43 +00:00
Patrick Jackson 5ef5fe6a67 feat: add reported broken packages 2024-05-08 07:58:24 -07:00
Patrick Jackson e09758962c refactor: move simple overrides to a function 2024-05-08 07:50:20 -07:00
jade aaf759cd93 Switch to tarball fetching because it is cheaper 2024-05-06 16:43:03 -07:00
jade 72060dfb08 Merge pull request 'fix: allow fetching nix-eval-jobs anonymously' (#23) from nogit-urls into main
Reviewed-on: lix-project/nixos-module#23
2024-05-06 23:06:29 +00:00
Lunaphied 10e849bdce Merge pull request 'chore(inputs): use git+https://' (#26) from flake-input-with-git into main
Reviewed-on: lix-project/nixos-module#26
2024-05-06 21:49:58 +00:00
raito d4587ea6a6 chore(inputs): use git+https://
Seems better in the context.

Signed-off-by: Raito Bezarius <raito@lix.systems>
2024-05-06 23:47:38 +02:00
raito ef84a1e4b3 fix: allow fetching nix-eval-jobs anonymously
Use HTTPS URL. Fixes #22.

Signed-off-by: Raito Bezarius <raito@lix.systems>
2024-05-06 23:46:37 +02:00
raito 0bb33a2305 feat: make the script autonomous in its python dependencies
Let's use a nix-shell shebang!

Signed-off-by: Raito Bezarius <raito@lix.systems>
2024-05-06 23:46:37 +02:00
Qyriad 4cf3e403e4 Merge pull request 'fix(inputs): use https://' (#25) from flake-input-https into main
Reviewed-on: lix-project/nixos-module#25
Reviewed-by: Qyriad <qyriad+lix@fastmail.com>
2024-05-06 21:43:25 +00:00
raito 999cc24eca fix(inputs): use https://
Signed-off-by: Raito Bezarius <raito@lix.systems>
2024-05-06 23:41:53 +02:00
mei (ckie) 9837ede4bd
cherrypick: "boehmgc: disable tests on aarch64-linux"
Is a big rebuild for upstream but here it's okay.
2024-05-06 04:28:24 +03:00
jade e31baf5768 Name should be source in fetching inputs 2024-05-04 17:14:17 -07:00
jade 491e0f076f Delete npins
This fixes a bug where nixos-rebuild as root cannot build a nixos
configuration since it cannot fetch the sources of our fork of
nix-eval-jobs for lack of ssh key. It doesn't hit cache *in the store*
for lack of `narHash` being specified, which cannot be specified with
npins since npins doesn't output SRI hashes for git inputs.

Altogether a very silly situation. Clearly we just need another pinning
tool.
2024-05-04 17:03:57 -07:00
jade 71df0f4a4a update flake.lock 2024-05-04 16:21:24 -07:00
jade 792119f425 Merge pull request 'Drop boehm-gc patch, now included in nixpkgs' (#20) from k900/nixos-module:drop-patch into main
Reviewed-on: lix-project/nixos-module#20
2024-05-04 20:56:27 +00:00
Ilya K 2148106d19 Conditionally drop boehm-gc patch, now included in nixpkgs
Not actually included yet
2024-05-04 10:33:25 +03:00
jade cf119933da nix flake check should work on mac probably 2024-05-03 17:18:19 -07:00
jade 1d636fd90a Fix NixOS system building and add a flake check that it works
Problem caused by: https://gerrit.lix.systems/c/lix/+/993

But this is actually nixpkgs doing extremely silly feature detection of
Nix based on version which it should /absolutely not be doing/.
2024-05-03 17:13:57 -07:00
jade 7267c72d32 Remove flake-compat, add readme
flake-compat is a kind of unhelpful thing to add here since it makes it
impossible to update lix separately from its module when not using
flakes. We would like non-flakes users to not use the flake by using
module.nix directly.
2024-05-02 20:02:34 -07:00
jade 0428921238 update lix 2024-05-02 00:36:53 -07:00
jade ddefc70e3d update lix 2024-04-22 15:11:54 -07:00
jade 04186bcae3 Fix eval on nixos-unstable following prefetch-npm-deps dep fix
See: https://github.com/NixOS/nixpkgs/pull/304913

We want to support older nixpkgs too, so we feature detect if we need to
apply this change.

Closes: lix-project/nixos-module#18
2024-04-22 14:59:54 -07:00
Qyriad d47d5dca07 Merge pull request 'callPackage Lix instead of overriding Nixpkgs' Nix' (#17) from qyriad/nixos-module:call-package into main
Reviewed-on: lix-project/nixos-module#17
2024-04-22 03:57:44 +00:00
Qyriad 8c2d5ca8bc callPackage Lix instead of overriding Nixpkgs' Nix 2024-04-18 14:56:07 -06:00
eldritch horrors 532c44fa43 bump nix-eval-jobs to fix eval with broken attrs 2024-04-18 18:24:40 +02:00
eldritch horrors 23da6e1d0a fix nix-eval-jobs repo url
this moved? we might want ci perhaps.
2024-04-17 21:32:57 +02:00
Qyriad 262c2b479d Merge pull request 'nix-eval-jobs: use lix' (#15) from jade/nix-eval-jobs-lix into main
Reviewed-on: lix-project/nixos-module#15
2024-04-16 09:33:50 +00:00
jade d66013efdf nix-eval-jobs: use lix 2024-04-15 20:06:52 -07:00
jade 9f7a36f023 bump lix 2024-04-15 20:06:05 -07:00
Qyriad a681f1cd49 flake.lock: update lix 2024-04-10 12:59:27 -06:00
Qyriad 061640f9b2 Merge pull request 'Rename nix-doc to lix-doc here too' (#14) from k900/nixos-module:main into main
Reviewed-on: lix-project/nixos-module#14
2024-04-08 18:40:50 +00:00
Ilya K 3e61e2aa24 Rename nix-doc to lix-doc here too
Fixes build
2024-04-08 11:15:34 +03:00
jade 8890cba994 Merge pull request 'overlay: fix builds of Lix after c21d11ac0' (#12) from qyriad/nixos-module:fixes/python-dep into main
Reviewed-on: lix-project/nixos-module#12
2024-04-06 04:30:25 +00:00
Qyriad 9b208d0d27 overlay: fix builds of Lix after c21d11ac0
lix-project/lix/c21d11ac094d4f39215dba6763fcabc62341def4 added a direct
build dependency on Python.
2024-04-05 22:20:24 -06:00
jade 8937cebb4f Merge pull request 'overlay: support nix-doc integration into Lix' (#11) from feature/nix-doc into main
Reviewed-on: lix-project/nixos-module#11
2024-04-03 22:48:05 +00:00
Lunaphied d1d43e601c overlay: support nix-doc integration into Lix 2024-04-03 15:55:27 -06:00
jade 4c47db0949 Merge pull request 'Add LICENSE' (#10) from jade/license into main
Reviewed-on: lix-project/nixos-module#10
2024-04-03 20:08:18 +00:00
jade 49fcc127f8 Add LICENSE 2024-04-02 13:21:56 -07:00
jade cccea113fe probably fix cross compilation 2024-04-02 00:41:06 -07:00
jade 1fee9f0e1f Merge pull request 'fix: pin nurl to upstream nix' (#9) from mweinelt/nixos-module:nurl-pin into main
Reviewed-on: lix-project/nixos-module#9
2024-03-29 07:16:53 +00:00
hexa ddb978dcc9 fix: pin nurl to upstream nix
nix-init depends on nurl, so they need to use the same nix for nix-init
to not be rebuilt.
2024-03-29 02:27:19 +01:00
eldritch horrors 10fd7b4135 flake.lock: update 2024-03-28 18:32:40 +01:00
eldritch horrors 49144e91d1 fix: add cmake and toml11 to inputs
toml11 is needed anyway, cmake is only needed for meson. meson isn't
needed right now but let's not have this cause problems *again* soon
2024-03-28 18:32:00 +01:00
jade b6e09b8191 Merge pull request 'fix: pin nix-init to upstream nix' (#8) from mweinelt/nixos-module:nix-init-pin into main
Reviewed-on: lix-project/nixos-module#8
2024-03-27 08:07:07 +00:00
hexa 43eeb747b1 fix: pin nix-init to upstream nix 2024-03-27 05:54:26 +01:00
jade 007b27add8 flake.lock: Update
Flake lock file updates:

• Updated input 'lix':
    'git+ssh://git@git.lix.systems/lix-project/lix.git?ref=refs/heads/main&rev=66ccc93eeded1ab77281600bd41d6b0d8d8bf43a' (2024-03-25)
  → 'git+ssh://git@git.lix.systems/lix-project/lix.git?ref=refs/heads/main&rev=0be766c12de6badbbfa4fb9f76b6688b04d81059' (2024-03-25)
2024-03-25 13:45:09 -07:00
jade 4a532feadb Add version suffix in nixos module 2024-03-25 13:44:56 -07:00
jade f2d3bb0802 flake.lock: Update
Flake lock file updates:

• Updated input 'lix':
    'git+ssh://git@git.lix.systems/lix-project/lix.git?ref=refs/heads/main&rev=d26eccebfc1f0d3f5b77e781ffc6455f05f8f90c' (2024-03-24)
  → 'git+ssh://git@git.lix.systems/lix-project/lix.git?ref=refs/heads/main&rev=66ccc93eeded1ab77281600bd41d6b0d8d8bf43a' (2024-03-25)
2024-03-24 21:32:14 -07:00
Qyriad ceec87bc48 Merge pull request 'Add gitignore' (#6) from emilytrau/nixos-module:emilytrau/gitignore into main
Reviewed-on: lix-project/nixos-module#6
2024-03-25 03:03:56 +00:00
Emily Trau e47e4c60f5 Add gitignore 2024-03-25 13:57:03 +11:00
jade 214f6ea5fc Update lix and add system profile 2024-03-24 17:17:53 -07:00
jade d28160f571 Add system profile 2024-03-24 17:14:18 -07:00
jade 9b5adef52d put prerelease info in the version 2024-03-18 14:26:45 -07:00
jade 057c652b5d bump lix to a non bork version 2024-03-18 13:18:23 -07:00
jade cf5507a03d fix: make the boehm patch content addressed to avoid rebuilds 2024-03-18 13:16:48 -07:00
jade 91055a3a46 nix-doc: disable plugin since it is broken by Lix API changes
We don't intend to fix the API changes in nix-doc, because we should be
able to kill nix-doc in like a week?
2024-03-16 16:30:31 -07:00
jade b2b26d073e Merge pull request 'Switch to the replicated forgejo, and bump lix to head' (#2) from ktemkin/nixos-module:change_url into main
Reviewed-on: lix-project/nixos-module#2
2024-03-09 00:30:16 -07:00
Kate Temkin 31b491ddef flake.lock: Update
Flake lock file updates:

• Updated input 'lix':
    'git+ssh://gerrit.lix.systems:2022/lix?ref=refs/heads/main&rev=eac76dbe90ad1ceade863744739246e9b6abaa90' (2024-03-08)
  → 'git+ssh://git@git.lix.systems/lix-project/lix.git?ref=refs/heads/main&rev=896e525681bbf696c330af4e51c5e161d3818350' (2024-03-09)
2024-03-09 00:24:17 -07:00
Kate Temkin baafefa6e4 lix: switch to forgejo (replicated) clone addr 2024-03-09 00:23:44 -07:00
raito a50986cfc7 fix: pin nixos-option to upstream
Signed-off-by: Raito Bezarius <raito@lix.systems>
2024-03-09 02:27:21 +01:00
jade 0ccb82f2b0 Merge pull request 'feat: introduce our own flake-compat' (#1) from flake-compat into main
Reviewed-on: lix-project/nixos-module#1
2024-03-08 18:11:31 -07:00
raito 3ddd6e5e79 feat: introduce our own flake-compat
Signed-off-by: Raito Bezarius <raito@lix.systems>
2024-03-09 01:48:11 +01:00
jade 3fe47ad3f3 fake version 2024-03-08 00:10:56 -08:00
jade bfceafae96 fix git-requiring tests 2024-03-08 00:05:25 -08:00
jade 9db8932797 fix version 2024-03-07 23:49:29 -08:00
jade 192dde3f06 update lix 2024-03-07 23:43:21 -08:00
14 changed files with 500 additions and 78 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
result
result-*

19
LICENSE Normal file
View file

@ -0,0 +1,19 @@
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

5
README.md Normal file
View file

@ -0,0 +1,5 @@
# Lix NixOS module
See the [beta guide][beta-guide] for details on how to use this:
[beta-guide]: https://wiki.lix.systems/link/1

View file

@ -5,11 +5,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1709126324,
"narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=",
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "d465f4819400de7c8d874d50b982301f28a84605",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
@ -18,28 +18,42 @@
"type": "github"
}
},
"flakey-profile": {
"locked": {
"lastModified": 1712898590,
"narHash": "sha256-FhGIEU93VHAChKEXx905TSiPZKga69bWl1VB37FK//I=",
"owner": "lf-",
"repo": "flakey-profile",
"rev": "243c903fd8eadc0f63d205665a92d4df91d42d9d",
"type": "github"
},
"original": {
"owner": "lf-",
"repo": "flakey-profile",
"type": "github"
}
},
"lix": {
"flake": false,
"locked": {
"lastModified": 1709811453,
"narHash": "sha256-UOyTAdUAJv80w3s6rrgYB5tQjp43u5Zp2dlM94uud04=",
"ref": "refs/heads/main",
"rev": "8a268359b06471b463a8f3fc46c83a1fced8ab75",
"revCount": 15077,
"type": "git",
"url": "ssh://gerrit.lix.systems:2022/lix"
"lastModified": 1718767907,
"narHash": "sha256-gpd+mGQxqVHw2kO6rSPQel8TkChHh9UpqxjsmQi0QJM=",
"rev": "85f282ef572577899b3d80ba8def1b920a386218",
"type": "tarball",
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/85f282ef572577899b3d80ba8def1b920a386218.tar.gz"
},
"original": {
"type": "git",
"url": "ssh://gerrit.lix.systems:2022/lix"
"type": "tarball",
"url": "https://git.lix.systems/lix-project/lix/archive/main.tar.gz"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1709703039,
"narHash": "sha256-6hqgQ8OK6gsMu1VtcGKBxKQInRLHtzulDo9Z5jxHEFY=",
"lastModified": 1718530797,
"narHash": "sha256-pup6cYwtgvzDpvpSCFh1TEUjw2zkNpk8iolbKnyFmmU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "9df3e30ce24fd28c7b3e2de0d986769db5d6225d",
"rev": "b60ebf54c15553b393d144357375ea956f89e9a9",
"type": "github"
},
"original": {
@ -52,6 +66,7 @@
"root": {
"inputs": {
"flake-utils": "flake-utils",
"flakey-profile": "flakey-profile",
"lix": "lix",
"nixpkgs": "nixpkgs"
}

View file

@ -1,25 +1,47 @@
{
# fixme: use the forgejo address
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.lix = {
url = "git+ssh://gerrit.lix.systems:2022/lix";
url = "https://git.lix.systems/lix-project/lix/archive/main.tar.gz";
flake = false;
};
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.flakey-profile.url = "github:lf-/flakey-profile";
outputs = { self, nixpkgs, lix, flake-utils }: {
nixosModules.default = import ./module.nix { inherit lix; };
overlays.default = import ./overlay.nix { inherit lix; };
} // flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
in
{
inherit pkgs;
packages.default = pkgs.nixVersions.nix_2_18;
packages.nix-doc = pkgs.nix-doc;
});
outputs = inputs@{ self, nixpkgs, lix, flake-utils, flakey-profile, ... }:
let versionSuffix = "pre${builtins.substring 0 8 lix.lastModifiedDate}-${lix.shortRev or lix.dirtyShortRev}";
in {
inherit inputs;
nixosModules.default = import ./module.nix { inherit lix versionSuffix; };
overlays.default = import ./overlay.nix { inherit lix versionSuffix; };
} // flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
linux64BitSystems = [
"x86_64-linux"
"aarch64-linux"
];
inherit (pkgs) lib;
in
{
inherit pkgs;
packages = {
default = pkgs.nixVersions.nix_2_18;
inherit (pkgs) nix-doc nix-eval-jobs;
};
packages.system-profile = import ./system-profile.nix { inherit pkgs flakey-profile; };
nixosTests = pkgs.recurseIntoAttrs (pkgs.callPackage ./test-nixos.nix { lix-module = self.nixosModules.default; });
checks = {
inherit (self.packages.${system}) default nix-eval-jobs;
} // lib.optionalAttrs (lib.elem system linux64BitSystems) {
inherit (self.nixosTests.${system}) it-builds;
};
});
}

View file

@ -1,5 +1,5 @@
{ lix }:
{ lix, versionSuffix ? "" }:
{ pkgs, config, ... }:
{
nixpkgs.overlays = [ (import ./overlay.nix { inherit lix; }) ];
nixpkgs.overlays = [ (import ./overlay.nix { inherit lix versionSuffix; }) ];
}

64
nix-doc/package.nix Normal file
View file

@ -0,0 +1,64 @@
# Temporary replacement of the nix-doc package with
# https://github.com/NixOS/nixpkgs/pull/296523 so that we can have working Lix
# with nix-doc on 23.11 and 24.05-pre
#
# Can be removed when that commit is in 23.11 and 24.05-pre, or 24.05 is
# released with the commit.
{ lib
, stdenv
, rustPlatform
, fetchFromGitHub
, boost
, nix
, pkg-config
# Whether to build the nix-doc plugin for Nix
, withPlugin ? true
}:
let
packageFlags = [ "-p" "nix-doc" ] ++ lib.optionals withPlugin [ "-p" "nix-doc-plugin" ];
in
rustPlatform.buildRustPackage rec {
pname = "nix-doc";
version = "0.6.5";
src = fetchFromGitHub {
rev = "v${version}";
owner = "lf-";
repo = "nix-doc";
sha256 = "sha256-9cuNzq+CBA2jz0LkZb7lh/WISIlKklfovGBAbSo1Mgk=";
};
doCheck = true;
buildInputs = lib.optionals withPlugin [ boost nix ];
nativeBuildInputs = lib.optionals withPlugin [ pkg-config nix ];
cargoBuildFlags = packageFlags;
cargoTestFlags = packageFlags;
# Packaging support for making the nix-doc plugin load cleanly as a no-op on
# the wrong Nix version (disabling bindnow permits loading libraries
# requiring unavailable symbols if they are unreached)
hardeningDisable = lib.optionals withPlugin [ "bindnow" ];
# Due to a Rust bug, setting -Z relro-level to anything including "off" on
# macOS will cause link errors
env = lib.optionalAttrs (withPlugin && stdenv.isLinux) {
# nix-doc does not use nightly features, however, there is no other way to
# set relro-level
RUSTC_BOOTSTRAP = 1;
RUSTFLAGS = "-Z relro-level=partial";
};
cargoSha256 = "sha256-CHagzXTG9AfrFd3WmHanQ+YddMgmVxSuB8vK98A1Mlw=";
meta = with lib; {
description = "An interactive Nix documentation tool";
longDescription = "An interactive Nix documentation tool providing a CLI for function search, a Nix plugin for docs in the REPL, and a ctags implementation for Nix script";
homepage = "https://github.com/lf-/nix-doc";
license = licenses.lgpl3Plus;
maintainers = [ maintainers.lf- ];
platforms = platforms.unix;
mainProgram = "nix-doc";
};
}

View file

@ -1,47 +1,99 @@
{ lix }:
{ lix, versionSuffix ? "" }:
final: prev:
let
boehmgc-patched = ((final.boehmgc.override {
enableLargeConfig = true;
}).overrideAttrs (o: {
patches = (o.patches or [ ]) ++ [
# for clown reasons this version is newer than the one in lix, we should
# fix this and update our nixpkgs pin
(prev.path + "/pkgs/tools/package-management/nix/patches/boehmgc-coroutine-sp-fallback.patch")
# https://github.com/ivmai/bdwgc/pull/586
(lix + "/boehmgc-traceable_allocator-public.diff")
];
})
);
in
{
nixVersions = prev.nixVersions // rec {
# FIXME: do something less scuffed
nix_2_18 = (prev.nixVersions.nix_2_18.override { boehmgc = boehmgc-patched; }).overrideAttrs (old: {
src = lix;
version = "2.18.3-lix";
VERSION_SUFFIX = "-lix";
patches = [ ];
});
stable = nix_2_18;
nix_2_18_upstream = prev.nixVersions.nix_2_18;
};
# force these onto upstream so we are not regularly rebuilding electron
prefetch-yarn-deps = prev.prefetch-yarn-deps.override {
nix = final.nixVersions.nix_2_18_upstream;
};
prefetch-npm-deps = prev.prefetch-npm-deps.override {
nix = final.nixVersions.nix_2_18_upstream;
};
nix-prefetch-git = prev.nix-prefetch-git.override {
nix = final.nixVersions.nix_2_18_upstream;
};
nix-doc = prev.nix-doc.overrideAttrs (old: {
# for the purposes of nix C++ API for nix-doc, lix is Nix 2.20
NIX_CFLAGS_COMPILE = [ "-DNIX_2_20_0" ];
# This is kind of scary to not override the nix version to pretend to be
# 2.18 since nixpkgs can introduce new breakage in its Nix unstable CLI
# usage.
# https://github.com/nixos/nixpkgs/blob/6afb255d976f85f3359e4929abd6f5149c323a02/nixos/modules/config/nix.nix#L121
lixPkg = final.callPackage (lix + "/package.nix") ({
versionSuffix = "-${versionSuffix}";
# FIXME: do this more sensibly for future releases
# https://git.lix.systems/lix-project/lix/issues/406
officialRelease = false;
});
}
# These packages depend on Nix features that Lix does not support
overridelist_2_18 = [
"attic-client"
"devenv"
"nix-du"
"nix-init"
"nix-prefetch-git"
"nixos-option"
"nurl"
"prefetch-yarn-deps" # force these onto upstream so we are not regularly rebuilding electron
];
override_2_18 = prev.lib.genAttrs overridelist_2_18 (
name: prev.${name}.override {
nix = final.nixVersions.nix_2_18_upstream;
});
inherit (prev) lib;
prefetch-npm-deps-args = lib.functionArgs prev.prefetch-npm-deps.override;
warning = ''
warning: You have the lix overlay included into a nixpkgs import twice,
perhaps due to the NixOS module being included twice, or because of using
pkgs.nixos and also including it in imports, or perhaps some unknown
machinations of a complicated flake library.
This is completely harmless since we have no-op'd the second one if you are
seeing this message, but it would be a small style improvement to fix
it :)
P.S. If you had some hack to fix nixos-option build failures in your
configuration, that was caused by including an older version of the lix
overlay twice, which is now mitigated if you see this message, so you can
delete that.
P.P.S. This Lix has super catgirl powers.
'';
maybeWarnDuplicate = x: if final.lix-overlay-present > 1 then builtins.trace warning x else x;
overlay = override_2_18 // {
lix-overlay-present = 1;
# used for things that one wouldn't necessarily want to update, but we
# nevertheless shove it in the overlay and fixed-point it in case one *does*
# want to do that.
lix-sources = import ./pins.nix;
nixVersions = prev.nixVersions // rec {
# FIXME: do something less scuffed
nix_2_18 = maybeWarnDuplicate lixPkg;
stable = nix_2_18;
nix_2_18_upstream = prev.nixVersions.nix_2_18;
};
nix-eval-jobs = (prev.nix-eval-jobs.override {
# lix
nix = final.nixVersions.nix_2_18;
}).overrideAttrs (old:
let src = final.lix-sources.nix-eval-jobs;
in {
version = "2.90.0-lix-${builtins.substring 0 7 src.rev}";
# FIXME: should this be patches instead?
inherit src;
mesonBuildType = "debugoptimized";
ninjaFlags = old.ninjaFlags or [ ] ++ [ "-v" ];
}
);
# support both having and missing https://github.com/NixOS/nixpkgs/pull/304913
prefetch-npm-deps =
if (prefetch-npm-deps-args ? nix) || (prefetch-npm-deps-args == {})
then prev.prefetch-npm-deps.override {
nix = final.nixVersions.nix_2_18_upstream;
}
else prev.prefetch-npm-deps;
nix-doc = prev.callPackage ./nix-doc/package.nix { withPlugin = false; };
pegtl = prev.callPackage ./pegtl.nix { };
};
in
# Make the overlay idempotent, since flakes passing nixos modules around by
# value and many other things make it way too easy to include the overlay
# twice
if (prev ? lix-overlay-present) then { lix-overlay-present = 2; } else overlay

23
pegtl.nix Normal file
View file

@ -0,0 +1,23 @@
{
stdenv,
cmake,
ninja,
fetchFromGitHub,
}:
stdenv.mkDerivation {
pname = "pegtl";
version = "3.2.7";
src = fetchFromGitHub {
repo = "PEGTL";
owner = "taocpp";
rev = "refs/tags/3.2.7";
hash = "sha256-IV5YNGE4EWVrmg2Sia/rcU8jCuiBynQGJM6n3DCWTQU=";
};
nativeBuildInputs = [
cmake
ninja
];
}

1
pins.json Normal file
View file

@ -0,0 +1 @@
{"nix-eval-jobs": {"kind": "tarball", "rev": "f8869bdcca7c1d5aaf37de3da3a4176811279a57", "nar_hash": "sha256-F/RvI9chHywnckEqHO1ggjzCayknhDnnl2kNnnVXpWg=", "locked_url": "https://git.lix.systems/api/v1/repos/lix-project/nix-eval-jobs/archive/f8869bdcca7c1d5aaf37de3da3a4176811279a57.tar.gz?rev=f8869bdcca7c1d5aaf37de3da3a4176811279a57", "url": "https://git.lix.systems/lix-project/nix-eval-jobs/archive/main.tar.gz"}}

26
pins.nix Normal file
View file

@ -0,0 +1,26 @@
# this is a custom pinning tool, written because npins doesn't have narHash
# compatible output for git inputs, and also doesn't support the Nix immutable
# tarball protocol
let
pins = builtins.fromJSON (builtins.readFile ./pins.json);
fetchPin = args@{ kind, ... }:
if kind == "git" then
builtins.fetchGit
{
name = "source";
url = args.url;
ref = args.ref;
rev = args.rev;
narHash = args.nar_hash;
}
else if kind == "tarball" then
args // {
outPath = builtins.fetchTarball {
name = "source";
url = args.locked_url;
sha256 = args.nar_hash;
};
}
else builtins.throw "unsupported input type ${kind}";
in
builtins.mapAttrs (_: fetchPin) pins

10
system-profile.nix Normal file
View file

@ -0,0 +1,10 @@
{ pkgs, flakey-profile }:
flakey-profile.lib.mkProfile {
inherit pkgs;
paths = with pkgs; [
cacert
nix
];
name = "system-profile";
extraSwitchArgs = [ "--profile" "/nix/var/nix/profiles/default" ];
}

18
test-nixos.nix Normal file
View file

@ -0,0 +1,18 @@
{ nixos, lix-module }:
let
configs = {
it-builds = nixos ({ ... }: {
imports = [ lix-module ];
documentation.enable = false;
fileSystems."/".device = "ignore-root-device";
boot.loader.grub.enable = false;
system.stateVersion = "24.05";
});
};
in
{
inherit configs;
it-builds = configs.it-builds.config.system.build.toplevel;
}

165
update_pins.py Executable file
View file

@ -0,0 +1,165 @@
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p 'python3.withPackages (ps: [ ps.requests ])'
"""
Updates pins in this repo to their latest version.
This is a custom pinning tool, written because npins doesn't have narHash
compatible output for git inputs (it is not SRI), and also doesn't support the
Nix immutable tarball protocol which we would like to use when we become public.
"""
import subprocess
import tempfile
from pathlib import Path
import re
import dataclasses
from typing import Literal
import urllib.parse
import json
# https://stackoverflow.com/a/51286749
class DataclassJSONEncoder(json.JSONEncoder):
def default(self, o):
if dataclasses.is_dataclass(o):
return dataclasses.asdict(o)
return super().default(o)
@dataclasses.dataclass
class PinSerialized:
kind: str
rev: str | None
nar_hash: str
@dataclasses.dataclass
class GitPinSerialized(PinSerialized):
kind: Literal['git']
url: str
rev: str
ref: str
@dataclasses.dataclass
class TarballPinSerialized(PinSerialized):
kind: Literal['tarball']
locked_url: str
url: str
class PinSpec:
def do_pin(self) -> dict[str, str]:
raise ValueError('unimplemented')
@dataclasses.dataclass
class GitPinSpec(PinSpec):
url: str
branch: str
def do_pin(self) -> GitPinSerialized:
return lock_git(self.url, self.branch)
@dataclasses.dataclass
class TarballPinSpec(PinSpec):
url: str
def do_pin(self) -> TarballPinSerialized:
return lock_tarball(self.url)
@dataclasses.dataclass
class LinkHeader:
url: str
rev: str | None
LINK_HEADER_RE = re.compile(r'<(?P<url>.*)>; rel="immutable"')
def parse_link_header(header) -> LinkHeader | None:
matched = LINK_HEADER_RE.match(header)
if not matched:
return None
url = matched.group('url')
parsed_url = urllib.parse.urlparse(url)
parsed_qs = urllib.parse.parse_qs(parsed_url.query)
return LinkHeader(url=url, rev=next(iter(parsed_qs.get('rev', [])), None))
def lock_tarball(url) -> TarballPinSerialized:
"""
Prefetches a tarball using the Nix immutable tarball protocol
"""
import requests
resp = requests.get(url)
with tempfile.TemporaryDirectory() as td:
td = Path(td)
proc = subprocess.Popen(["tar", "-C", td, "-xvzf", "-"],
stdin=subprocess.PIPE)
assert proc.stdin
for chunk in resp.iter_content(64 * 1024):
proc.stdin.write(chunk)
proc.stdin.close()
if proc.wait() != 0:
raise RuntimeError("untarring failed")
children = list(td.iterdir())
# FIXME: allow different tarball structures
assert len(children) == 1
child = children[0].rename(children[0].parent.joinpath('source'))
sri_hash = subprocess.check_output(
["nix-hash", "--type", "sha256", "--sri", child]).decode().strip()
path = subprocess.check_output(
["nix-store", "--add-fixed", "--recursive", "sha256",
child]).decode().strip()
link_info = parse_link_header(resp.headers['Link'])
print(sri_hash, path)
return TarballPinSerialized(kind='tarball',
nar_hash=sri_hash,
locked_url=link_info.url if link_info else url,
rev=link_info.rev if link_info else None,
url=url)
def lock_git(url, branch) -> GitPinSerialized:
url_escaped = json.dumps(url)
ref_escaped = json.dumps(branch)
data = json.loads(
subprocess.check_output([
"nix", "eval", "--impure", "--json", "--expr",
f"builtins.removeAttrs (builtins.fetchGit {{ url = {url_escaped}; ref = {ref_escaped}; }}) [ \"outPath\" ]"
]).strip())
return GitPinSerialized(kind='git',
url=url,
rev=data['rev'],
ref=branch,
nar_hash=data['narHash'])
PINS = {
'nix-eval-jobs':
TarballPinSpec('https://git.lix.systems/lix-project/nix-eval-jobs/archive/main.tar.gz')
}
def main():
output = {}
for (name, pin) in PINS.items():
output[name] = pin.do_pin()
print(output)
with open('pins.json', 'w') as fh:
json.dump(output, fh, cls=DataclassJSONEncoder)
if __name__ == '__main__':
main()