Compare commits

...

15 Commits

Author SHA1 Message Date
Gytis Ivaskevicius
bfc53579db
Merge pull request #140 from gytis-ivaskevicius/dependabot/github_actions/actions/checkout-4
Bump actions/checkout from 3 to 4
2023-10-03 14:11:17 +03:00
dependabot[bot]
5e1d2f3472
Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-02 21:34:09 +00:00
Gytis Ivaskevicius
f726afcdf0
Merge pull request #139 from gytis-ivaskevicius/implement-fup-repl-blueprint
feat: implement fup-repl blueprint #127
2023-10-02 23:57:00 +03:00
Gytis Ivaskevicius
24b3a16053
feat: implement fup-repl blueprint #127 2023-10-02 23:53:33 +03:00
Gytis Ivaskevicius
f9d088fb6a
Merge pull request #138 from gytis-ivaskevicius/update-ci
ci: update and speed up CI
2023-10-02 23:36:09 +03:00
Gytis Ivaskevicius
339d9131ce
chore: update examples nixpkgs versions 2023-10-02 23:32:26 +03:00
Gytis Ivaskevicius
724fbc3c84
ci: update and speed up CI 2023-10-02 23:26:27 +03:00
Gytis Ivaskevicius
1577ffa311
fix: failing overlays-flow tests 2023-10-02 23:14:47 +03:00
Gytis Ivaskevicius
2db363d432
chore: update dependencies 2023-10-02 23:06:48 +03:00
Gytis Ivaskevicius
9d10d7ea17
fix: failing channel-patching tests 2023-10-02 23:03:07 +03:00
Gytis Ivaskevicius
170d7a3c78
Merge pull request #137 from andrevmatos/fix_nixpkgs_config
fix passing nixpkgs.config if nixpkgs.pkgs.config is present
2023-10-02 23:00:55 +03:00
Gytis Ivaskevicius
2893fcad90
Merge pull request #134 from ravensiris/ravensiris/fix-devshell-legacy-packages
🐛 Check all attributes for devshell legacyPackages
2023-10-02 21:50:29 +03:00
Gytis Ivaskevicius
d01cae97e1
fix: failing channel-patching test 2023-10-02 21:46:11 +03:00
André Vitor de Lima Matos
671cad9ada
fix passing nixpkgs.config if nixpkgs.pkgs.config is present
Fix gytis-ivaskevicius/flake-utils-plus#136, caused by NixOS/nixpkgs#257458
2023-10-02 13:54:47 -03:00
Maksymilian Jodłowski
7a8d789d4d 🐛 Check all attributes for devshell legacyPackages 2023-05-13 19:45:06 +02:00
14 changed files with 102 additions and 95 deletions

View File

@ -1,4 +1,5 @@
name: CI
on:
push:
workflow_dispatch:
@ -6,16 +7,24 @@ on:
types: [opened]
jobs:
tests:
eval:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v17
with:
install_url: https://github.com/numtide/nix-unstable-installer/releases/download/nix-2.8.0pre20220311_d532269/install
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v25
- uses: DeterminateSystems/magic-nix-cache-action@main
# Quick eval
- run: nix develop --command evalnix
# Check formatting
- run: nix develop --command fmt --check
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v25
- uses: DeterminateSystems/magic-nix-cache-action@main
# Execute /tests/*
- run: nix develop --command check-derivation-outputs
@ -23,6 +32,13 @@ jobs:
- run: nix develop --command check-overlays-flow
- run: nix develop --command check-hosts-config
build-examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v25
- uses: DeterminateSystems/magic-nix-cache-action@main
# Build /examples/*
- run: nix develop --command build-home-manager+nur+neovim-Rick
- run: nix develop --command build-minimal-multichannel-Hostname1
@ -30,5 +46,3 @@ jobs:
- run: nix develop --command build-exporters-Morty
- run: nix develop --command build-darwin
# Check formatting
- run: nix develop --command fmt --check

View File

@ -1,17 +1,17 @@
{ system ? builtins.currentSystem }:
let
# nixpkgs / devshell is only used for development. Don't add it to the flake.lock.
nixpkgsGitRev = "1a268c42c8b0550f70da78c136171799481b0d97";
devshellGitRev = "59fbe1dfc0de8c3332957c16998a7d16dff365d8";
nixpkgsGitRev = "15de3b878a1fab784ddeae4c33cbc56381748505";
devshellGitRev = "cd4e2fda3150dd2f689caeac07b7f47df5197c31";
nixpkgsSrc = fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/${nixpkgsGitRev}.tar.gz";
sha256 = "010d6glxdam0j7kah7h2z79fnqvgs703v6ac53v4hfv1iz7lvzv9";
sha256 = "1nb53mycxj3hqcxg1vwbz76rkbmzkp84jgljqv6q2rby5v9k8cwc";
};
devshellSrc = fetchTarball {
url = "https://github.com/numtide/devshell/archive/${devshellGitRev}.tar.gz";
sha256 = "0zsbgpssr704m8hbdmp5qnr86jv6s5h8jy8f35rlbpc2y0g5ka1d";
sha256 = "02h3j2wqxsgf8sfl476q070ss86palxba48i497kh69nrvhqgz84";
};
pkgs = import nixpkgsSrc { inherit system; };

View File

@ -2,7 +2,7 @@
description = "A highly awesome system configuration.";
inputs = {
nixpkgs.url = github:nixos/nixpkgs/release-21.05;
nixpkgs.url = github:nixos/nixpkgs/nixos-unstable-small;
utils.url = path:../../;
darwin.url = "github:lnl7/nix-darwin/master";
darwin.inputs.nixpkgs.follows = "nixpkgs";

View File

@ -2,7 +2,7 @@
description = "FUP exporters demo";
inputs = {
nixpkgs.url = github:nixos/nixpkgs/release-21.05;
nixpkgs.url = github:nixos/nixpkgs/nixos-unstable-small; # Lets pretend that this is a stable channel
unstable.url = github:nixos/nixpkgs/nixos-unstable-small;
utils.url = path:../../;
};

View File

@ -13,7 +13,7 @@
};
home-manager = {
url = github:nix-community/home-manager/release-21.05;
url = github:nix-community/home-manager;
inputs.nixpkgs.follows = "nixpkgs";
};
};

View File

@ -2,8 +2,8 @@
description = "A highly awesome system configuration.";
inputs = {
nixpkgs.url = github:nixos/nixpkgs/release-21.05;
unstable.url = github:nixos/nixpkgs/nixos-unstable;
nixpkgs.url = github:nixos/nixpkgs/nixos-unstable-small; # Lets pretend that this is a stable channel
unstable.url = github:nixos/nixpkgs/nixos-unstable-small;
utils.url = path:../../;
};

View File

@ -1,12 +1,15 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1644229661,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
@ -19,6 +22,21 @@
"inputs": {
"flake-utils": "flake-utils"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View File

@ -15,11 +15,16 @@
exportPackages = import ./lib/exportPackages.nix fupArgs;
genPkgOverlay = import ./lib/genPkgOverlay.nix;
internal-functions = import ./lib/internal-functions.nix;
overlay = import ./lib/overlay.nix;
overlay = final: prev: {
__dontExport = true;
fup-repl = final.callPackage ./lib/fup-repl.nix { };
};
in
rec {
inherit overlay;
blueprints.fup-repl = ./lib/fup-repl.nix;
nixosModules.autoGenFromInputs = import ./lib/options.nix;
darwinModules.autoGenFromInputs = import ./lib/options.nix;

20
lib/fup-repl.nix Normal file
View File

@ -0,0 +1,20 @@
{ writeShellScriptBin, coreutils, gnused }:
let
example = command: desc: ''\n\u001b[33m ${command}\u001b[0m - ${desc}'';
in
writeShellScriptBin "repl" ''
case "$1" in
"-h"|"--help"|"help")
printf "%b\n\e[4mUsage\e[0m: \
${example "repl" "Loads system flake if available."} \
${example "repl /path/to/flake.nix" "Loads specified flake."}\n"
;;
*)
if [ -z "$1" ]; then
nix repl ${./repl.nix}
else
nix repl --arg flakePath $(${coreutils}/bin/readlink -f $1 | ${gnused}/bin/sed 's|/flake.nix||') ${./repl.nix}
fi
;;
esac
''

View File

@ -146,7 +146,6 @@ let
(if options ? nixpkgs.pkgs then
{
nixpkgs.config = selectedNixpkgs.config;
nixpkgs.pkgs =
# Make sure we don't import nixpkgs again if not
# necessary. We can't use `config.nixpkgs.config`
@ -205,7 +204,7 @@ mergeAny otherArguments (
# Little hack, we make sure that `legacyPackages` contains `nix` to make sure that we are dealing with nixpkgs.
# For some odd reason `devshell` contains `legacyPackages` out put as well
channelFlakes = filterAttrs (_: value: value ? legacyPackages && value.legacyPackages.x86_64-linux ? nix) inputs;
channelFlakes = filterAttrs (_: value: value ? legacyPackages && value.legacyPackages ? x86_64-linux && value.legacyPackages.x86_64-linux ? nix) inputs;
channelsFromFlakes = mapAttrs (name: input: { inherit input; }) channelFlakes;
importChannel = name: value: (import (patchChannel system value.input (value.patches or [ ])) {
@ -236,8 +235,8 @@ mergeAny otherArguments (
{ inherit pkgs; }
// (foldl' mkOutputs { } (attrNames systemOutputs))
)
# produces attrset in the shape of
# { nixosConfigurations = {}; darwinConfigurations = {}; ... }
# according to profile.output or the default `nixosConfigurations`
// foldl' mergeAny { } (attrValues (mapAttrs configurationBuilder hosts))
# produces attrset in the shape of
# { nixosConfigurations = {}; darwinConfigurations = {}; ... }
# according to profile.output or the default `nixosConfigurations`
// foldl' mergeAny { } (attrValues (mapAttrs configurationBuilder hosts))
)

View File

@ -1,25 +0,0 @@
final: prev:
let
example = command: desc: ''\n\u001b[33m ${command}\u001b[0m - ${desc}'';
in
{
__dontExport = true;
fup-repl = final.writeShellScriptBin "repl" ''
case "$1" in
"-h"|"--help"|"help")
printf "%b\n\e[4mUsage\e[0m: \
${example "repl" "Loads system flake if available."} \
${example "repl /path/to/flake.nix" "Loads specified flake."}\n"
;;
*)
if [ -z "$1" ]; then
nix repl ${./repl.nix}
else
nix repl --arg flakePath $(${final.coreutils}/bin/readlink -f $1 | ${final.gnused}/bin/sed 's|/flake.nix||') ${./repl.nix}
fi
;;
esac
'';
}

View File

@ -1,5 +1,6 @@
{
inputs.utils.url = path:../../;
inputs.nixpkgs.url = github:NixOS/nixpkgs/3c4a65f323dd;
outputs = inputs@{ self, nixpkgs, utils }:
utils.lib.mkFlake {
@ -24,7 +25,6 @@
hosts.PatchedHost.modules = [
({ lib, ... }: {
patchedModule.test = lib.patchedFunction "using patched module via patched function";
nixpkgs.config.packageOverrides = pkgs: { };
# To keep Nix from complaining
boot.loader.grub.devices = [ "nodev" ];
@ -54,7 +54,7 @@
{
# Patched package gets passed to `packageBuilder`
patchedPackageGetsPassedToBuilders = isEqual self.packages.x86_64-linux.flake-utils-plus-test.pname "hello";
patchedPackageGetsPassedToBuilders = isEqual self.packages.x86_64-linux.flake-utils-plus-test.pname "coreutils";
# Modules (and lib) from patched nixpkgs are used
patchedModuleAndFunctionWorks = isEqual hostConfig.patchedModule.test "using patched module via patched function";
@ -65,9 +65,6 @@
# `channels.nixpkgs.config.*` is also used
channelSpecificConfigWorks = hasKey hostConfig.nixpkgs.pkgs.config "allowUnfree";
# `options.nixpkgs.config.*` is also used
modulesNixpkgsConfigWorks = hasKey hostConfig.nixpkgs.pkgs.config "packageOverrides";
};
};

View File

@ -1,23 +1,23 @@
diff --git a/lib/default.nix b/lib/default.nix
index 5a85c542117..0ed00136d1d 100644
index 169f013191b8..05e91f1cd27b 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -146,5 +146,7 @@ let
nixType imap;
inherit (self.versions)
splitVersion;
+
@@ -10,6 +10,7 @@ let
lib = makeExtensible (self: let
callLibs = file: import file { lib = self; };
in {
+ patchedFunction = x: x;
});
in lib
# often used, or depending on very little
trivial = callLibs ./trivial.nix;
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index c951db5822a..53226de942e 100644
index ec6f410a48f6..3c6669988d2f 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -1191,4 +1191,10 @@
./virtualisation/vmware-guest.nix
./virtualisation/xen-dom0.nix
@@ -1505,4 +1505,10 @@
./virtualisation/xe-guest-utilities.nix
./virtualisation/xen-dom0.nix
{ documentation.nixos.extraModules = [ ./virtualisation/qemu-vm.nix ]; }
+ ({ lib, config, ... }: {
+ options.patchedModule.test = lib.mkOption {
+ default = null;
@ -26,15 +26,13 @@ index c951db5822a..53226de942e 100644
+ })
]
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index c904707b7cf..9f0cab1875d 100644
index 0c2a44d531df..299ff71619b6 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -12,6 +12,8 @@ with pkgs;
@@ -42286,4 +42286,6 @@ with pkgs;
ssl-proxy = callPackage ../tools/networking/ssl-proxy { };
{
+ flake-utils-plus-test = callPackage ../applications/misc/hello { };
code-maat = callPackage ../development/tools/code-maat {};
+
# A stdenv capable of building 32-bit binaries. On x86_64-linux,
# it uses GCC compiled with multilib support; on i686-linux, it's
# just the plain stdenv.
+ flake-utils-plus-test = callPackage ../tools/misc/coreutils { };
}

View File

@ -43,14 +43,6 @@
hosts.ExistingPkgsFlow = { };
hosts.ReimportFlow.modules = [
{
# Custom configuration from modules causes reimport of nixpkgs
nixpkgs.config.allowUnfree = true;
}
];
######################
### Test execution ###
@ -61,7 +53,6 @@
let
inherit (utils.lib.check-utils channels.nixpkgs) hasKey;
existingPkgsFlow = self.nixosConfigurations.ExistingPkgsFlow.pkgs;
reimportFlow = self.nixosConfigurations.ReimportFlow.pkgs;
in
{
@ -74,16 +65,6 @@
contains_srcs_1 = hasKey existingPkgsFlow "srcs";
# ReimportFlow
sharedOverlays_Applied_2 = hasKey reimportFlow "fromSharedOverlays";
channelSpecific_Applied_2 = hasKey reimportFlow "fromChannelSpecific";
hostConfig_Applied_2 = hasKey reimportFlow "fromHostConfig";
contains_srcs_2 = hasKey reimportFlow "srcs";
};
};