Compare commits
No commits in common. "7828941e12e61d6243858c46f72acf4310a19009" and "ec91266fcd12f16d8ca355ab70a14f2b4c2c4691" have entirely different histories.
7828941e12
...
ec91266fcd
5 changed files with 81 additions and 77 deletions
|
@ -1,14 +1,31 @@
|
||||||
{
|
# Edit this configuration file to define what should be installed on
|
||||||
inputs,
|
# your system. Help is available in the configuration.nix(5) man page
|
||||||
lib,
|
# and in the NixOS manual (accessible by running 'nixos-help').
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
|
{ inputs, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (pkgs) mkWrappedExecutable;
|
||||||
|
|
||||||
|
# bool -> nixpkgs[]
|
||||||
|
wrappedNixExecutables = inEnvironment: assert builtins.isBool inEnvironment; [
|
||||||
|
(mkWrappedExecutable {pkg = pkgs.nix; exe = "nix-build"; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar${lib.optionalString inEnvironment "-with-logs"}"];})
|
||||||
|
(mkWrappedExecutable {pkg = pkgs.nix; exe = "nix-shell"; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar"];})
|
||||||
|
];
|
||||||
|
wrappedNixosExecutables = [
|
||||||
|
(mkWrappedExecutable {pkg = pkgs.nixos-rebuild; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar"];})
|
||||||
|
];
|
||||||
|
wrappedNix = (pkgs.buildEnv {
|
||||||
|
name = "wrappedNix-${pkgs.nix.version}";
|
||||||
|
paths = [ pkgs.nix ] ++ wrappedNixExecutables false;
|
||||||
|
}).overrideAttrs {
|
||||||
|
version = pkgs.nix.version;
|
||||||
|
passthru.meta = pkgs.nix.meta;
|
||||||
|
};
|
||||||
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./module-overrides.nix
|
./module-overrides.nix
|
||||||
./nix.nix
|
|
||||||
];
|
];
|
||||||
|
|
||||||
# kernel
|
# kernel
|
||||||
|
@ -20,6 +37,7 @@
|
||||||
# Allow unfree packages
|
# Allow unfree packages
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
nix = {
|
nix = {
|
||||||
|
package = wrappedNix;
|
||||||
channel.enable = false;
|
channel.enable = false;
|
||||||
settings.experimental-features = [
|
settings.experimental-features = [
|
||||||
"no-url-literals"
|
"no-url-literals"
|
||||||
|
@ -44,7 +62,9 @@
|
||||||
fastfetch
|
fastfetch
|
||||||
smartmontools
|
smartmontools
|
||||||
ddrescue
|
ddrescue
|
||||||
];
|
] ++ wrappedNixExecutables true
|
||||||
|
++ wrappedNixosExecutables;
|
||||||
|
|
||||||
programs.git.enable = true;
|
programs.git.enable = true;
|
||||||
programs.git.config = {
|
programs.git.config = {
|
||||||
commit.verbose = true;
|
commit.verbose = true;
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
makeWrapper = "${pkgs.makeWrapper}/nix-support/setup-hook";
|
|
||||||
# bool -> nixpkgs[]
|
|
||||||
wrappedNixExecutables = inEnvironment: assert builtins.isBool inEnvironment; pkgs.symlinkJoin {
|
|
||||||
name = "${pkgs.nix.name}-wrap";
|
|
||||||
paths = [ pkgs.nix ];
|
|
||||||
postBuild = ''
|
|
||||||
. ${makeWrapper}
|
|
||||||
wrapProgram $out/bin/nix-build \
|
|
||||||
--add-flags "--log-format" \
|
|
||||||
--add-flags "bar${lib.optionalString inEnvironment "-with-logs"}"
|
|
||||||
wrapProgram $out/bin/nix-shell \
|
|
||||||
--add-flags "--log-format" \
|
|
||||||
--add-flags "bar"
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
wrappedNixosExecutables = pkgs.symlinkJoin {
|
|
||||||
name = "${pkgs.nixos-rebuild.name}-wrap";
|
|
||||||
paths = [ pkgs.nixos-rebuild ];
|
|
||||||
postBuild = ''
|
|
||||||
. ${makeWrapper}
|
|
||||||
wrapProgram $out/bin/nixos-rebuild \
|
|
||||||
--add-flags "--log-format" \
|
|
||||||
--add-flags "bar"
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
wrappedNix = (pkgs.symlinkJoin {
|
|
||||||
name = "wrappedNix-${pkgs.nix.version}";
|
|
||||||
paths = [ pkgs.nix ] ++ [( wrappedNixExecutables false )];
|
|
||||||
}).overrideAttrs {
|
|
||||||
version = pkgs.nix.version;
|
|
||||||
passthru.meta = pkgs.nix.meta;
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
config = {
|
|
||||||
nix.package = wrappedNix;
|
|
||||||
environment.systemPackages = lib.map (lib.hiPrio) [
|
|
||||||
(wrappedNixExecutables true)
|
|
||||||
wrappedNixosExecutables
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
18
outputs.nix
18
outputs.nix
|
@ -7,29 +7,11 @@ let
|
||||||
|
|
||||||
lib = (import "${inputs.nixpkgs}/lib").extend (import ./lib/overlays/version-info-fixup.nix { revision = inputs.lock.nixpkgs.revision; });
|
lib = (import "${inputs.nixpkgs}/lib").extend (import ./lib/overlays/version-info-fixup.nix { revision = inputs.lock.nixpkgs.revision; });
|
||||||
|
|
||||||
systems = [
|
|
||||||
"x86_64-linux"
|
|
||||||
"aarch64-linux"
|
|
||||||
];
|
|
||||||
|
|
||||||
# (system -> x) -> { [system] := x }
|
|
||||||
forEachSystem = x: lib.pipe systems [
|
|
||||||
(builtins.map (system: { name = system; value = x system; }))
|
|
||||||
builtins.listToAttrs
|
|
||||||
];
|
|
||||||
|
|
||||||
self = {
|
self = {
|
||||||
inherit inputs lib self;
|
inherit inputs lib self;
|
||||||
outPath = selfPath;
|
outPath = selfPath;
|
||||||
modifiedNixpkgs = import ./pkgs/top-level/impure.nix;
|
modifiedNixpkgs = import ./pkgs/top-level/impure.nix;
|
||||||
modifiedNixpkgsPure = import ./pkgs/top-level/default.nix;
|
modifiedNixpkgsPure = import ./pkgs/top-level/default.nix;
|
||||||
packagesForSystem = system: self.modifiedNixpkgsPure { localSystem = system; };
|
|
||||||
packages = forEachSystem (system: let
|
|
||||||
nixpkgs = import "${inputs.nixpkgs}/pkgs/top-level/default.nix" { localSystem = system; };
|
|
||||||
attrnames = builtins.attrNames nixpkgs;
|
|
||||||
in
|
|
||||||
builtins.removeAttrs (self.pkgsForSystem system) attrnames
|
|
||||||
);
|
|
||||||
overlays = {
|
overlays = {
|
||||||
cosmicPackages = import ./pkgs/overlays/cosmic-packages.nix { inherit inputs; };
|
cosmicPackages = import ./pkgs/overlays/cosmic-packages.nix { inherit inputs; };
|
||||||
selfExpr = import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = inputs.nixpkgs; };
|
selfExpr = import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = inputs.nixpkgs; };
|
||||||
|
|
31
pkgs/by-name/mk/mkScriptOverride/package.nix
Normal file
31
pkgs/by-name/mk/mkScriptOverride/package.nix
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
src,
|
||||||
|
script,
|
||||||
|
...
|
||||||
|
} @ args:
|
||||||
|
lib.hiPrio (stdenv.mkDerivation (
|
||||||
|
{
|
||||||
|
src = src;
|
||||||
|
name = if lib.isDerivation src
|
||||||
|
then "${src.name}-script-override"
|
||||||
|
else "${builtins.baseNameOf src}-script-override";
|
||||||
|
phases = [ "installPhase" "scriptOverridePhase" ];
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
cp -r $src $out
|
||||||
|
chmod u+w -R $out
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
scriptOverridePhase = script;
|
||||||
|
} // lib.removeAttrs args [
|
||||||
|
"src"
|
||||||
|
"script"
|
||||||
|
]
|
||||||
|
))
|
22
pkgs/by-name/mk/mkWrappedExecutable/package.nix
Normal file
22
pkgs/by-name/mk/mkWrappedExecutable/package.nix
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
makeWrapper,
|
||||||
|
stdenv
|
||||||
|
}:
|
||||||
|
|
||||||
|
/*
|
||||||
|
pkg: package - nixpkgs package
|
||||||
|
exe: string - executable (under bin) in pkg
|
||||||
|
wrapperArgs: string[] - arguments to pass to the wrapper
|
||||||
|
*/
|
||||||
|
{ pkg, exe ? pkg.meta.mainProgram, wrapperArgs }:
|
||||||
|
lib.hiPrio (stdenv.mkDerivation {
|
||||||
|
inherit wrapperArgs;
|
||||||
|
name = "${pkg.name}-wrap-${exe}";
|
||||||
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
|
phases = ["installPhase"];
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
makeWrapper ${pkg}/bin/${exe} $out/bin/${exe} $wrapperArgs
|
||||||
|
'';
|
||||||
|
})
|
Loading…
Add table
Add a link
Reference in a new issue