I tried following flake.nix
with nix (Nix) 2.24.10
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs =
{ self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in
{
packages.${system} = {
default = let
config = builtins.readFile "${pkgs.sway}/etc/sway/config" + "include ...";
in
builtins.toFile "sway_config" config;
};
};
}
and I got error:
error: access to absolute path '/nix/store/69qg78xfrpxfgxb4k5yvg3f856hf4j3h-sway-unwrapped-1.10' is forbidden in pure evaluation mode (use '--impure' to override)
However, via my derivation, build was successful.
diff --git a/flake.nix b/flake.nix
index 0d45bb3..81d147f 100644
--- a/flake.nix
+++ b/flake.nix
@@ -12,7 +12,8 @@
{
packages.${system} = {
default = let
- config = builtins.readFile "${pkgs.sway}/etc/sway/config" + "include ...";
+ drv = pkgs.runCommandLocal "config" {} "cp ${pkgs.sway}/etc/sway/config $out";
+ config = builtins.readFile "${drv}" + "include ...";
in
builtins.toFile "sway_config" config;
};
These are expected behavior?