From 2d9c236a0256bd3bd81c51137617d5dd36a0f210 Mon Sep 17 00:00:00 2001 From: cidkidnix Date: Fri, 24 Mar 2023 10:41:36 -0500 Subject: [PATCH] Update nix to nix 2.13 --- dep/nixpkgs_unstable/default.nix | 2 ++ dep/nixpkgs_unstable/github.json | 7 +++++++ dep/nixpkgs_unstable/thunk.nix | 12 ++++++++++++ haskell-overlays/obelisk.nix | 4 ++-- lib/command/src/Obelisk/Command/Project.hs | 6 +++++- nixpkgs-overlays/default.nix | 2 ++ 6 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 dep/nixpkgs_unstable/default.nix create mode 100644 dep/nixpkgs_unstable/github.json create mode 100644 dep/nixpkgs_unstable/thunk.nix diff --git a/dep/nixpkgs_unstable/default.nix b/dep/nixpkgs_unstable/default.nix new file mode 100644 index 000000000..2b4d4ab11 --- /dev/null +++ b/dep/nixpkgs_unstable/default.nix @@ -0,0 +1,2 @@ +# DO NOT HAND-EDIT THIS FILE +import (import ./thunk.nix) \ No newline at end of file diff --git a/dep/nixpkgs_unstable/github.json b/dep/nixpkgs_unstable/github.json new file mode 100644 index 000000000..807d8d99e --- /dev/null +++ b/dep/nixpkgs_unstable/github.json @@ -0,0 +1,7 @@ +{ + "owner": "NixOS", + "repo": "nixpkgs", + "private": false, + "rev": "22ce075f1c3ffb413dfc53b10ff3e577b5b15941", + "sha256": "1pgxmdw7qi5kq1jn9fq1jfv757y67rfgkid2zkip8licyghlgdr1" +} diff --git a/dep/nixpkgs_unstable/thunk.nix b/dep/nixpkgs_unstable/thunk.nix new file mode 100644 index 000000000..20f2d28c2 --- /dev/null +++ b/dep/nixpkgs_unstable/thunk.nix @@ -0,0 +1,12 @@ +# DO NOT HAND-EDIT THIS FILE +let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256, ... }: + if !fetchSubmodules && !private then builtins.fetchTarball { + url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256; + } else (import (builtins.fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/3aad50c30c826430b0270fcf8264c8c41b005403.tar.gz"; + sha256 = "0xwqsf08sywd23x0xvw4c4ghq0l28w2ki22h0bdn766i16z9q2gr"; +}) {}).fetchFromGitHub { + inherit owner repo rev sha256 fetchSubmodules private; + }; + json = builtins.fromJSON (builtins.readFile ./github.json); +in fetch json \ No newline at end of file diff --git a/haskell-overlays/obelisk.nix b/haskell-overlays/obelisk.nix index f3a2e39e6..28847df7b 100644 --- a/haskell-overlays/obelisk.nix +++ b/haskell-overlays/obelisk.nix @@ -20,7 +20,7 @@ in librarySystemDepends = [ pkgs.jre pkgs.git - pkgs.nix + pkgs.nixpkgs_unstable.nixVersions.nix_2_13 pkgs.nix-prefetch-git pkgs.openssh pkgs.rsync @@ -38,7 +38,7 @@ in pkgs.cabal-install pkgs.coreutils pkgs.git - pkgs.nix + pkgs.nixpkgs_unstable.nixVersions.nix_2_13 pkgs.nix-prefetch-git pkgs.rsync ]; diff --git a/lib/command/src/Obelisk/Command/Project.hs b/lib/command/src/Obelisk/Command/Project.hs index 1c4caa5fe..cd90db9e1 100644 --- a/lib/command/src/Obelisk/Command/Project.hs +++ b/lib/command/src/Obelisk/Command/Project.hs @@ -301,7 +301,7 @@ filePermissionIsSafe s umask = not fileWorldWritable && fileGroupWritable <= uma nixShellRunConfig :: MonadObelisk m => FilePath -> Bool -> Maybe String -> m NixShellConfig nixShellRunConfig root isPure command = do nixpkgsPath <- fmap T.strip $ readProcessAndLogStderr Debug $ setCwd (Just root) $ - proc nixExePath ["eval", "(import .obelisk/impl {}).nixpkgs.path"] + proc nixExePath ["eval", "--impure", "--expr", "(import .obelisk/impl {}).nixpkgs.path"] nixRemote <- liftIO $ lookupEnv "NIX_REMOTE" pure $ def & nixShellConfig_pure .~ isPure @@ -383,8 +383,12 @@ findProjectAssets root = do isDerivation <- readProcessAndLogStderr Debug $ setCwd (Just root) $ proc nixExePath [ "eval" + , "--impure" + , "--expr" , "(let a = import ./. {}; in toString (a.reflex.nixpkgs.lib.isDerivation a.passthru.staticFilesImpure))" , "--raw" + -- `--expr` and `--impure` are a side-effect of a newer nix version + -- `nix eval` is no longer the same as 2.3 -- `--raw` is not available with old nix-instantiate. It drops quotation -- marks and trailing newline, so is very convenient for shelling out. ] diff --git a/nixpkgs-overlays/default.nix b/nixpkgs-overlays/default.nix index c79a45350..4fb099c3d 100644 --- a/nixpkgs-overlays/default.nix +++ b/nixpkgs-overlays/default.nix @@ -12,4 +12,6 @@ in { lib.cleanSource (gitignoreSource src); obeliskExecutableConfig = self.callPackage ../lib/executable-config {}; + + nixpkgs_unstable = import ../dep/nixpkgs_unstable { }; }