Patch nix to remove nix-profile and nix-defexpr

This commit is contained in:
Alexander Bantyev 2021-06-15 01:02:51 +03:00
parent 28a2a7aec4
commit 2b1cc184e9
Signed by: balsoft
GPG Key ID: E081FF12ADCB4AD5
4 changed files with 51 additions and 5 deletions

View File

@ -330,11 +330,11 @@
"nixpkgs": "nixpkgs_6" "nixpkgs": "nixpkgs_6"
}, },
"locked": { "locked": {
"lastModified": 1622633535, "lastModified": 1622809115,
"narHash": "sha256-EelxH4BcFDowm5+c8Kl6wUTyvP6LhMpzoOS6r559oHo=", "narHash": "sha256-0lfX3ihV+5VsOs40eSzNMUSNlmH6MRqkb+VDWaJNEzw=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nix", "repo": "nix",
"rev": "bb066409719f3b0e820115a3f89589457bf7f500", "rev": "8e6ee1b9e924fbbbeb5594eb89e7a570f36ab6e1",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -25,13 +25,15 @@
secrets.wireguard-wg0 = { }; secrets.wireguard-wg0 = { };
environment.sessionVariables.WINEPREFIX = "/home/balsoft/.local/share/wineprefixes/default";
persist = { persist = {
enable = true; enable = true;
cache.clean.enable = false; # Scary... cache.clean.enable = false; # Scary...
state.directories = [ "/home/balsoft/.local/share/Steam" ]; state.directories = [ "/home/balsoft/.local/share/Steam" ];
derivative.directories = [ "/home/balsoft/.wine" "/home/balsoft/.wine32" ]; derivative.directories = [ "/home/balsoft/.local/share/wineprefixes/default" ];
}; };
services.ezwg = { services.ezwg = {

View File

@ -16,7 +16,9 @@
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
]; ];
package = inputs.nix.packages.x86_64-linux.nix; package = inputs.nix.packages.x86_64-linux.nix.overrideAttrs (oa: {
patches = [./nix.patch] ++ oa.patches or [];
});
extraOptions = '' extraOptions = ''
experimental-features = nix-command flakes experimental-features = nix-command flakes

42
modules/nix/nix.patch Normal file
View File

@ -0,0 +1,42 @@
diff --git a/src/libstore/profiles.cc b/src/libstore/profiles.cc
index 5d1723886..4f2e4f5db 100644
--- a/src/libstore/profiles.cc
+++ b/src/libstore/profiles.cc
@@ -250,13 +250,6 @@ Path getDefaultProfile()
{
Path profileLink = getHome() + "/.nix-profile";
try {
- if (!pathExists(profileLink)) {
- replaceSymlink(
- getuid() == 0
- ? settings.nixStateDir + "/profiles/default"
- : fmt("%s/profiles/per-user/%s/profile", settings.nixStateDir, getUserName()),
- profileLink);
- }
return absPath(readLink(profileLink), dirOf(profileLink));
} catch (Error &) {
return profileLink;
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc
index e04954d45..5649bd01a 100644
--- a/src/nix-env/nix-env.cc
+++ b/src/nix-env/nix-env.cc
@@ -1336,19 +1336,6 @@ static int main_nix_env(int argc, char * * argv)
globals.instSource.nixExprPath = getHome() + "/.nix-defexpr";
globals.instSource.systemFilter = "*";
- if (!pathExists(globals.instSource.nixExprPath)) {
- try {
- createDirs(globals.instSource.nixExprPath);
- replaceSymlink(
- fmt("%s/profiles/per-user/%s/channels", settings.nixStateDir, getUserName()),
- globals.instSource.nixExprPath + "/channels");
- if (getuid() != 0)
- replaceSymlink(
- fmt("%s/profiles/per-user/root/channels", settings.nixStateDir),
- globals.instSource.nixExprPath + "/channels_root");
- } catch (Error &) { }
- }
-
globals.dryRun = false;
globals.preserveInstalled = false;
globals.removeAll = false;