I have following configuration in my NixOS configuration repository:
{ config, lib, pkgs, ... }:
let nginxLocation = url: dir: {
name = url;
value = {
alias = dir;
index = "index.html";
extraConfig = ''expires 6h;'';
};
};
updateIndex = newIndex : args@{name, value} :
args // { value = args.value // { index = newIndex; }; };
releaseOS = pkgs.callPackage (import <nixpkgs/nixos/release.nix>) {};
releasePKGS = pkgs.callPackage (import <nixpkgs/pkgs/top-level/release.nix>) {};
nixos-manual = "${releaseOS.manualHTML.${builtins.currentSystem}}";
nixpkgs-manual = "${releasePKGS.manual}";
in
{
services.nginx = {
enable = true;
virtualHosts = {
localhost = {
default = true;
listen = [ { addr = "127.0.0.1"; port = 80; ssl = false; }
{ addr = "[::1]"; port = 80; ssl = false; }
];
locations = (builtins.listToAttrs [
(nginxLocation "/ghc-doc/" "${pkgs.ghc.doc}/share/doc/ghc/html/")
(nginxLocation "/nix-doc/" "${config.nix.package.doc}/share/doc/nix/manual/")
(nginxLocation "/nixos-doc/" "${nixos-manual}/share/doc/nixos/")
(updateIndex "manual.html" (nginxLocation "/nixpkgs-doc/" "${nixpkgs-manual}/share/doc/nixpkgs/"))
]);
};
};
};
}
And I’m trying to move to Nix Flake, and I’m getting following error:
warning: creating lock file '/home/user/projects/my-nixos/flake.lock'
error: --- ThrownError ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- nix
at: (13:42) in file: /nix/store/cpa8yfd6sjmvjblcnn77vxybia16x4ss-source/web-server.nix
12| args // { value = args.value // { index = newIndex; }; };
13| releaseOS = pkgs.callPackage (import <nixpkgs/nixos/release.nix>) {};
| ^
14| releasePKGS = pkgs.callPackage (import <nixpkgs/pkgs/top-level/release.nix>) {};
cannot look up '<nixpkgs/nixos/release.nix>' in pure evaluation mode (use '--impure' to override)
(use '--show-trace' to show detailed location information)
I guess I need to transform <nixpkgs/nixos/...>
to flakes equivalent. Any ideas how to go about this ?
I’m running nix-env (Nix) 2.4pre20201205_a5d85d0
.
Thanks!