diff --git a/hs/.gitignore b/.gitignore similarity index 100% rename from hs/.gitignore rename to .gitignore diff --git a/hs/cli/Main.hs b/cli/Main.hs similarity index 93% rename from hs/cli/Main.hs rename to cli/Main.hs index 99eda9f..0040085 100644 --- a/hs/cli/Main.hs +++ b/cli/Main.hs @@ -34,7 +34,7 @@ stackAction args = do withSystemTempFile "nixage-stack-snapshot.yaml" $ \snapshotPath snapshotH -> withTempFile "." "nixage-stack.yaml" $ \stackPath stackH -> do withTempFile "." "nixage-stack-shell.nix" $ \stackShellPath stackShellH -> do - stackShellSourcePath <- liftIO $ getDataFileName "stack-shell.nix" + stackShellSourcePath <- liftIO $ getDataFileName "data/stack-shell.nix" let stackFilesInfo = StackFilesInfo snapshotPath stackShellPath stackShellSourcePath "./." liftIO $ hClose stackShellH >> hClose stackH >> hClose snapshotH encodeToStack stackPath stackFilesInfo projectNative @@ -51,7 +51,7 @@ convertAction (ConvertArgs convertIn convertOut) = do YamlConvertIn yamlPath -> decodeFromYaml (toString yamlPath) case convertOut of StackConvertOut stackPath snapshotPath stackShellPath -> do - stackShellSourcePath <- liftIO $ getDataFileName "stack-shell.nix" + stackShellSourcePath <- liftIO $ getDataFileName "data/stack-shell.nix" let stackFilesInfo = StackFilesInfo snapshotPath stackShellPath stackShellSourcePath "./." encodeToStack (toString stackPath) stackFilesInfo projectNative NixConvertOut -> do diff --git a/hs/cli/Parser.hs b/cli/Parser.hs similarity index 100% rename from hs/cli/Parser.hs rename to cli/Parser.hs diff --git a/hs/cli/Types.hs b/cli/Types.hs similarity index 100% rename from hs/cli/Types.hs rename to cli/Types.hs diff --git a/hs/data/stack-shell.nix b/data/stack-shell.nix similarity index 70% rename from hs/data/stack-shell.nix rename to data/stack-shell.nix index 0faceaa..0203916 100644 --- a/hs/data/stack-shell.nix +++ b/data/stack-shell.nix @@ -1,6 +1,11 @@ root: let - x = import (root + "/default.nix") { exposeNixage = true; }; + defaultNixage = let nixage = import ../nix { exposeNixage = true; }; + in nixage.buildYamlProject root; + projDefaultNix = root + "/default.nix"; + x = if builtins.pathExists projDefaultNix + then import projDefaultNix { exposeNixage = true; } + else defaultNixage; pkgs = x._nixage.pkgs; stackCmd = ''stack --internal-re-exec-version="${pkgs.stack.version}"''; in x._nixage.haskellPackages.shellFor { diff --git a/default.nix b/default.nix index 4203ea9..a68c4a6 100644 --- a/default.nix +++ b/default.nix @@ -1 +1,6 @@ -import ./nix +{ exposeNixage ? false }: + +let + nixage = import ./nix { inherit exposeNixage; }; + +in nixage.buildNixProject ./. diff --git a/hs/default.nix b/hs/default.nix deleted file mode 100644 index 2379eba..0000000 --- a/hs/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ exposeNixage ? false }: - -let - nixage = import ../nix { inherit exposeNixage; }; - -in nixage.buildNixProject ./. diff --git a/hs/lib/Nixage/Convert/FromYaml.hs b/lib/Nixage/Convert/FromYaml.hs similarity index 100% rename from hs/lib/Nixage/Convert/FromYaml.hs rename to lib/Nixage/Convert/FromYaml.hs diff --git a/hs/lib/Nixage/Convert/Nix.hs b/lib/Nixage/Convert/Nix.hs similarity index 100% rename from hs/lib/Nixage/Convert/Nix.hs rename to lib/Nixage/Convert/Nix.hs diff --git a/hs/lib/Nixage/Convert/Stack.hs b/lib/Nixage/Convert/Stack.hs similarity index 100% rename from hs/lib/Nixage/Convert/Stack.hs rename to lib/Nixage/Convert/Stack.hs diff --git a/hs/lib/Nixage/Project.hs b/lib/Nixage/Project.hs similarity index 100% rename from hs/lib/Nixage/Project.hs rename to lib/Nixage/Project.hs diff --git a/hs/lib/Nixage/Project/Extensible.hs b/lib/Nixage/Project/Extensible.hs similarity index 100% rename from hs/lib/Nixage/Project/Extensible.hs rename to lib/Nixage/Project/Extensible.hs diff --git a/hs/lib/Nixage/Project/Native.hs b/lib/Nixage/Project/Native.hs similarity index 100% rename from hs/lib/Nixage/Project/Native.hs rename to lib/Nixage/Project/Native.hs diff --git a/hs/lib/Nixage/Project/Types.hs b/lib/Nixage/Project/Types.hs similarity index 100% rename from hs/lib/Nixage/Project/Types.hs rename to lib/Nixage/Project/Types.hs diff --git a/hs/lib/Nixage/Project/Yaml.hs b/lib/Nixage/Project/Yaml.hs similarity index 100% rename from hs/lib/Nixage/Project/Yaml.hs rename to lib/Nixage/Project/Yaml.hs diff --git a/nix/yaml.nix b/nix/yaml.nix index 33f94ed..51e8fe6 100644 --- a/nix/yaml.nix +++ b/nix/yaml.nix @@ -3,7 +3,7 @@ let inherit (builtins) genList head tail; inherit (pkgs.lib) concatMap concatStrings singleton; - inherit (import ../hs {}) nixage; + inherit (import ../default.nix {}) nixage; in { importYaml = path: diff --git a/hs/package.yaml b/package.yaml similarity index 77% rename from hs/package.yaml rename to package.yaml index a846306..705e58b 100644 --- a/hs/package.yaml +++ b/package.yaml @@ -58,5 +58,16 @@ executables: ghc-options: - -threaded -data-dir: data -data-files: stack-shell.nix +data-dir: . +data-files: + - default.nix + - project.nix + - package.yaml + - cli/*.hs + - lib/Nixage/*.hs + - lib/Nixage/Convert/*.hs + - lib/Nixage/Project/*.hs + - nix/*.nix + - nix/extraDeps/*.nix + - nix/tools/nix-prefetch-git + - data/stack-shell.nix diff --git a/hs/project.nix b/project.nix similarity index 100% rename from hs/project.nix rename to project.nix diff --git a/hs/shell.nix b/shell.nix similarity index 100% rename from hs/shell.nix rename to shell.nix